more bugfixes

This commit is contained in:
joey
2000-04-22 02:09:13 +00:00
parent 624306abba
commit f85230dc81
4 changed files with 47 additions and 6 deletions

View File

@@ -253,6 +253,15 @@ to produce a suitable build tree.
sub prep {}
=item cleantree
This method should clean the unpacked_tree of any effects the prep and
build methods might have on it.
=cut
sub cleantree {}
=item build
This method takes a prepped build tree, and simply builds a package from

View File

@@ -384,6 +384,19 @@ sub build {
return $this->name."_".$this->version."-".$this->release."_".$this->arch.".deb";
}
=item cleantree
Delete the entire debian/ directory.
=cut
sub cleantree {
my $this=shift;
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
system("rm -rf $dir/debian");
}
=item package
Set/get package name.

View File

@@ -265,6 +265,19 @@ sub prep {
close OUT;
}
=item cleantree
Delete the spec file.
=cut
sub cleantree {
my $this=shift;
my $dir=$this->unpacked_tree || die "The package must be unpacked first!";
unlink "$dir/".$this->name."-".$this->version."-".$this->release.".spec";
}
=item build
Build a rpm. If RPMBUILDOPT is set in the environement, the options in
@@ -376,7 +389,8 @@ sub _script_helper {
# get
return unless defined wantarray; # optimization
$_=$this->{$script};
return $_ if ! defined $_ || m/^\s*$/;
return '' unless defined $_;
return $_ if m/^\s*$/;
my $f = pack("u",$_);
$f =~ s/%/%%/g; # Rpm expands %S, so escape such things.
return "set -e\n".

15
alien
View File

@@ -283,7 +283,7 @@ if (($generate || $single) && $install) {
die "You can not use --generate or --single with --install.\n";
}
if (($generate || $single) && keys %destformats > 1) {
die "--generate and --single may noly be used when converting to a single format.\n";
die "--generate and --single may only be used when converting to a single format.\n";
}
if ($patchfile && ! -f $patchfile) {
die "Specified patch file, \"$patchfile\" cannot be found.\n";
@@ -298,11 +298,11 @@ unless (@ARGV) {
# Check alien's working anvironment.
if (! -w '.') {
die("Cannot write to current directory. Try changing to /tmp and re-running alien.\n");
die("Cannot write to current directory. Try moving to /tmp and re-running alien.\n");
}
if ($> ne 0) {
if ($destformats{deb} && ! $generate && ! $single) {
die "Must run as root to convert to .deb format (or you may use fakeroot).\n";
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 probably be messed up.\n";
@@ -349,7 +349,12 @@ foreach my $file (@ARGV) {
# Skip conversion if package is already the correct format.
if ($package->origformat ne $format) {
# Only unpack once.
$package->unpack unless $package->unpacked_tree;
if ($package->unpacked_tree) {
$package->cleantree;
}
else {
$package->unpack;
}
# Mutate package into desired format.
bless($package, "Alien::Package::".ucfirst($format));
@@ -370,7 +375,7 @@ foreach my $file (@ARGV) {
else {
print "Directory ".$package->unpacked_tree." prepared.\n";
}
# Make sure $package does not whipe out the
# Make sure $package does not wipe out the
# directory when it is destroyed.
$package->unpacked_tree('');
exit;