Bläddra i källkod

dpkg-source: Some cleanup on the -Z feature

Use the same semantics as dpkg-deb -Z (i.e. specify
program to use, not the extension).
Update the man page to be less V1 specific.
Frank Lichtenheld 19 år sedan
förälder
incheckning
20fbbf435e
4 ändrade filer med 28 tillägg och 17 borttagningar
  1. 1 1
      ChangeLog
  2. 5 1
      man/ChangeLog
  3. 8 6
      man/dpkg-source.1
  4. 14 9
      scripts/dpkg-source.pl

+ 1 - 1
ChangeLog

@@ -12,7 +12,7 @@
 	wig&pen (aka Format: 2.0) on build:
 	Use .orig.tar.(bz2|lzma) if they are available
 	and no .gz can be found. Also let the user specify
-	via -Z(gz|bz2|lzma) how files that need to be
+	via -Z(gzip|bzip2|lzma) how files that need to be
 	generated should be compressed. -z([1-9]|best|fast)
 	can be used to specify the compression level
 	to use.

+ 5 - 1
man/ChangeLog

@@ -1,5 +1,9 @@
 2007-10-09  Frank Lichtenheld  <djpig@debian.org>
-	
+
+	* dpkg-source.1: Change the rest of the
+	man page to not contain any hardcoded
+	.gz references.
+
 	* dpkg-buildpackage.1: Document all
 	options only passed to dpkg-source.
 	-s[nsAkurKUR], -z, and -Z were missing.

+ 8 - 6
man/dpkg-source.1

@@ -51,7 +51,9 @@ the empty string if the package is a Debian-specific one and so has no
 Debianisation diffs. If no second argument is supplied then
 .B dpkg\-source
 will look for the original source tarfile
-.IB package _ upstream-version .orig.tar.gz
+.IB package _ upstream-version .orig.tar. extension
+(where \fIextension\fP is one of
+.BR gz ", " bz2 ", and " lzma )
 or the original source directory
 .IB directory .orig
 depending on the \fB\-sX\fP arguments.
@@ -110,8 +112,8 @@ This option negates a previously set
 Specify the compression to use for created files (tarballs and diffs).
 Note that this option will not cause existing tarballs to be recompressed,
 it only affects new files. Supported values are:
-.IR gz ", " bz2 ", and " lzma .
-\fIgz\fP is the default.
+.IR gzip ", " bzip2 ", and " lzma .
+\fIgzip\fP is the default.
 .TP
 .BR \-z \fIlevel\fP
 Compression level to use. As with \fB\-Z\fP it only affects newly created
@@ -130,7 +132,7 @@ build output directories. There can only be one active regexp, of multiple
 
 
 This is very helpful in cutting out extraneous files that get included
-in the .diff.gz, e.g. if you maintain your source in a revision control
+in the diff, e.g. if you maintain your source in a revision control
 system and want to use a checkout to build a source package without
 including the additional files and directories that it will usually
 contain (e.g. CVS/, .cvsignore, .svn/). The default regexp is already
@@ -143,7 +145,7 @@ the neccessary anchors (e.g. '(^|/)', '($|/)') yourself.
 If this option is specified, the pattern will be passed to
 .BR tar (1)'s
 \-\-exclude
-option when it is called to generate a .orig.tar.gz or .tar.gz file. For
+option when it is called to generate a .orig.tar or .tar file. For
 example, \-ICVS will make tar skip over CVS directories when generating
 a .tar.gz file. The option may be repeated multiple times to list multiple
 patterns to exclude.
@@ -178,7 +180,7 @@ should be used instead.
 .TP
 .BR \-sk
 Specifies to expect the original source as a tarfile, by default
-.IB package _ upstream-version .orig.tar.gz\fR.
+.IB package _ upstream-version .orig.tar. extension \fR.
 It will leave this original source in place as a tarfile, or copy it
 to the current directory if it isn't already there.
 .TP

+ 14 - 9
scripts/dpkg-source.pl

@@ -75,11 +75,15 @@ my $max_dscformat = 2;
 my $def_dscformat = "1.0"; # default format for -b
 
 my $expectprefix;
-my $compression = 'gz';
-my $comp_level = '9';
-my @comp_supported = qw(gz bz2 lzma);
+
+# Compression
+my @comp_supported = qw(gzip bzip2 lzma);
 my %comp_supported = map { $_ => 1 } @comp_supported;
+my %comp_ext = ( gzip => 'gz', bzip2 => 'bz2', lzma => 'lzma' );
 my $comp_regex = '(?:gz|bz2|lzma)';
+my $compression = 'gzip';
+my $comp_level = '9';
+my $comp_ext = $comp_ext{$compression};
 
 # Packages
 my %remove;
@@ -176,7 +180,7 @@ Build options:
   -ss                      trust packed & unpacked orig src are same.
   -sn                      there is no diff, do main tarfile only.
   -sA,-sK,-sP,-sU,-sR      like -sa,-sk,-sp,-su,-sr but may overwrite.
-  -Z<compression>          select compression to use (defaults to 'gz',
+  -Z<compression>          select compression to use (defaults to 'gzip',
                              supported are: %s).
   -z<level>                compression level to use (defaults to '9',
                              supported are: '1'-'9', 'best', 'fast')
@@ -213,6 +217,7 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
         &setopmode('extract');
     } elsif (m/^-Z/) {
 	$compression = $POSTMATCH;
+	$comp_ext = $comp_ext{$compression};
 	usageerr(sprintf(_g("%s is not a supported compression"), $compression))
 	    unless $comp_supported{$compression};
     } elsif (m/^-z/) {
@@ -287,7 +292,7 @@ if ($opmode eq 'build') {
     
     parsechangelog($changelogfile, $changelogformat);
     parsecontrolfile($controlfile);
-    $f{"Format"}= $compression eq 'gz' ? $def_dscformat : '2.0';
+    $f{"Format"}= $compression eq 'gzip' ? $def_dscformat : '2.0';
     &init_substvars;
 
     my @sourcearch;
@@ -427,7 +432,7 @@ if ($opmode eq 'build') {
                        " but source handling style -s%s wants something"), $sourcestyle));
         }
     } elsif ($sourcestyle =~ m/[aA]/) {
-	my @origtargz = map { "$basename.orig.tar.$_" } ($compression, @comp_supported);
+	my @origtargz = map { "$basename.orig.tar.$comp_ext{$_}" } ($compression, @comp_supported);
 	foreach my $origtar (@origtargz) {
 	    if (stat($origtar)) {
 		-f _ || &error(sprintf(_g("packed orig `%s' exists but is not a plain file"), $origtar));
@@ -474,14 +479,14 @@ if ($opmode eq 'build') {
 	                       $origdirname, "$basedirname.orig"));
         $tardirbase= $origdirbase; $tardirname= $origdirname;
 
-	$tarname= $origtargz || "$basename.orig.tar.$compression";
+	$tarname= $origtargz || "$basename.orig.tar.$comp_ext";
 	$tarname =~ /$basename.orig.tar.($comp_regex)/ ||
 	    warning(sprintf(_g(".orig.tar name %s is not <package>_<upstreamversion>" .
 			       ".orig.tar (wanted %s)"), $tarname, "$basename.orig.tar.$comp_regex"));
 	if (($1 ne 'gz') && ($f{'Format'} < 2)) { $f{'Format'} = '2.0' };
     } else {
 	$tardirbase= $dirbase; $tardirname= $dirname;
-	$tarname= "$basenamerev.tar.$compression";
+	$tarname= "$basenamerev.tar.$comp_ext";
     }
 
     if ($sourcestyle =~ m/[nurUR]/) {
@@ -559,7 +564,7 @@ if ($opmode eq 'build') {
         
     if ($sourcestyle =~ m/[kpursKPUR]/) {
 
-	my $diffname = "$basenamerev.diff.$compression";
+	my $diffname = "$basenamerev.diff.$comp_ext";
         printf(_g("%s: building %s in %s")."\n",
                $progname, $sourcepackage, $diffname)
             || &syserr(_g("write building diff message"));