The following commit has been merged in the master branch:
commit 8c8f3aa28bb001c19a43960568ecdfd6936d3fc6
Author: Raphaël Hertzog <[email protected]>
Date: Sun Sep 20 12:01:31 2009 +0200
Dpkg::Vendor::*: better handle unknown hooks
Implement vendor objects in a way that the return value for unknown
hooks is better defined: empty list in list context or undef in scalar
context.
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 5e40011..e234b7b 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -36,11 +36,7 @@ for Debian specific actions.
sub run_hook {
my ($self, $hook, @params) = @_;
- if ($hook eq "before-source-build") {
- my $srcpkg = shift @params;
- } elsif ($hook eq "before-changes-creation") {
- my $fields = shift @params;
- } elsif ($hook eq "keyrings") {
+ if ($hook eq "keyrings") {
return ('/usr/share/keyrings/debian-keyring.gpg',
'/usr/share/keyrings/debian-maintainers.gpg');
} elsif ($hook eq "register-custom-fields") {
@@ -50,6 +46,8 @@ sub run_hook {
[ "insert_after", CTRL_APT_SRC, "Uploaders", "Dm-Upload-Allowed" ],
[ "insert_after", CTRL_PKG_SRC, "Uploaders", "Dm-Upload-Allowed" ],
);
+ } else {
+ return $self->SUPER::run_hook($hook, @params);
}
}
diff --git a/scripts/Dpkg/Vendor/Default.pm b/scripts/Dpkg/Vendor/Default.pm
index 518cd47..72b9af6 100644
--- a/scripts/Dpkg/Vendor/Default.pm
+++ b/scripts/Dpkg/Vendor/Default.pm
@@ -120,6 +120,9 @@ sub run_hook {
my $fields = shift @params;
}
+ # Default return value for unknown/unimplemented hooks
+ return () if wantarray;
+ return undef;
}
=back
diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm
index 545b02e..5f46664 100644
--- a/scripts/Dpkg/Vendor/Ubuntu.pm
+++ b/scripts/Dpkg/Vendor/Ubuntu.pm
@@ -61,9 +61,6 @@ sub run_hook {
}
}
- } elsif ($hook eq "before-changes-creation") {
- my $fields = shift @params;
-
} elsif ($hook eq "keyrings") {
my @keyrings = $self->SUPER::run_hook($hook);
@@ -87,6 +84,9 @@ sub run_hook {
if (scalar(@$bugs)) {
$fields->{"Launchpad-Bugs-Fixed"} = join(" ", @$bugs);
}
+
+ } else {
+ return $self->SUPER::run_hook($hook, @params);
}
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]