retitle 442267 [debchange] Allow distribution to be changed non-interactively
clone 442267 -1
retitle -1 [debchange] Non-interactive changes add a spurious space to the 
changelog
submitter -1 !
thanks

Hi,

On Fri, 2007-09-14 at 16:24 +0100, Adam D. Barratt wrote:

> Ondrej Certik wrote, :
> [...]
> >     To change to unstable, I can do this:
> >
> > dch -r " "
> >
> > and it works fine. Howeve, when changing back to UNRELEASED, I need
> > to do:
> >
> > dch -D UNRELEASED " "
> >
> > and it adds a new line with "* " into the changelog. Could this
> > behavior be changed?
[...]
> > Also, it updates the time stamp:
> >
> > -- Ondrej Certik <[EMAIL PROTECTED]>  Fri, 14 Sep 2007 15:53:10 +0200
> >
> > is there a way how to make dch not to update the timestamp?
> 
> So long as you don't mind it also not updating the maintainer name (i.e. not 
> changing that trailer line at all) then there's a fix for #435980 in SVN 
> (adding -t / --mainttrailer).

Having thought about this a little more, the combination of -t and -r
doesn't and shouldn't work. The purpose of -r is to update the trailer
line, also changing the distribution if relevant.

I have committed a further patch (attached) that allows an empty (as
opposed to missing) changelog entry on the command line, so that you can
use (combining both patches)

  dch -t -D unstable ""

and

  dch -t -D UNRELEASED ""

to achieve your goal of simply updating the distribution. As this was
your original request, I've cloned a copy of the bug to handle the
"extra space" issue.

Apologies for the original misdirecction; hopefully the command lines
above give you what were looking for, without inadvertantly breaking the
expected functionality of -r.

Regards,

Adam
Index: scripts/debchange.pl
===================================================================
--- scripts/debchange.pl        (revision 797)
+++ scripts/debchange.pl        (working copy)
@@ -721,12 +721,18 @@
     }
 }
 
+# Get a possible changelog entry from the command line
+my $ARGS=join(' ', @ARGV);
+my $TEXT=decode_utf8($ARGS);
+my $EMPTY_TEXT=0;
 
-# Get a possible changelog entry from the command line
-my $TEXT=decode_utf8(join(' ', @ARGV));
 if (@ARGV and ! $TEXT) {
-    warn "$progname warning: command-line changelog entry not UTF-8 encoded; ignoring\n";
-    $TEXT='';
+    if ($ARGS) {
+       warn "$progname warning: command-line changelog entry not UTF-8 encoded; ignoring\n";
+       $TEXT='';
+    } else {
+       $EMPTY_TEXT = 1;
+    }
 }
 
 # Get the date
@@ -1051,7 +1057,7 @@
        } elsif ($opt_news) {
            print O "\n  \n";
            $line++;
-       } else {
+       } elsif (!$EMPTY_TEXT) {
            print O "  * \n";
        }
     }
@@ -1143,7 +1149,7 @@
 }
 
 # Now Run the Editor; always run if doing "closes" to give a chance to check
-if (! $TEXT or @closes_text or $opt_create) {
+if ((!$TEXT and !$EMPTY_TEXT) or @closes_text or $opt_create) {
     my $mtime = (stat("$changelog_path.dch"))[9];
     defined $mtime or fatal
        "Error getting modification time of temporary $changelog_path: $!";

Reply via email to