* 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