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