]> git.donarmstrong.com Git - wannabuild.git/blobdiff - lib/WB/QD.pm
Newer versions of Dpkg::Version export version_compare instead of vercmp.
[wannabuild.git] / lib / WB / QD.pm
index 25d2fb0234e3f7e0db684ed6dee4b8e81619614c..48ae97902b84e661ff9631f39b171e83af94afbd 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;