From 704d6ddbd0040acd67bc185b54398980a39fd2e5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 19 Jan 2012 10:51:48 +0100 Subject: build-sys: add ko-release-push script Signed-off-by: Karel Zak --- tools/ko-release-push | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 tools/ko-release-push (limited to 'tools/ko-release-push') diff --git a/tools/ko-release-push b/tools/ko-release-push new file mode 100755 index 000000000..0c500ac8c --- /dev/null +++ b/tools/ko-release-push @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Copyright (C) 2012 Karel Zak +# +# This script pushs files from /v to kernel.org. The +# default directory is kernel.org and is the current package version. +# +# The /v 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=$(cat .version) +VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//') +BASEDIR=${1:-"kernel.org"} +DISTDIR="${BASEDIR}/v${VERSION_MAJOR}" + +KO_DIR="/pub/linux/utils/util-linux/v${VERSION_MAJOR}" + +function die { + echo $1 + exit 1 +} + +function push_file { + local sig="$1" + + case "$sig" in + *.tar.sign) + fl=$(echo "$sig" | sed 's/\.tar\.sign/.tar.xz/') + ;; + *) + fl=$(echo "$sig" | sed 's/\.sign//') + ;; + esac + + echo -n " PUSH $sig ..." + 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 + -- cgit v1.2.3-55-g7522