[D-m-team] Creating changesets

Anthony Towns aj at azure.humbug.org.au
Sun Nov 18 20:08:55 UTC 2007


Hey all,

Attached is a rough pass at a script to autogenerate changesets. You
invoke it as:

   make-changeset camrdale at gmail.com

then edit the generated file as appropriate. The argument needs to
identify the applicant's key in your keyring, so can be a name, email
or keyid. If it's not found in your keyring, it'll try invoking gpg
--recv-key to get the key.

The recommended-by is filled out with your name and email address, date
is filled out with date -R, NM-page is filled out if the page seems to
be valid. The key is exported using the "export-minimal" option which
doesn't include signatures.

I couldn't think of a good way to automatically fill in urls for the
agrees-to-dfsg-etc and advocates fields. It'd be nice to be able to
just say:

   make-changeset camrdale at gmail.com 447323

and have it pull and authenticate all the information from the given
bug report or something.

Thoughts?

Cheers,
aj

-------------- next part --------------
#!/bin/sh -e

# Copyright 2007 Anthony Towns
# GPLv2 or later

getmaint () {
  gpg --with-colons --list-keys "$1" | grep ^pub: | head -n1 | cut -d: -f5,10
}

MAINT=$(getmaint "$1")

if [ "$MAINT" = "" ]; then
  gpg --recv-key "$1"
  MAINT=$(getmaint "$1")
fi

MAINTKEY=${MAINT%:*}
MAINT=${MAINT#*:}
MAINTEMAIL=$(echo "$MAINT" | sed -e 's/^.*<\(.*\)>.*$/\1/')

MYNAME="$(getent passwd $(id -u) | cut -d: -f5 | cut -d, -f1)"
MYEMAIL="$(id -un)@$(cat /etc/mailname)"

if [ -e "$HOME/.devscripts" ]; then
  . $HOME/.devscripts
  if [ "$DEBEMAIL" ]; then MYEMAIL="$DEBEMAIL"; fi
fi

ME="$MYNAME <$MYEMAIL>"

NMPAGE="https://nm.debian.org/nmstatus.php?email=$MAINTEMAIL"

if ! curl 2>/dev/null -k "$NMPAGE" | grep -q "Status Page for applicant:" ; then
  NMPAGE="none"
fi

OUTPUTFILE="add-${MAINTEMAIL%%@*}_${MAINTEMAIL##*@}"

cat >$OUTPUTFILE <<EOF
Recommended-By: $ME
Date: $(date -R)
Comment: add debian-maintainer $MAINT
NM-Page: $NMPAGE
Agreement: ?
Advocates:
 ? - ?
Action: import
Data:
$(gpg --armour --export-options export-minimal --export $MAINTKEY | sed 's/^/ /')
EOF

echo "Output is in $OUTPUTFILE"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/d-m-team/attachments/20071119/dd312afe/attachment.pgp 


More information about the D-m-team mailing list