]> git.donarmstrong.com Git - wannabuild.git/blobdiff - lib/WB/QD.pm
mark overwritten by arch-all-packages as auto-not-for-us
[wannabuild.git] / lib / WB / QD.pm
index 25d2fb0234e3f7e0db684ed6dee4b8e81619614c..01eea54354c1cb19862ff1543716447981462e3a 100644 (file)
@@ -2,7 +2,12 @@ package WB::QD;
 
 use strict;
 use IO::Uncompress::AnyInflate qw(anyinflate);
-use Dpkg::Version qw(vercmp);
+use Dpkg::Version (); # import nothing
+if ( defined $Dpkg::Version::VERSION ) {
+    *vercmp = \&Dpkg::Version::version_compare;
+} else {
+    *vercmp = \&Dpkg::Version::vercmp;
+}
 use Dpkg::Arch qw(debarch_is);
 use Data::Dumper;
 
@@ -15,15 +20,15 @@ sub readsourcebins {
 
     my $pas = {};
     local($/) = "\n";
-    open(PAS, '<', $pasfile);
-    while(<PAS>) {
+    open(my $pasf, '<', $pasfile);
+    while(<$pasf>) {
         chomp;
         s,\s*#.*,,;
         next unless $_;
         my ($p, $c) = split(/:\s*/);
         $pas->{$p} = { arch => [ split(/\s+/, $c) ], mode => substr($c, 0, 1) ne '!' };
     }
-    close PAS;
+    close $pasf;
 
     my $srcs = {};
     local($/) = ""; # read in paragraph mode
@@ -52,8 +57,9 @@ sub readsourcebins {
             if ($srcs->{$p->{'name'}}) {
                 next if (vercmp($srcs->{$p->{'name'}}->{'version'}, $p->{'version'}) > 0);
             }
-            my @a = split(/,? /, $p->{'binary'}) if $p->{'binary'};
-            $p->{'binary'} = \@a;
+            if ($p->{'binary'}) {
+                $p->{'binary'} = [ split(/,? /, $p->{'binary'}) ];
+            }
             $srcs->{$p->{'name'}} = $p;
         }
         close $S;
@@ -71,6 +77,8 @@ sub readsourcebins {
             /^Source:\s*(\S+)$/mi and $p->{'source'} = $1;
             /^Source:\s*(\S+)\s+\((\S+)\)$/mi and $p->{'source'} = $1 and $p->{'version'} = $2;
 
+            # consider packages as non-existant if it's all but outdated
+            next if $p->{'arch'} eq 'all' && $srcs->{$p->{'source'}} && $srcs->{$p->{'source'}}->{'version'} && vercmp($srcs->{$p->{'source'}}->{'version'}, $p->{'version'}) > 0;
             next unless $p->{'arch'} eq 'all' || $p->{'arch'} eq ${arch};
             $binary->{$p->{'binary'}} = { 'version' => $p->{'version'}, 'arch' => $p->{'arch'}} unless $binary->{$p->{'binary'}} and vercmp($binary->{$p->{'binary'}}->{'version'}, $p->{'version'}) < 0;
 
@@ -113,11 +121,19 @@ sub readsourcebins {
             next;
         }
         for my $bin (@{$srcs->{$k}->{'binary'}}) {
+            $srcs->{$k}->{'pas'} = 1 if pasignore($pas->{$bin}, $arch);
             next if pasignore($pas->{$bin}, $arch);
             next if $binary->{$bin} and $binary->{$bin}->{'arch'} eq 'all';
             next SRCS;
         }
-        $srcs->{$k}->{'status'} = 'not-for-us';
+        if ($srcs->{$k}->{'pas'}) {
+            $srcs->{$k}->{'status'} = 'not-for-us';
+            $srcs->{$k}->{'notes'} = 'packages-arch-specific';
+        } else {
+            $srcs->{$k}->{'status'} = 'auto-not-for-us';
+            $srcs->{$k}->{'notes'} = 'overwritten-by-arch-all';
+        }
+        delete $srcs->{$k}->{'pas'};
     }
     $srcs->{'_binary'} = $binary;
     local($/) = "\n";