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