Browse Source

scripts: Improve and unify -O option handling and man page wording

Take an optional filename argument everywhere. Describe the default
output file for dpkg-gensymbols.
Guillem Jover 13 years ago
parent
commit
7a5f47b184

+ 3 - 0
debian/changelog

@@ -70,6 +70,9 @@ dpkg (1.17.2) UNRELEASED; urgency=low
   * Add support for pie and stack-protector options to dpkg-buildflags FFLAGS,
   * Add support for pie and stack-protector options to dpkg-buildflags FFLAGS,
     and update the man page to mention FFLAGS are a subset of CFLAGS.
     and update the man page to mention FFLAGS are a subset of CFLAGS.
     Closes: #726932
     Closes: #726932
+  * Improve and unify -O option handling in dpkg-genchanges, dpkg-gensymbols
+    and dpkg-shlibdeps, by always taking an optional filename argument and
+    describing in the man page the default output files.
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 4 - 3
man/dpkg-gencontrol.1

@@ -18,7 +18,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .
 .
-.TH dpkg\-gencontrol 1 "2013-04-02" "Debian Project" "dpkg utilities"
+.TH dpkg\-gencontrol 1 "2013-09-06" "Debian Project" "dpkg utilities"
 .SH NAME
 .SH NAME
 dpkg\-gencontrol \- generate Debian control files
 dpkg\-gencontrol \- generate Debian control files
 .
 .
@@ -129,8 +129,9 @@ substitution variable and control file field (using
 .BR du ),
 .BR du ),
 and for the default location of the output file.
 and for the default location of the output file.
 .TP
 .TP
-.B \-O
-Print the control file to standard output, rather than to
+.BR \-O [\fIfilename\fP]
+Print the control file to standard output (or \fIfilename\fP if specified),
+rather than to
 .B debian/tmp/DEBIAN/control
 .B debian/tmp/DEBIAN/control
 (or
 (or
 .IB package-build-dir /DEBIAN/control
 .IB package-build-dir /DEBIAN/control

+ 12 - 8
man/dpkg-gensymbols.1

@@ -2,6 +2,7 @@
 .\"
 .\"
 .\" Copyright © 2007-2011 Raphaël Hertzog <hertzog@debian.org>
 .\" Copyright © 2007-2011 Raphaël Hertzog <hertzog@debian.org>
 .\" Copyright © 2009-2010 Modestas Vainius <modestas@vainius.eu>
 .\" Copyright © 2009-2010 Modestas Vainius <modestas@vainius.eu>
+.\" Copyright © 2012-2013 Guillem Jover <guillem@debian.org>
 .\"
 .\"
 .\" This is free software; you can redistribute it and/or modify
 .\" This is free software; you can redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as published by
 .\" it under the terms of the GNU General Public License as published by
@@ -16,7 +17,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .
 .
-.TH dpkg\-gensymbols 1 "2012-04-22" "Debian Project" "dpkg utilities"
+.TH dpkg\-gensymbols 1 "2013-09-06" "Debian Project" "dpkg utilities"
 .SH NAME
 .SH NAME
 dpkg\-gensymbols \- generate symbols files (shared library dependency information)
 dpkg\-gensymbols \- generate symbols files (shared library dependency information)
 .
 .
@@ -409,13 +410,16 @@ multiple libraries with a single argument (otherwise you need multiple
 Use \fIfilename\fR as reference file to generate the symbols file
 Use \fIfilename\fR as reference file to generate the symbols file
 that is integrated in the package itself.
 that is integrated in the package itself.
 .TP
 .TP
-.B \-O
-Print the generated symbols file to standard output, rather than being
-stored in the package build tree.
-.TP
-.BI \-O filename
-Store the generated symbols file as \fIfilename\fR. If \fIfilename\fR is
-pre-existing, its content is used as basis for the generated symbols file.
+.BR \-O [\fIfilename\fP]
+Print the generated symbols file to standard output or to \fIfilename\fR
+if specified, rather than to
+.B debian/tmp/DEBIAN/symbols
+(or
+.IB package-build-dir /DEBIAN/symbols
+if
+.B \-P
+was used). If \fIfilename\fR is pre-existing, its contents are used as
+basis for the generated symbols file.
 You can use this feature to update a symbols file so that it matches a
 You can use this feature to update a symbols file so that it matches a
 newer upstream version of your library.
 newer upstream version of your library.
 .TP
 .TP

+ 4 - 4
man/dpkg-shlibdeps.1

@@ -19,7 +19,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
 .
 .
-.TH dpkg\-shlibdeps 1 "2012-05-04" "Debian Project" "dpkg utilities"
+.TH dpkg\-shlibdeps 1 "2013-09-06" "Debian Project" "dpkg utilities"
 .SH NAME
 .SH NAME
 dpkg\-shlibdeps \- generate shared library substvar dependencies
 dpkg\-shlibdeps \- generate shared library substvar dependencies
 .
 .
@@ -183,9 +183,9 @@ Likewise, any existing substitution variables starting with
 .BR shlibs: )
 .BR shlibs: )
 are removed from the the substitution variables file.
 are removed from the the substitution variables file.
 .TP
 .TP
-.B \-O
-Print substitution variable settings to standard output, rather than being
-added to the substitution variables file
+.BR \-O [\fIfilename\fP]
+Print substitution variable settings to standard output (or \fIfilename\fP
+if specified), rather than being added to the substitution variables file
 .RB ( debian/substvars
 .RB ( debian/substvars
 by default).
 by default).
 .TP
 .TP

+ 5 - 2
scripts/dpkg-gencontrol.pl

@@ -46,6 +46,7 @@ my $changelogfile = 'debian/changelog';
 my $changelogformat;
 my $changelogformat;
 my $fileslistfile = 'debian/files';
 my $fileslistfile = 'debian/files';
 my $packagebuilddir = 'debian/tmp';
 my $packagebuilddir = 'debian/tmp';
+my $outputfile;
 
 
 my $sourceversion;
 my $sourceversion;
 my $binaryversion;
 my $binaryversion;
@@ -81,7 +82,7 @@ sub usage {
   -f<files-list-file>      write files here instead of debian/files.
   -f<files-list-file>      write files here instead of debian/files.
   -P<package-build-dir>    temporary build dir instead of debian/tmp.
   -P<package-build-dir>    temporary build dir instead of debian/tmp.
   -n<filename>             assume the package filename will be <filename>.
   -n<filename>             assume the package filename will be <filename>.
-  -O                       write to stdout, not .../DEBIAN/control.
+  -O[<file>]               write to stdout (or <file>), not .../DEBIAN/control.
   -is, -ip, -isp, -ips     deprecated, ignored for compatibility.
   -is, -ip, -isp, -ips     deprecated, ignored for compatibility.
   -D<field>=<value>        override or add a field and value.
   -D<field>=<value>        override or add a field and value.
   -U<field>                remove a field.
   -U<field>                remove a field.
@@ -110,6 +111,8 @@ while (@ARGV) {
         $forceversion= $1;
         $forceversion= $1;
     } elsif (m/^-O$/) {
     } elsif (m/^-O$/) {
         $stdout= 1;
         $stdout= 1;
+    } elsif (m/^-O(.+)$/) {
+        $outputfile = $1;
     } elsif (m/^-i[sp][sp]?$/) {
     } elsif (m/^-i[sp][sp]?$/) {
 	# ignored for backwards compatibility
 	# ignored for backwards compatibility
     } elsif (m/^-F([0-9a-z]+)$/) {
     } elsif (m/^-F([0-9a-z]+)$/) {
@@ -401,7 +404,7 @@ close($lockfh) || syserr(_g('cannot close %s'), $lockfile);
 my $cf;
 my $cf;
 my $fh_output;
 my $fh_output;
 if (!$stdout) {
 if (!$stdout) {
-    $cf= "$packagebuilddir/DEBIAN/control";
+    $cf = $outputfile // "$packagebuilddir/DEBIAN/control";
     open($fh_output, '>', "$cf.new") ||
     open($fh_output, '>', "$cf.new") ||
         syserr(_g("cannot open new output control file \`%s'"), "$cf.new");
         syserr(_g("cannot open new output control file \`%s'"), "$cf.new");
 } else {
 } else {

+ 2 - 3
scripts/dpkg-gensymbols.pl

@@ -3,7 +3,7 @@
 # dpkg-gensymbols
 # dpkg-gensymbols
 #
 #
 # Copyright © 2007 Raphaël Hertzog
 # Copyright © 2007 Raphaël Hertzog
-# Copyright © 2007-2012 Guillem Jover <guillem@debian.org>
+# Copyright © 2007-2013 Guillem Jover <guillem@debian.org>
 #
 #
 # This program is free software; you can redistribute it and/or modify
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # it under the terms of the GNU General Public License as published by
@@ -77,8 +77,7 @@ sub usage {
                            file and the reference template.
                            file and the reference template.
   -I<file>                 force usage of <file> as reference symbols
   -I<file>                 force usage of <file> as reference symbols
                            file instead of the default file.
                            file instead of the default file.
-  -O<file>                 write to <file>, not .../DEBIAN/symbols.
-  -O                       write to stdout, not .../DEBIAN/symbols.
+  -O[<file>]               write to stdout (or <file>), not .../DEBIAN/symbols.
   -t                       write in template mode (tags are not
   -t                       write in template mode (tags are not
                            processed and included in output).
                            processed and included in output).
   -V                       verbose output; write deprecated symbols and pattern
   -V                       verbose output; write deprecated symbols and pattern

+ 4 - 2
scripts/dpkg-shlibdeps.pl

@@ -5,7 +5,7 @@
 # Copyright © 1996 Ian Jackson
 # Copyright © 1996 Ian Jackson
 # Copyright © 2000 Wichert Akkerman
 # Copyright © 2000 Wichert Akkerman
 # Copyright © 2006 Frank Lichtenheld
 # Copyright © 2006 Frank Lichtenheld
-# Copyright © 2006-2010,2012 Guillem Jover <guillem@debian.org>
+# Copyright © 2006-2010,2012-2013 Guillem Jover <guillem@debian.org>
 # Copyright © 2007 Raphaël Hertzog
 # Copyright © 2007 Raphaël Hertzog
 #
 #
 # This program is free software; you can redistribute it and/or modify
 # This program is free software; you can redistribute it and/or modify
@@ -93,6 +93,8 @@ foreach (@ARGV) {
 	push @pkg_dir_to_search, $1;
 	push @pkg_dir_to_search, $1;
     } elsif (m/^-O$/) {
     } elsif (m/^-O$/) {
 	$stdout = 1;
 	$stdout = 1;
+    } elsif (m/^-O(.+)$/) {
+	$varlistfile = $1;
     } elsif (m/^-(\?|-help)$/) {
     } elsif (m/^-(\?|-help)$/) {
 	usage(); exit(0);
 	usage(); exit(0);
     } elsif (m/^--version$/) {
     } elsif (m/^--version$/) {
@@ -564,7 +566,7 @@ sub usage {
 "Options:
 "Options:
   -l<library-dir>          add directory to private shared library search list.
   -l<library-dir>          add directory to private shared library search list.
   -p<varname-prefix>       set <varname-prefix>:* instead of shlibs:*.
   -p<varname-prefix>       set <varname-prefix>:* instead of shlibs:*.
-  -O                       print variable settings to stdout.
+  -O[<file>]               write variable settings to stdout (or <file>).
   -L<local-shlibs-file>    shlibs override file, not debian/shlibs.local.
   -L<local-shlibs-file>    shlibs override file, not debian/shlibs.local.
   -T<substvars-file>       update variables here, not debian/substvars.
   -T<substvars-file>       update variables here, not debian/substvars.
   -t<type>                 set package type (default is deb).
   -t<type>                 set package type (default is deb).