Просмотр исходного кода

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 лет назад: 14
Родитель
Сommit
c484882864
2 измененных файлов с 10 добавлено и 1 удалено
  1. 9 0
      scripts/Dpkg/Source/Package.pm
  2. 1 1
      scripts/Dpkg/Source/Package/V2.pm

+ 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'}};