comparison release.sh @ 1812:552bb9b4f16a

Make releases tarballs more deterministic Not fully tested on different systems yet
author Matt Johnston <matt@ucc.asn.au>
date Tue, 30 Mar 2021 22:08:14 +0800
parents e2e4929d057b
children f78e67527731
comparison
equal deleted inserted replaced
1811:7dc92355a986 1812:552bb9b4f16a
1 #!/bin/sh 1 #!/bin/sh
2
3 set -e
4
2 VERSION=$(echo '#include "sysoptions.h"\necho DROPBEAR_VERSION' | cpp - | sh) 5 VERSION=$(echo '#include "sysoptions.h"\necho DROPBEAR_VERSION' | cpp - | sh)
3 echo Releasing version "$VERSION" ... 6 echo Releasing version "$VERSION" ...
4 if ! head -n1 CHANGES | grep -q $VERSION ; then 7 if ! head -n1 CHANGES | grep -q $VERSION ; then
5 echo "CHANGES needs updating" 8 echo "CHANGES needs updating"
6 exit 1 9 exit 1
11 exit 1 14 exit 1
12 fi 15 fi
13 16
14 head -n1 CHANGES 17 head -n1 CHANGES
15 18
16 #sleep 3 19 if tar --version | grep -q 'GNU tar'; then
20 TAR=tar
21 else
22 TAR=gtar
23 fi
17 24
18 RELDIR=$PWD/../dropbear-$VERSION 25 RELDIR=$PWD/../dropbear-$VERSION
19 ARCHIVE=${RELDIR}.tar.bz2 26 ARCHIVE=${RELDIR}.tar.bz2
20 if test -e $RELDIR; then 27 if test -e $RELDIR; then
21 echo "$RELDIR exists" 28 echo "$RELDIR exists"
33 40
34 rm -r "$RELDIR/autom4te.cache" || exit 2 41 rm -r "$RELDIR/autom4te.cache" || exit 2
35 42
36 rm "$RELDIR/.hgtags" 43 rm "$RELDIR/.hgtags"
37 44
38 (cd "$RELDIR/.." && tar cjf $ARCHIVE `basename "$RELDIR"`) || exit 2 45 RELDATE=$(head -n1 CHANGES | cut -d - -f 2)
46
47 # from https://reproducible-builds.org/docs/archives/
48 TAROPTS="--sort=name --owner=0 --group=0 --numeric-owner"
49 (cd "$RELDIR/.." && $TAR cjf $ARCHIVE $TAROPTS --mtime="$RELDATE" `basename "$RELDIR"`) || exit 2
39 50
40 ls -l $ARCHIVE 51 ls -l $ARCHIVE
41 openssl sha256 $ARCHIVE 52 openssl sha256 $ARCHIVE
42 echo Done to 53 echo Done to
43 echo "$ARCHIVE" 54 echo "$ARCHIVE"