[Debian-l10n-commits] r2057 - in /dl10n/trunk: Changelog dl10n-check lib/Debian/Pkg/DebSrc.pm

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Tue Dec 29 09:06:23 UTC 2009


Author: nekral-guest
Date: Tue Dec 29 09:06:22 2009
New Revision: 2057

URL: http://svn.debian.org/wsvn/?sc=1&rev=2057
Log:
	* lib/Debian/Pkg/DebSrc.pm: Hack to support v3 source packages.
	* dl10n-check: In the v3 source packages, the debian archive is
	not rooted to /.

Modified:
    dl10n/trunk/Changelog
    dl10n/trunk/dl10n-check
    dl10n/trunk/lib/Debian/Pkg/DebSrc.pm

Modified: dl10n/trunk/Changelog
URL: http://svn.debian.org/wsvn/dl10n/trunk/Changelog?rev=2057&op=diff
==============================================================================
--- dl10n/trunk/Changelog (original)
+++ dl10n/trunk/Changelog Tue Dec 29 09:06:22 2009
@@ -1,3 +1,9 @@
+2009-12-29  Nicolas François  <nicolas.francois at centraliens.net>
+
+	* lib/Debian/Pkg/DebSrc.pm: Hack to support v3 source packages.
+	* dl10n-check: In the v3 source packages, the debian archive is
+	not rooted to /.
+
 2009-12-29  Nicolas François  <nicolas.francois at centraliens.net>
 
 	* lib/Debian/Pkg/Tar.pm: Fixed typo (unknozn).

Modified: dl10n/trunk/dl10n-check
URL: http://svn.debian.org/wsvn/dl10n/trunk/dl10n-check?rev=2057&op=diff
==============================================================================
--- dl10n/trunk/dl10n-check (original)
+++ dl10n/trunk/dl10n-check Tue Dec 29 09:06:22 2009
@@ -491,7 +491,7 @@
         unless ($deb->file_exists($control)) {
                 #    The debian/ directory may be a link, search for
                 #    debian/control elsewhere
-                my @list = $deb->file_matches('/debian/control$');
+                my @list = $deb->file_matches('(^|/)debian/control$');
                 if (@list) {
                         $control = $list[0];
                 } else {

Modified: dl10n/trunk/lib/Debian/Pkg/DebSrc.pm
URL: http://svn.debian.org/wsvn/dl10n/trunk/lib/Debian/Pkg/DebSrc.pm?rev=2057&op=diff
==============================================================================
--- dl10n/trunk/lib/Debian/Pkg/DebSrc.pm (original)
+++ dl10n/trunk/lib/Debian/Pkg/DebSrc.pm Tue Dec 29 09:06:22 2009
@@ -79,6 +79,7 @@
         $dir =~ s|/+[^/]*$||;
 
         my $origtargz = '';
+        my $v3targz = '';
         my $diffgz = '';
         open(DSC, "< ".$file) or return undef;
         while (<DSC>) {
@@ -87,7 +88,13 @@
         while (<DSC>) {
                 chomp;
                 last unless s/^ \S* \S* //;
-                if (m/\.tar\.gz$/) {
+                if (m/\.debian.tar\.(gz|bz2)$/) {
+                        $v3targz = $dir . '/' . $_;
+                        unless (-f $v3targz) {
+                                warn "$v3targz: No such file\n";
+                                return undef;
+                        }
+                } elsif (m/\.tar\.(gz|bz2)$/) {
                         $origtargz = $dir . '/' . $_;
                         unless (-f $origtargz) {
                                 warn "$origtargz: No such file\n";
@@ -109,6 +116,13 @@
         my $self = $class->SUPER::new("$origtargz", @_);
         bless ($self, $class);
 
+        #   Apply the v3 tarball if found
+        if ($v3targz) {
+                $self->{v3} = Debian::Pkg::Tar->new("$v3targz", @_);
+                $self->{v3}->parse();
+                $self->{v3}->_prepend_dir($self->{v3}->{dir});
+        }
+
         #   Apply patch if found
         my %patch_opts = ();
         if ($#_ >= 0) {
@@ -152,6 +166,57 @@
         return (defined($self->{patch}) ? $self->{patch}->{name} : '');
 }
 
+=item file_matches
+
+Check files matching in origtargz and v3targz
+
+=cut
+
+sub file_matches {
+        my $self = shift;
+        my $expr = shift;
+        my @found = ();
+
+        @found = $self->SUPER::file_matches($expr);
+
+        push @found, $self->{v3}->file_matches($expr)
+                if $self->{v3};
+
+        return @found;
+}
+
+=item file_exists
+
+Check if a given file exists in origtargz or v3targz
+
+=cut
+
+sub file_exists {
+        my $self = shift;
+        my $file = shift;
+
+        return    $self->SUPER::file_exists($file)
+               or $self->{v3}->file_exists($file);
+}
+
+=item file_content
+
+Get the content of a file from origtargz or v3targz
+
+=cut
+
+sub file_content {
+        my $self = shift;
+        my $file = shift;
+        my $length = shift || -1;
+
+        if ($self->SUPER::file_exists($file)) {
+                return $self->SUPER::file_content($file, $length);
+        }
+
+        return $self->{v3}->file_content($file, $length);
+}
+
 =back
 
 =head1 LIMITATIONS




More information about the Debian-l10n-commits mailing list