]> err.no Git - dpkg/commitdiff
dpkg-source: Some cleanup on the -Z feature
authorFrank Lichtenheld <djpig@debian.org>
Tue, 9 Oct 2007 12:45:18 +0000 (14:45 +0200)
committerFrank Lichtenheld <djpig@debian.org>
Tue, 9 Oct 2007 22:11:14 +0000 (00:11 +0200)
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.

ChangeLog
man/ChangeLog
man/dpkg-source.1
scripts/dpkg-source.pl

index ae563d7fd87e1fafe11a142a4abe9649755eaddb..59e378e29437b452f2ef24bff8e73e340013d61a 100644 (file)
--- a/ChangeLog
+++ b/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.
index 05c4e4e1255dc99d1da81bfb155552b80956ecb8..f876f15b1d2cbc9d491d6620ad75e7624810ef44 100644 (file)
@@ -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.
index cb6699cfdd24826e3ead2cf1a0da3e8801487e5c..b526417a33bff47595f82eb6d713591fcd0f8952 100644 (file)
@@ -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
index b12d5d36aaa011a1d1699fcc417cd0175d5f34d2..1a5a44a48ac17054a9f7aa159fa7e2539c017de2 100755 (executable)
@@ -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"));