* scripts/Dpkg/Source/Package.pm (extract, build): Change those methods
to delegate the real work to do_extract() and do_build() and catch
critical failures to clean up any temporary files/directories before
re-raising the error.
* scripts/Dpkg/Source/Package/V1_0.pm: Rename build() into do_build()
and extract() into do_extract().
use Dpkg::Version qw(parseversion);
use Dpkg::Deps qw(@src_dep_fields);
use Dpkg::Compression;
+use Dpkg::Exit;
use File::Basename;
}
sub extract {
+ my $self = shift;
+ eval { $self->do_extract(@_) };
+ if ($@) {
+ &$_() foreach reverse @Dpkg::Exit::handlers;
+ die $@;
+ }
+}
+
+sub do_extract {
error("Dpkg::Source::Package doesn't know how to unpack a source package. Use one of the subclass.");
}
# Function used specifically during creation of a source package
sub build {
+ my $self = shift;
+ eval { $self->do_build(@_) };
+ if ($@) {
+ &$_() foreach reverse @Dpkg::Exit::handlers;
+ die $@;
+ }
+}
+
+sub do_build {
error("Dpkg::Source::Package doesn't know how to build a source package. Use one of the subclass.");
}
use File::Basename;
use File::Temp qw(tempfile);
-sub extract {
+sub do_extract {
my ($self, $newdirectory) = @_;
my $sourcestyle = $self->{'options'}{'sourcestyle'};
my $fields = $self->{'fields'};
}
}
-sub build {
+sub do_build {
my ($self, $dir) = @_;
my $sourcestyle = $self->{'options'}{'sourcestyle'};
my @argv = @{$self->{'options'}{'ARGV'}};