1# $Id: buildpatch,v 12.36 2007/11/15 15:18:33 bostic Exp $ 2# 3# Build the distribution package. 4# 5# A set of commands intended to be cut-and-pasted into a csh window. 6# 7# Search for XXX to find places where work is required before running 8# the commands, or to find values you need to update in the commands. 9 10# Set the major, minor & patch values 11# XXX 12setenv MAJOR 4 13setenv MINOR XXX 14setenv PATCH XXX 15 16# Set root directory where we do the work, can be anywhere. 17# XXX 18setenv D ~/berkeleydb 19setenv R $D/db-${MAJOR}.${MINOR}.${PATCH} 20 21# Remove any previous release tree. 22rm -rf $R 23 24# Set the major, minor and patch numbers of the snapshot we're starting with, 25# and the locations of the full release archive and the patch to upgrade. 26# XXX 27setenv ORIG 4.6.19 28setenv ARCHIVE "~ftp/hidden/db-$ORIG.tar.gz" 29setenv ARPATCH "$D/$ORIG.patch" 30 31# Extract from the starting release archive and rename as the release tree. 32rm -rf $R.tmp && mkdir $R.tmp && cd $R.tmp &&\ 33 gzcat $ARCHIVE | tar xf - &&\ 34 mv -i db-$ORIG $R && cd $R && rm -rf $R.tmp 35 36# Set permissions to allow file modification. 37cd $R && find . -type f | xargs chmod 664 38 39# Apply the patch set that moves from the old release to the new one. 40cd $R && patch -p0 < $ARPATCH &&\ 41 find . -name '*.orig' -o -name '*.rej' | xargs rm -f 42 43# Update all of the version numbers in the documentation. 44# 45# We get most of the version numbers, but don't re-build the Getting Started 46# Guide PDF, so its version numbers will be left unchanged. 47# 48# !!! 49# This is obviously unsafe, although the changes of the old version number 50# appearing in some piece of documentation and NOT needing to be changed 51# are pretty minimal. That said, each patched release should be compared 52# against the original release, and each change vetted to ensure no incorrect 53# changes have been made. 54cd $R/docs/ 55find . -name '*.html' > __a 56foreach i (`cat __a`) 57 cat $i | sed\ 58 -e "s/>$ORIG</>$MAJOR.$MINOR.$PATCH</g"\ 59 -e "s/Version $ORIG/Version $MAJOR.$MINOR.$PATCH/g"\ 60 -e "s/version $ORIG/version $MAJOR.$MINOR.$PATCH/g"\ 61 -e "s/Version: $ORIG/Version: $MAJOR.$MINOR.$PATCH/g"\ 62 > __b 63 cmp $i __b > /dev/null || cp __b $i 64end 65rm -rf __a __b 66 67# Update the change log. 68# 69# XXX 70# The Ref Guide change log page should have been updated in the CVS source tree 71# to reflect changes between the archival snapshot we started with and the new 72# release. Copy the change log page into place in the docs_src and docs trees, 73# from a current CVS tree. 74# XXX 75setenv CURRENT path-to-current-tree 76cd $R && cp \ 77 $CURRENT/docs_src/ref/changelog/${MAJOR}.${MINOR}.html\ 78 docs_src/ref/changelog/${MAJOR}.${MINOR}.html 79cp docs_src/ref/changelog/${MAJOR}.${MINOR}.html\ 80 docs/ref/changelog/${MAJOR}.${MINOR}.html 81 82# Update the change log patch number. 83cd $R/docs_src/ref/changelog && vi toc.so 84 85# Update the release date (the version has already been updated, but the 86# date is wrong). 87cd $R && vi docs/index.html 88 89# Update the release number. 90cd $R/dist &&\ 91 (echo "/^DB_VERSION_MAJOR/s/=.*/=$MAJOR/" &&\ 92 echo "/^DB_VERSION_MINOR/s/=.*/=$MINOR/" &&\ 93 echo "/^DB_VERSION_PATCH/s/=.*/=$PATCH/" &&\ 94 echo w &&\ 95 echo q) | ed RELEASE > /dev/null 96setenv VERSION `sh -c '. RELEASE; echo $DB_VERSION'` 97echo "Berkeley DB release $VERSION." 98 99# Build auto-generated files. 100cd $R/dist && sh s_all 101 102# Remove source directories we don't distribute. 103cd $R && rm -rf build_brew_x build_s60_x 104cd $R && rm -rf java/src/com/sleepycat/xa 105cd $R && rm -rf rpc_server/java 106cd $R && rm -rf test/TODO test/upgrade test_erlang test_perf test_purify 107cd $R && rm -rf test_rep test_server test_vxworks 108cd $R && find . -name '.cvsignore' | xargs rm -f 109 110# Create symbolic links and cscope output, fix permissions. 111cd $R/dist && sh s_perm 112cd $R/dist && sh s_cscope 113cd $R/dist && sh s_symlink 114 115# Build a version and smoke test. 116setenv DBCONF "~db/bin/dbconf thread" 117cd $R && rm -rf build_run && mkdir build_run 118cd $R/build_run && $DBCONF && make >& mklog 119cd $R/build_run && make ex_access && ./ex_access 120 121# Check the install 122cd $R/build_run && make prefix=`pwd`/BDB install 123 124# Build a small-footprint version and smoke test. 125cd $R && rm -rf build_run && mkdir build_run 126cd $R/build_run && ../dist/configure --enable-smallbuild && make >& mklog 127cd $R/build_run && make ex_access && ./ex_access 128 129# Remove the build directory 130cd $R && rm -rf build_run 131 132# ACQUIRE ROOT PRIVILEGES 133cd $R && find . -type d | xargs chmod 775 134cd $R && find . -type f | xargs chmod 444 135cd $R && chmod 664 build_windows/*.dsp 136cd $R/dist && sh s_perm 137chown -R 100 $R 138chgrp -R 100 $R 139# DISCARD ROOT PRIVILEGES 140 141# Check for file names differing only in case. 142cd $R && find . | sort -f | uniq -ic | sed '/1 /d' 143 144# Create the crypto tar archive release. 145setenv T "$R/../db-$VERSION.tar.gz" 146cd $R/.. && tar cf - db-$VERSION | gzip --best > $T 147chmod 444 $T 148 149# Check the path length. 150gzcat $T | tar tf - |\ 151awk '{ if (length() > 99) print "Path length: " length() " bytes: " $0;}' 152 153# Create the non-crypto tree. 154setenv RNC "$R/../db-$VERSION.NC" 155rm -rf $RNC $R/../__TMP && mkdir $R/../__TMP 156cd $R/../__TMP && gzcat $T | pax -r && mv -i db-$VERSION $RNC 157cd $R && rm -rf $R/../__TMP 158cd $RNC/dist && sh s_crypto 159 160# ACQUIRE ROOT PRIVILEGES 161cd $RNC && find . -type d | xargs chmod 775 162cd $RNC && find . -type f | xargs chmod 444 163cd $RNC && chmod 664 build_windows/*.dsp 164cd $RNC/dist && sh s_perm 165chown -R 100 $RNC 166chgrp -R 100 $RNC 167# DISCARD ROOT PRIVILEGES 168 169# Create the non-crypto tar archive release. 170setenv T "$R/../db-$VERSION.NC.tar.gz" 171cd $RNC/.. && tar cf - db-$VERSION.NC | gzip --best > $T 172chmod 444 $T 173 174# Check the path length. 175gzcat $T | tar tf - |\ 176awk '{ if (length() > 99) print "Path length: " length() " bytes: " $0;}' 177 178# Remove tags files. They're large and we don't want to store symbolic links 179# in the zip archive for portability reasons. 180# 181# Modify the text files to have Windows end-of-line characters. 182# ACQUIRE ROOT PRIVILEGES 183cd $R && rm -f `find . -name 'tags'` 184cd $RNC && rm -f `find . -name 'tags'` 185 186set t=__tmp 187cd $R && awk '{print $0 "\r"}' < LICENSE > $t && cp $t LICENSE && rm -f $t 188cd $R && awk '{print $0 "\r"}' < README > $t && cp $t README && rm -f $t 189cd $RNC && awk '{print $0 "\r"}' < LICENSE > $t && cp $t LICENSE && rm -f $t 190cd $RNC && awk '{print $0 "\r"}' < README > $t && cp $t README && rm -f $t 191# DISCARD ROOT PRIVILEGES 192 193# Create the crypto zip archive release. 194setenv T "$R/../db-$VERSION.zip" 195cd $R/.. && zip -q -r - db-$VERSION > $T 196chmod 444 $T 197 198# Create the non-crypto zip archive release. 199setenv T "$R/../db-$VERSION.NC.zip" 200cd $RNC/.. && zip -q -r - db-$VERSION.NC > $T 201chmod 444 $T 202