diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 14:30:35 +0000 |
commit | 378c18e5f024ac5a8aef4cb40d7c9aa9633d144c (patch) | |
tree | 44dfb6ca500d32cabd450649b322a42e70a30683 /tools/ko-release-push | |
parent | Initial commit. (diff) | |
download | util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.tar.xz util-linux-378c18e5f024ac5a8aef4cb40d7c9aa9633d144c.zip |
Adding upstream version 2.38.1.upstream/2.38.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/ko-release-push')
-rwxr-xr-x | tools/ko-release-push | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/ko-release-push b/tools/ko-release-push new file mode 100755 index 0000000..530c3a7 --- /dev/null +++ b/tools/ko-release-push @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (C) 2012 Karel Zak <kzak@redhat.com> +# +# Usage: ko-release-push [<directory> [<version>]] +# +# This script pushs files from <directory>/v<version> to kernel.org. The +# default <directory> is "kernel.org" and the default <version> is the current +# package version. +# +# The <directory>/v<version> files should be generated by ko-release-gen script. +# + +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=${2:-$(cat .version)} +VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/') +BASEDIR=${1:-"kernel.org"} +DISTDIR="${BASEDIR}/v${VERSION_MAJOR}" + +KO_DIR="/pub/linux/utils/util-linux/v${VERSION_MAJOR}" + +die() { + echo $1 + exit 1 +} + +function push_file { + local sig="$1" + + case "$sig" in + *.tar.sign) + fl=${sig%%.sign} + if [ -f ${fl}.xz ]; then fl=${fl}.xz + elif [ -f ${fl}.gz ]; then fl=${fl}.gz + elif [ -f ${fl}.bz2 ]; then fl=${fl}.bz2 + else die "cannot found original file for $sig" + fi + ;; + *) + fl=$(echo "$sig" | sed 's/\.sign//') + ;; + esac + + echo -n " PUSH $fl ..." + kup put $fl $sig ${KO_DIR}/${fl##${DISTDIR}/} + echo " OK " +} + +[ -d "$DISTDIR" ] || die "$DISTDIR: Not such directory" + +FILES=$(find $DISTDIR -name "*.sign" | sort) +DIRS=$(for f in $FILES; do echo $(dirname ${KO_DIR}/${f##${DISTDIR}/}); done | sort -u) + +for d in $DIRS; do + echo -n " MKDIR $d ..." + kup mkdir $d + echo " OK " +done + +for f in $FILES; do + push_file $f +done + |