| #!/bin/bash -xe |
| |
| git_export () { |
| if [ -e "$1" ]; then |
| rm -rf "$1" |
| fi |
| mkdir -p "$1" |
| git archive --format=tar "$2" | tar -C "$1" -xf - |
| } |
| |
| here="$(mktemp -d)" |
| cd $here |
| |
| if [ x"$1" = x'test' ]; then |
| real=false |
| else |
| real=true |
| fi |
| |
| me=`whoami` |
| repo=~/src/klibc/klibc/.git |
| signkey=AC2B29BD34A6AFDDB3F68F35E7BFC8EC95861109 |
| releasedir=~/src/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 |
| gitdir="$here"/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 "klibc $version released on $now" "$tag" |
| fi |
| |
| exportdir="$here"/"$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 |