[Reproducible-commits] [dpkg] 90/105: dpkg-genchanges: Add new -O option

Niko Tyni ntyni at moszumanska.debian.org
Mon May 2 13:49:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.

commit 194d3fe7ac2f3d30b252f1f7660ae46187dcae3f
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Apr 18 11:00:03 2016 +0200

    dpkg-genchanges: Add new -O option
    
    This unifies this command with other commands outputting a generated
    file.
---
 debian/changelog           |  1 +
 man/dpkg-genchanges.1      |  6 +++++-
 scripts/dpkg-genchanges.pl | 13 ++++++++++---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3985ff3..5a26207 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -79,6 +79,7 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
     “full”) in dpkg-genchanges and dpkg-buildpackage.
   * Add new -I option to dpkg-shlibdeps to ignore package build directories.
     Closes: #821025
+  * Add new -O option to dpkg-genchanges.
   * Portability:
     - Move DPKG_ADMINDIR environment variable name out from update-alternatives
       code, to make life easier for non-dpkg-based systems.
diff --git a/man/dpkg-genchanges.1 b/man/dpkg-genchanges.1
index c24630b..68d7b82 100644
--- a/man/dpkg-genchanges.1
+++ b/man/dpkg-genchanges.1
@@ -2,7 +2,7 @@
 .\"
 .\" Copyright © 1995-1996 Ian Jackson <ijackson at chiark.greenend.org.uk>
 .\" Copyright © 2000 Wichert Akkerman <wakkerma at debian.org>
-.\" Copyright © 2006-2015 Guillem Jover <guillem at debian.org>
+.\" Copyright © 2006-2016 Guillem Jover <guillem at debian.org>
 .\" Copyright © 2008-2010 Raphaël Hertzog <hertzog at debian.org>
 .\"
 .\" This is free software; you can redistribute it and/or modify
@@ -179,6 +179,10 @@ how many of the package's source files are being uploaded.
 .B \-q
 suppresses these messages.
 .TP
+.BR \-O [\fIfilename\fP]
+Print the changes file to standard output (the default) or to \fIfilename\fP
+if specified (since dpkg 1.18.5).
+.TP
 .BR \-? ", " \-\-help
 Show the usage message and exit.
 .TP
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 1455b5d..3ac1dbd 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -51,6 +51,7 @@ my $controlfile = 'debian/control';
 my $changelogfile = 'debian/changelog';
 my $changelogformat;
 my $fileslistfile = 'debian/files';
+my $outputfile;
 my $uploadfilesdir = '..';
 my $sourcestyle = 'i';
 my $quiet = 0;
@@ -119,6 +120,7 @@ sub usage {
   -T<substvars-file>       read variables here, not debian/substvars.
   -D<field>=<value>        override or add a field and value.
   -U<field>                remove a field.
+  -O[<filename>]           write to stdout (default) or <filename>.
   -?, --help               show this help message.
       --version            show the version.
 "), $Dpkg::PROGNAME;
@@ -172,6 +174,8 @@ while (@ARGV) {
         $remove{$1} = 1;
     } elsif (m/^-V(\w[-:0-9A-Za-z]*)[=:](.*)$/s) {
 	$substvars->set($1, $2);
+    } elsif (m/^-O(.*)$/) {
+        $outputfile = $1;
     } elsif (m/^-(?:\?|-help)$/) {
 	usage();
 	exit(0);
@@ -183,8 +187,11 @@ while (@ARGV) {
     }
 }
 
-# Do not pollute STDOUT with info messages.
-report_options(info_fh => \*STDERR, quiet_warnings => $quiet);
+# Do not pollute STDOUT with info messages if the .changes file goes there.
+if (not defined $outputfile) {
+    report_options(info_fh => \*STDERR, quiet_warnings => $quiet);
+    $outputfile = '-';
+}
 
 # Retrieve info from the current changelog entry
 my %options = (file => $changelogfile);
@@ -500,4 +507,4 @@ for my $f (keys %remove) {
 
 # Note: do not perform substitution of variables, one of the reasons is that
 # they could interfere with field values, for example the Changes field.
-$fields->output(\*STDOUT);
+$fields->save($outputfile);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list