[dh-r] 07/43: Use a hash of all packages instead

Gordon Ball chronitis-guest at moszumanska.debian.org
Thu Sep 15 13:45:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

chronitis-guest pushed a commit to branch master
in repository dh-r.

commit 343cc99d31798d47315d55e4809f5fe7175ad954
Author: Gordon Ball <gordon at chronitis.net>
Date:   Thu Sep 1 17:22:23 2016 +0200

    Use a hash of all packages instead
---
 dh/R.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dh/R.pm b/dh/R.pm
index cbd9c01..114ac81 100644
--- a/dh/R.pm
+++ b/dh/R.pm
@@ -36,6 +36,9 @@ sub parse_depends {
     my $field = shift;
     my @text = split(/,/, qx/grep-dctrl -s $field -n . DESCRIPTION/);
     my @deps;
+    my @aptavail = qx/grep-aptavail -P -s Package -n -e ^r-/;
+    my %apthash;
+    @apthash{@aptavail} = ();
     foreach my $dep (@text) {
         chomp $dep;
         # rely on the R version format being equivalent
@@ -49,10 +52,10 @@ sub parse_depends {
             next;
         }
 
-        if (system("sh", "-c", "dpkg-query -W r-cran-$pkg 2>/dev/null") == 0) {
+        if (exists $apthash{"r-cran-$pkg"}) {
             say "I: Using r-cran-$pkg for $field:$dep";
             push (@deps, "r-cran-$pkg $vers");
-        } elsif (system("sh", "-c", "dpkg-query -W r-bioc-$pkg 2>/dev/null") == 0) {
+        } elsif (exists $apthash{"r-bioc-$pkg"}) {
             say "I: Using r-bioc-$pkg for $field:$dep";
             push (@deps, "r-bioc-$pkg $vers");
         } else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/dh-r.git



More information about the debian-science-commits mailing list