diff --git a/Alien/Package.pm b/Alien/Package.pm index 7dcb4fb..34e7289 100644 --- a/Alien/Package.pm +++ b/Alien/Package.pm @@ -206,6 +206,23 @@ sub filename { return $this->{filename}; } +=item scripts + +Returns a list of all non-empty maintainer scripts in the package. + +=cut + +sub scripts { + my $this=shift; + + my @ret; + foreach my $s (qw{postinst postrm preinst prerm}) { + my $val=$this->$s; + push(@ret, $s) if defined $val && length $val; + } + return @ret; +} + =item scan This method scans the file associated with an object, and populates as many diff --git a/Alien/Package/Deb.pm b/Alien/Package/Deb.pm index 1786dbd..096fb38 100644 --- a/Alien/Package/Deb.pm +++ b/Alien/Package/Deb.pm @@ -330,12 +330,11 @@ sub prep { open (OUT, ">$dir/debian/changelog") || die "$dir/debian/changelog: $!"; print OUT $this->name." (".$this->version."-".$this->release.") experimental; urgency=low\n"; print OUT "\n"; - print OUT " * Converted from .".$this->origformat." format to .deb\n"; - print OUT " by alien version $Alien::Version\n"; + print OUT " * Converted from .".$this->origformat." format to .deb by alien version $Alien::Version\n"; print OUT "\n"; print OUT " -- ".$this->username." <".$this->email."> ".$this->date."\n"; print OUT "\n"; - print OUT $this->changelogtext."\n"; + print OUT $this->changelogtext."\n" if defined $this->changelogtext; close OUT; # Control file. diff --git a/Alien/Package/Pkg.pm b/Alien/Package/Pkg.pm index 9af2c8c..67b33fd 100644 --- a/Alien/Package/Pkg.pm +++ b/Alien/Package/Pkg.pm @@ -88,6 +88,8 @@ sub checkfile { my $line = ; close F; + return unless defined $line; + if($line =~ "# PaCkAgE DaTaStReAm") { return 1; } diff --git a/alien.pl b/alien.pl index 31a6a6b..005138f 100755 --- a/alien.pl +++ b/alien.pl @@ -321,7 +321,7 @@ Usage: alien [options] file [...] looking for patch in /var/lib/alien. --nopatch Do not use patches. --anypatch Use even old version os patches. - --single Like --generate, but do not create .orig + -s, --single Like --generate, but do not create .orig directory. --fixperms Munge/fix permissions and owners. --test Test generated packages with lintian. @@ -415,11 +415,11 @@ if ($> != 0) { 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"; + print STDERR "Warning: Ownerships of files in the generated packages will probably be wrong.\n"; } foreach my $file (@ARGV) { - if (! -f $file) { + if (! -e $file) { die "File \"$file\" not found.\n"; } @@ -452,7 +452,13 @@ foreach my $file (@ARGV) { die "Unknown type of package, $file.\n"; } - $package->usescripts($scripts) unless $package->usescripts; + if (! $package->usescripts && $package->scripts) { + $package->usescripts($scripts); + if (! $scripts) { + print STDERR "Warning: Skipping conversion of scripts in package ".$package->name.": ".join(" ", $package->scripts)."\n"; + print STDERR "Warning: Use the --scripts parameter to include the scripts.\n"; + } + } # Increment release. unless (defined $keepversion) { @@ -476,14 +482,14 @@ foreach my $file (@ARGV) { # Mutate package into desired format. bless($package, "Alien::Package::".ucfirst($format)); - + # Make .orig.tar.gz directory? if ($format eq 'deb' && ! $single && $generate) { # Make .orig.tar.gz directory. Alien::Package->do("cp", "-fa", "--", $package->unpacked_tree, $package->unpacked_tree.".orig") or die "cp -fa failed"; } - + # See if a patch file should be used. if ($format eq 'deb' && ! $nopatch) { if (defined $patchfile) { diff --git a/debian/changelog b/debian/changelog index c8d1227..dff020c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +alien (8.56) unstable; urgency=low + + * Warn if a package contains maintainer scripts which are not converted, + since this can result in broken packages. + * Many small fixes. + + -- Joey Hess Tue, 19 Jul 2005 20:21:42 -0400 + alien (8.55) unstable; urgency=low * Add lgtoclnt patch from Clint. Closes: #276365