[Reproducible-commits] [dpkg] 76/90: scripts/t: Generalize get_arch_vars() into cmd_get_vars()

Jérémy Bobbio lunar at moszumanska.debian.org
Sat Aug 29 18:26:19 UTC 2015


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

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 84790a78dab74e4813cbdfdcaae1ca3ce13ee99e
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Aug 6 01:58:41 2015 +0200

    scripts/t: Generalize get_arch_vars() into cmd_get_vars()
---
 scripts/t/mk.t | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/scripts/t/mk.t b/scripts/t/mk.t
index 5476683..eee46c1 100644
--- a/scripts/t/mk.t
+++ b/scripts/t/mk.t
@@ -41,25 +41,24 @@ sub test_makefile {
     ok($? == 0, "makefile $makefile computes all values correctly");
 }
 
-sub get_arch_vars {
-    my $prefix = shift // '';
-    my %arch;
+sub cmd_get_vars {
+    my (@cmd) = @_;
+    my %var;
 
-    open my $arch_env, '-|', "$srcdir/dpkg-architecture.pl", '-f'
-        or subprocerr('dpkg-architecture');
-    while (<$arch_env>) {
+    open my $cmd_fh, '-|', @cmd or subprocerr($cmd[0]);
+    while (<$cmd_fh>) {
         chomp;
         my ($key, $value) = split /=/, $_, 2;
-        $arch{$key} = $value;
+        $var{$key} = $value;
     }
-    close $arch_env or subprocerr('dpkg-architecture');
+    close $cmd_fh or subprocerr($cmd[0]);
 
-    return %arch;
+    return %var;
 }
 
 # Test makefiles.
 
-my %arch = get_arch_vars();
+my %arch = cmd_get_vars("$srcdir/dpkg-architecture.pl", '-f');
 
 delete $ENV{$_} foreach keys %arch;
 $ENV{"TEST_$_"} = $arch{$_} foreach keys %arch;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list