diff options
author | Karel Zak <kzak@redhat.com> | 2012-01-19 10:33:42 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2012-01-19 10:48:16 +0100 |
commit | a3f225678fd96e004486ea9b5fb38a5b663537af (patch) | |
tree | 614b73d7f8de7dd5c25e7c05b3ebb2443e446418 /tools | |
parent | 748c010f070e96ff397a65e2338ae58125f085c0 (diff) | |
download | util-linux-a3f225678fd96e004486ea9b5fb38a5b663537af.tar.gz |
build-sys: add ko-release-gen script
The script creates directory kernel.org/v<version>/, copy .xz tarball,
changelog, release notes and docs to the directory and sign all files by
gpg.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ko-release-gen | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tools/ko-release-gen b/tools/ko-release-gen new file mode 100755 index 00000000..46d140f9 --- /dev/null +++ b/tools/ko-release-gen @@ -0,0 +1,76 @@ +#!/bin/sh +# +# Copyright (C) 2012 Karel Zak <kzak@redhat.com> +# +# Usage: ko-release-gen [<directory>] +# +# This script prepares a new release for publishing on kernel.org. The +# hierarchy of release files is created in the <directory> (default directory +# is "kernel.org"). Use case: +# +# make distcheck +# make changelog +# tools/ko-release-gen +# tools/ko-release-push +# + +cd "$(git rev-parse --show-toplevel)" || { + echo "error: failed to chdir to git root" + exit 1 +} + +[ -f ".version" ] || \ + echo "error: cannot found version file (call make distcheck)" + +VERSION=$(cat .version) +VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//') +DISTDIR=${1:-"kernel.org"}/v${VERSION_MAJOR} + +GPG_CMD="gpg --use-agent --armor --detach-sign --quiet --batch" + +function die { + echo $1 + exit 1 +} + +function add_file { + local src="$1" + local name=$(basename $1) + local subdir=$DISTDIR/${2:-""} + + mkdir -p $subdir + cp $src $subdir || die "$src: copy failed" + + [ -f $subdir/$name ] || die "$name not found" + echo -n " $subdir/$name ..." + + case "$name" in + *.tar.xz) + local sig=$(echo "$name" | sed 's/\.tar\.xz/.tar.sign/') + xz -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig + ;; + *) + local sig="${name}.sign" + cat $subdir/$name | $GPG_CMD --output $subdir/$sig + ;; + esac + echo " OK " +} + +function add_html_dir { + local src="$1" # source dir + local tgt="$2" # target dir + + for fl in $(ls $src/*.{html,css,png}); do + add_file $fl $tgt + done +} + +rm -rf $DISTDIR + +add_file util-linux-${VERSION}.tar.xz +add_file v${VERSION}-ChangeLog +add_file Documentation/releases/v${VERSION_MAJOR}-ReleaseNotes +add_html_dir libmount/docs/html libmount-docs +add_html_dir libblkid/docs/html libblkid-docs + |