]> git.ipfire.org Git - thirdparty/squid.git/blame - mkrelease.sh
Source Format Enforcement (#571)
[thirdparty/squid.git] / mkrelease.sh
CommitLineData
cccb93e3 1#!/bin/sh -ex
a151895d 2#
77b1029d 3## Copyright (C) 1996-2020 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
a4572994 10if [ $# -ne 1 -a $# -ne 2 ]; then
11 echo "Usage: $0 revision [destination]"
95468954 12 exit 1
f373d962 13fi
39e4ea99
HN
14
15# infer tags from command line details
16package=squid
95468954 17rev=`echo $1 | sed -e "s/^${package}-//"`
18name=${package}-${rev}
19tag=`echo ${name} | tr a-z.- A-Z__`
a4572994 20startdir=$PWD/
21dst=${2:-$PWD}/
f5386c09 22RELEASE_TIME=`date +%s`
95468954 23
fe4990f7 24# DPW 2007-08-30
25#
26# check that $rev has the right syntax
27#
702a9bc3 28checkrev=`expr $rev : '\([0-9]\.[0-9]\(\.[0-9\.]\)*\)'`
fe4990f7 29if test "$rev" != "$checkrev" ; then
7ed34ab7 30 echo "revision '$rev' has incorrect syntax. Should be like '3.1.0.1'"
fe4990f7 31 exit 1;
32fi
33
bf97dee2 34tmpdir=${TMPDIR:-${PWD}}/${name}-mkrelease
95468954 35
95468954 36rm -rf $name.tar.gz $tmpdir
37trap "rm -rf $tmpdir" 0
38
2db9989c
AJ
39mkdir ${tmpdir}
40(git archive --format=tar HEAD | tar -xC ${tmpdir}) || exit 1
41
7ed34ab7 42if [ ! -f $tmpdir/bootstrap.sh ]; then
2db9989c 43 echo "ERROR! Tag $tag not found"
95468954 44fi
45
46cd $tmpdir
7ed34ab7 47./bootstrap.sh
2db9989c 48eval `grep "^ *PACKAGE_VERSION=" configure | sed -e 's/-VCS//' | sed -e 's/PACKAGE_//'`
156251e6 49eval `grep "^ *PACKAGE_TARNAME=" configure | sed -e 's/_TARNAME//'`
95468954 50if [ ${name} != ${PACKAGE}-${VERSION} ]; then
39e4ea99 51 echo "ERROR! The tag and configure version numbers do not match!"
95468954 52 echo "${name} != ${PACKAGE}-${VERSION}"
53 exit 1
54fi
cd6a9da6
AJ
55RELEASE=`echo $VERSION | cut -d. -f1,1 | cut -d- -f1`
56NOTES_VERSION=`grep "$VERSION" doc/release-notes/release-${RELEASE}.sgml`
d88bcf6b 57if test "x$NOTES_VERSION" = "x"; then
0bd5370a 58 echo "ERROR! Release Notes HTML version numbers do not match!"
d88bcf6b
AJ
59 exit 1
60fi
a6093a2d 61ed -s configure.ac <<EOS
2db9989c 62g/${VERSION}-VCS/ s//${VERSION}/
95468954 63w
64EOS
65ed -s configure <<EOS
2db9989c 66g/${VERSION}-VCS/ s//${VERSION}/
95468954 67w
68EOS
f5386c09 69ed -s include/version.h <<EOS
70g/squid_curtime/ s//${RELEASE_TIME}/
71w
72EOS
95468954 73
4eb85b7a 74./configure --silent --enable-translation
58b4f0d6 75make dist-all
95468954 76
77cd $startdir
d2eaa7f2 78inst() {
79rm -f $2
80cp -p $1 $2
81chmod 444 $2
82}
83inst $tmpdir/${name}.tar.gz $dst/${name}.tar.gz
84inst $tmpdir/${name}.tar.bz2 $dst/${name}.tar.bz2
85inst $tmpdir/CONTRIBUTORS $dst/CONTRIBUTORS.txt
86inst $tmpdir/COPYING $dst/COPYING.txt
78dd48ca 87inst $tmpdir/README $dst/README.txt
d2eaa7f2 88inst $tmpdir/CREDITS $dst/CREDITS.txt
bdb40e33 89inst $tmpdir/SPONSORS $dst/SPONSORS.txt
d2eaa7f2 90inst $tmpdir/ChangeLog $dst/ChangeLog.txt
cccb93e3 91if [ -f $tmpdir/doc/release-notes/release-$RELEASE.html ]; then
d2eaa7f2 92 cat $tmpdir/doc/release-notes/release-$RELEASE.html | sed -e '
93 s/"ChangeLog"/"ChangeLog.txt"/g;
94 ' > $tmpdir/RELEASENOTES.html
95 touch -r $tmpdir/doc/release-notes/release-$RELEASE.html $tmpdir/RELEASENOTES.html
96 inst $tmpdir/RELEASENOTES.html $dst/${name}-RELEASENOTES.html
97 ln -sf ${name}-RELEASENOTES.html $dst/RELEASENOTES.html
cccb93e3 98fi
f2cc7004 99if [ -f $dst/changesets/.update ]; then
100 rm -f $dst/changesets/$tag.html
101 $dst/changesets/.update
b84e7b4c 102fi