-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathbuildpkg
244 lines (206 loc) · 6.28 KB
/
buildpkg
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#!/bin/sh
# $Id: $
#
die()
{
echo >&2 "$@"
exit 1
}
# Build the distribution package.
. ./RELEASE || die "Can't read the RELEASE file"
CSHARP_DOC_SRC=""
# 0 is none, 1 is local dir, 2 is remote dir
CSHARP_DOC_LOCATION=0
test_run=0
while [ $# -gt 0 ]
do
case "$1" in
-n)
nodocs=true;;
-csharp_doc_src)
shift
if [ ! $# -gt 0 ]; then
die "csharp_doc_dir param requires argument."
fi
CSHARP_DOC_SRC=$1
CSHARP_DOC_LOCATION=1
if [ ! -f $CSHARP_DOC_SRC ]; then
die "CSharp doc archive must exist."
fi;;
-csharp_doc_url)
shift
if [ ! $# -gt 0 ]; then
die "csharp_doc_dir param requires argument."
fi
CSHARP_DOC_SRC=$1
CSHARP_DOC_LOCATION=2;;
-test)
echo "Doing a test run - this may contain changes that aren't\
reflected in a tag, so the package won't be reproducible."
test_run=1;;
esac
shift
done
# A version string can be specified on the command line (e.g., "20080219").
# Otherwise, use the standard X.X.X format.
VERSION=${1:-${DB_VERSION_MAJOR}.${DB_VERSION_MINOR}.${DB_VERSION_PATCH}}
# Use "ustar" as the archiver
TAR=ustar
# Set root directory where we do the work, can be anywhere.
START_DIR=`pwd`
D=`pwd`/../release
R="$D/db-${VERSION}"
RNC="$D/db-$VERSION.NC"
DOCS=`pwd`/../../docs_books-5.3
DB_ADDONS=`pwd`/../../db_addons-5.3
if [ ! -d $DB_ADDONS ]; then
echo "buildpkg requires a db_addons repository at the same level as the db repository."
exit 1
fi
# Create directory, remove any previous release tree.
rm -rf $R $RNC
mkdir -p $R
echo "Removed old release build from $R"
# Copy the files in the current tip to $R
hg archive $R
# If doing a test run, apply any local changes to the new tree.
if [ $test_run != 0 ]; then
hg diff | patch -p1 -d $R
fi
echo "Created hg archive in $R"
if [ "$nodocs" = true ] ; then
rm -rf $R/docs
else
[ -d $DOCS ] || die "buildpkg requires a docs_books repository at the same level as the db repository."
# Check that the doc repo is up to date, and create a tag if necessary.
cd $DOCS
hg pull -u
if [ $? != 0 ]; then
rm -rf $R
die "Failed updating the docs_books repository."
fi
has_tag=`hg tags | grep "db-${VERSION}"`
if [ "$has_tag" = "" ]; then
hg tag "db-${VERSION}"
TAG_CREATED="true"
else
hg up -r "db-${VERSION}"
fi
# Build a copy of the documentation in the release tree.
cd $R/dist
sh s_docs db-${VERSION} $DOCS
if [ $? != 0 ]; then
rm -rf $R
die "Failed generating documentation."
fi
# Copy in the C sharp doc.
if [ $CSHARP_DOC_LOCATION -eq 2 ]; then
scp $CSHARP_DOC_SRC .
CSHARP_DOC_SRC="csharp_docs.tgz"
if [ ! -f $CSHARP_DOC_SRC ]; then
echo "WARNING: Invalid csharp doc file - csharp_docs.tgz expected."
fi
fi
if [ $CSHARP_DOC_LOCATION -eq 0 -o ! -f $CSHARP_DOC_SRC ]; then
echo "WARNING: No csharp docs, skipping."
CSHARP_DOC_LOCATION=0
fi
if [ $CSHARP_DOC_LOCATION != 0 ]; then
rm -rf $R/docs/csharp
mkdir -p $R/docs/csharp
$TAR zxf $CSHARP_DOC_SRC -C $R/docs/csharp
fi
# Build the Java documentation.
cd $R/dist && sh s_javadoc
fi
# Pull a copy of the JDBC and ODBC libraries into the package.
# Build the ADO.NET package, including moving the ADO.NET doc built above
# into that package.
# Tell the script where to look for packages.
cd $R/dist && sh s_sql_drivers ../../../..
# Warn if s_sql_drivers didn't move its docs.
if [ -e "$R/docs/bdb-sql-ado" ]; then
echo "WARNING: ADO.NET doc is still in the non ADO.NET package."
fi
cd $START_DIR
# Pull a copy of the bfile directory into the package.
cd $DB_ADDONS
hg pull -u
if [ $? != 0 ]; then
echo "Failed updating the db_addons repository. Exiting."
rm -rf $R
exit 1
fi
cd $START_DIR
SQL_EXT_DIR=$R/lang/sql/sqlite/ext
if [ ! -d $SQL_EXT_DIR ]; then
mkdir -p $SQL_EXT_DIR
fi
if [ -d $SQL_EXT_DIR/bfile ]; then
rm -rf $SQL_EXT_DIR/bfile
fi
cp -rp $DB_ADDONS/bfile $SQL_EXT_DIR
# Remove source directories we don't distribute.
cd $R && rm -rf test/tcl/TODO test/upgrade test/scr036 test/erlang
cd $R && rm -rf test/perf test/purify test/repmgr
cd $R && rm -rf test/server test/stl test/vxworks
cd $R && find . -name '.hg*' | xargs rm -f
cd $R && find . -name 'tags' | xargs rm -f
# Create symbolic links and cscope output, fix permissions.
#cd $R/dist && sh s_perm
#cd $R/dist && sh s_cscope
# Build a regular version and smoke test.
### cd $R && rm -rf build_run && mkdir build_run
### cd $R/build_run && ../dist/configure && make >& mklog
### cd $R/build_run && make ex_access && echo "test" | ./ex_access
# Check the install
### cd $R/build_run && make prefix=`pwd`/BDB install
# Build a small-footprint version and smoke test.
### cd $R && rm -rf build_run && mkdir build_run
### cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog
### cd $R/build_run && make ex_access && echo "test" | ./ex_access
# Remove the build directory
### cd $R && rm -rf build_run
(cd $R/dist && ./s_perm)
# Check for file names differing only in case.
cd $R && find . | sort -f | uniq -ic | sed '/1 /d'
# Create the crypto tar archive release.
T="$D/db-$VERSION.tar.gz"
rm -f $T
cd $D || die "Can't find $D"
# Move package files in db-$VERSION/release to current directory so that
# regular packages won't includes generated package twice.
if [ -d "db-$VERSION/release" ]; then
mv db-$VERSION/release/* .
rm -rf db-$VERSION/release
fi
$TAR czf $T -find db-$VERSION -chown 100 -chgrp 100
chmod 444 $T
# Create the non-crypto tree.
cd $D && mv -i db-$VERSION $RNC && $TAR xzf $T
cd $RNC/dist && sh s_crypto
(cd $RNC/dist && ./s_perm)
# Create the non-crypto tar archive release.
T="$D/db-$VERSION.NC.tar.gz"
rm -f $T
cd $RNC/.. && $TAR czf $T -find db-$VERSION.NC -chown 100 -chgrp 100
chmod 444 $T
t=__tmp
cd $R && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE
cd $R && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm $t
cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && rm -f LICENSE && cp $t LICENSE
cd $RNC && awk '{print $0 "\r"}' < README > $t && rm -f README && cp $t README && rm $t
# Create the crypto zip archive release.
T="$D/db-$VERSION.zip"
rm -f $T
cd $R/.. && rm -f $T && zip -q -r $T db-$VERSION
chmod 444 $T
# Create the non-crypto zip archive release.
T="$D/db-$VERSION.NC.zip"
rm -f $T
cd $RNC/.. && rm -f $T && zip -q -r $T db-$VERSION.NC
chmod 444 $T
rm -rf $R $RNC
if [ "$TAG_CREATED" = "true" ]; then
echo "Created a tag in docs_books repository. Please push."
fi