From: Michael Buesch Date: Mon, 27 Feb 2012 23:04:40 +0000 (+0100) Subject: fwcutter: Rewrite release script X-Git-Tag: b43-fwcutter-016~2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=a4083e9b01445286dd9a376bb25b51f905ea5404;p=b43-tools.git fwcutter: Rewrite release script Signed-off-by: Michael Buesch --- diff --git a/fwcutter/makerelease.sh b/fwcutter/makerelease.sh index 2c25a86..1d51810 100755 --- a/fwcutter/makerelease.sh +++ b/fwcutter/makerelease.sh @@ -1,55 +1,26 @@ -#!/bin/bash -set -e +#!/bin/sh -project="b43-fwcutter" +srcdir="$(dirname "$0")" +[ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir" -origin="$(dirname "$0")" -[ "${origin:0:1}" = "/" ] || origin="$PWD/$origin" +srcdir="$srcdir/.." # git repos root -do_git_tag=1 -[ "$1" = "--notag" ] && do_git_tag=0 +die() { echo "$*"; exit 1; } -version="$(cat $origin/Makefile | grep -e VERSION | head -n1 | cut -d' ' -f3)" -if [ -z "$version" ]; then - echo "Could not determine version!" - exit 1 -fi -tmpdir="/tmp" -release_name="$project-$version" -tarball="$release_name.tar.bz2" -tagname="$project-$version-release" -tagmsg="$project-$version release" +# Import the makerelease.lib +# http://bues.ch/gitweb?p=misc.git;a=blob_plain;f=makerelease.lib;hb=HEAD +for path in $(echo "$PATH" | tr ':' ' '); do + [ -f "$MAKERELEASE_LIB" ] && break + MAKERELEASE_LIB="$path/makerelease.lib" +done +[ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found." -export GIT_DIR="$origin/../.git" +hook_get_version() +{ + local file="$1/Makefile" + version="$(cat "$file" | grep -e VERSION | head -n1 | cut -d' ' -f3)" +} -rm -Rf "$tmpdir/$release_name" -echo "Creating target directory" -mkdir -p "$tmpdir/$release_name" -cd "$tmpdir/$release_name" -echo "git checkout" -git checkout -f -mv fwcutter $release_name -targetdir="$tmpdir/$release_name/$release_name" - -rm "$targetdir/makerelease.sh" - -echo "creating tarball" -cd "$targetdir/.." -tar cjf "$tarball" "$release_name" -mv "$tarball" "$origin" - -echo "running testbuild" -cd "$targetdir" -make - -echo "removing testbuild" -rm -R "$tmpdir/$release_name" - -if [ "$do_git_tag" -ne 0 ]; then - echo "Tagging GIT" - cd "$origin" - git tag -m "$tagmsg" -a "$tagname" -fi - -echo -echo "built release $version" +project=b43-fwcutter +srcsubdir=fwcutter +makerelease $@