summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--scripts/Dpkg/Control/HashCore.pm6
-rw-r--r--scripts/Dpkg/Source/Package.pm10
3 files changed, 5 insertions, 12 deletions
diff --git a/debian/changelog b/debian/changelog
index 193cf7a27..7f52af054 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -140,6 +140,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
which might be problematic when cross-compiling. Closes: #698881
* Only apply empy line and comma cleanups when doing substvar replacements
on fields where those are relevant. Closes: #659814
+ * Do not scan control files twice for PGP signature presence.
[ Raphaƫl Hertzog ]
* Fix dpkg-maintscript-helper rm_conffile and mv_conffile to do nothing
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm
index 236e111b4..51cfc5a33 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -105,6 +105,7 @@ sub new {
my $self = \{
in_order => [],
out_order => [],
+ is_pgp_signed => 0,
allow_pgp => 0,
allow_duplicate => 0,
drop_empty => 0,
@@ -172,7 +173,6 @@ sub parse {
my $parabody = 0;
my $cf; # Current field
my $expect_pgp_sig = 0;
- my $pgp_signed = 0;
while (<$fh>) {
s/\s*\n$//;
@@ -229,7 +229,7 @@ sub parse {
}
# This does not mean the signature is correct, that needs to
# be verified by gnupg.
- $pgp_signed = 1;
+ $$self->{is_pgp_signed} = 1;
}
last; # Finished parsing one block
} else {
@@ -238,7 +238,7 @@ sub parse {
}
}
- if ($expect_pgp_sig and not $pgp_signed) {
+ if ($expect_pgp_sig and not $$self->{is_pgp_signed}) {
syntaxerr($desc, _g('unfinished PGP signature'));
}
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 0d510fbad..3472f4463 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -189,19 +189,11 @@ sub initialize {
$self->{basedir} = $dir || './';
$self->{filename} = $fn;
- # Check if it contains a signature
- open(my $dsc_fh, '<', $filename) || syserr(_g('cannot open %s'), $filename);
- $self->{is_signed} = 0;
- while (<$dsc_fh>) {
- next if /^\s*$/o;
- $self->{is_signed} = 1 if /^-----BEGIN PGP SIGNED MESSAGE-----\s*$/o;
- last;
- }
- close($dsc_fh);
# Read the fields
my $fields = Dpkg::Control->new(type => CTRL_PKG_SRC);
$fields->load($filename);
$self->{fields} = $fields;
+ $self->{is_signed} = $fields->get_option('is_pgp_signed');
foreach my $f (qw(Source Version Files)) {
unless (defined($fields->{$f})) {