Author: adsb
Date: 2009-01-15 21:46:23 +0000 (Thu, 15 Jan 2009)
New Revision: 1790

Modified:
   trunk/debian/changelog
   trunk/scripts/debchange.pl
Log:
* debchange:
  + When adding a NEWS item, automatically propogate the urgency from the
    changelog. (Closes: #511911)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2009-01-14 19:45:41 UTC (rev 1789)
+++ trunk/debian/changelog      2009-01-15 21:46:23 UTC (rev 1790)
@@ -10,6 +10,9 @@
   [ Adam D. Barratt ]
   * debsign: Add further quoting around the use and generation of temporary
     directory names, in case $TMPDIR contains spaces.
+  * debchange:
+    + When adding a NEWS item, automatically propogate the urgency from the
+      changelog. (Closes: #511911)
 
   [ James Vega ]
   * debcheckout:

Modified: trunk/scripts/debchange.pl
===================================================================
--- trunk/scripts/debchange.pl  2009-01-14 19:45:41 UTC (rev 1789)
+++ trunk/scripts/debchange.pl  2009-01-15 21:46:23 UTC (rev 1790)
@@ -485,6 +485,8 @@
 my $DISTRIBUTION = 'UNRELEASED';
 my $bpo_dist = '';
 my $CHANGES = '';
+# Changelog urgency, possibly propogated to NEWS files
+my $CL_URGENCY = '';
 
 if (! $opt_create || ($opt_create && $opt_news)) {
     if (! $opt_create) {
@@ -532,6 +534,8 @@
 
     # Find the current package version
     if ($opt_news) {
+       my $found_version = 0;
+       my $found_urgency = 0;
        open PARSED, qq[dpkg-parsechangelog -l"$real_changelog_path" | ]
            or fatal "Cannot execute dpkg-parsechangelog: $!";
        while (<PARSED>) {
@@ -539,6 +543,13 @@
            if (m%^Version:\s+(\S+)$%) {
                $VERSION = $1;
                $VERSION =~ s/~$//;
+               $found_version = 1;
+               last if $found_urgency;
+           } elsif (m%^Urgency:\s+(\S+)(\s|$)%) {
+               $CL_URGENCY = $1;
+               $found_urgency = 1;
+               last if $found_version;
+           } elsif (m%^$%) {
                last;
            }
        }
@@ -1028,7 +1039,11 @@
     }
     my $distribution = $opt_D || $bpo_dist || (($opt_release_heuristic eq 
'changelog') ? "UNRELEASED" : $DISTRIBUTION);
     
-    my $urgency = $opt_u || 'low';
+    my $urgency = $opt_u;
+    if ($opt_news) {
+       $urgency ||= $CL_URGENCY;
+    }
+    $urgency ||= 'low';
 
     if (($opt_v or $opt_i or $opt_l or $opt_d) and
        $opt_release_heuristic eq "changelog" and
@@ -1153,6 +1168,9 @@
     if ($CHANGES =~ m/^\w[-+0-9a-z.]* \([^\(\) 
\t]+\)((?:\s+[-+0-9a-z.]+)+)\;\s+urgency=(\w+)/i) {
        my $distribution = $1;
        my $urgency = $2;
+       if ($opt_news) {
+           $urgency = $CL_URGENCY;
+       }
        $distribution =~ s/^\s+//;
        if ($opt_r) {
            # Change the distribution from UNRELEASED for release
@@ -1261,7 +1279,11 @@
        push @closes_text, "Initial release. (Closes: \#XXXXXX)\n";
     }
 
-    my $urgency = $opt_u || 'low';
+    my $urgency = $opt_u;
+    if ($opt_news) {
+       $urgency ||= $CL_URGENCY;
+    }
+    $urgency ||= 'low';
     print O "$PACKAGE ($VERSION) $DISTRIBUTION; urgency=$urgency\n\n";
 
     if (@closes_text or $TEXT) {



-- 
To unsubscribe, send mail to [email protected].

Reply via email to