* Fixed the problem I thought I fixed in 6.50. Hmm. Closes: #52402

This commit is contained in:
joey
1999-12-10 18:30:26 +00:00
parent 61251bfdf1
commit 7d098feedd
8 changed files with 70 additions and 26 deletions

2
alien
View File

@@ -195,7 +195,7 @@ foreach $file (@ARGV) {
$workdir="$fields{NAME}-$fields{VERSION}"; $workdir="$fields{NAME}-$fields{VERSION}";
Alien::SafeMkdir($workdir); Alien::SafeMkdir($workdir);
chdir $workdir; chdir $workdir;
$src->Unpack($file,$nopatch,%fields); $src->Unpack($file,%fields);
chdir ".."; chdir "..";
# Conversion stage. # Conversion stage.

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
alien (6.53) unstable; urgency=low
* Fixed the problem I thought I fixed in 6.50. Hmm. Closes: #52402
-- Joey Hess <joeyh@debian.org> Fri, 10 Dec 1999 10:21:43 -0800
alien (6.52) unstable; urgency=low alien (6.52) unstable; urgency=low
* Added (very simple) build dep. * Added (very simple) build dep.

View File

@@ -112,7 +112,7 @@ sub GetFields { my ($self,$file)=@_;
} }
# Unpack a rpm file. # Unpack a rpm file.
sub Unpack { my ($self,$file,$nopatch,%fields)=@_; sub Unpack { my ($self,$file,%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");

View File

@@ -103,7 +103,7 @@ sub GetFields { my ($self,$file)=@_;
# Unpack a slp file. # Unpack a slp file.
# They can be compressed in various ways, depending on what is in # They can be compressed in various ways, depending on what is in
# $fields{COMPRESSTYPE}. # $fields{COMPRESSTYPE}.
sub Unpack { my ($self,$file,$nopatch,%fields)=@_; sub Unpack { my ($self,$file,%fields)=@_;
if ($fields{COMPRESSTYPE} eq 0) { if ($fields{COMPRESSTYPE} eq 0) {
Alien::SafeSystem ("(cd ..;cat $file) | bzip2 -d | tar xpf -","Error unpacking $file\n"); Alien::SafeSystem ("(cd ..;cat $file) | bzip2 -d | tar xpf -","Error unpacking $file\n");
} }

View File

@@ -86,7 +86,7 @@ sub GetFields { my ($self,$file)=@_;
} }
# Handles unpacking of tgz's. # Handles unpacking of tgz's.
sub Unpack { my ($self,$nopatch,$file)=@_; sub Unpack { my ($self,$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.

View File

@@ -19,12 +19,15 @@ sub FixFields { my ($self,%fields)=@_;
foreach $field ('POSTINST', 'POSTRM', 'PREINST', 'PRERM') { foreach $field ('POSTINST', 'POSTRM', 'PREINST', 'PRERM') {
if ($fields{$field}) { if ($fields{$field}) {
$fields{$field}= $fields{$field}=
"rm -f /tmp/alien.$field\n". "set -e\n".
qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.$field\n}. "mkdir /tmp/alien.\$\$\n".
qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.\$\$/script\n}.
pack("u",$fields{$field}). pack("u",$fields{$field}).
"__EOF__\n". "__EOF__\n".
"sh /tmp/alien.$field \"\$@\"\n". "chmod 755 /tmp/alien.\$\$/script\n".
"rm -f /tmp/alien.$field\n"; "/tmp/alien.\$\$/script \"\$@\"\n".
"rm -f /tmp/alien.\$\$/script\n".
"rmdir /tmp/alien.\$\$";
} }
} }
@@ -32,7 +35,7 @@ sub FixFields { my ($self,%fields)=@_;
} }
# Generate the spec file. # Generate the spec file.
sub Convert { my ($self,$workdir,%fields)=@_; sub Convert { my ($self,$workdir,$nopatch,%fields)=@_;
Alien::Status("Automatic spec file generation"); Alien::Status("Automatic spec file generation");
# Create some more fields we will need. # Create some more fields we will need.
@@ -47,8 +50,7 @@ sub Convert { my ($self,$workdir,%fields)=@_;
my $fn; my $fn;
foreach $fn (split(/\n/,$fields{FILELIST})) { foreach $fn (split(/\n/,$fields{FILELIST})) {
if ($fn=~m:/$: eq undef) { # not a directory if ($fn=~m:/$: eq undef) { # not a directory
my $efn=quotemeta($fn); if (grep(m:^\Q$fn\E$:,@conffiles)) { # it's a conffile
if (grep(m:^$efn$:,@conffiles)) { # it's a conffile
$filelist.="%config $fn\n"; $filelist.="%config $fn\n";
} }
else { # normal file else { # normal file
@@ -82,27 +84,54 @@ sub GetPackageName { my ($self,%fields)=@_;
$rpmdir=$1; $rpmdir=$1;
} }
} }
if (!$rpmarch || !$rpmdir) { if (!$rpmarch) {
Alien::Error("rpm --showrc failed."); Alien::Error("rpm --showrc failed.");
} }
# Debian's "all" architecture is a special case, and the output rpm will # Debian's "all" architecture is a special case, and the output rpm
# be a noarch rpm. # will be a noarch rpm.
if ($fields{ARCH} eq 'all') { $rpmarch='noarch' } if ($fields{ARCH} eq 'all') { $rpmarch='noarch' }
if (! $rpmdir) {
# Presumably we're delaing with rpm 3.0 or above, which
# doesn't output rpmdir in any format I'd care to try to parse.
# Instead, rpm is now of a late enough version to notice the
# %define's in the spec file, that will make the file end up in
# the directory we started in.
return "$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.$rpmarch.rpm";
}
else {
# Old rpm.
return "$rpmdir/$rpmarch/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.$rpmarch.rpm"; return "$rpmdir/$rpmarch/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.$rpmarch.rpm";
} }
}
# Build a rpm file. # Build a rpm file.
sub Build { my ($self,%fields)=@_; sub Build { my ($self,%fields)=@_;
# Debian's "all" architecture is a special case where we make noarch rpms. # Debian's "all" architecture is a special case where we make noarch rpms.
my $buildarch; my $buildarch;
if ($fields{ARCH} eq 'all') { $buildarch="--buildarch noarch" } if ($fields{ARCH} eq 'all') {
# Nasty version check in here because rpm gratuitously
# changed this option at version 3.0.
my $lc_all=$ENV{LC_ALL};
$ENV{LC_ALL}='C';
my $version=`rpm --version`;
$ENV{LC_ALL}=$lc_all; # important to reset it.
my $minor;
($version,$minor)=$version=~m/version (\d+).(\d+)/;
if ($version >= 3 || ($version eq 2 && $minor >= 92)) {
$buildarch="--target noarch";
}
else {
$buildarch="--buildarch noarch"
}
}
Alien::SafeSystem("rpm $buildarch -bb $ENV{RPMBUILDOPT} $fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec", Alien::SafeSystem("rpm $buildarch -bb $ENV{RPMBUILDOPT} $fields{NAME}-$fields{VERSION}-$fields{RELEASE}.spec",
"Error putting together the RPM package.\n"); "Error putting together the RPM package.\n");
} }
# Install the passed rpm file. # Install the passed rpm file.
sub Install { my ($self,$package)=shift; sub Install { my ($self,$package)=@_;
Alien::SafeSystem("rpm -ivh $ENV{RPMINSTALLOPT} $package"); Alien::SafeSystem("rpm -ivh $ENV{RPMINSTALLOPT} $package");
} }

View File

@@ -70,7 +70,10 @@ sub FixFields { my ($self,%fields)=@_;
} }
# Do any necessary conversions on the file tree. # Do any necessary conversions on the file tree.
sub Convert { my ($self,$workdir,%fields)=@_; sub Convert { my ($self,$workdir,$nopatch,%fields)=@_;
if ($main::generate) {
print "Directory $workdir prepared.\n";
}
} }
# Passed the available info about the package in a hash, return the name of # Passed the available info about the package in a hash, return the name of
@@ -104,7 +107,7 @@ sub MakeFooter { my %fields=@_;
$fields{COMPILER}, $fields{COMPILER},
$fields{VERSION}, $fields{VERSION},
$fields{NAME}, $fields{NAME},
$fields{ARCH}, $fields{BINFORMAT},
$fields{GROUP}, $fields{GROUP},
$fields{SLPKGVERSION}, $fields{SLPKGVERSION},
)); ));
@@ -114,8 +117,10 @@ sub MakeFooter { my %fields=@_;
# This consists of first generating a .tar.bz2 file, and then appending the # This consists of first generating a .tar.bz2 file, and then appending the
# footer to it. # footer to it.
sub Build { my ($self,%fields)=@_; sub Build { my ($self,%fields)=@_;
# Note the -I is for making a .bzip2 file. # Note that it's important I use "./*" instead of just "." or something like
Alien::SafeSystem("tar cIf ../".$self->GetPackageName(%fields)." ."); # 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.
Alien::SafeSystem("tar cf - ./* | bzip2 - > ../".$self->GetPackageName(%fields));
# Now append the footer to that. # Now append the footer to that.
open (OUT,">>../".$self->GetPackageName(%fields)) || open (OUT,">>../".$self->GetPackageName(%fields)) ||

View File

@@ -12,7 +12,7 @@ sub FixFields { my ($self,%fields)=@_;
return %fields; return %fields;
} }
sub Convert { my ($self,$workdir,%fields)=@_; sub Convert { my ($self,$workdir,$nopatch,%fields)=@_;
if ($main::scripts) { if ($main::scripts) {
my $install_made=undef; my $install_made=undef;
my %scripttrans=( my %scripttrans=(
@@ -38,6 +38,10 @@ sub Convert { my ($self,$workdir,%fields)=@_;
} }
} }
} }
if ($main::generate) {
print "Directory $workdir prepared.\n";
}
} }
# Passed the available info about the package in a hash, return the name of # Passed the available info about the package in a hash, return the name of
@@ -52,14 +56,14 @@ sub Build { my ($self,%fields)=@_;
} }
# Install the passed tgz file. # Install the passed tgz file.
sub Install { my ($self,$package)=shift; sub Install { my ($self,$package)=@_;
if (-x "/sbin/installpkg") { if (-x "/sbin/installpkg") {
Alien::SafeSystem("/sbin/installpkg $package"); Alien::SafeSystem("/sbin/installpkg $package");
} }
else { else {
print STDERR "Sorry, I cannot install the generated .tgz file,\n"; Alien::Warning("Sorry, I cannot install the generated .tgz file,");
print STDERR "\"$package\" because /sbin/installpkg is not\n"; Alien::Warning("\"$package\" because /sbin/installpkg is not");
print STDERR "present. You can use tar to install it yourself.\n"; Alien::Warning("present. You can use tar to install it yourself.");
exit 1; # otherwise alien will delete the package file on us. exit 1; # otherwise alien will delete the package file on us.
} }
} }