* Fixed problem with relocatable packages, and probably several other

unrelated problems that were introduced last version.
This commit is contained in:
joey
1999-12-01 21:57:02 +00:00
parent a06b66ec0c
commit dafcd16174
5 changed files with 56 additions and 71 deletions

7
debian/changelog vendored
View File

@@ -1,3 +1,10 @@
alien (6.50) unstable; urgency=low
* Fixed problem with relocatable packages, and probably several other
unrelated problems that were introduced last version.
-- Joey Hess <joeyh@debian.org> Wed, 1 Dec 1999 13:52:55 -0800
alien (6.49) unstable; urgency=low alien (6.49) unstable; urgency=low
* Removed an obsolete note from the man page. * Removed an obsolete note from the man page.

2
debian/control vendored
View File

@@ -2,7 +2,7 @@ Source: alien
Section: admin Section: admin
Priority: extra Priority: extra
Maintainer: Joey Hess <joeyh@debian.org> Maintainer: Joey Hess <joeyh@debian.org>
Standards-Version: 3.1.0.0 Standards-Version: 3.1.1.0
Package: alien Package: alien
Architecture: all Architecture: all

View File

@@ -38,10 +38,6 @@ sub GetFields { my ($self,$file)=@_;
$fields{$fieldtrans{$field}}=$_ if $_ ne '(none)'; $fields{$fieldtrans{$field}}=$_ if $_ ne '(none)';
} }
# DEFAULTPREFIX is special because it only exists in old versions of rpm.
$_=`rpm -qp $file --queryformat \%{PREFIXES} 2>/dev/null`;
$fields{PREFIXES}=$_ if $_ ne '' && $_ ne '(none)';
if ($main::scripts) { if ($main::scripts) {
# Fix up the scripts - they are always shell scripts, so make them so. # Fix up the scripts - they are always shell scripts, so make them so.
foreach $field ('PREINST','POSTINST','PRERM','POSTRM') { foreach $field ('PREINST','POSTINST','PRERM','POSTRM') {
@@ -116,20 +112,21 @@ sub GetFields { my ($self,$file)=@_;
} }
# Unpack a rpm file. # Unpack a rpm file.
sub Unpack { my ($self,$file,%fields)=@_; sub Unpack { my ($self,$file,$nopatch,%fields)=@_;
Alien::SafeSystem("(cd ..;rpm2cpio $file) | cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time", Alien::SafeSystem("(cd ..;rpm2cpio $file) | cpio --extract --make-directories --no-absolute-filenames --preserve-modification-time",
"Error unpacking $file\n"); "Error unpacking $file\n");
# If the package is relocatable. We'd like to move it to be under the # If the package is relocatable. We'd like to move it to be under the
# PREFIXES directory. However, it's possible that that directory is in the # PREFIXES directory. However, it's possible that that directory is in
# package - it seems some rpm's are marked as relocatable and unpack already # the package - it seems some rpm's are marked as relocatable and
# in the directory they can relocate to, while some are marked relocatable # unpack already in the directory they can relocate to, while some are
# and the directory they can relocate to is removed from all filenames in the # marked relocatable and the directory they can relocate to is removed
# package. I suppose this is due to some change between versions of rpm, but # from all filenames in the package. I suppose this is due to some
# none of this is adequatly documented, so we'll just muddle through. # vchange between versions of rpm, but none of this is adequatly
# documented, so we'll just muddle through.
# #
# Test to see if the package contains the PREFIXES directory already. # Test to see if the package contains the PREFIXES directory already.
print "----$fields{PREFIXES}\n";
if ($fields{PREFIXES} ne undef && ! -e "./$fields{PREFIXES}") { if ($fields{PREFIXES} ne undef && ! -e "./$fields{PREFIXES}") {
print "Moving unpacked files into $fields{PREFIXES}\n"; print "Moving unpacked files into $fields{PREFIXES}\n";

View File

@@ -2,23 +2,13 @@
# #
# Package for converting from a .slp (Stampede) file. # Package for converting from a .slp (Stampede) file.
# Pull in details on the binary footer.
use Slp;
package From::slp; package From::slp;
use strict; use strict;
# Becuase .slp files are a binary format we parse by hand, I need to code in
# the details of the structure here.
# Complete sizeof(slpformat) from slp.h in the stampede package manager source.
$From::slp::footer_size=3784;
# This is the pack format string for the footer.
$From::slp::footer_packstring="A756IIIIA128A128A80A1536A512A512A30A30IA20A20III";
# What package format are we up to now? (Lowest one this is still compatable
# with.)
$From::slp::footer_version=5;
# Pass it a chunk of footer, it will attempt a decode and spit back the result # Pass it a chunk of footer, it will attempt a decode and spit back the result
# in a hash, %fields. # in a hash, %fields.
sub DecodeFooter { my $footer=shift; sub DecodeFooter { my $footer=shift;
@@ -43,11 +33,11 @@ sub DecodeFooter { my $footer=shift;
$fields{ARCH}, $fields{ARCH},
$fields{GROUP}, $fields{GROUP},
$fields{SLPKGVERSION}, $fields{SLPKGVERSION},
)=unpack($From::slp::footer_packstring,$footer); )=unpack($slp::footer_packstring,$footer);
# A simple sanity check. # A simple sanity check.
if (! $fields{SLPKGVERSION} || $fields{SLPKGVERSION} < $From::slp::footer_version) { if (! $fields{SLPKGVERSION} || $fields{SLPKGVERSION} < $slp::footer_version) {
Alien::Error("This is not a V$From::slp::footer_version or greater Stampede package"); Alien::Error("This is not a V$slp::footer_version or greater Stampede package");
} }
return %fields; return %fields;
@@ -57,8 +47,8 @@ sub DecodeFooter { my $footer=shift;
# in a scalar. # in a scalar.
sub GetFooter { my ($filename)=@_; sub GetFooter { my ($filename)=@_;
open (SLP,"<$filename") || Alien::Error("unable to read $filename: $!"); open (SLP,"<$filename") || Alien::Error("unable to read $filename: $!");
seek SLP,(-1 * $From::slp::footer_size),2; # position at beginning of footer (2 = seek from EOF) seek SLP,(-1 * $slp::footer_size),2; # position at beginning of footer (2 = seek from EOF)
read SLP,$_,$From::slp::footer_size; read SLP,$_,$slp::footer_size;
close SLP; close SLP;
return $_; return $_;
} }
@@ -74,54 +64,34 @@ sub GetFields { my ($self,$file)=@_;
$fields{CONFFILES}.="\n"; $fields{CONFFILES}.="\n";
} }
if ($fields{COPYRIGHT} == 0) { if ($$slp::copyrighttrans{$fields{COPYRIGHT}}) {
$fields{COPYRIGHT}="GPL"; $fields{COPYRIGHT}=$$slp::copyrighttrans{$fields{COPYRIGHT}};
}
elsif ($fields{COPYRIGHT} == 1) {
$fields{COPYRIGHT}="BSD";
}
elsif ($fields{COPYRIGHT} == 2) {
$fields{COPYRIGHT}="LGPL";
}
elsif ($fields{COPYRIGHT} == 3) {
$fields{COPYRIGHT}="unknown";
} }
else { else {
Alien::Warning("I don't know what copyright type \"$fields{COPYRIGHT}\" is."); Alien::Warning("I don't know what copyright type \"$fields{COPYRIGHT}\" is.");
$fields{COPYRIGHT}="unknown"; $fields{COPYRIGHT}="unknown";
} }
if ($fields{ARCH} == 0) { if ($$slp::archtrans{$fields{ARCH}}) {
$fields{ARCH}='all'; $fields{ARCH}=$$slp::archtrans{$fields{ARCH}};
}
elsif ($fields{ARCH} == 1) {
$fields{ARCH}='i386';
}
elsif ($fields{ARCH} == 2) {
$fields{ARCH}='sparc';
}
elsif ($fields{ARCH} == 3) {
$fields{ARCH}='alpha';
}
elsif ($fields{ARCH} == 4) {
$fields{ARCH}='powerpc';
}
elsif ($fields{ARCH} == 5) {
$fields{ARCH}='m68k';
} }
else { else {
Alien::Error("An unknown architecture of \"$fields{ARCH}\" was specified."); Alien::Error("An unknown architecture, \"$fields{ARCH}\" was specified.");
} }
$fields{RELEASE}++ unless $main::keep_version; $fields{RELEASE}++ unless $main::keep_version;
$fields{DISTRIBUTION}="Stampede"; $fields{DISTRIBUTION}="Stampede";
# Read in the list of all files. # Read in the list of all files.
# Note that they will have a leading "." we don't want.
$fields{FILELIST}=undef; $fields{FILELIST}=undef;
my $fn; my $fn;
foreach $fn (`tar -Itf $file`) { foreach $fn (`bzip2 -d < $file | tar -tf -`) {
$fn=~s/^\.//; # They may have a leading "." we don't want.
$fn=~s:^\./:/:;
# Ensure there is always a leading '/'.
if ($fn=~m:^/: eq undef) {
$fn="/$fn";
}
$fields{FILELIST}.="$fn\n"; $fields{FILELIST}.="$fn\n";
} }
@@ -131,9 +101,20 @@ sub GetFields { my ($self,$file)=@_;
} }
# Unpack a slp file. # Unpack a slp file.
sub Unpack { my ($self,$file,%fields)=@_; # They can be compressed in various ways, depending on what is in
# Note it's a .tar.bz2, this the -I # $fields{COMPRESSTYPE}.
Alien::SafeSystem ("(cd ..;cat $file) | tar Ixpf -","Error unpacking $file\n"); sub Unpack { my ($self,$file,$nopatch,%fields)=@_;
if ($fields{COMPRESSTYPE} eq 0) {
Alien::SafeSystem ("(cd ..;cat $file) | bzip2 -d | tar xpf -","Error unpacking $file\n");
}
elsif ($fields{COMPRESSTYPE} eq 1) {
# .gz
Alien::SafeSystem ("(cd ..;cat $file) | tar zxpf -","Error unpacking $file\n");
}
else {
# Seems .zip might be a possibility, but I have no way of testing it.
Alien::Error("This packages uses an unknown compression type, $fields{COMPRESSTYPE}.");
}
} }
1 1

View File

@@ -15,7 +15,7 @@ sub GetFields { my ($self,$file)=@_;
my ($basename)=('/'.$file)=~m#^/?.*/(.*?)$#; my ($basename)=('/'.$file)=~m#^/?.*/(.*?)$#;
# Strip out any tar extentions. # Strip out any tar extentions.
$basename=~s/\.(tgz|tar\.gz)$//; $basename=~s/\.(tgz|tar\.(gz|Z))$//;
if ($basename=~m/(.*)-(.*)/ ne undef) { if ($basename=~m/(.*)-(.*)/ ne undef) {
$fields{NAME}=$1; $fields{NAME}=$1;
@@ -26,7 +26,7 @@ sub GetFields { my ($self,$file)=@_;
$fields{VERSION}=1; $fields{VERSION}=1;
} }
$fields{ARCH}='i386'; $fields{ARCH}='all';
if ($main::tgzdescription eq undef) { if ($main::tgzdescription eq undef) {
$fields{SUMMARY}='Converted Slackware tgz package'; $fields{SUMMARY}='Converted Slackware tgz package';
} }
@@ -56,8 +56,8 @@ sub GetFields { my ($self,$file)=@_;
} }
close FILELIST; close FILELIST;
# Now get the whole filelist. We have to add leading /'s to the filenames. # Now get the whole filelist. We have to add leading /'s to the
# We have to ignore all files under /install/ # filenames. We have to ignore all files under /install/
$fields{FILELIST}=''; $fields{FILELIST}='';
open (FILELIST, "tar ztf $file |"); open (FILELIST, "tar ztf $file |");
while (<FILELIST>) { while (<FILELIST>) {
@@ -86,7 +86,7 @@ sub GetFields { my ($self,$file)=@_;
} }
# Handles unpacking of tgz's. # Handles unpacking of tgz's.
sub Unpack { my ($self,$file)=@_; sub Unpack { my ($self,$nopatch,$file)=@_;
Alien::SafeSystem ("(cd ..;cat $file) | tar zxpf -","Error unpacking $file\n"); Alien::SafeSystem ("(cd ..;cat $file) | tar zxpf -","Error unpacking $file\n");
# Delete this install directory that has slackware info in it. # Delete this install directory that has slackware info in it.