[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.1-158-ge3d3313



The following commit has been merged in the master branch:
commit e3d3313ae4ed2c5e84031d74e5ce8aa2f47f2303
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Jul 29 00:20:34 2011 +0200

    Made two tests resistant to umask variance on clone system
    
    This fixes some problems for building Lintian in Ubuntu, where the
    umask is slightly different.  There are still some problems for
    some more "interesting" umask settings.

diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index 9dcf59f..5f669eb 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -24,6 +24,7 @@ use warnings;
 
 use Lintian::Output;
 use Lintian::Tag::Info;
+use Lintian::Tag::Override;
 use Util qw(fail);
 
 use base 'Exporter';
@@ -193,36 +194,20 @@ called first or if an attempt is made to issue an unknown tag.
 sub _check_overrides {
     my ($self, $tag, $extra) = @_;
     my $overrides = $self->{info}{$self->{current}}{overrides}{$tag};
+    my $stats = $self->{info}{$self->{current}}{'overrides-stats'}{$tag};
     return unless $overrides;
     if (exists $overrides->{''}) {
-        $overrides->{''}++;
+        $stats->{''}++;
         return $tag;
     } elsif ($extra ne '' and exists $overrides->{$extra}) {
-        $overrides->{$extra}++;
+        $stats->{$extra}++;
         return "$tag $extra";
     } elsif ($extra ne '') {
         for (sort keys %$overrides) {
-            my $pattern = $_;
-            my $end = '';
-            my $pat = '';
-            next unless $pattern =~ m/\Q*\E/o;
-            # Split does not help us if $text ends with *
-            # so we deal with that now
-            if ($pattern =~ s/\Q*\E+\z//o){
-                $end = '.*';
-            }
-            # Are there any * left (after the above)?
-            if ($pattern =~ m/\Q*\E/o) {
-                # this works even if $text starts with a *, since
-                # that is split as '', <text>
-                my @pargs = split(m/\Q*\E++/o, $pattern);
-                $pat = join('.*', map { quotemeta($_) } @pargs);
-            } else {
-                $pat = $pattern;
-            }
-            if ($extra =~ m/^$pat$end\z/) {
-                $overrides->{$_}++;
-                return "$tag $_";
+            my $override = $overrides->{$_};
+            if ($override->is_pattern && $override->overrides($extra)){
+                $stats->{$_}++;
+                return $tag . ' ' . $override->extra;
             }
         }
     }
@@ -235,7 +220,7 @@ sub _record_stats {
     my ($self, $tag, $info, $overridden) = @_;
     my $stats = $self->{statistics}{$self->{current}};
     if ($overridden) {
-        $stats = $self->{statistics}{$self->{current}}{overrides};
+        $stats = $self->{statistics}{$self->{current}}{'overrides-stats'};
     }
     $stats->{tags}{$tag}++;
     $stats->{severity}{$info->severity}++;
@@ -501,12 +486,13 @@ sub file_start {
         die "duplicate of file $file added to Lintian::Tags object";
     }
     $self->{info}{$file} = {
-        file      => $file,
-        package   => $pkg,
-        version   => $version,
-        arch      => $arch,
-        type      => $type,
-        overrides => {},
+        file              => $file,
+        package           => $pkg,
+        version           => $version,
+        arch              => $arch,
+        type              => $type,
+        overrides         => {},
+        'overrides-stats' => {},
     };
     $self->{statistics}{$file} = {
         types     => {},
@@ -562,6 +548,7 @@ sub file_overrides {
             # Valid - so far at least
             my ($archlist, $tagdata) = ($1, $2);
             my ($tag, $extra) = split(m/ /o, $tagdata, 2);
+            my $tagover;
             if ($archlist) {
                 # parse and figure
                 my (@archs) = split(m/\s++/o, $archlist);
@@ -584,7 +571,9 @@ sub file_overrides {
             }
             next if $ignored->{$tag};
             $extra = '' unless defined $extra;
-            $info->{overrides}{$tag}{$extra} = 0;
+            $tagover = Lintian::Tag::Override->new($tag, { 'extra' => $extra } );
+            $info->{'overrides-stats'}{$tag}{$extra} = 0;
+            $info->{overrides}{$tag}{$extra} = $tagover;
         } else {
             tag('malformed-override', $_);
         }
@@ -634,7 +623,7 @@ tag some-tag, regardless of what extra data was associated with it.
 sub overrides {
     my ($self, $file) = @_;
     if ($self->{info}{$file}) {
-        return $self->{info}{$file}{overrides};
+        return $self->{info}{$file}{'overrides-stats'};
     } else {
         return;
     }
diff --git a/t/debs/control-files-weird-files/Makefile b/t/debs/control-files-weird-files/Makefile
index 29445d8..c10ee59 100644
--- a/t/debs/control-files-weird-files/Makefile
+++ b/t/debs/control-files-weird-files/Makefile
@@ -9,11 +9,12 @@ all:
 	chown 0:0 control
 	chmod 644 control
 	md5sum usr/share/doc/$(name)/* > md5sums
+	touch triggers
 	tar -czf control.tar.gz control md5sums \
 	    special-file isinstallable triggers
 	ar rc $(name).deb \
 	    debian-binary control.tar.gz data.tar.gz
 
 clean:
-	rm -f *.tar.gz *.tar.lzma *.deb md5sums debian-binary
+	rm -f *.tar.gz *.tar.lzma *.deb md5sums debian-binary triggers
 	rm -rf usr
diff --git a/t/debs/control-files-weird-files/triggers b/t/debs/control-files-weird-files/triggers
deleted file mode 100644
index e69de29..0000000
diff --git a/t/tests/files-bad-perm-owner/debian/debian/rules b/t/tests/files-bad-perm-owner/debian/debian/rules
index 78aa93a..b352395 100644
--- a/t/tests/files-bad-perm-owner/debian/debian/rules
+++ b/t/tests/files-bad-perm-owner/debian/debian/rules
@@ -14,15 +14,18 @@ override_dh_auto_build:
 	pod2man --section 1 script > script.1
 
 override_dh_fixperms:
+	dh_fixperms
 	# game
 	chown 'root:games' debian/$(GPKG)/usr/games/script
 	# binary
-	find debian/$(PKG)/ -name 'README' -exec chown "daemon:daemon" {} \;
-	find debian/$(PKG)/ -name 'read-only' -exec chmod a=r {} \;
-	chmod +x,u+s  debian/$(PKG)/usr/bin/script-uid
-	chmod +x,g+s  debian/$(PKG)/usr/bin/script-gid
-	chmod +x,ug+s debian/$(PKG)/usr/bin/script-ugid
-	chmod +x,g+w  debian/$(PKG)/usr/bin/script-wexec
-	chmod u+x,u+s debian/$(PKG)/usr/bin/script-wuid
-	chmod +x,o-r  debian/$(PKG)/usr/bin/script-ro
-	chmod go-x    debian/$(PKG)/usr/share/doc/$(PKG)
+	chown "daemon:daemon" debian/$(PKG)/usr/share/doc/$(PKG)/README
+	chmod 0444 debian/$(PKG)/usr/share/doc/$(PKG)/read-only
+	chmod 4755 debian/$(PKG)/usr/bin/script-uid
+	chmod 2755 debian/$(PKG)/usr/bin/script-gid
+	chmod 6755 debian/$(PKG)/usr/bin/script-ugid
+	chmod 0775 debian/$(PKG)/usr/bin/script-wexec
+	chmod 4744 debian/$(PKG)/usr/bin/script-wuid
+	chmod 0751 debian/$(PKG)/usr/bin/script-ro
+	chmod 0744 debian/$(PKG)/usr/share/doc/$(PKG)
+	chmod 0755 debian/$(PKG)/etc/cron.d/script
+	chmod 0755 debian/$(PKG)/etc/emacs.d/script

-- 
Debian package checker


Reply to: