diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2019-01-18 20:57:13 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-01-20 01:31:59 +0000 |
commit | dc9d23d12f7b0e0adb78db0aa70bb3f65a25164d (patch) | |
tree | 30e484f6549a30c9c007c729f7bb8de7ec0648fc | |
parent | b65d1e9b0b6fbf0705aeeb5ed8028348966d4c99 (diff) | |
download | klibc-maint-dc9d23d12f7b0e0adb78db0aa70bb3f65a25164d.tar.gz |
newklibc: Add hpa's release script
-rwxr-xr-x | newklibc | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/newklibc b/newklibc new file mode 100755 index 0000000..58af7f9 --- /dev/null +++ b/newklibc @@ -0,0 +1,95 @@ +#!/bin/bash -xe + +export PATH=/home/hpa/klibc/bin:"$PATH" + +git_export () { + if [ -e "$1" ]; then + rm -rf "$1" + fi + mkdir -p "$1" + git archive --format=tar "$2" | tar -C "$1" -xf - +} + +me=`whoami` +here=/tmp/"$USER"/klibc.tmp +mkdir -p $here +cd $here +rm -rf klibc* + +if [ x"$1" = x'test' ]; then + real=false +else + real=true +fi + +me=`whoami` +repo=/home/hpa/klibc/klibc.git +#repo=/home/hpa/klibc/klibc-test.git +signkey=D86455E3D1D0962037AA86E088AE647D58F7ABFE +export KUP_HOST=hpa@geb.kernel.org +releasedir=/home/hpa/klibc/release/ + +# Make sure the repo is up to date +GIT_DIR="$repo" git fetch -f + +# Get a snapshot of the top of the repository +tmpdir=/tmp/$me/klibc.$$ +rm -rf "$tmpdir" +mkdir -p "$tmpdir" +gitdir="$tmpdir"/git +git clone -s -l "$repo" "$gitdir" +cd "$gitdir" + +version=`cat $gitdir/usr/klibc/version` +major=`cut -d. -f1 < $gitdir/usr/klibc/version` +minor=`cut -d. -f2 < $gitdir/usr/klibc/version` +subminor=`cut -d. -f3 < $gitdir/usr/klibc/version` +tag=klibc-$version +now=`date -R` + +umask 022 + +if $real; then + unset GPG_AGENT_INFO + eval $(gpg-agent --daemon --quiet --no-use-standard-socket --keep-tty --keep-display --sh) + git tag -u "$signkey" -f -m "Relased on $now" "$tag" +fi + +exportdir="$tmpdir"/"$tag" +rm -rf "$exportdir" + +git_export "$exportdir" HEAD +cd $exportdir + +make release + +cd .. + +tar cvvf klibc-$version.tar klibc-$version +if $real; then + gpg -u "$signkey" --use-agent -a -b -o klibc-$version.tar.sign \ + klibc-$version.tar +fi +gzip -9 klibc-$version.tar + +if $real; then + cp klibc-$version.tar.gz klibc-$version.tar.sign "$releasedir" + + whereto=/pub/linux/libs/klibc/$major.$minor + kup mkdir "$whereto" + kup put klibc-$version.tar.gz klibc-$version.tar.sign "$whereto"/ + + # Bump the version number + ( + cd "$gitdir" + upstream=$(GIT_DIR="$repo" git config remote.origin.url) + git remote add upstream "$upstream" + + newsubminor=`expr 0$subminor + 1` + newversion=$major.$minor.$newsubminor + echo $newversion > usr/klibc/version + git add usr/klibc/version + git commit -m "[klibc] $version released, next version is $newversion" + git push upstream refs/heads/master refs/tags/"$tag" + ) +fi |