summaryrefslogtreecommitdiff
path: root/buildscripts/update-vendor-wiredtiger
blob: e4fbf9ce64e3ad0cb76dc1505882ebec61b1b78d (plain)
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
#!/bin/sh
#
# Updates src/third_party/wiredtiger contents
# from github.com/wiredtiger/wiredtiger branch "develop"
#

set -o errexit

REMOTEBRANCH="mongodb-3.0"
LOCALBRANCH=$(git symbolic-ref HEAD)

# Ensure working directory is TOPLEVEL/src/third_party
STARTPWD=$(pwd)
TOPLEVEL=$(git rev-parse --show-toplevel)
cd ${TOPLEVEL}/src/third_party

# Begin tracing commands
set -o xtrace

# Write file according to "Content-Disposition: attachment" header. Example:
# Content-Disposition: attachment; filename=wiredtiger-wiredtiger-2.4.0-109-ge5aec44.tar.gz

rm -f wiredtiger-wiredtiger-*.tar.gz
curl -OJL https://api.github.com/repos/wiredtiger/wiredtiger/tarball/${REMOTEBRANCH}

TARBALL=$(echo wiredtiger-wiredtiger-*.tar.gz)
test -f "$TARBALL"

# Delete everything in wiredtiger dir, then selectively undelete

mkdir -p wiredtiger
(cd wiredtiger;
 rm -rf *;
 git checkout -- .gitignore 'SCons*';
 git checkout -- 'build_*/wiredtiger_config.h')

# Tar options:
# - Exclude subdirs "api", "test", "src/docs"
# - Strip 'wiredtiger-wiredtiger-e5aec44/' prefix after exclude applied
# - Change to dir "wiredtiger" before extracting

tar -x --strip-components 1 \
    --exclude '*/api' --exclude '*/dist/package' --exclude '*/examples' \
    --exclude '*/src/docs' --exclude '*/test' \
    --exclude '*/tools/wtperf_stats' \
    --exclude '*/tools/wtstats/template' \
    -C wiredtiger -f ${TARBALL}

git add wiredtiger
git commit -m "Import ${TARBALL} from wiredtiger branch ${REMOTEBRANCH}"
git log -n 1

set -o errexit
cd $STARTPWD
echo "Done applying $TARBALL to $LOCALBRANCH"