diff options
author | Raphaël Hertzog <hertzog@debian.org> | 2009-09-20 12:01:31 +0200 |
---|---|---|
committer | Raphaël Hertzog <hertzog@debian.org> | 2009-09-20 12:06:10 +0200 |
commit | 8c8f3aa28bb001c19a43960568ecdfd6936d3fc6 (patch) | |
tree | 96c5f2308fff6e8bc3c84803069a8ca4b69a71ee /scripts | |
parent | f7a323fc945a1484fabd7a8e639b48b8b5b8124d (diff) | |
download | dpkg-8c8f3aa28bb001c19a43960568ecdfd6936d3fc6.tar.gz |
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Dpkg/Vendor/Debian.pm | 8 | ||||
-rw-r--r-- | scripts/Dpkg/Vendor/Default.pm | 3 | ||||
-rw-r--r-- | scripts/Dpkg/Vendor/Ubuntu.pm | 6 |
3 files changed, 9 insertions, 8 deletions
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 5e4001104..e234b7be9 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 518cd4751..72b9af654 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 545b02ebd..5f46664b0 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); } } |