* 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

View File

@@ -112,7 +112,7 @@ sub GetFields { my ($self,$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",
"Error unpacking $file\n");

View File

@@ -103,7 +103,7 @@ sub GetFields { my ($self,$file)=@_;
# Unpack a slp file.
# They can be compressed in various ways, depending on what is in
# $fields{COMPRESSTYPE}.
sub Unpack { my ($self,$file,$nopatch,%fields)=@_;
sub Unpack { my ($self,$file,%fields)=@_;
if ($fields{COMPRESSTYPE} eq 0) {
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.
sub Unpack { my ($self,$nopatch,$file)=@_;
sub Unpack { my ($self,$file)=@_;
Alien::SafeSystem ("(cd ..;cat $file) | tar zxpf -","Error unpacking $file\n");
# 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') {
if ($fields{$field}) {
$fields{$field}=
"rm -f /tmp/alien.$field\n".
qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.$field\n}.
"set -e\n".
"mkdir /tmp/alien.\$\$\n".
qq{perl -pe '\$_=unpack("u",\$_)' << '__EOF__' > /tmp/alien.\$\$/script\n}.
pack("u",$fields{$field}).
"__EOF__\n".
"sh /tmp/alien.$field \"\$@\"\n".
"rm -f /tmp/alien.$field\n";
"chmod 755 /tmp/alien.\$\$/script\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.
sub Convert { my ($self,$workdir,%fields)=@_;
sub Convert { my ($self,$workdir,$nopatch,%fields)=@_;
Alien::Status("Automatic spec file generation");
# Create some more fields we will need.
@@ -47,8 +50,7 @@ sub Convert { my ($self,$workdir,%fields)=@_;
my $fn;
foreach $fn (split(/\n/,$fields{FILELIST})) {
if ($fn=~m:/$: eq undef) { # not a directory
my $efn=quotemeta($fn);
if (grep(m:^$efn$:,@conffiles)) { # it's a conffile
if (grep(m:^\Q$fn\E$:,@conffiles)) { # it's a conffile
$filelist.="%config $fn\n";
}
else { # normal file
@@ -82,27 +84,54 @@ sub GetPackageName { my ($self,%fields)=@_;
$rpmdir=$1;
}
}
if (!$rpmarch || !$rpmdir) {
if (!$rpmarch) {
Alien::Error("rpm --showrc failed.");
}
# Debian's "all" architecture is a special case, and the output rpm will
# be a noarch rpm.
# Debian's "all" architecture is a special case, and the output rpm
# will be a noarch rpm.
if ($fields{ARCH} eq 'all') { $rpmarch='noarch' }
return "$rpmdir/$rpmarch/$fields{NAME}-$fields{VERSION}-$fields{RELEASE}.$rpmarch.rpm";
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";
}
}
# Build a rpm file.
sub Build { my ($self,%fields)=@_;
# Debian's "all" architecture is a special case where we make noarch rpms.
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",
"Error putting together the RPM package.\n");
}
# Install the passed rpm file.
sub Install { my ($self,$package)=shift;
sub Install { my ($self,$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.
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
@@ -104,7 +107,7 @@ sub MakeFooter { my %fields=@_;
$fields{COMPILER},
$fields{VERSION},
$fields{NAME},
$fields{ARCH},
$fields{BINFORMAT},
$fields{GROUP},
$fields{SLPKGVERSION},
));
@@ -114,8 +117,10 @@ sub MakeFooter { my %fields=@_;
# This consists of first generating a .tar.bz2 file, and then appending the
# footer to it.
sub Build { my ($self,%fields)=@_;
# Note the -I is for making a .bzip2 file.
Alien::SafeSystem("tar cIf ../".$self->GetPackageName(%fields)." .");
# Note that it's important I use "./*" instead of just "." or 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.
Alien::SafeSystem("tar cf - ./* | bzip2 - > ../".$self->GetPackageName(%fields));
# Now append the footer to that.
open (OUT,">>../".$self->GetPackageName(%fields)) ||

View File

@@ -12,7 +12,7 @@ sub FixFields { my ($self,%fields)=@_;
return %fields;
}
sub Convert { my ($self,$workdir,%fields)=@_;
sub Convert { my ($self,$workdir,$nopatch,%fields)=@_;
if ($main::scripts) {
my $install_made=undef;
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
@@ -52,14 +56,14 @@ sub Build { my ($self,%fields)=@_;
}
# Install the passed tgz file.
sub Install { my ($self,$package)=shift;
sub Install { my ($self,$package)=@_;
if (-x "/sbin/installpkg") {
Alien::SafeSystem("/sbin/installpkg $package");
}
else {
print STDERR "Sorry, I cannot install the generated .tgz file,\n";
print STDERR "\"$package\" because /sbin/installpkg is not\n";
print STDERR "present. You can use tar to install it yourself.\n";
Alien::Warning("Sorry, I cannot install the generated .tgz file,");
Alien::Warning("\"$package\" because /sbin/installpkg is not");
Alien::Warning("present. You can use tar to install it yourself.");
exit 1; # otherwise alien will delete the package file on us.
}
}