* Corrected precidence problem that made alien not catch mkdir of the work

directory failing if the directory already existed (and let it delete the
     existing directory). Closes: #181061
   * Fixed several other instances of the same precidence problem in the code.
This commit is contained in:
joey
2003-02-15 20:46:09 +00:00
parent 8b6a5ed7f8
commit 40e12efe45
9 changed files with 365 additions and 29 deletions

View File

@@ -87,7 +87,7 @@ sub install {
my $this=shift;
my $deb=shift;
system("dpkg", "--no-force-overwrite", "-i", $deb) == 0
(system("dpkg", "--no-force-overwrite", "-i", $deb) == 0)
or die "Unable to install";
}
@@ -237,11 +237,11 @@ sub unpack {
my $file=$this->filename;
if ($this->have_dpkg_deb) {
system("dpkg-deb", "-x", $file, $this->unpacked_tree) == 0
(system("dpkg-deb", "-x", $file, $this->unpacked_tree) == 0)
or die "Unpacking of `$file' failed: $!";
}
else {
system("ar -p $file data.tar.gz | gzip -dc | (cd ".$this->unpacked_tree."; tar xpf -)") == 0
(system("ar -p $file data.tar.gz | gzip -dc | (cd ".$this->unpacked_tree."; tar xpf -)") == 0)
or die "Unpacking of `$file' failed: $!";
}
@@ -293,14 +293,14 @@ sub prep {
my $this=shift;
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
mkdir "$dir/debian", 0755 ||
mkdir("$dir/debian", 0755) ||
die "mkdir $dir/debian failed: $!";
# Use a patch file to debianize?
if (defined $this->patchfile) {
# The -f passed to zcat makes it pass uncompressed files
# through without error.
system("zcat -f ".$this->patchfile." | (cd $dir; patch -p1)") == 0
(system("zcat -f ".$this->patchfile." | (cd $dir; patch -p1)") == 0)
or die "patch error: $!";
# Look for .rej files.
die "patch failed with .rej files; giving up"

View File

@@ -104,7 +104,7 @@ sub install {
my $pkg=shift;
if (-x "/usr/sbin/pkgadd") {
system("/usr/sbin/pkgadd", "-d .", "$pkg") == 0
(system("/usr/sbin/pkgadd", "-d .", "$pkg") == 0)
or die "Unable to install";
}
else {
@@ -124,7 +124,7 @@ sub scan {
my $file=$this->filename;
my $tdir="pkg-scan-tmp.$$";
mkdir $tdir, 0755 || die "Error making $tdir: $!\n";
mkdir($tdir, 0755) || die "Error making $tdir: $!\n";
my $pkgname;
if (-x "/usr/bin/pkginfo" && -x "/usr/bin/pkgtrans") {
@@ -137,7 +137,7 @@ sub scan {
close INFO;
# Extract the files
system("/usr/bin/pkgtrans -i $file $tdir $pkgname") == 0
(system("/usr/bin/pkgtrans -i $file $tdir $pkgname") == 0)
|| die "Error running pkgtrans: $!\n";
open(INFO, "$tdir/$pkgname/pkginfo")
@@ -230,13 +230,13 @@ sub unpack {
if (-x "/usr/bin/pkgtrans") {
my $workdir = $this->name."-".$this->version;;
mkdir $workdir, 0755 || die "unable to mkdir $workdir: $!\n";
system("/usr/bin/pkgtrans $file $workdir $pkgname") == 0
mkdir($workdir, 0755) || die "unable to mkdir $workdir: $!\n";
(system("/usr/bin/pkgtrans $file $workdir $pkgname") == 0)
|| die "unable to extract $file: $!\n";
rename "$workdir/$pkgname", "$ {workdir}_1"
rename("$workdir/$pkgname", "$ {workdir}_1")
|| die "unable rename $workdir/$pkgname: $!\n";
rmdir $workdir;
rename "$ {workdir}_1", $workdir
rename("$ {workdir}_1", $workdir)
|| die "unable to rename $ {workdir}_1: $!\n";
$this->unpacked_tree($workdir);
}
@@ -257,7 +257,7 @@ sub prep {
# grep {/^\./} readdir DIR;
# closedir DIR;
system("cd $dir; find . -print | pkgproto > ./prototype") == 0
(system("cd $dir; find . -print | pkgproto > ./prototype") == 0)
|| die "error during pkgproto: $!\n";
open(PKGPROTO, ">>$dir/prototype")
@@ -280,7 +280,7 @@ sub prep {
close PKGINFO;
print PKGPROTO "i pkginfo=./pkginfo\n";
mkdir "$dir/install", 0755;
mkdir("$dir/install", 0755) || die "unable to mkdir $dir/install: $!";
open(COPYRIGHT, ">$dir/install/copyright")
|| die "error creating copyright: $!\n";
print COPYRIGHT $this->copyright;
@@ -311,12 +311,12 @@ sub build {
my $this = shift;
my $dir = $this->unpacked_tree;
system("cd $dir; pkgmk -r / -d .") == 0
(system("cd $dir; pkgmk -r / -d .") == 0)
|| die "Error during pkgmk: $!\n";
my $pkgname = $this->converted_name;
my $name = $this->name."-".$this->version.".pkg";
system("pkgtrans $dir $name $pkgname") == 0
(system("pkgtrans $dir $name $pkgname") == 0)
|| die "Error during pkgtrans: $!\n";
rename "$dir/$name", $name;
return $name;

View File

@@ -51,7 +51,7 @@ sub install {
my $this=shift;
my $rpm=shift;
system("rpm -ivh ".(exists $ENV{RPMINSTALLOPT} ? $ENV{RPMINSTALLOPT} : '').$rpm) == 0
(system("rpm -ivh ".(exists $ENV{RPMINSTALLOPT} ? $ENV{RPMINSTALLOPT} : '').$rpm) == 0)
or die "Unable to install";
}
@@ -145,7 +145,7 @@ sub unpack {
$this->SUPER::unpack(@_);
my $workdir=$this->unpacked_tree;
system("rpm2cpio ".$this->filename." | (cd $workdir; cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null") == 0
(system("rpm2cpio ".$this->filename." | (cd $workdir; cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time) 2>/dev/null") == 0)
or die "Unpacking of `".$this->filename."' failed";
# If the package is relocatable. We'd like to move it to be under
@@ -168,11 +168,11 @@ sub unpack {
foreach (split m:/:, $this->prefixes) {
if ($_ ne '') { # this keeps us from using anything but relative paths.
$collect.="/$_";
mkdir $collect,0755 || die "unable to mkdir $collect: $!";
mkdir($collect,0755) || die "unable to mkdir $collect: $!";
}
}
# Now move all files in the package to the directory we made.
system("mv", @filelist, "$workdir/".$this->prefixes) == 0
(system("mv", @filelist, "$workdir/".$this->prefixes) == 0)
or die "error moving unpacked files into the default prefix directory: $!";
}

View File

@@ -114,7 +114,7 @@ sub install {
my $this=shift;
my $slp=shift;
system("slpi", $slp) == 0
(system("slpi", $slp) == 0)
or die "Unable to install";
}
@@ -250,7 +250,7 @@ sub build {
# something like that, becuase it results in a tar file where all
# the files in it start with "./", which is consitent with how
# normal stampede files look.
system("(cd ".$this->unpacked_tree."; tar cf - ./*) | bzip2 - > $slp") == 0
(system("(cd ".$this->unpacked_tree."; tar cf - ./*) | bzip2 - > $slp") == 0)
or die "package build failed: $!";
# Now append the footer.

View File

@@ -66,7 +66,7 @@ sub install {
my $tgz=shift;
if (-x "/sbin/installpkg") {
system("/sbin/installpkg", "$tgz") == 0
(system("/sbin/installpkg", "$tgz") == 0)
or die "Unable to install";
}
else {
@@ -162,7 +162,7 @@ sub unpack {
$this->SUPER::unpack(@_);
my $file=$this->filename;
system("cat $file | (cd ".$this->unpacked_tree."; tar zxpf -)") == 0
(system("cat $file | (cd ".$this->unpacked_tree."; tar zxpf -)") == 0)
or die "Unpacking of `$file' failed: $!";
# Delete the install directory that has slackware info in it.
system("cd ".$this->unpacked_tree."; rm -rf ./install");
@@ -187,7 +187,8 @@ sub prep {
my $out=$this->unpacked_tree."/install/".${scripttrans()}{$script};
next if ! defined $data || $data =~ m/^\s*$/;
if (!$install_made) {
mkdir $this->unpacked_tree."/install", 0755;
mkdir($this->unpacked_tree."/install", 0755)
|| die "unable to mkdir ".$this->unpacked_tree."/install: $!";
$install_made=1;
}
open (OUT, ">$out") || die "$out: $!";
@@ -208,7 +209,7 @@ sub build {
my $this=shift;
my $tgz=$this->name."-".$this->version.".tgz";
system("cd ".$this->unpacked_tree."; tar czf ../$tgz .") == 0
(system("cd ".$this->unpacked_tree."; tar czf ../$tgz .") == 0)
or die "Package build failed";
return $tgz;