Author: jamessan
Date: 2008-09-29 17:17:35 +0000 (Mon, 29 Sep 2008)
New Revision: 1654

Modified:
   trunk/debian/changelog
   trunk/debian/links
   trunk/scripts/pts-subscribe.1
   trunk/scripts/pts-subscribe.sh
Log:
pts-subscribe: When called as pts-unsubscribe, send an unsubscribe request to 
the PTS.  (Closes: #500585)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-09-27 20:37:45 UTC (rev 1653)
+++ trunk/debian/changelog      2008-09-29 17:17:35 UTC (rev 1654)
@@ -1,5 +1,6 @@
 devscripts (2.10.39) UNRELEASED; urgency=low
 
+  [ Adam D. Barratt ]
   * bts:
     + Allow an explicit HELO to be specified when connecting via SMTP.
     + If a HELO is not specified then attempt to use the content of
@@ -10,6 +11,10 @@
   * debdiff: Ensure exit status is always explicitly set (and set
     correctly). (Closes: #500256)
 
+  [ James Vega ]
+  * pts-subscribe: When called as pts-unsubscribe, send an unsubscribe request
+    to the PTS.  (Closes: #500585)
+
  -- Adam D. Barratt <[EMAIL PROTECTED]>  Tue, 23 Sep 2008 19:07:48 +0100
 
 devscripts (2.10.38) unstable; urgency=low

Modified: trunk/debian/links
===================================================================
--- trunk/debian/links  2008-09-27 20:37:45 UTC (rev 1653)
+++ trunk/debian/links  2008-09-29 17:17:35 UTC (rev 1654)
@@ -1,5 +1,7 @@
 /usr/bin/cvs-debi                              /usr/bin/cvs-debc
 /usr/bin/debchange                             /usr/bin/dch
 /usr/bin/debi                                  /usr/bin/debc
+/usr/bin/pts-subscribe                         /usr/bin/pts-unsubscribe
 /usr/share/devscripts/conf.default             
/usr/share/doc/devscripts/devscripts.conf.ex
 /usr/share/man/man1/debchange.1.gz             /usr/share/man/man1/dch.1.gz
+/usr/share/man/man1/pts-subscribe.1.gz         
/usr/share/man/man1/pts-unsubscribe.1.gz

Modified: trunk/scripts/pts-subscribe.1
===================================================================
--- trunk/scripts/pts-subscribe.1       2008-09-27 20:37:45 UTC (rev 1653)
+++ trunk/scripts/pts-subscribe.1       2008-09-29 17:17:35 UTC (rev 1654)
@@ -3,11 +3,16 @@
 pts-subscribe \- time-limited subscription to the PTS
 .SH SYNOPSIS
 \fBpts-subscribe\fR [options] \fIpackage\fR
+.PP
+\fBpts-unsubscribe\fR [options] \fIpackage\fR
 .SH DESCRIPTION
 \fBpts-subscribe\fR sends a subscription request for \fIpackage\fR to
 the Package Tracking System at [EMAIL PROTECTED], and cancels the
 subscription 30 days later.
 .PP
+If called as \fBpts-unsubscribe\fR, send an unsubscription request
+for \fIpackage\fR to the Package Tracking System.
+.PP
 This utility is useful if a developer has made an NMU and wants to
 track the package for a limited period of time.
 .SH OPTIONS

Modified: trunk/scripts/pts-subscribe.sh
===================================================================
--- trunk/scripts/pts-subscribe.sh      2008-09-27 20:37:45 UTC (rev 1653)
+++ trunk/scripts/pts-subscribe.sh      2008-09-29 17:17:35 UTC (rev 1654)
@@ -11,6 +11,9 @@
   Subscribe to the PTS (Package Tracking System) for the specified package
   for a limited length of time (30 days by default).
 
+  If called as 'pts-unsubscribe', unsubscribe from the PTS for the specified
+  package.
+
   Options:
     -u, --until UNTIL
                    When to unsubscribe; this is given as the command-line
@@ -41,6 +44,11 @@
 GNU General Public License, version 2 or later."
 }
 
+ACTION="subscribe"
+if [ "$PROGNAME" = pts-unsubscribe ]; then
+    ACTION="unsubscribe"
+fi
+
 # Boilerplate: set config variables
 DEFAULT_PTS_UNTIL='now + 30 days'
 VARS="PTS_UNTIL"
@@ -91,7 +99,7 @@
 # Will bomb out if there are unrecognised options
 TEMP=$(getopt -s bash -o "u:" \
        --long until:,forever \
-        --long no-conf,noconf \
+       --long no-conf,noconf \
        --long help,version -n "$PROGNAME" -- "$@")
 
 eval set -- $TEMP
@@ -110,7 +118,7 @@
        exit 1 ;;
     --help) usage; exit 0 ;;
     --version) version; exit 0 ;;
-    --)        shift; break ;;
+    --) shift; break ;;
     *) echo "$PROGNAME: bug in option parser, sorry!" >&2 ; exit 1 ;;
     esac
     shift
@@ -143,7 +151,7 @@
 
 if [ -z "$DEBEMAIL" ]; then
     if [ -z "$EMAIL" ]; then
-       echo "$PROGNAME warning: \$DEBEMAIL is not set; attempting to subscribe 
anyway" >&2
+       echo "$PROGNAME warning: \$DEBEMAIL is not set; attempting to $ACTION 
anyway" >&2
     else
        echo "$PROGNAME warning: \$DEBEMAIL is not set; using \$EMAIL instead" 
>&2
        DEBEMAIL=$EMAIL
@@ -151,15 +159,19 @@
 fi
 DEBEMAIL=$(echo $DEBEMAIL | sed -s 's/^.*[     ]<\(.*\)>.*/\1/')
 
-cd /
-if [ "$PTS_UNTIL" != forever ]; then
-    TEMPFILE=$(mktemp) || { echo "$PROGNAME: Couldn't create tempfile!" >&2; 
exit 1; }
-    trap "rm -f '$TEMPFILE'" 0 1 2 3 7 10 13 15
-    echo "echo 'unsubscribe $pkg $DEBEMAIL' | mail [EMAIL PROTECTED]" | \
-       at $PTS_UNTIL 2>$TEMPFILE
-    grep '^job ' $TEMPFILE | sed -e 's/^/Unsubscription will be sent by "at" 
as /'
+if [ "$ACTION" = "unsubscribe" ]; then
+    echo "$ACTION $pkg $DEBEMAIL" | mail [EMAIL PROTECTED]
 else
-    echo "No unsubscription request will be sent"
+    cd /
+    if [ "$PTS_UNTIL" != forever ]; then
+       TEMPFILE=$(mktemp) || { echo "$PROGNAME: Couldn't create tempfile!" 
>&2; exit 1; }
+       trap "rm -f '$TEMPFILE'" 0 1 2 3 7 10 13 15
+       echo "echo 'unsubscribe $pkg $DEBEMAIL' | mail [EMAIL PROTECTED]" | \
+           at $PTS_UNTIL 2>$TEMPFILE
+       grep '^job ' $TEMPFILE | sed -e 's/^/Unsubscription will be sent by 
"at" as /'
+    else
+       echo "No unsubscription request will be sent"
+    fi
+
+    echo "$ACTION $pkg $DEBEMAIL" | mail [EMAIL PROTECTED]
 fi
-
-echo "subscribe $pkg $DEBEMAIL" | mail [EMAIL PROTECTED]



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to