[dh-r] 14/43: Avoid repeatedly re-reading grep-aptavail

Gordon Ball chronitis-guest at moszumanska.debian.org
Thu Sep 15 13:45:32 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 f71313b63268847b9765222dbd16e44a0acc47e3
Author: Gordon Ball <gordon at chronitis.net>
Date:   Sun Sep 4 12:37:23 2016 +0200

    Avoid repeatedly re-reading grep-aptavail
---
 dh/R.pm | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/dh/R.pm b/dh/R.pm
index 660b982..ddcb946 100644
--- a/dh/R.pm
+++ b/dh/R.pm
@@ -34,15 +34,10 @@ sub parse_depends {
     # list of debian package dependencies
 
     my $field = shift;
+    my %apthash = %{shift()};
     my @text = split(/,\s*/, qx/grep-dctrl -s $field -n . DESCRIPTION/);
     my @deps;
 
-    # get all available r-* packages from which we can guess dependencies
-    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
@@ -164,12 +159,17 @@ sub install {
         }
     }
 
-    my $sourcepackage = $this->sourcepackage();
-    my $rdepends = join(",", parse_depends("Depends"));
-    my $rrecommends = join(",", parse_depends("Recommends"));
-    my $rsuggests = join(",", parse_depends("Suggests"));
-    my $rimports = join(",", parse_depends("Imports"));
+    # get all available r-* packages from which we can guess dependencies
+    my @aptavail = qx/grep-aptavail -P -s Package -n -e ^r-/;
+    my %apthash;
+    @apthash{@aptavail} = ();
+
+    my $rdepends = join(",", parse_depends("Depends", \%apthash));
+    my $rrecommends = join(",", parse_depends("Recommends", \%apthash));
+    my $rsuggests = join(",", parse_depends("Suggests", \%apthash));
+    my $rimports = join(",", parse_depends("Imports", \%apthash));
 
+    my $sourcepackage = $this->sourcepackage();
     open(my $svs, ">>", "debian/$sourcepackage.substvars");
     say $svs "R:Depends=r-base-core (>= $rbase_version), $rapi_version";
     say $svs "R:PkgDepends=$rdepends, $rimports";

-- 
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