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