diff --git a/debian/changelog b/debian/changelog index 7b2c958..f1f51f7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +ubuntu-dev-tools (0.22) UNRELEASED; urgency=low + + * update-maintainer-field: + - Use rmadison instead of apt-cache madison. + - Added --nochangelog command-line argument. + - Check --section value. + - Reformatted usage information. + - Some code cleanup. + + -- Luke Yelavich Thu, 15 Nov 2007 22:31:42 +1100 + ubuntu-dev-tools (0.21) hardy; urgency=low [ Laurent Bigonville ] diff --git a/update-maintainer b/update-maintainer index cc6e992..3aeca82 100755 --- a/update-maintainer +++ b/update-maintainer @@ -5,14 +5,41 @@ # This script is used to update the maintainer field of an Ubuntu package # to match the DebianMaintainerField specification. +usage() { +cat <&2; exit 1 ;; + "--path") + path="$value" + ;; + "--section") + [ "$value" != "main" ] && + [ "$value" != "restricted" ] && + [ "$value" != "universe" ] && + [ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1 + section=$value + ;; + "--nochangelog") + nochangelog=1 + ;; + "--help") + usage + ;; + *) + echo "Bad parameter." + usage + exit 1 + ;; esac done @@ -33,11 +60,11 @@ fi exit 1; } if [ -z "$section" ]; then - DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog|cut -d'-' -f1) - pkgline=$(apt-cache madison $(head -1 $DEBIANDIR/changelog| cut -d' ' -f1)|\ - grep -m 1 "$DISTRO.*Sources") + DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1) + pkgline=$(rmadison -u ubuntu -a source -s $DISTRO $(head -1 $DEBIANDIR/changelog | cut -d' ' -f1)) if [ -z "$pkgline" ]; then - echo "You don't have $DISTRO in your source repos." >&2 + echo "The package doesn't exist in the $DISTRO archive. You may have to use the" >&2 + echo "--section argument. Run $0 --help for more information." >&2 exit 1 fi section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") @@ -52,5 +79,5 @@ for file in control{,.in,.real}; do [ -f $DEBIANDIR/$file ] && sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/$file done -dch --changelog $DEBIANDIR/changelog "Modify Maintainer value to match the DebianMaintainerField specification." +[ -z "$nochangelog" ] && dch --changelog $DEBIANDIR/changelog "Modify Maintainer value to match the DebianMaintainerField specification." echo "Maintainer changed to $email."