diff options
author | Peter Palfrader <peter@palfrader.org> | 2011-04-11 14:50:41 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2011-04-11 14:50:41 +0000 |
commit | 680b320d315143b366d91ef46401b9bf7d5abb95 (patch) | |
tree | c066c8c498459a6e80e55aca7e4d17302ded3154 /sbuild-stuff | |
parent | e167170fc2a836346d58a0ef23084e4c82e73989 (diff) |
Make sure we keep the original Distribution:
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@475 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'sbuild-stuff')
-rwxr-xr-x | sbuild-stuff | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/sbuild-stuff b/sbuild-stuff index 5f282fd..ebd59d5 100755 --- a/sbuild-stuff +++ b/sbuild-stuff @@ -9,7 +9,43 @@ if [ "${1:-}" == "--binary-only" ]; then shift else BINARCH=0 -fi; +fi + +if ! which grep-dctrl > /dev/null; then + echo "grep-dctrl not found. Maybe install dctrl-tools?" + exit 1 +fi +if ! which changestool > /dev/null; then + echo "changestool not found. Maybe install reprepro?" + exit 1 +fi + +get_metadata() { + local dsc="$1"; shift + + dsc="$(readlink -f "$dsc")" + local origtar="$(dcmd --orig $dsc)" + if ! [ -e "$origtar" ]; then + echo >&2 "File $origtar not found" + exit 1 + fi + local dirname="$(tar tzf $origtar | head -n1)" + dirname="${dirname%%/}" + + local tmpdir="`mktemp -d`" + pushd . >/dev/null + cd "$tmpdir" + + dpkg-source -x "$dsc" > /dev/null + cd "$dirname" + + local dist=$(dpkg-parsechangelog | grep-dctrl -n -s Distribution '') + local ver=$(dpkg-parsechangelog | grep-dctrl -n -s Version '') + + popd >/dev/null + rm -rf "$tmpdir" + echo "$dist $ver" +} DSC="${1:-}"; shift if [ -z "$DSC" ] || [ -z "$BINARCH" ]; then @@ -17,8 +53,8 @@ if [ -z "$DSC" ] || [ -z "$BINARCH" ]; then exit 1; fi -package=`echo $DSC | sed -e 's/_.*//'` -debian_version=`echo $DSC | sed -e 's/^[^_]*_//' -e s/\.dsc$//` +metadata="$(get_metadata "$DSC")" +read dscdist debian_version <<< "$metadata" if [ -z "${DIST:-}" ]; then DIST=sid @@ -49,3 +85,10 @@ else fi sbuild --arch="$ARCH" --dist="$DIST" --apt-update $extra "$DSC" + +changesfile="${DSC%.dsc}_$ARCH.changes" +if ! [ -e "$changesfile" ]; then + echo >&2 "Expected file $changesfile does not exist" + exit 1 +fi +changestool "$changesfile" setdistribution "$dscdist" |