From 522e3b46ee9861f6e1b87124066d716a5b6a6c0c Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 1 May 2019 23:18:34 +0200 Subject: Dpkg::Source::Package: Refactor original tarball handling --- scripts/Dpkg/Source/Package/V1.pm | 8 +++++--- scripts/Dpkg/Source/Package/V2.pm | 32 ++++++++++++++------------------ 2 files changed, 19 insertions(+), 21 deletions(-) (limited to 'scripts') diff --git a/scripts/Dpkg/Source/Package/V1.pm b/scripts/Dpkg/Source/Package/V1.pm index be13750a4..ff683af21 100644 --- a/scripts/Dpkg/Source/Package/V1.pm +++ b/scripts/Dpkg/Source/Package/V1.pm @@ -409,9 +409,11 @@ sub do_build { $sourcepackage, $tarname); } - $self->add_file($tarname) if $tarname; - if ($tarname and -e "$tarname.sig" and not -e "$tarname.asc") { - openpgp_sig_to_asc("$tarname.sig", "$tarname.asc"); + if ($tarname) { + $self->add_file($tarname); + if (-e "$tarname.sig" and not -e "$tarname.asc") { + openpgp_sig_to_asc("$tarname.sig", "$tarname.asc"); + } } if ($tarsign and -e $tarsign) { info(g_('building %s using existing %s'), $sourcepackage, $tarsign); diff --git a/scripts/Dpkg/Source/Package/V2.pm b/scripts/Dpkg/Source/Package/V2.pm index e2c1b49fb..db9bd3e71 100644 --- a/scripts/Dpkg/Source/Package/V2.pm +++ b/scripts/Dpkg/Source/Package/V2.pm @@ -408,26 +408,22 @@ sub _generate_patch { 'one is allowed'), $tarfile, $file); } $tarfile = $file; - push @origtarfiles, $file; - $self->add_file($file); - if (-e "$file.sig" and not -e "$file.asc") { - openpgp_sig_to_asc("$file.sig", "$file.asc"); - } - if (-e "$file.asc") { - push @origtarfiles, "$file.asc"; - $self->add_file("$file.asc") - } } elsif ($file =~ /\.orig-([[:alnum:]-]+)\.tar\.$comp_ext_regex$/) { $addonfile{$1} = $file; - push @origtarfiles, $file; - $self->add_file($file); - if (-e "$file.sig" and not -e "$file.asc") { - openpgp_sig_to_asc("$file.sig", "$file.asc"); - } - if (-e "$file.asc") { - push @origtarfiles, "$file.asc"; - $self->add_file("$file.asc"); - } + } else { + next; + } + + push @origtarfiles, $file; + $self->add_file($file); + + # Check for an upstream signature. + if (-e "$file.sig" and not -e "$file.asc") { + openpgp_sig_to_asc("$file.sig", "$file.asc"); + } + if (-e "$file.asc") { + push @origtarfiles, "$file.asc"; + $self->add_file("$file.asc") } } -- cgit v1.2.3