Package: devscripts Version: 2.9.20 Severity: wishlist Hi Steinar and devscripts maintainers,
After a while, I decided to give nmudiff a try, and to my surprise, I've found that having this little set of actions as a script really helps, to thanks for it. However, while opening a new bug to submit a NMU diff has been the traditional approach, nowadays I really think it's more common to send the diff to the bugs fixed by the NMU. So I hacked a copy for my ~/bin changing that, but then I thought why not submit it, etc., and here I am. I attach both the new version, and a diff to the previous one. Now, sending the diff to the fixed bug (and tagging them +patch) is the default, unless --new is specified, which reverts to old behavior. While I was at it, I added support for --help and --version. Thanks, -- Adeodato Simó dato at net.com.org.es Debian Developer adeodato at debian.org Listening to: Nightmares on Wax - Ease Jimi
nmudiff-new.sh
Description: Bourne shell script
--- /usr/bin/nmudiff 2006-05-17 08:28:18.000000000 +0200 +++ /home/adeodato/bin/nmudiff 2006-06-03 00:43:04.000000000 +0200 @@ -2,13 +2,58 @@ # Copyright 2006 by Steinar H. Gunderson # Licensed under the GPL version 2. +PROGNAME=`basename $0` + +usage () { + echo \ +"nmudiff creates a diff for a non-maintainer upload and sends it to the +relevant bugs in the BTS. + +Usage: nmudiff [options] + Options: + --new Send the patch to a newly created bug report + --help Show this message + --version Show version and copyright information" +} + +version () { + echo \ +"This is nmudiff, from the Debian devscripts package, version ###VERSION### +This code is copyright 2006 by Steinar H. Gunderson, all rights reserved. +This program comes with ABSOLUTELY NO WARRANTY. +You are free to redistribute this code under the terms of the +GNU General Public License, version 2." +} + +# TODO: implement a --no-mutt option that uses /usr/bin/mail? if ! command -v mutt >/dev/null 2>&1; then - echo "nmudiff: requires mutt to be installed to run!" >&2 + echo "$PROGNAME: requires mutt to be installed to run!" >&2 exit 1 fi +while [ $# != 0 ] +do + case "$1" in + --new) submit_new_bug=yes ;; + -h|--help) + usage + exit 0 ;; + --version) + version + exit 0 ;; + --) break ;; + -*) echo "$PROGNAME: Unrecognised option: $1" >&2 + usage >&2 + exit 1 ;; + *) break ;; # TODO: accept two .dsc? + esac + shift +done + + SOURCE=$( dpkg-parsechangelog | grep ^Source: | cut -d" " -f2 ) VERSION=$( dpkg-parsechangelog | grep ^Version: | cut -d" " -f2 ) +CLOSES=$( dpkg-parsechangelog | grep ^Closes: | cut -d" " -f2- ) OLDVERSION=$( dpkg-parsechangelog -v~ \ | sed -n "s/^ [^ .][^ ]* (\(.*\)).*$/\1/p" | head -2 | tail -1 ) @@ -21,18 +66,35 @@ sensible-editor ../${SOURCE}-${VERSION_NO_EPOCH}-nmu.diff TMPNAM=$( tempfile ) -cat <<EOF >$TMPNAM + +if [ -n "$submit_new_bug" ]; then + ADDRESSES="[EMAIL PROTECTED]" + cat <<EOF >$TMPNAM Package: $SOURCE Version: $OLDVERSION Severity: normal Tags: patch +EOF +else + ADDRESSES="" + for b in $CLOSES; do + ADDRESSES="$ADDRESSES [EMAIL PROTECTED]" + done + ADDRESSES="$ADDRESSES [EMAIL PROTECTED]" + cat <<EOF >$TMPNAM +$(for b in $CLOSES; do echo "tag $b + patch"; done) +thanks +EOF +fi + +cat <<EOF >>$TMPNAM Hi, Attached is the diff for my $SOURCE $VERSION NMU. EOF -mutt -s "diff for $VERSION NMU" -i $TMPNAM \ - -a ../${SOURCE}-${VERSION_NO_EPOCH}-nmu.diff [EMAIL PROTECTED] +mutt -s "NMU diff for $SOURCE $VERSION" -i $TMPNAM \ + -a ../${SOURCE}-${VERSION_NO_EPOCH}-nmu.diff $ADDRESSES rm $TMPNAM