From c667e71653820f880e6af82e91b3db509c45022d Mon Sep 17 00:00:00 2001 From: joey Date: Thu, 21 Apr 2005 15:44:50 +0000 Subject: [PATCH] releasing version 8.52 --- Alien/Package.pm | 9 ++++++++- Alien/Package/Deb.pm | 18 +++++++++--------- Alien/Package/Lsb.pm | 2 +- Alien/Package/Rpm.pm | 12 ++++++------ Alien/Package/Slp.pm | 4 ++-- Alien/Package/Tgz.pm | 4 ++-- debian/changelog | 11 +++++++++++ 7 files changed, 39 insertions(+), 21 deletions(-) diff --git a/Alien/Package.pm b/Alien/Package.pm index 49933c1..7dcb4fb 100644 --- a/Alien/Package.pm +++ b/Alien/Package.pm @@ -421,18 +421,24 @@ sub do { =item runpipe This is similar to backticks, but honors $Alien::Package::verbose, logging -the command run if asked to. The output of the command returned. +the command run if asked to. The output of the command is returned. + +The first parameter controls what to do on error. If it's true then any +errors from the command will be ignored (and $? will be set). If it's +false, errors will abort alien. =cut sub runpipe { my $whatever=shift; + my $ignoreerror=shift; my @command=@_; if ($Alien::Package::verbose) { print "\t@command\n"; } if (wantarray) { my @ret=`@command`; + die "Error executing \"@command\": $!" if ! $ignoreerror && $? ne 0; if ($Alien::Package::verbose >= 2) { print @ret; } @@ -440,6 +446,7 @@ sub runpipe { } else { my $ret=`@command`; + die "Error executing \"@command\": $!" if ! $ignoreerror && $? ne 0; if ($Alien::Package::verbose >= 2) { print $ret."\n"; } diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index cf5fd37..67ecf5e 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -107,7 +107,7 @@ sub test { return map { s/\n//; $_ } grep { ! /unknown-section alien/ - } $this->runpipe("lintian $deb"); + } $this->runpipe(1, "lintian $deb"); } else { return "lintian not available, so not testing"; @@ -127,7 +127,7 @@ sub getcontrolfile { my $file=$this->filename; if ($this->have_dpkg_deb) { - return $this->runpipe("dpkg-deb --info $file $controlfile 2>/dev/null"); + return $this->runpipe(1, "dpkg-deb --info $file $controlfile 2>/dev/null"); } else { # Solaris tar doesn't support O @@ -140,7 +140,7 @@ sub getcontrolfile { " cat $file; cd /; rm -rf /tmp/tar_out.$$)"; } my $getcontrol = "ar -p $file control.tar.gz | gzip -dc | ".tar_out($controlfile)." 2>/dev/null"; - return $this->runpipe($getcontrol); + return $this->runpipe(1, $getcontrol); } } @@ -209,11 +209,11 @@ sub scan { my @filelist; if ($this->have_dpkg_deb) { @filelist=map { chomp; s:\./::; "/$_" } - $this->runpipe("dpkg-deb --fsys-tarfile $file | tar tf -"); + $this->runpipe(0, "dpkg-deb --fsys-tarfile $file | tar tf -"); } else { @filelist=map { chomp; s:\./::; "/$_" } - $this->runpipe("ar -p $file data.tar.gz | gzip -dc | tar tf -"); + $this->runpipe(0, "ar -p $file data.tar.gz | gzip -dc | tar tf -"); } $this->filelist(\@filelist); @@ -304,7 +304,7 @@ sub prep { or die "patch error: $!"; # Look for .rej files. die "patch failed with .rej files; giving up" - if $this->runpipe("find $dir -name \"*.rej\""); + if $this->runpipe(1, "find $dir -name \"*.rej\""); $this->do('find', '.', '-name', '*.orig', '-exec', 'rm', '{}', ';'); $this->do("chmod", 755, "$dir/debian/rules"); @@ -483,7 +483,7 @@ sub build { my $this=shift; chdir $this->unpacked_tree; - my $log=$this->runpipe("debian/rules binary 2>&1"); + my $log=$this->runpipe(1, "debian/rules binary 2>&1"); if ($?) { die "Package build failed. Here's the log:\n", $log; } @@ -647,7 +647,7 @@ Returns the date, in rfc822 format. sub date { my $this=shift; - my $date=$this->runpipe("822-date"); + my $date=$this->runpipe(1, "822-date"); chomp $date; if (!$date) { die "822-date did not return a valid result. You probably need to install the dpkg-dev debian package"; @@ -677,7 +677,7 @@ sub email { close MAILNAME; } if (!$mailname) { - $mailname=$this->runpipe("hostname -f"); + $mailname=$this->runpipe(1, "hostname -f"); chomp $mailname; } return "$login\@$mailname"; diff --git a/Alien/Package/Lsb.pm b/Alien/Package/Lsb.pm index 7394925..cc72e66 100644 --- a/Alien/Package/Lsb.pm +++ b/Alien/Package/Lsb.pm @@ -30,7 +30,7 @@ sub checkfile { my $this=shift; my $file=shift; return unless $file =~ m/^lsb-.*\.rpm$/; - my @deps=$this->runpipe("LANG=C rpm -qp -R $file"); + my @deps=$this->runpipe(1, "LANG=C rpm -qp -R $file"); return 1 if grep { s/\s+//g; $_ eq 'lsb' } @deps; return; } diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 9281f3c..162ec24 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -83,23 +83,23 @@ sub scan { # Use --queryformat to pull out all the fields we need. foreach my $field (keys(%fieldtrans)) { - $_=$this->runpipe("LANG=C rpm -qp --queryformat \%{$field} $file"); + $_=$this->runpipe(0, "LANG=C rpm -qp --queryformat \%{$field} $file"); $field=$fieldtrans{$field}; $_='' if $_ eq '(none)'; $this->$field($_); } # Get the conffiles list. - $this->conffiles([map { chomp; $_ } $this->runpipe("LANG=C rpm -qcp $file")]); + $this->conffiles([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qcp $file")]); if (defined $this->conffiles->[0] && $this->conffiles->[0] eq '(contains no files)') { $this->conffiles([]); } - $this->binary_info(scalar $this->runpipe("rpm -qpi $file")); + $this->binary_info(scalar $this->runpipe(0, "rpm -qpi $file")); # Get the filelist. - $this->filelist([map { chomp; $_ } $this->runpipe("LANG=C rpm -qpl $file")]); + $this->filelist([map { chomp; $_ } $this->runpipe(0, "LANG=C rpm -qpl $file")]); if (defined $this->filelist->[0] && $this->filelist->[0] eq '(contains no files)') { $this->filelist([]); @@ -362,7 +362,7 @@ sub build { # Ask rpm how it's set up. We want to know where it will place rpms. my $rpmdir; - foreach ($this->runpipe("rpm --showrc")) { + foreach ($this->runpipe(1, "rpm --showrc")) { chomp; if (/^rpmdir\s+:\s(.*)$/) { $rpmdir=$1; @@ -393,7 +393,7 @@ sub build { $opts.=" $ENV{RPMBUILDOPTS}" if exists $ENV{RPMBUILDOPTS}; my $command="cd $dir; $buildcmd -bb $opts ".$this->name."-".$this->version."-".$this->release.".spec"; - my $log=$this->runpipe("$command 2>&1"); + my $log=$this->runpipe(1, "$command 2>&1"); if ($?) { die "Package build failed. Here's the log of the command ($command):\n", $log; } diff --git a/Alien/Package/Slp.pm b/Alien/Package/Slp.pm index 5b631c3..470dd74 100644 --- a/Alien/Package/Slp.pm +++ b/Alien/Package/Slp.pm @@ -163,7 +163,7 @@ sub scan { # Read in the file list. my @filelist; # FIXME: support gzip files too! - foreach ($this->runpipe("bzip2 -d < $file | tar -tf -")) { + foreach ($this->runpipe(0, "bzip2 -d < $file | tar -tf -")) { chomp; s:^\./:/:; $_="/$_" unless m:^/:; @@ -176,7 +176,7 @@ sub scan { $this->distribution('Stampede'); $this->origformat('slp'); $this->changelogtext(''); - $this->binary_info($this->runpipe("ls -l $file")); + $this->binary_info($this->runpipe(0, "ls -l $file")); return 1; } diff --git a/Alien/Package/Tgz.pm b/Alien/Package/Tgz.pm index 648fd0c..fc5702c 100644 --- a/Alien/Package/Tgz.pm +++ b/Alien/Package/Tgz.pm @@ -111,7 +111,7 @@ sub scan { $this->group("unknown"); $this->origformat('tgz'); $this->changelogtext(''); - $this->binary_info($this->runpipe("ls -l $file")); + $this->binary_info($this->runpipe(0, "ls -l $file")); # Now figure out the conffiles. Assume anything in etc/ is a # conffile. @@ -145,7 +145,7 @@ sub scan { # Now get the scripts. foreach my $script (keys %{scripttrans()}) { - $this->$script($this->runpipe("tar Oxzf $file install/${scripttrans()}{$script} 2>/dev/null")); + $this->$script($this->runpipe(1, "tar Oxzf $file install/${scripttrans()}{$script} 2>/dev/null")); } return 1; diff --git a/debian/changelog b/debian/changelog index 6388430..413673e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +alien (8.52) unstable; urgency=low + + * Add a new parameter to runpipe to control whether it automatically + checks the return code of the command (and exits). Turn this on for many + runpipe calls that are not expected to fail in normal operation, but can + fail if the input file is empty, corrupt, or not readable. Previous + behavior for rpm files was a cascading failure that created weird + directories in cwd. Closes: #305592 + + -- Joey Hess Thu, 21 Apr 2005 11:34:41 -0400 + alien (8.51) unstable; urgency=low * In rpm unpack permission fixup code, do not call chmod on symlinks,