Procházet zdrojové kódy

Dpkg::Source::Package: enable exit handlers for the commit operation

The commit function already uses various exit handlers to clean up in case
of failures. Unfortunately those handlers were never triggered because
there was no global eval intercepting the failures. This commit adds the
required logic.
Raphaël Hertzog před 14 roky
rodič
revize
c484882864

+ 9 - 0
scripts/Dpkg/Source/Package.pm

@@ -514,6 +514,15 @@ sub add_file {
 }
 
 sub commit {
+    my $self = shift;
+    eval { $self->do_commit(@_) };
+    if ($@) {
+        &$_() foreach reverse @Dpkg::Exit::handlers;
+        die $@;
+    }
+}
+
+sub do_commit {
     my ($self, $dir) = @_;
     info(_g("'%s' is not supported by the source format '%s'"),
          "dpkg-source --commit", $self->{'fields'}{'Format'});

+ 1 - 1
scripts/Dpkg/Source/Package/V2.pm

@@ -619,7 +619,7 @@ sub register_patch {
     return $patch;
 }
 
-sub commit {
+sub do_commit {
     my ($self, $dir) = @_;
     my ($patch_name, $tmpdiff) = @{$self->{'options'}{'ARGV'}};