]> git.ipfire.org Git - thirdparty/squid.git/blob - mksnapshot.sh
Sync with trunk rev.13312
[thirdparty/squid.git] / mksnapshot.sh
1 #!/bin/sh -e
2 echo "RUN: $0"
3 if [ $# -lt 1 ]; then
4 echo "Usage: $0 [branch]"
5 echo "Where [branch] is the path under /bzr/ to the branch to snapshot."
6 exit 1
7 fi
8 # VCS details
9 module=squid3
10 BZRROOT=${BZRROOT:-/bzr}
11
12 # generate a tarball name from the branch ($1) note that trunk is at
13 # /bzr/trunk, but we call it 3.HEAD for consistency with CVS (squid 2.x), and
14 # branches are in /bzr/branches/ but we don't want 'branches/' in the tarball
15 # name so we strip that.
16 branchpath=${1:-trunk}
17 tag=${2:-`basename $branchpath`}
18 startdir=${PWD}
19 date=`env TZ=GMT date +%Y%m%d`
20
21 tmpdir=${TMPDIR:-${PWD}}/${module}-${tag}-mksnapshot
22
23 rm -rf ${tmpdir}
24 trap "echo FAIL-BUILD_${VERSION} ; rm -rf ${tmpdir}" 0
25
26 rm -f ${tag}.out
27 bzr export ${tmpdir} ${BZRROOT}/${module}/${branchpath} || exit 1
28 if [ ! -f ${tmpdir}/configure ] && [ -f ${tmpdir}/configure.ac ]; then
29 sh -c "cd ${tmpdir} && ./bootstrap.sh"
30 fi
31 if [ ! -f ${tmpdir}/configure ]; then
32 echo "ERROR! Tag ${tag} not found in ${module}"
33 fi
34
35 cd ${tmpdir}
36 revision=`bzr revno ${BZRROOT}/${module}/${branchpath}`
37 suffix="${date}-r${revision}"
38 eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-BZR//' | sed -e 's/PACKAGE_//'`
39 eval `grep "^ *PACKAGE_TARNAME=" configure | sed -e 's/_TARNAME//'`
40 ed -s configure.ac <<EOS
41 g/${VERSION}-[A-Z]*/ s//${VERSION}-${suffix}/
42 w
43 EOS
44 ed -s configure <<EOS
45 g/${VERSION}-[A-Z]*/ s//${VERSION}-${suffix}/
46 w
47 EOS
48
49 echo "STATE..."
50 echo "PACKAGE: ${PACKAGE}"
51 echo "VERSION: ${VERSION}"
52 echo "TAG: ${tag}"
53 echo "REVISION: ${revision}"
54 echo "STARTDIR: ${startdir}"
55 echo "TMPDIR: ${tmpdir}"
56
57 ## Ignore extra build layers. General features building is sufficient for snapshot release.
58 ./test-builds.sh --cleanup layer-00-default layer-01-minimal layer-02-maximus || exit 1
59 ./configure --silent --enable-build-info="DATE: ${date} REVISION: ${revision}" --enable-translation
60 make -s dist-all
61
62 webbase=/server/httpd/htdocs/squid-cache.org/content/
63 basetarball=${webbase}/Versions/v`echo ${VERSION} | cut -d. -f1`/`echo ${VERSION} | cut -d. -f-2|cut -d- -f1`/${PACKAGE}-${VERSION}.tar.bz2
64
65 echo "Building Tarball diff (${basetarball}) ..."
66 if [ -f ${basetarball} ]; then
67 tar jxf ${PACKAGE}-${VERSION}-${suffix}.tar.bz2
68 tar jxf ${basetarball}
69 echo "Differences from ${PACKAGE}-${VERSION} to ${PACKAGE}-${VERSION}-${suffix}" >${PACKAGE}-${VERSION}-${suffix}.diff
70 diff -ruN ${PACKAGE}-${VERSION} ${PACKAGE}-${VERSION}-${suffix} >>${PACKAGE}-${VERSION}-${suffix}.diff || true
71 else
72 echo "Building Tarball diff ... skipped (no tarball exists)."
73 fi
74
75 cd ${startdir}
76 echo "Preparing to publish: ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.* ..."
77 #echo "LOCAL: " ; pwd
78 #echo "BUILT TARS: " ; ls -1 ${tmpdir}/*.tar.* || true
79
80 cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.gz .
81 echo ${PACKAGE}-${VERSION}-${suffix}.tar.gz >>${tag}.out
82 cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.bz2 .
83 echo ${PACKAGE}-${VERSION}-${suffix}.tar.bz2 >>${tag}.out
84 if [ -f ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.diff ]; then
85 cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.diff .
86 echo ${PACKAGE}-${VERSION}-${suffix}.diff >>${tag}.out
87 fi
88
89 relnotes=${tmpdir}/doc/release-notes/release-`echo ${VERSION} | cut -d. -f1,2 | cut -d- -f1`.html
90 if [ -f ${relnotes} ]; then
91 cp -p ${relnotes} ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html
92 echo ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html >>${tag}.out
93 ed -s ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html <<EOF
94 g/"ChangeLog"/ s//"${PACKAGE}-${VERSION}-${suffix}-ChangeLog.txt"/g
95 w
96 EOF
97 fi
98 cp -p ${tmpdir}/ChangeLog ${PACKAGE}-${VERSION}-${suffix}-ChangeLog.txt
99 echo ${PACKAGE}-${VERSION}-${suffix}-ChangeLog.txt >>${tag}.out
100
101 # Generate Configuration Manual HTML
102 if [ -x ${tmpdir}/scripts/www/build-cfg-help.pl ]; then
103 make -C ${tmpdir}/src cf.data
104 mkdir -p ${tmpdir}/doc/cfgman
105 ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${tmpdir}/doc/cfgman ${tmpdir}/src/cf.data
106 sh -c "cd ${tmpdir}/doc/cfgman && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-cfgman.tar.gz *"
107 echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.tar.gz >>${tag}.out
108 ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${PACKAGE}-${VERSION}-${suffix}-cfgman.html -f singlehtml ${tmpdir}/src/cf.data
109 gzip -f -9 ${PACKAGE}-${VERSION}-${suffix}-cfgman.html
110 echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.html.gz >>${tag}.out
111 fi
112
113 # Collate Manual Pages and generate HTML versions
114 if (groff --help >/dev/null); then
115 make -C ${tmpdir}/src squid.8
116 if [ ! -d ${tmpdir}/doc/manuals ] ; then
117 mkdir -p ${tmpdir}/doc/manuals
118 fi
119 for f in `ls -1 ${tmpdir}/helpers/*/*/*.8 ${tmpdir}/src/*.8 ${tmpdir}/src/*/*.8 ${tmpdir}/tools/squidclient/*.1 ${tmpdir}/tools/*.8 ./helpers/*/*/*.8 2>/dev/null` ; do
120 cp $f ${tmpdir}/doc/manuals/
121 done
122 for f in `ls -1 ${tmpdir}/doc/manuals/*.1 ${tmpdir}/doc/manuals/*.8 2>/dev/null` ; do
123 cat ${f} | groff -E -Thtml -mandoc >${f}.html
124 done
125 sh -c "cd ${tmpdir}/doc/manuals && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-manuals.tar.gz *.html *.1 *.8"
126 echo ${PACKAGE}-${VERSION}-${suffix}-manuals.tar.gz >>${tag}.out
127 fi
128
129 # Generate language-pack tarballs
130 # NP: Only to be done on trunk.
131 if test "${tag}" = "trunk" ; then
132 sh -c "cd ${tmpdir}/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-langpack.tar.gz ./*/* ./alias* ./TRANSLATORS ./COPYRIGHT "
133 echo ${PACKAGE}-${VERSION}-${suffix}-langpack.tar.gz >>${tag}.out
134 fi