[SCM] Debian package checker branch, master, updated. 2.5.6-40-g35bfafa
The following commit has been merged in the master branch:
commit 9cebb444e832eaf135b9f3cdafb14d091880fc8e
Author: Niels Thykier <niels@thykier.net>
Date: Mon Apr 2 14:41:33 2012 +0200
L::Collect: Remove extra level of quoting in index
This makes index more compatible with (example) file-info indices.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/collection/ar-info b/collection/ar-info
index 4cbd88b..0a0c864 100755
--- a/collection/ar-info
+++ b/collection/ar-info
@@ -42,12 +42,9 @@ open OUT, '>', "$dir/ar-info"
chdir ("$dir/unpacked")
or fail("cannot chdir to unpacked directory: $!");
-foreach my $origfile (@{ $info->sorted_index }) {
- next unless $origfile =~ m/\.a$/;
- next unless -f $origfile and not -l $origfile;
- my $file = $origfile;
- $file =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $file =~ s/\\\\/\\/g;
+foreach my $file (@{ $info->sorted_index }) {
+ next unless $file =~ m/\.a$/;
+ next unless -f $file and not -l $file;
my $opts = { pipe_out => FileHandle->new, err => '/dev/null' };
spawn($opts, [ 'ar', 't', $file ]);
diff --git a/collection/file-info b/collection/file-info
index dba694b..dd1c803 100755
--- a/collection/file-info
+++ b/collection/file-info
@@ -60,10 +60,7 @@ $opts{pipe_in}->blocking(1);
foreach my $file (@{ $info->sorted_index }) {
next unless $file; # ignore "root-dir" which has "no name" (post stripping).
- my $c = $file;
- $c =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $c =~ s/\\\\/\\/g;
- printf {$opts{pipe_in}} "%s\0", $c;
+ printf {$opts{pipe_in}} "%s\0", $file;
}
close $opts{pipe_in};
diff --git a/collection/java-info b/collection/java-info
index 0a6bb60..a713c70 100755
--- a/collection/java-info
+++ b/collection/java-info
@@ -40,12 +40,9 @@ open OUT, '>', "$dir/java-info"
chdir ("$dir/unpacked")
or fail "unable to chdir to unpacked: $!";
-foreach my $origfile (@{ $info->sorted_index }) {
- my $ftype = $info->index->{$origfile}->{type};
+foreach my $file (@{ $info->sorted_index }) {
+ my $ftype = $info->index->{$file}->{type};
next unless $ftype eq '-' or $ftype eq 'h';
- my $file = $origfile;
- $file =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $file =~ s/\\\\/\\/g;
if ($file =~ m#\S+\.jar$#i) {
my $has_manifest = 0;
diff --git a/collection/md5sums b/collection/md5sums
index dccb47c..b2f110f 100755
--- a/collection/md5sums
+++ b/collection/md5sums
@@ -47,11 +47,9 @@ spawn(\%opts, ['xargs', '-0r', 'md5sum'] );
$opts{pipe_in}->blocking(1);
foreach my $file (@{ $info->sorted_index }) {
+ next unless $file;
next unless $info->index->{$file}->{type} =~ m/^[-h]/;
- my $c = $file;
- $c =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $c =~ s/\\\\/\\/g;
- printf {$opts{pipe_in}} "%s\0", $c;
+ printf {$opts{pipe_in}} "%s\0", $file;
}
close $opts{pipe_in};
diff --git a/collection/scripts b/collection/scripts
index 06aa93b..12512bf 100755
--- a/collection/scripts
+++ b/collection/scripts
@@ -35,11 +35,8 @@ my $file;
my $magic;
my $scriptpath;
-foreach my $origfile (@{ $info->sorted_index }) {
- next unless $info->index->{$origfile}->{type} eq '-';
- my $file = $origfile;
- $file =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
- $file =~ s/\\\\/\\/g;
+foreach my $file (@{ $info->sorted_index }) {
+ next unless $info->index->{$file}->{type} eq '-';
# This used to call fail() instead of next. However, the check to
# see if all files in the index can be opened should be done elsewhere.
diff --git a/debian/changelog b/debian/changelog
index 9d1a838..3a8b9f3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -77,6 +77,8 @@ lintian (2.5.7) UNRELEASED; urgency=low
* lib/Lintian/Architecture.pm:
+ [NT] Lazily evaluate the data file.
+ * lib/Lintian/Collect/Package.pm:
+ + [NT] Remove an extra level of quoting in index.
* lib/Lintian/Data.pm:
+ [NT] Lazily load data files.
+ [NT] Allow pre-process sub to alter existing value for a key
diff --git a/lib/Lintian/Collect/Package.pm b/lib/Lintian/Collect/Package.pm
index 24b6777..7d46f41 100644
--- a/lib/Lintian/Collect/Package.pm
+++ b/lib/Lintian/Collect/Package.pm
@@ -105,6 +105,19 @@ sub _fetch_extracted_dir {
return $dir;
}
+# Strip an extra layer quoting in index file names and optionally
+# remove an initial "./" if any.
+#
+# sub _dequote_name Needs-Info <>
+sub _dequote_name {
+ my ($name, $slsd) = @_;
+ $slsd = 1 unless defined $slsd; # Remove initial ./ by default
+ $name =~ s,^\./,, if $slsd;
+ $name =~ s/(\G|[^\\](?:\\\\)*)\\(\d{3})/"$1" . chr(oct $2)/ge;
+ $name =~ s/\\\\/\\/;
+ return $name;
+}
+
# Backing method for index and others; this is not a part of the API.
# sub _fetch_index_data Needs-Info <>
sub _fetch_index_data {
@@ -145,18 +158,17 @@ sub _fetch_index_data {
$file{owner} = 'root' if $file{owner} eq '0';
$file{group} = 'root' if $file{group} eq '0';
- $name =~ s,^\./,,;
if ($name =~ s/ link to (.*)//) {
- my $target = $1;
- $target =~ s,^\./,,;
+ my $target = _dequote_name ($1);
$file{type} = 'h';
$file{link} = $target;
- push @{$rhlinks{$target}}, $name;
+ push @{$rhlinks{$target}}, _dequote_name ($name);
} elsif ($file{type} eq 'l') {
($name, $file{link}) = split ' -> ', $name, 2;
+ $file{link} = _dequote_name ($file{link}, 0);
}
- $file{name} = $name;
+ $file{name} = $name = _dequote_name ($name);
# count directory contents:
$dir_counts{$name} ||= 0 if $file{type} eq 'd';
diff --git a/testset/tags.filenames b/testset/tags.filenames
index 955494e..a49d258 100644
--- a/testset/tags.filenames
+++ b/testset/tags.filenames
@@ -87,7 +87,7 @@ W: filenames: extra-license-file usr/share/pixmaps/license.foo
W: filenames: extra-license-file usr/share/pixmaps/license.txt
W: filenames: file-in-unusual-dir files/ .tif
W: filenames: file-in-unusual-dir files/".tif
-W: filenames: file-in-unusual-dir files/'\\
+W: filenames: file-in-unusual-dir files/'\
W: filenames: file-in-unusual-dir files/.#Maelstrom Sound.1.1.1
W: filenames: file-in-unusual-dir files/.arch-inventory
W: filenames: file-in-unusual-dir files/.cvsignore
@@ -98,7 +98,7 @@ W: filenames: file-in-unusual-dir files/feedparser.py
W: filenames: file-in-unusual-dir files/svk-commitsEr9P.tmp
W: filenames: file-in-unusual-dir files/svn-commit.tmp
W: filenames: file-in-usr-lib-sgml usr/lib/sgml/package
-W: filenames: file-name-ends-in-whitespace files/'\\
+W: filenames: file-name-ends-in-whitespace files/'\
W: filenames: gz-file-not-gzip usr/share/filenames/prototype.js.gz
W: filenames: macos-ds-store-file-in-package usr/share/doc/filenames/.DS_Store
W: filenames: macos-resource-fork-file-in-package usr/share/doc/filenames/._NEWS.Debian
@@ -144,7 +144,7 @@ W: filenames: zero-byte-file-in-doc-directory usr/share/doc/filenames/news.debia
W: more-filename-games: binary-without-manpage usr/bin/another-test-game
W: more-filename-games: binary-without-manpage usr/games/yet-another-test-game
W: more-filename-games: package-section-games-but-has-usr-bin
-X: filenames: duplicate-files usr/share/doc/filenames/.DS_Store usr/share/doc/filenames/._NEWS.Debian usr/share/doc/filenames/Thumbs.db usr/share/doc/filenames/link-one
+X: filenames: duplicate-files usr/share/doc/filenames/.DS_Store usr/share/doc/filenames/._NEWS.Debian usr/share/doc/filenames/Thumbs.db usr/share/doc/filenames/bokm??l usr/share/doc/filenames/bokm?l usr/share/doc/filenames/link-one
X: filenames: package-contains-broken-symlink usr/lib/filenames/symlink1ok ../../share/symlink
X: filenames: package-contains-broken-symlink usr/lib/filenames/symlink1wrong ../../../etc/symlink
X: filenames: package-contains-broken-symlink usr/lib/filenames/symlink2ok etc/symlink
--
Debian package checker
Reply to: