From 56174e91c6c7e8d2e12706f26dc54ffdb5ea8982 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 17 Jul 2017 00:37:49 +1200 Subject: [PATCH 1/4] Maintenance: update snapshot script for git --- configure.ac | 2 +- mksnapshot.sh | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 21dcd733324..6886014318b 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -AC_INIT([Squid Web Proxy],[5.0.0-BZR],[http://bugs.squid-cache.org/],[squid]) +AC_INIT([Squid Web Proxy],[5.0.0-VCS],[http://bugs.squid-cache.org/],[squid]) AC_PREREQ(2.61) AC_CONFIG_HEADERS([include/autoconf.h]) AC_CONFIG_AUX_DIR(cfgaux) diff --git a/mksnapshot.sh b/mksnapshot.sh index 7dfdb29695f..52a2487fe4a 100755 --- a/mksnapshot.sh +++ b/mksnapshot.sh @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh -x # ## Copyright (C) 1996-2017 The Squid Software Foundation and contributors ## @@ -9,41 +9,43 @@ echo "RUN: $0" if [ $# -lt 1 ]; then - echo "Usage: $0 [branch]" - echo "Where [branch] is the path under /bzr/ to the branch to snapshot." + echo "Usage: $0 [branch] [tag]" + echo "Where [branch] is the name of the branch to snapshot." + echo "Where [tag] is the name of the tag on that branch to snapshot." exit 1 fi # VCS details -module=squid3 -BZRROOT=${BZRROOT:-/bzr} - -# generate a tarball name from the branch ($1) note that trunk is at -# /bzr/trunk, but we call it 3.HEAD for consistency with CVS (squid 2.x), and -# branches are in /bzr/branches/ but we don't want 'branches/' in the tarball -# name so we strip that. -branchpath=${1:-trunk} -tag=${2:-`basename $branchpath`} +if test "x${VCSROOT}" = "x"; then + echo "VCSROOT needs to be set to the base path for the repository to snapshot." + exit 1 +fi + +# generate a tarball name from the branch ($1) at tag ($2) +branch=${1:-master} +tag=${2:-HEAD} startdir=${PWD} date=`env TZ=GMT date +%Y%m%d` -tmpdir=${TMPDIR:-${PWD}}/${module}-${tag}-mksnapshot +tmpdir=${TMPDIR:-${PWD}}/squid-${tag}-mksnapshot/ rm -rf ${tmpdir} trap "echo FAIL-BUILD_${VERSION} ; rm -rf ${tmpdir}" 0 +mkdir ${tmpdir} rm -f ${tag}.out -bzr export ${tmpdir} ${BZRROOT}/${module}/${branchpath} || exit 1 +git checkout ${branch} || exit 1 +(git archive --format=tar ${tag} | tar -xC ${tmpdir}) || exit 1 if [ ! -f ${tmpdir}/configure ] && [ -f ${tmpdir}/configure.ac ]; then sh -c "cd ${tmpdir} && ./bootstrap.sh" fi if [ ! -f ${tmpdir}/configure ]; then - echo "ERROR! Tag ${tag} not found in ${module}" + echo "ERROR! Tag ${tag} not found." fi cd ${tmpdir} -revision=`bzr revno ${BZRROOT}/${module}/${branchpath}` +revision=`git rev-parse --short HEAD` suffix="${date}-r${revision}" -eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-BZR//' | sed -e 's/PACKAGE_//'` +eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-VCS//' | sed -e 's/PACKAGE_//'` eval `grep "^ *PACKAGE_TARNAME=" configure | sed -e 's/_TARNAME//'` ed -s configure.ac < Date: Mon, 17 Jul 2017 22:23:32 +1200 Subject: [PATCH 2/4] Remove unused VCSROOT environment variable --- mksnapshot.sh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mksnapshot.sh b/mksnapshot.sh index 52a2487fe4a..a3ee66229e3 100755 --- a/mksnapshot.sh +++ b/mksnapshot.sh @@ -14,11 +14,6 @@ if [ $# -lt 1 ]; then echo "Where [tag] is the name of the tag on that branch to snapshot." exit 1 fi -# VCS details -if test "x${VCSROOT}" = "x"; then - echo "VCSROOT needs to be set to the base path for the repository to snapshot." - exit 1 -fi # generate a tarball name from the branch ($1) at tag ($2) branch=${1:-master} From 6ec54747b05f89f8d68b73d8d24c693d8da50b51 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 18 Jul 2017 18:41:52 +1200 Subject: [PATCH 3/4] Replace tag with branch name Reverting to the BZR way of doing things solely on branch name. It turns out that all the git documentation saying to use tags and indicating a tag named HEAD was best to use for latest code snapshots was wrong. So long as we consistently use the branch name in all git commands they are applied to that branchs HEAD revision instead of the working directory's checkout. --- mksnapshot.sh | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/mksnapshot.sh b/mksnapshot.sh index a3ee66229e3..87454f62237 100755 --- a/mksnapshot.sh +++ b/mksnapshot.sh @@ -9,36 +9,33 @@ echo "RUN: $0" if [ $# -lt 1 ]; then - echo "Usage: $0 [branch] [tag]" + echo "Usage: $0 [branch]" echo "Where [branch] is the name of the branch to snapshot." - echo "Where [tag] is the name of the tag on that branch to snapshot." exit 1 fi -# generate a tarball name from the branch ($1) at tag ($2) +# generate a tarball name from the branch ($1) branch=${1:-master} -tag=${2:-HEAD} startdir=${PWD} date=`env TZ=GMT date +%Y%m%d` -tmpdir=${TMPDIR:-${PWD}}/squid-${tag}-mksnapshot/ +tmpdir=${TMPDIR:-${PWD}}/squid-${branch}-mksnapshot/ rm -rf ${tmpdir} trap "echo FAIL-BUILD_${VERSION} ; rm -rf ${tmpdir}" 0 mkdir ${tmpdir} -rm -f ${tag}.out -git checkout ${branch} || exit 1 -(git archive --format=tar ${tag} | tar -xC ${tmpdir}) || exit 1 +rm -f ${branch}.out +(git archive --format=tar ${branch} | tar -xC ${tmpdir}) || exit 1 if [ ! -f ${tmpdir}/configure ] && [ -f ${tmpdir}/configure.ac ]; then sh -c "cd ${tmpdir} && ./bootstrap.sh" fi if [ ! -f ${tmpdir}/configure ]; then - echo "ERROR! Tag ${tag} not found." + echo "ERROR! Branch ${branch} not found." fi cd ${tmpdir} -revision=`git rev-parse --short HEAD` +revision=`git rev-parse --short ${branch}` suffix="${date}-r${revision}" eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-VCS//' | sed -e 's/PACKAGE_//'` eval `grep "^ *PACKAGE_TARNAME=" configure | sed -e 's/_TARNAME//'` @@ -55,7 +52,6 @@ echo "STATE..." echo "PACKAGE: ${PACKAGE}" echo "VERSION: ${VERSION}" echo "BRANCH: ${branch}" -echo "TAG: ${tag}" echo "REVISION: ${revision}" echo "STARTDIR: ${startdir}" echo "TMPDIR: ${tmpdir}" @@ -84,12 +80,12 @@ echo "Preparing to publish: ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.* ..." #echo "BUILT TARS: " ; ls -1 ${tmpdir}/*.tar.* || true cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.gz . -echo ${PACKAGE}-${VERSION}-${suffix}.tar.gz >>${tag}.out +echo ${PACKAGE}-${VERSION}-${suffix}.tar.gz >>${branch}.out cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.tar.bz2 . -echo ${PACKAGE}-${VERSION}-${suffix}.tar.bz2 >>${tag}.out +echo ${PACKAGE}-${VERSION}-${suffix}.tar.bz2 >>${branch}.out if [ -f ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.diff ]; then cp -p ${tmpdir}/${PACKAGE}-${VERSION}-${suffix}.diff . - echo ${PACKAGE}-${VERSION}-${suffix}.diff >>${tag}.out + echo ${PACKAGE}-${VERSION}-${suffix}.diff >>${branch}.out fi # latest Squid 'make' builds a RELEASENOTES.html at top directory @@ -100,14 +96,14 @@ if [ ! -f ${relnotes} ]; then fi if [ -f ${relnotes} ]; then cp -p ${relnotes} ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html - echo ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html >>${tag}.out + echo ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html >>${branch}.out ed -s ${PACKAGE}-${VERSION}-${suffix}-RELEASENOTES.html <>${tag}.out +echo ${PACKAGE}-${VERSION}-${suffix}-ChangeLog.txt >>${branch}.out # Generate Configuration Manual HTML if [ -x ${tmpdir}/scripts/www/build-cfg-help.pl ]; then @@ -115,10 +111,10 @@ if [ -x ${tmpdir}/scripts/www/build-cfg-help.pl ]; then mkdir -p ${tmpdir}/doc/cfgman ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${tmpdir}/doc/cfgman ${tmpdir}/src/cf.data sh -c "cd ${tmpdir}/doc/cfgman && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-cfgman.tar.gz *" - echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.tar.gz >>${tag}.out + echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.tar.gz >>${branch}.out ${tmpdir}/scripts/www/build-cfg-help.pl --version ${VERSION} -o ${PACKAGE}-${VERSION}-${suffix}-cfgman.html -f singlehtml ${tmpdir}/src/cf.data gzip -f -9 ${PACKAGE}-${VERSION}-${suffix}-cfgman.html - echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.html.gz >>${tag}.out + echo ${PACKAGE}-${VERSION}-${suffix}-cfgman.html.gz >>${branch}.out fi # Collate Manual Pages and generate HTML versions @@ -134,10 +130,10 @@ if (groff --help >/dev/null); then cat ${f} | groff -E -Thtml -mandoc >${f}.html done sh -c "cd ${tmpdir}/doc/manuals && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-manuals.tar.gz *.html *.1 *.8" - echo ${PACKAGE}-${VERSION}-${suffix}-manuals.tar.gz >>${tag}.out + echo ${PACKAGE}-${VERSION}-${suffix}-manuals.tar.gz >>${branch}.out fi # Generate language-pack tarballs # NP: Only useful on development branch sh -c "cd ${tmpdir}/errors && tar -zcf ${PWD}/${PACKAGE}-${VERSION}-${suffix}-langpack.tar.gz ./*/* ./alias* ./TRANSLATORS ./COPYRIGHT " -echo ${PACKAGE}-${VERSION}-${suffix}-langpack.tar.gz >>${tag}.out +echo ${PACKAGE}-${VERSION}-${suffix}-langpack.tar.gz >>${branch}.out From 37afd5a708db351787699e24c141345a919b3f14 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Wed, 19 Jul 2017 12:03:31 +1200 Subject: [PATCH 4/4] Revert -x use. The changes are now small enough not to worry about correct branch alignment between code and revision ID. --- mksnapshot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mksnapshot.sh b/mksnapshot.sh index 87454f62237..9c82f59e9a7 100755 --- a/mksnapshot.sh +++ b/mksnapshot.sh @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh -e # ## Copyright (C) 1996-2017 The Squid Software Foundation and contributors ##