Package: devscripts
Version: 2.15.5
Severity: minor
Control: tags + patch

When working with Emacs ‘debian-changelog-mode’ it is normal to have
the latest changelog entry set to distribution “UNRELEASED”, and have
the trailer line unfinalised — since the release is not ready.

Currently ‘debchange --release’ will fail with the following error::

=====
$ debchange --release
parsechangelog/debian: warning:     debian/changelog(l21): badly formatted 
trailer line
LINE:  --
parsechangelog/debian: warning:     debian/changelog(l23): found start of entry 
where expected more change data or trailer
LINE: python-lockfile (1:0.10.2-1) experimental; urgency=low
parsechangelog/debian: warning:     debian/changelog(l23): found eof where 
expected more change data or trailer
debchange: fatal error at line 645:
No maintainer in changelog!
=====

Instead, ‘debchange --release’ should recognise an unfinalised trailer
line as valid for this action, and replace the line with a finalised
trailer line for the release.

Attached is a suggested patch for this behaviour.

-- 
 \       “From the moment I picked your book up until I laid it down I |
  `\        was convulsed with laughter. Someday I intend reading it.” |
_o__)                                                    —Groucho Marx |
Ben Finney <b...@benfinney.id.au>
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 1ca421f..1419a31 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -1280,7 +1280,7 @@ if (($opt_r || $opt_a || $merge) && ! $opt_create) {
     # last entry, and determine whether there are existing
     # multi-developer changes by the current maintainer.
     $line=-1;
-    my ($lastmaint, $nextmaint, $maintline, $count, $lastheader, $lastdist, $dist_indicator);
+    my ($lastmaint, $nextmaint, $trailer, $maintline, $count, $lastheader, $lastdist, $dist_indicator);
     my $savedline = $line;;
     while (<S>) {
 	$line++;
@@ -1317,8 +1317,19 @@ if (($opt_r || $opt_a || $merge) && ! $opt_create) {
 	    ($dist_indicator = $1) =~ s/[!:.,;]$//;
 	    chomp $dist_indicator;
 	}
-	elsif (/^ --\s+([^<]+)\s+/ || /^ --\s+<(.+?)>/) {
-	    $lastmaint=$1;
+	elsif (/^ --$/ || /^ --\s+([^<]+)\s+/ || /^ --\s+<(.+?)>/) {
+            $trailer = $line;
+            if (/^ --$/) {
+                # The trailer line is not finalised.
+                if (defined $lastdist) {
+                    # Distribution should be “UNRELEASED”.
+                    fatal "Trailer line must be finalised, or distribution must be UNRELEASED"
+                }
+            }
+            else {
+                # The trailer line is finalised. Store the maintainer value.
+                $lastmaint = $1;
+            }
 	    # Remember where we are so we can skip back afterwards
 	    $savedline = $line;
 	}

Attachment: signature.asc
Description: Digital signature

Reply via email to