Просмотр исходного кода

Dpkg: Include information about supported compression formats

Currently this is only used by dpkg-source, but other scripts
like dpkg-genchanges will need to use this information, too.
Frank Lichtenheld лет назад: 18
Родитель
Сommit
8b282a3e34
3 измененных файлов с 19 добавлено и 9 удалено
  1. 6 0
      ChangeLog
  2. 9 0
      scripts/Dpkg.pm
  3. 4 9
      scripts/dpkg-source.pl

+ 6 - 0
ChangeLog

@@ -1,5 +1,11 @@
 2007-12-04  Frank Lichtenheld  <djpig@debian.org>
 2007-12-04  Frank Lichtenheld  <djpig@debian.org>
 
 
+	* scripts/dpkg-source.pl: Move definition
+	of @comp_supported, %comp_supported, %comp_ext,
+	$comp_regex to...
+	* scripts/Dpkg.pm: ...here. Make them exportable
+	via the :compression tag.
+
 	* scripts/Dpkg/ErrorHandling.pm (usageerr):
 	* scripts/Dpkg/ErrorHandling.pm (usageerr):
 	Support format strings like all the other
 	Support format strings like all the other
 	error reporting functions.
 	error reporting functions.

+ 9 - 0
scripts/Dpkg.pm

@@ -5,6 +5,9 @@ use warnings;
 
 
 use base qw(Exporter);
 use base qw(Exporter);
 our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
 our @EXPORT = qw($version $progname $admindir $dpkglibdir $pkgdatadir);
+our %EXPORT_TAGS = ( 'compression' =>
+		     [ qw(@comp_supported %comp_supported %comp_ext $comp_regex) ] );
+our @EXPORT_OK = @{$EXPORT_TAGS{compression}};
 
 
 our ($progname) = $0 =~ m#(?:.*/)?([^/]*)#;
 our ($progname) = $0 =~ m#(?:.*/)?([^/]*)#;
 
 
@@ -14,4 +17,10 @@ our $admindir = "/var/lib/dpkg";
 our $dpkglibdir = ".";
 our $dpkglibdir = ".";
 our $pkgdatadir = "..";
 our $pkgdatadir = "..";
 
 
+# Compression
+our @comp_supported = qw(gzip bzip2 lzma);
+our %comp_supported = map { $_ => 1 } @comp_supported;
+our %comp_ext = ( gzip => 'gz', bzip2 => 'bz2', lzma => 'lzma' );
+our $comp_regex = '(?:gz|bz2|lzma)';
+
 1;
 1;

+ 4 - 9
scripts/dpkg-source.pl

@@ -3,7 +3,7 @@
 use strict;
 use strict;
 use warnings;
 use warnings;
 
 
-use Dpkg;
+use Dpkg qw(:DEFAULT :compression);
 use Dpkg::Gettext;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning warnerror error failure unknown
 use Dpkg::ErrorHandling qw(warning warnerror error failure unknown
                            internerr syserr subprocerr usageerr
                            internerr syserr subprocerr usageerr
@@ -39,6 +39,9 @@ my $diff_ignore_default_regexp = '
 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
 ';
 ';
+# Take out comments and newlines
+$diff_ignore_default_regexp =~ s/^#.*$//mg;
+$diff_ignore_default_regexp =~ s/\n//sg;
 
 
 no warnings 'qw';
 no warnings 'qw';
 my @tar_ignore_default_pattern = qw(
 my @tar_ignore_default_pattern = qw(
@@ -71,10 +74,6 @@ _darcs
 {arch}
 {arch}
 );
 );
 
 
-# Take out comments and newlines
-$diff_ignore_default_regexp =~ s/^#.*$//mg;
-$diff_ignore_default_regexp =~ s/\n//sg;
-
 my $sourcestyle = 'X';
 my $sourcestyle = 'X';
 my $min_dscformat = 1;
 my $min_dscformat = 1;
 my $max_dscformat = 2;
 my $max_dscformat = 2;
@@ -83,10 +82,6 @@ my $def_dscformat = "1.0"; # default format for -b
 my $expectprefix;
 my $expectprefix;
 
 
 # Compression
 # 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 $compression = 'gzip';
 my $comp_level = '9';
 my $comp_level = '9';
 my $comp_ext = $comp_ext{$compression};
 my $comp_ext = $comp_ext{$compression};