Explorar o código

Dpkg::Changelog: add new vendor hook post-process-changelog-entry

This hook is mainly meant to extract more structured information
from the raw changes information.
Raphaël Hertzog %!s(int64=17) %!d(string=hai) anos
pai
achega
88a0baff55
Modificáronse 2 ficheiros con 13 adicións e 0 borrados
  1. 4 0
      scripts/Dpkg/Changelog.pm
  2. 9 0
      scripts/Dpkg/Vendor/Default.pm

+ 4 - 0
scripts/Dpkg/Changelog.pm

@@ -43,6 +43,7 @@ use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(:DEFAULT report);
 use Dpkg::Control;
 use Dpkg::Version qw(compare_versions);
+use Dpkg::Vendor qw(run_vendor_hook);
 
 use base qw(Exporter);
 
@@ -553,6 +554,7 @@ sub dpkg {
 
     $f->{Closes} = join " ", sort { $a <=> $b } @{$f->{Closes}};
     $f->{Urgency} .= $urg_comment;
+    run_vendor_hook("post-process-changelog-entry", $f);
 
     return %$f if wantarray;
     return $f;
@@ -611,6 +613,8 @@ sub rfc822 {
 	    $f->{$field} = $entry->{$field};
 	}
 
+        run_vendor_hook("post-process-changelog-entry", $f);
+
 	push @out_data, $f;
     }
 

+ 9 - 0
scripts/Dpkg/Vendor/Default.pm

@@ -96,6 +96,12 @@ function.
 
 Known operations are "register", "insert_after" and "insert_before".
 
+=item post-process-changelog-entry ($fields)
+
+The hook is called in Dpkg::Changelog to post-process a
+Dpkg::Changelog::Entry after it has been created and filled with the
+appropriate values.
+
 =back
 
 =cut
@@ -111,7 +117,10 @@ sub run_hook {
         return ();
     } elsif ($hook eq "register-custom-fields") {
         return ();
+    } elsif ($hook eq "post-process-changelog-entry") {
+        my $fields = shift @params;
     }
+
 }
 
 =back