| 1 | #!/bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # |
| 3 | # Copyright (C) 2012 Karel Zak <[email protected]> |
| 4 | # |
| 5 | # Usage: ko-release-push [<directory> [<version>]] |
| 6 | # |
| 7 | # This script pushs files from <directory>/v<version> to kernel.org. The |
| 8 | # default <directory> is "kernel.org" and the default <version> is the current |
| 9 | # package version. |
| 10 | # |
| 11 | # The <directory>/v<version> files should be generated by ko-release-gen script. |
| 12 | # |
| 13 | |
| 14 | cd "$(gitscip-shell system . . git. rev-parse --show-toplevel)" || { |
| 15 | echoscip-shell system . . echo. "error: failed to chdir to git root" |
| 16 | exit 1 |
| 17 | } |
| 18 | |
| 19 | [scip-shell system . . `[`. -f ".version" ] || \ |
| 20 | echo "error: cannot found version file (call make distcheck)" |
| 21 | |
| 22 | VERSION=${2:-$(catscip-shell system . . cat. .version)} |
| 23 | VERSION_MAJOR=$(echoscip-shell system . . echo. $VERSION | sedscip-shell system . . sed. 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/') |
| 24 | BASEDIR=${1:-"kernel.org"} |
| 25 | DISTDIR="${BASEDIR}/v${VERSION_MAJOR}" |
| 26 | |
| 27 | KO_DIR="/pub/linux/utils/util-linux/v${VERSION_MAJOR}" |
| 28 | |
| 29 | diescip-shell shell util-linux 2.42.2-1 die().() { |
| 30 | echoscip-shell system . . echo. $1 |
| 31 | exit 1 |
| 32 | } |
| 33 | |
| 34 | function push_filescip-shell shell util-linux 2.42.2-1 push_file(). { |
| 35 | local sig="$1" |
| 36 | |
| 37 | case "$sig" in |
| 38 | *.tar.sign) |
| 39 | fl=${sig%%.sign} |
| 40 | if [scip-shell system . . `[`. -f ${fl}.xz ]; then fl=${fl}.xz |
| 41 | elif [scip-shell system . . `[`. -f ${fl}.gz ]; then fl=${fl}.gz |
| 42 | elif [scip-shell system . . `[`. -f ${fl}.bz2 ]; then fl=${fl}.bz2 |
| 43 | else diescip-shell shell util-linux 2.42.2-1 die(). "cannot found original file for $sig" |
| 44 | fi |
| 45 | ;; |
| 46 | *) |
| 47 | fl=$(echoscip-shell system . . echo. "$sig" | sedscip-shell system . . sed. 's/\.sign//') |
| 48 | ;; |
| 49 | esac |
| 50 | |
| 51 | echoscip-shell system . . echo. -n " PUSH $fl ..." |
| 52 | kup put $fl $sig ${KO_DIR}/${fl##${DISTDIR}/} |
| 53 | echoscip-shell system . . echo. " OK " |
| 54 | } |
| 55 | |
| 56 | [scip-shell system . . `[`. -d "$DISTDIR" ] || diescip-shell shell util-linux 2.42.2-1 die(). "$DISTDIR: Not such directory" |
| 57 | |
| 58 | FILES=$(findscip-shell system . . find. $DISTDIR -name "*.sign" | sortscip-shell system . . sort.) |
| 59 | DIRS=$(for f in $FILES; do echoscip-shell system . . echo. $(dirnamescip-shell system . . dirname. ${KO_DIR}/${f##${DISTDIR}/}); done | sortscip-shell system . . sort. -u) |
| 60 | |
| 61 | for d in $DIRS; do |
| 62 | echoscip-shell system . . echo. -n " MKDIR $d ..." |
| 63 | kup mkdir $d |
| 64 | echoscip-shell system . . echo. " OK " |
| 65 | done |
| 66 | |
| 67 | for f in $FILES; do |
| 68 | push_filescip-shell shell util-linux 2.42.2-1 push_file(). $f |
| 69 | done |
| 70 |