forked from bittorrent/go-btfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patching.sh
executable file
·66 lines (58 loc) · 3.23 KB
/
patching.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
# patching $GOPATH/pkg/mod/github.com/multiformats/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/multiformats/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/protocols.go < ./patches/go-multiaddr-v0.0.4-protocols.go.patch 1>/dev/null; then
patch $patchdir/protocols.go < ./patches/go-multiaddr-v0.0.4-protocols.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/ipfs/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/path.go < ./patches/go-path-v0.0.4-path.go.patch 1>/dev/null; then
patch $patchdir/path.go < ./patches/go-path-v0.0.4-path.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/ipfs/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected]
chmod -R 777 $patchdir
# 1) path.go
if ! patch -R -s -f --dry-run $patchdir/path/path.go < ./patches/interface-go-ipfs-core-v0.0.8-path.go.patch 1>/dev/null; then
patch $patchdir/path/path.go < ./patches/interface-go-ipfs-core-v0.0.8-path.go.patch;
fi
# 2) errors.go
if ! patch -R -s -f --dry-run $patchdir/errors.go < ./patches/interface-go-ipfs-core-v0.0.8-errors.go.patch 1>/dev/null; then
patch $patchdir/errors.go < ./patches/interface-go-ipfs-core-v0.0.8-errors.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/libp2p/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/libp2p/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/dht_bootstrap.go < ./patches/go-libp2p-kad-dht-v0.0.13-dht_bootstrap.go.patch 1>/dev/null; then
patch $patchdir/dht_bootstrap.go < ./patches/go-libp2p-kad-dht-v0.0.13-dht_bootstrap.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/ipfs/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/cli/parse.go < ./patches/go-ipfs-cmds-v0.0.8-cli-parse.go.patch 1>/dev/null; then
patch $patchdir/cli/parse.go < ./patches/go-ipfs-cmds-v0.0.8-cli-parse.go.patch;
fi
if ! patch -R -s -f --dry-run $patchdir/http/client.go < ./patches/go-ipfs-cmds-http-client.go.patch 1>/dev/null; then
patch $patchdir/http/client.go < ./patches/go-ipfs-cmds-http-client.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/libp2p/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/libp2p/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/validator.go < ./patches/go-libp2p-record-v0.0.1-validator.go.patch 1>/dev/null; then
patch $patchdir/validator.go < ./patches/go-libp2p-record-v0.0.1-validator.go.patch;
fi
# patching $GOPATH/pkg/mod/github.com/ipfs/[email protected]
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected]
chmod -R 777 $patchdir
if ! patch -R -s -f --dry-run $patchdir/record.go < ./patches/go-ipns-v.0.0.1-record.go.patch 1>/dev/null; then
patch $patchdir/record.go < ./patches/go-ipns-v.0.0.1-record.go.patch;
fi
# patching test
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected]
cp ./patches/test/interface-go-ipfs-core.patch $patchdir
cd $patchdir
if ! patch -p1 -R -s -f --dry-run < interface-go-ipfs-core.patch 1>/dev/null; then
patch -p1 < interface-go-ipfs-core.patch
fi