summaryrefslogtreecommitdiffstats
path: root/tools/ko-release-gen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:10:49 +0000
commitcfe5e3905201349e9cf3f95d52ff4bd100bde37d (patch)
treed0baf160cbee3195249d095f85e52d20c21acf02 /tools/ko-release-gen
parentInitial commit. (diff)
downloadutil-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.tar.xz
util-linux-cfe5e3905201349e9cf3f95d52ff4bd100bde37d.zip
Adding upstream version 2.39.3.upstream/2.39.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/ko-release-gen')
-rwxr-xr-xtools/ko-release-gen103
1 files changed, 103 insertions, 0 deletions
diff --git a/tools/ko-release-gen b/tools/ko-release-gen
new file mode 100755
index 0000000..b3afc39
--- /dev/null
+++ b/tools/ko-release-gen
@@ -0,0 +1,103 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 Karel Zak <kzak@redhat.com>
+#
+# Usage: ko-release-gen [<directory> [<file>]]
+#
+# 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]//; s/\(.*\..*\)\..*/\1/')
+VERSION_DOCS=$(echo $VERSION | sed 's/-rc[0-9]//')
+DISTDIR=${1:-"kernel.org"}/v${VERSION_MAJOR}
+
+GPG_PROG=${GPG_PROG:-"gpg"}
+GPG_CMD="$GPG_PROG --use-agent --armor --detach-sign --quiet"
+
+die() {
+ echo $1
+ exit 1
+}
+
+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
+ ;;
+ *.tar.gz)
+ local sig=$(echo "$name" | sed 's/\.tar\.gz/.tar.sign/')
+ gzip -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
+ ;;
+ *.tar.bz2)
+ local sig=$(echo "$name" | sed 's/\.tar\.bz2/.tar.sign/')
+ bzip2 -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
+ ;;
+ *)
+ local sig="${name}.sign"
+ cat $subdir/$name | $GPG_CMD --output $subdir/$sig
+ ;;
+ esac
+ echo " OK "
+}
+
+add_html_dir() {
+ local src="$1" # source dir
+ local tgt="$2" # target dir
+
+ for fl in $(ls $src/*.html $src/*.css $src/*.png); do
+ add_file $fl $tgt
+ done
+}
+
+rm -rf $DISTDIR
+
+eval $(gpg-agent --daemon)
+
+# Add just specified files only
+if [ -f "$2" ]; then
+ shift
+ while (( "$#" )); do
+ add_file "$1"
+ shift
+ done
+ killall gpg-agent
+ exit 0
+fi
+
+add_file util-linux-${VERSION}.tar.xz
+add_file v${VERSION}-ChangeLog
+add_file Documentation/releases/v${VERSION_DOCS}-ReleaseNotes
+add_html_dir libmount/docs/html libmount-docs
+add_html_dir libblkid/docs/html libblkid-docs
+add_html_dir libsmartcols/docs/html libsmartcols-docs
+add_html_dir libfdisk/docs/html libfdisk-docs
+
+killall gpg-agent
+