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

[SCM] Debian package checker branch, master, updated. 2.5.11-127-gfdccd0f



The following commit has been merged in the master branch:
commit fdccd0fc5a85d65177095b5244681cfd11389a22
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Jan 29 11:21:07 2013 +0100

    lintian: Simplify _find_changes
    
    Always build the "entire" list of architectures instead of trying to
    exit early.
    
    Consider "dpkg --print-architecture" an alternative for the "BUILD"
    architecture rather than the "HOST" architecture.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/frontend/lintian b/frontend/lintian
index bd878f3..a083a46 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1497,10 +1497,10 @@ sub _find_changes {
     my $dch = Parse::DebianChangelog->init ( { infile => 'debian/changelog', quiet => 1 } );
     my $data = $dch->data;
     my $last = $data ? $data->[0] : undef;
-    my ($source, $version, $arch);
+    my ($source, $version);
     my $changes;
     my @archs;
-    my @dirs;
+    my @dirs = ('..', '../build-area', '/var/cache/pbuilder/result');
     if (not $last) {
         my @errors = $dch->get_parse_errors;
         if (@errors) {
@@ -1526,21 +1526,12 @@ sub _find_changes {
     # remove the epoch
     $version =~ s/^\d+://;
     if (exists $ENV{'DEB_BUILD_ARCH'}) {
-        my $barch = $ENV{'DEB_BUILD_ARCH'};
-        push @archs, $barch;
-        $changes = "../${source}_${version}_${barch}.changes";
-        return $changes if -f $changes;
-    }
-    if (exists $ENV{'DEB_HOST_ARCH'}) {
-        $arch = $ENV{'DEB_HOST_ARCH'};
+        push @archs, $ENV{'DEB_BUILD_ARCH'}
     } else {
-        chomp ( $arch = `dpkg --print-architecture` );
-    }
-    if ($arch ne ($ENV{'DEB_BUILD_ARCH'}//'')) {
-        push @archs, $arch;
-        $changes = "../${source}_${version}_${arch}.changes";
-        return $changes if -f $changes;
+        chomp ( my $arch = `dpkg --print-architecture 2>/dev/null` );
+        push @archs, $arch if $arch ne '';
     }
+    push @archs, $ENV{'DEB_HOST_ARCH'} if exists $ENV{'DEB_HOST_ARCH'};
     if (system ('dpkg', '--assert-multi-arch') == 0) {
         # Maybe cross-built for something dpkg knows about...
         open my $foreign, '-|', 'dpkg', '--print-foreign-architectures'
@@ -1549,38 +1540,23 @@ sub _find_changes {
             chomp $line;
             # Skip already attempted architectures (e.g. via DEB_BUILD_ARCH)
             next if grep { $_ eq $line } @archs;
-            $changes = "../${source}_${version}_${line}.changes";
-            if ( -f $changes ) {
-                # Consume the entire input, even if we don't need it.
-                1 for <$foreign>;
-                close $foreign;
-                return $changes;
-            }
             push @archs, $line;
         }
         close $foreign;
     }
-    foreach my $a (qw(multi all source)) {
-        $changes = "../${source}_${version}_${a}.changes";
-        return $changes if -f $changes;
-        push @archs, $a;
-    }
-    foreach my $dir ('../build-area', '/var/cache/pbuilder/result') {
-        next unless -d $dir;
-        foreach my $a (@archs) {
-            $changes = "$dir/${source}_${version}_${a}.changes";
+    push @archs, qw(multi all source);
+    foreach my $dir (@dirs) {
+        foreach my $arch (@archs) {
+            $changes = "$dir/${source}_${version}_${arch}.changes";
             return $changes if -f $changes;
         }
-        push @dirs, $dir;
     }
     print STDERR "Cannot find changes file for ${source}/${version}, tried:\n";
-    foreach my $a (@archs) {
-        print STDERR "  ../${source}_${version}_${a}.changes\n";
-    }
-    if (@dirs) {
-        print STDERR " Also tried the following dirs:\n";
-        print STDERR '  ' , join ("\n  ", @dirs), "\n";
+    foreach my $arch (@archs) {
+        print STDERR "  ${source}_${version}_${arch}.changes\n";
     }
+    print STDERR " in the following dirs:\n";
+    print STDERR '  ' , join ("\n  ", @dirs), "\n";
     exit 0;
 }
 
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index f676952..73675e6 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -727,14 +727,14 @@ using the following values as architectecture (in order):
 
 =over 4
 
-=item I<$DEB_BUILD_ARCH>
+=item I<$DEB_BUILD_ARCH> (or I<dpkg --print-architecture>)
 
-The environment variable DEB_BUILD_ARCH.
+The environment variable DEB_BUILD_ARCH (if not set, "dpkg
+--print-architecture" will be used instead)
 
-=item I<$DEB_HOST_ARCH> (or I<dpkg --print-architecture>)
+=item I<$DEB_HOST_ARCH>
 
-The environment variable DEB_HOST_ARCH (if not set, "dpkg
---print-architecture" will be used instead)
+The environment variable DEB_HOST_ARCH.
 
 =item I<dpkg --print-foreign-architectures>
 

-- 
Debian package checker


Reply to: