From d384a93c99380ec32f55bceb1e001f218b0f8811 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 22 Apr 2000 00:56:50 +0000 Subject: [PATCH] tons of bugfixes --- Alien/Package/Deb.pm | 2 +- Alien/Package/Rpm.pm | 16 +++++++++------- Alien/Package/Slp.pm | 2 +- Alien/Package/Tgz.pm | 15 ++++++++------- alien | 13 ++++++------- 5 files changed, 25 insertions(+), 23 deletions(-) diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index 253510c..09234ad 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -74,7 +74,7 @@ sub install { my $deb=shift; system("dpkg --no-force-overwrite -i $deb") && - die "Unable to install: $!"; + die "Unable to install"; } =item scan diff --git a/Alien/Package/Rpm.pm b/Alien/Package/Rpm.pm index 8e73b78..57bd60f 100644 --- a/Alien/Package/Rpm.pm +++ b/Alien/Package/Rpm.pm @@ -52,8 +52,8 @@ sub install { my $this=shift; my $rpm=shift; - system("rpm -ivh $ENV{RPMINSTALLOPT} $rpm") && - die "Unable to install: $!"; + system("rpm -ivh ".(exists $ENV{RPMINSTALLOPT} ? $ENV{RPMINSTALLOPT} : '').$rpm) && + die "Unable to install"; } =item scan @@ -259,7 +259,7 @@ sub prep { print OUT "\%description\n"; print OUT $this->description."\n"; print OUT "\n"; - print OUT " (Converted from a .".$this->origformat." package by alien.)\n"; + print OUT "(Converted from a .".$this->origformat." package by alien.)\n"; print OUT "\n"; print OUT "%files\n"; print OUT $filelist; @@ -298,14 +298,14 @@ sub build { $rpmarch='noarch' if $this->arch eq 'all'; my $rpm=$this->name."-".$this->version."-".$this->release.".$rpmarch.rpm"; - my $buildarch; + my $opts=''; if ($rpmdir) { # Old versions of rpm toss it off in the middle of nowhere. $rpm="$rpmdir/$rpmarch/$rpm"; # This is the old command line argument to make noarch # rpms. - $buildarch="--buildarch noarch" if $rpmarch eq 'noarch'; + $opts="--buildarch noarch" if $rpmarch eq 'noarch'; } else { # Presumably we're delaing with rpm 3.0 or above, which @@ -317,10 +317,12 @@ sub build { # This is the new command line arcgument to make noarch # rpms. It appeared in rpm version 3. - $buildarch="--target noarch" if $rpmarch eq 'noarch'; + $opts="--target noarch" if $rpmarch eq 'noarch'; } - system("cd $dir; rpm $buildarch -bb $ENV{RPMBUILDOPT} ".$this->name."-".$this->version."-".$this->release.".spec") && + $opts.=" $ENV{RPMBUILDOPTS}" if exists $ENV{RPMBUILDOPTS}; + + system("cd $dir; rpm $opts -bb ".$this->name."-".$this->version."-".$this->release.".spec >/dev/null") && die "package build failed: $!"; return $rpm; diff --git a/Alien/Package/Slp.pm b/Alien/Package/Slp.pm index 5c65c05..f02593e 100644 --- a/Alien/Package/Slp.pm +++ b/Alien/Package/Slp.pm @@ -115,7 +115,7 @@ sub install { my $this=shift; my $slp=shift; - system("slpi $slp") && die "Unable to install: $!"; + system("slpi $slp") && die "Unable to install"; } =item getfooter diff --git a/Alien/Package/Tgz.pm b/Alien/Package/Tgz.pm index 6b6645a..6647f96 100644 --- a/Alien/Package/Tgz.pm +++ b/Alien/Package/Tgz.pm @@ -28,7 +28,7 @@ tgz's. =cut use constant - scriptrans => { + scripttrans => { postinst => 'doinst.sh', postrm => 'delete.sh', prerm => 'predelete.sh', @@ -73,7 +73,7 @@ sub install { if (-x "/sbin/installpkg") { system("/sbin/installpkg $tgz") && - die "Unable to install: $!"; + die "Unable to install"; } else { die "Sorry, I cannot install the generated .tgz file because /sbin/installpkg is not present. You can use tar to install it yourself.\n" @@ -183,18 +183,18 @@ sub prep { my $dir=$this->unpacked_tree || die "The package must be unpacked first!"; my $install_made=0; - foreach my $script (keys %{scriptrans()}) { + foreach my $script (keys %{scripttrans()}) { my $data=$this->$script(); + my $out=$this->unpacked_tree."/install/".${scripttrans()}{$script}; next if ! defined $data || $data =~ m/^\s*$/; if (!$install_made) { mkdir $this->unpacked_tree."/install", 0755; $install_made=1; } - open (OUT, ">".$this->unpacked_tree."/install/$script") || - die $this->unpacked_tree."/install/$script: $!"; + open (OUT, ">$out") || die "$out: $!"; print OUT $data; close OUT; - chmod 0755, $this->unpacked_tree."/install/$script"; + chmod 0755, $out; } } @@ -208,7 +208,8 @@ sub build { my $this=shift; my $tgz=$this->name."-".$this->version.".tgz"; - system("cd ".$this->unpacked_tree."; tar czf ../$tgz"); + system("cd ".$this->unpacked_tree."; tar czf ../$tgz .") && + die "Package build failed"; return $tgz; } diff --git a/alien b/alien index c9381e8..e82ae19 100755 --- a/alien +++ b/alien @@ -299,8 +299,7 @@ if ($> ne 0) { die "Must run as root to convert to .deb format (or you may use fakeroot).\n"; } print STDERR "Warning: alien is not running as root!\n"; - print STDERR "Ownerships of files in the generated packages will\n"; - print STDERR "probably be messed up.\n"; + print STDERR "Ownerships of files in the generated packages will probably be messed up.\n"; } foreach my $file (@ARGV) { @@ -318,7 +317,7 @@ foreach my $file (@ARGV) { } elsif (Alien::Package::Tgz->checkfile($file)) { $package=Alien::Package::Tgz->new(filename => $file); - $package->description($tgzdescription) if $tgzdescription ne ''; + $package->description($tgzdescription) if defined $tgzdescription; } elsif (Alien::Package::Slp->checkfile($file)) { $package=Alien::Package::Slp->new(filename => $file); @@ -328,16 +327,16 @@ foreach my $file (@ARGV) { } # Kill scripts from the package, unless they were enabled. - unless ($scripts) { + unless (defined $scripts) { $package->postinst(''); $package->postrm(''); $package->preinst(''); $package->prerm(''); } - # Increment revision. - unless ($keepversion) { - $package->revision($package->revision + 1); + # Increment release. + unless (defined $keepversion) { + $package->release($package->release + 1); } foreach my $format (keys %destformats) {