[SCM] Debian package checker branch, master, updated. 2.5.11-139-g76f1c80
The following commit has been merged in the master branch:
commit fa546e311c051555208d8b59fb18212115d99ed6
Author: Niels Thykier <niels@thykier.net>
Date: Thu Jan 31 17:44:28 2013 +0100
L::CollScript: Handle the actual collect invocation
Add full collection invokation handling in L::CollScript and abuse
this in the frontend to transparently support perl-coll for
auto-removed colls.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/frontend/lintian b/frontend/lintian
index 5023d85..492fde0 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -1207,8 +1207,11 @@ sub auto_clean_package {
next unless $lpkg->is_coll_finished ($coll, $ci->version);
debug_msg(1, "Auto removing: $coll ...");
$changed = 1;
- unless (system ($ci->script_path, $pkg_name, "remove-${pkg_type}", $base) == 0) {
- warning("removing collect info $coll about package $pkg_name failed",
+ eval {
+ $ci->collect ($pkg_name, "remove-${pkg_type}", $base);
+ };
+ if ($@) {
+ warning($@, "removing collect info $coll about package $pkg_name failed",
"skipping cleanup of $pkg_type package $pkg_name");
return -1;
}
diff --git a/lib/Lintian/CollScript.pm b/lib/Lintian/CollScript.pm
index bd45e3a..912f13e 100644
--- a/lib/Lintian/CollScript.pm
+++ b/lib/Lintian/CollScript.pm
@@ -235,26 +235,34 @@ sub is_type {
sub collect {
my ($self, $pkg_name, $task, $dir) = @_;
- my $collector = $self->{'_collect_sub'};
- unless (defined $collector) {
- my $cs_path = $self->script_path;
- my $ppkg = $self->name;
-
- $ppkg =~ s,[-.],_,go;
- $ppkg =~ s,/,::,go;
-
- require $cs_path;
-
- {
- no strict 'refs';
- $collector = \&{'Lintian::coll::' . $ppkg . '::collect'}
- if defined &{'Lintian::coll::' . $ppkg . '::collect'};
+ my $iface = $self->interface;
+ if ($iface eq 'perl-coll') {
+ my $collector = $self->{'_collect_sub'};
+ unless (defined $collector) {
+ my $cs_path = $self->script_path;
+ my $ppkg = $self->name;
+
+ $ppkg =~ s,[-.],_,go;
+ $ppkg =~ s,/,::,go;
+
+ require $cs_path;
+
+ {
+ no strict 'refs';
+ $collector = \&{'Lintian::coll::' . $ppkg . '::collect'}
+ if defined &{'Lintian::coll::' . $ppkg . '::collect'};
+ }
+ fail $self->name . ' does not have a collect function'
+ unless defined $collector;
+ $self->{'_collect_sub'} = $collector;
}
- fail $self->name . ' does not have a collect function'
- unless defined $collector;
- $self->{'_collect_sub'} = $collector;
+ $collector->($pkg_name, $task, $dir);
+ } elsif ($iface eq 'exec') {
+ system ($self->script_path, $pkg_name, $task, $dir) == 0
+ or die 'Collection ' . $self->name . " for $pkg_name failed\n";
+ } else {
+ fail "Unknown interface: $iface";
}
- $collector->($pkg_name, $task, $dir);
}
=back
diff --git a/lib/Lintian/Unpacker.pm b/lib/Lintian/Unpacker.pm
index da22397..0ac017c 100644
--- a/lib/Lintian/Unpacker.pm
+++ b/lib/Lintian/Unpacker.pm
@@ -438,7 +438,8 @@ sub process_tasks {
if (not $pid) {
# child
my $ret = 0;
- if ($cs->interface eq 'perl-coll') {
+ if ($cs->interface ne 'exec') {
+ # With a non-exec interface, let L::CollScript handle it
eval {
$cs->collect ($pkg_name, $pkg_type, $base);
};
@@ -447,6 +448,7 @@ sub process_tasks {
$ret = 2;
}
} else {
+ # Its fork + exec - invoke that directly (saves a fork)
exec $cs->script_path, $pkg_name, $pkg_type, $base
or die "exec $cs->script_path: $!";
}
--
Debian package checker
Reply to: