* Added --test parameter, Closes: #145520

This commit is contained in:
joey
2002-05-03 00:12:13 +00:00
parent ddc50f48fb
commit 451483bc02
5 changed files with 72 additions and 10 deletions

View File

@@ -177,7 +177,7 @@ sub checkfile {
=item install
Simply installs a package file. The filename is passed on standard input.
Simply installs a package file. The filename is passed.
This has to be overridden in child classes.
=cut
@@ -186,6 +186,18 @@ sub install {
my $this=shift;
}
=item test
Test a package file. The filename is passed, should return an array of lines
of test results. Child classses may implement this.
=cut
sub test {
my $this=shift;
return;
}
=item filename
Set/get the filename of the package the object represents.

View File

@@ -45,17 +45,23 @@ if it is available since it is a lot more future-proof.
=cut
sub _inpath {
my $this=shift;
my $program=shift;
foreach (split(/:/,$ENV{PATH})) {
if (-x "$_/$program") {
return 1;
}
}
return '';
}
sub init {
my $this=shift;
$this->SUPER::init(@_);
$this->have_dpkg_deb('');
foreach (split(/:/,$ENV{PATH})) {
if (-x "$_/dpkg-deb") {
$this->have_dpkg_deb(1);
last;
}
}
$this->have_dpkg_deb($this->_inpath('dpkg-deb'));
}
=item checkfile
@@ -85,6 +91,29 @@ sub install {
or die "Unable to install";
}
=item test
Test a deb with lintian. Pass in the filename of the deb to test.
=cut
sub test {
my $this=shift;
my $deb=shift;
if ($this->_inpath("lintian")) {
# Ignore some lintian warnings that don't matter for
# aliened packages.
return map { s/\n//; $_ }
grep {
! /unknown-section alien/
} `lintian $deb`;
}
else {
return "lintian not available, so not testing";
}
}
=item getcontrolfile
Helper method. Pass it the name of a control file, and it will pull it out

View File

@@ -154,6 +154,12 @@ and check to see what they do before using this option.
This is enabled by default when converting from lsb packages.
=item B<-T>, B<--test>
Test the generated packages. Currently this is only supported for debian
packages, which, if lintian is installed, will be tested with lintian and
lintian's output displayed.
=item B<-k>, B<--keep-version>
By default, alien adds one to the minor version number of each package it
@@ -283,6 +289,7 @@ Usage: alien [options] file [...]
--single Like --generate, but do not create .orig
directory.
--fixperms Munge/fix permissions and owners.
--test Test generated packages with lintian.
-r, --to-rpm Generate a RedHat rpm package.
--to-slp Generate a Stampede slp package.
-l, --to-lsb Generate a LSB package.
@@ -303,7 +310,7 @@ EOF
# Start by processing the parameters.
my (%destformats, $generate, $install, $single, $scripts, $patchfile,
$nopatch, $tgzdescription, $keepversion, $fixperms);
$nopatch, $tgzdescription, $keepversion, $fixperms, $test);
GetOptions(
"to-deb|d", sub { $destformats{deb}=1 },
@@ -312,6 +319,7 @@ GetOptions(
"to-tgz|t", sub { $destformats{tgz}=1 },
"to-slp", sub { $destformats{slp}=1 },
"to-pkg|p", sub { $destformats{pkg}=1 },
"test|T", \$test,
"generate|g", \$generate,
"install|i", \$install,
"single|s", sub { $single=1; $generate=1 },
@@ -452,6 +460,13 @@ foreach my $file (@ARGV) {
}
my $newfile=$package->build;
if ($test) {
my @results = $package->test($newfile);
if (@results) {
print "Test results:\n";
print "\t$_\n" foreach @results;
}
}
if ($install) {
$package->install($newfile);
unlink $newfile;

6
debian/changelog vendored
View File

@@ -1,3 +1,9 @@
alien (8.07) unstable; urgency=low
* Added --test parameter, Closes: #145520
-- Joey Hess <joeyh@debian.org> Thu, 2 May 2002 20:03:21 -0400
alien (8.06) unstable; urgency=low
* Added --fixperms option. Closes: #142850

2
debian/control vendored
View File

@@ -9,7 +9,7 @@ Package: alien
Architecture: all
Section: admin
Depends: debhelper (>= 3), ${perl:Depends}, rpm (>= 2.4.4-2), dpkg-dev, make, cpio
Suggests: patch, bzip2, lsb-rpm
Suggests: patch, bzip2, lsb-rpm, lintian
Description: install non-native packages with dpkg
Alien allows you to convert LSB, Red Hat, Stampede and Slackware Packages
into Debian packages, which can be installed with dpkg.