From 07a81c8b5cd98ee4c1b4e889a252c4f1c01030fe Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 22 Apr 2000 01:16:10 +0000 Subject: [PATCH] more bug fixes --- Alien/Package/Slp.pm | 38 ++++++++++++++++++++------------------ Alien/Package/Tgz.pm | 3 +-- alien | 3 +++ 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Alien/Package/Slp.pm b/Alien/Package/Slp.pm index f02593e..76985fe 100644 --- a/Alien/Package/Slp.pm +++ b/Alien/Package/Slp.pm @@ -49,28 +49,28 @@ This is a list of all the fields in the order they appear in the footer. =cut -use constant footer_size => 3784, - footer_packstring => "A756IIIIA128A128A80A1536A512A512A30A30IA20A20III", - footer_version => 5, - archtrans => { +use constant footer_size => 3784; +use constant footer_packstring => "A756IIIIA128A128A80A1536A512A512A30A30IA20A20III"; +use constant footer_version => 5; +use constant archtrans => { 0 => 'all', 1 => 'i386', 2 => 'sparc', 3 => 'alpha', 4 => 'powerpc', 5 => 'm68k', - }, - copyrighttrans => { + }; +use constant copyrighttrans => { 0 => 'GPL', 1 => 'BSD', 2 => 'LGPL', 3 => 'unknown', 254 => 'unknown', - }, - fieldlist => [qw{conffiles priority compresstype release copyright - conflicts setupscript summary description depends - provides author date compiler version name arch - group slpkgversion}]; + }; +use constant fieldlist => [qw{conffiles priority compresstype release copyright + conflicts setupscript summary description depends + provides maintainer date compiler version name + arch group slpkgversion}]; =back @@ -192,11 +192,11 @@ sub unpack { if ($compresstype == 0) { system("bzip2 -d $file | (cd ".$this->unpacked_tree."; tar xpf -") && - die "unpack failed: $!"; + die "unpack failed"; } elsif ($compresstype == 1) { system("cat $file | (cd ".$this->unpacked_tree."; tar zxpf -") && - die "unpack failed: $!"; + die "unpack failed"; } else { die "package uses an unknown compression type, $compresstype (please file a bug report)"; @@ -221,7 +221,7 @@ sub build { # (a). That is good for decoding, but not for encoding. my $fmt=footer_packstring(); $fmt=~tr/A/a/; - + my $footer=pack($fmt, $this->conffiles, 2, # Use priority optional for alien packages. @@ -230,10 +230,11 @@ sub build { 254, # Don't try to guess copyright, just use unknown. '', # Conflicts. '', # Set up script. TODO + $this->summary, $this->description, '', # Depends. '', # Provides. - $this->author, + $this->maintainer, scalar localtime, # Use current date. 252, # Unknown compiler. $this->version, @@ -319,8 +320,9 @@ sub arch { # set if (@_) { - $this->{arch}=${archtrans()}{shift}; - die "unknown architecture" if ! $this->{arch}; + my $arch=shift; + $this->{arch}=${archtrans()}{$arch}; + die "unknown architecture $arch" unless defined $this->{arch}; } # get @@ -344,7 +346,7 @@ sub release { my $this=shift; # set - $this->{release}=shift; + $this->{release}=shift if @_; # get return unless defined wantarray; # optimization diff --git a/Alien/Package/Tgz.pm b/Alien/Package/Tgz.pm index 6647f96..26cb52b 100644 --- a/Alien/Package/Tgz.pm +++ b/Alien/Package/Tgz.pm @@ -27,8 +27,7 @@ tgz's. =cut -use constant - scripttrans => { +use constant scripttrans => { postinst => 'doinst.sh', postrm => 'delete.sh', prerm => 'predelete.sh', diff --git a/alien b/alien index e82ae19..3ffdd52 100755 --- a/alien +++ b/alien @@ -365,5 +365,8 @@ foreach my $file (@ARGV) { # Note I don't unlink it. I figure that might annoy # people, since it was an input file. } + else { + print "$file already exists\n"; + } } }