1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/sh
set -e
sourcename="cloud-utils"
RELEASE=${RELEASE:-UNRELEASED}
TEMP_D=""
fail() { echo "$@" 1>&2; exit 1; }
cleanup() {
[ -z "$TEMP_D" ] || rm -Rf "$TEMP_D"
}
if [ "$1" = "-h" -o "$1" = "--help" ]; then
cat <<EOF
Usage: ${0##*/}
build a deb of from trunk directory
any options are passed straight through to debuild
Example:
* ${0##*/} -us -uc
Its not significantly different than what you'd get by modifying
the debian/changelog to have the current HEAD, and then running
debuild --no-tgz-check
EOF
exit
fi
bname=${0##*/}
[ -n "$DEBEMAIL" ] || DEBEMAIL=$(git config user.email)
[ -n "$DEBFULLNAME" ] || DEBFULLNAME=$(git config user.name)
if [ -z "$DEBEMAIL" -o -z "$DEBFULLNAME" ]; then
echo "Must have DEBEMAIL and DEBFULLNAME in environment"
echo "or set git user.email and user.name."
fi
start_d=$PWD
top_d=$(cd "$(dirname "${0}")"/.. && pwd)
# git describe will output something either like '0.1.0' (a tag)
# or TAG-N-gHASH where N is number of commits since TAG
uver=$(git describe --abbrev=8) ||
fail "failed to get upstream version with 'git describe'"
clogver_debian=${CLOGVER_DEBIAN:-0ubuntu1}
clogver_new="${uver}-${clogver_debian}"
TEMP_D=$(mktemp -d "${TMPDIR:-/tmp}/${bname}.XXXXXX")
trap cleanup EXIT
echo "building upstream version ${uver}, debian ver=${clogver_debian}"
dir="${sourcename}-$uver"
tarball="${sourcename}_$uver.orig.tar.gz"
myd=$(dirname "$0")
"$myd/make-tarball" "--output=${TEMP_D}/$tarball" HEAD
echo "created ${tarball}"
cd "${TEMP_D}"
tar xzf "$tarball" || fail "failed extract tarball"
cd "$dir" || fail "failed cd $dir"
cat > debian/changelog <<EOF
$sourcename ($uver-${clogver_debian}) $RELEASE; urgency=low
* Upstream Build
-- $DEBFULLNAME <$DEBEMAIL> $(date -R)
EOF
debuild "$@" || fail "debuild failed"
cd "$TEMP_D"
for f in *; do
[ -f "$f" ] || continue
cp "$f" "$start_d" || fail "failed copy $f"
echo "wrote $f"
done
exit
|