[devscripts] 01/03: build-rdeps: Avoid using the shell in dose-ceve code

James McCoy jamessan at debian.org
Mon Mar 14 02:10:27 UTC 2016


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

jamessan pushed a commit to branch master
in repository devscripts.

commit bc228340c81c20f5b190ac9bfbcffc771a7419aa
Author: James McCoy <jamessan at debian.org>
Date:   Sun Mar 13 21:34:58 2016 -0400

    build-rdeps: Avoid using the shell in dose-ceve code
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 scripts/build-rdeps.pl | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/scripts/build-rdeps.pl b/scripts/build-rdeps.pl
index 89cfc39..7afb5f3 100755
--- a/scripts/build-rdeps.pl
+++ b/scripts/build-rdeps.pl
@@ -306,22 +306,25 @@ sub findreversebuilddeps {
 
 		(my $buildarch_file = $source_file) =~ s/_source_Sources$/_binary-${opt_buildarch}_Packages/;
 
-		my $ceve_cmd = "dose-ceve -T debsrc -r $package -G pkg"
-			. " --deb-native-arch=$opt_buildarch deb://$buildarch_file"
-			. " debsrc://$source_file";
+		my @ceve_cmd = ('dose-ceve', '-T', 'debsrc', '-r', $package, '-G', 'pkg',
+		    "--deb-native-arch=$opt_buildarch", "deb://$buildarch_file", "debsrc://$source_file");
 		if ($opt_buildarch ne $opt_hostarch) {
-			$ceve_cmd .= " --deb-host-arch=$opt_hostarch";
-			(my $hostarch_file = $source_file) =~ s/_source_Sources$/_binary-${opt_hostarch}_Packages/;
-			$ceve_cmd .= " deb://$hostarch_file";
+			(my $hostarch_file = $source_file) =~ s/_source_Sources(\.\w+)?$/_binary-${opt_hostarch}_Packages$1/;
+			push(@ceve_cmd, "--deb-host-arch=$opt_hostarch", "deb://$hostarch_file");
 		}
-		$ceve_cmd .= " | grep-dctrl -n -s Package '' | sort -u |";
-		print STDERR "DEBUG: executing: $ceve_cmd" if ($opt_debug);
-		open(SOURCES, $ceve_cmd);
+		my %sources;
+		print STDERR 'DEBUG: executing: '.join(' ', @ceve_cmd) if ($opt_debug);
+		open(SOURCES, '-|', @ceve_cmd);
 		while(<SOURCES>) {
-			chomp;
-			print "$_";
+		    next unless s/^Package:\s+//;
+		    chomp;
+		    $sources{$_} = 1;
+		}
+		for my $source (sort keys %sources)
+		{
+			print $source;
 			if ($opt_maintainer) {
-			    my $maintainer = `apt-cache showsrc $_ | grep-dctrl -n -s Maintainer '' | sort -u`;
+			    my $maintainer = `apt-cache showsrc $source | grep-dctrl -n -s Maintainer '' | sort -u`;
 			    print " ($maintainer)";
 			}
 			print "\n";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list