forked from josch/mmdebstrap
put fh variables into their own scope
This commit is contained in:
parent
62159d124a
commit
d503e4fd96
1 changed files with 34 additions and 27 deletions
19
mmdebstrap
19
mmdebstrap
|
@ -3302,7 +3302,9 @@ sub main() {
|
|||
$gpghome, '--no-auto-check-trustdb',
|
||||
'--trust-model', 'always'
|
||||
);
|
||||
my ($ret, $fh, $message);
|
||||
my ($ret, $message);
|
||||
{
|
||||
my $fh;
|
||||
{
|
||||
# change warning handler to prevent message
|
||||
# Can't exec "gpg": No such file or directory
|
||||
|
@ -3311,6 +3313,7 @@ sub main() {
|
|||
}
|
||||
# we only want to check if the gpg command exists
|
||||
close $fh;
|
||||
}
|
||||
if ($? != 0 || !defined $ret || defined $message) {
|
||||
info "gpg --version failed: cannot determine the right"
|
||||
. " signed-by value";
|
||||
|
@ -3336,6 +3339,7 @@ sub main() {
|
|||
$signedby = " [signed-by=\"$keyring\"]";
|
||||
last;
|
||||
}
|
||||
{
|
||||
open my $fh, '-|', @gpgcmd, @keyringopts, '--with-colons',
|
||||
'--list-keys' // error "failed to fork(): $!";
|
||||
while (my $line = <$fh>) {
|
||||
|
@ -3345,6 +3349,7 @@ sub main() {
|
|||
push @aptfingerprints, $1;
|
||||
}
|
||||
close $fh;
|
||||
}
|
||||
if ($? != 0) {
|
||||
error "gpg failed";
|
||||
}
|
||||
|
@ -3356,21 +3361,23 @@ sub main() {
|
|||
# are known by apt and only add signed-by option if that's not
|
||||
# the case
|
||||
my @suitefingerprints = ();
|
||||
open my $suitefh, '-|', @gpgcmd, '--keyring', $keyring,
|
||||
{
|
||||
open my $fh, '-|', @gpgcmd, '--keyring', $keyring,
|
||||
'--with-colons',
|
||||
'--list-keys' // error "failed to fork(): $!";
|
||||
while (my $line = <$suitefh>) {
|
||||
while (my $line = <$fh>) {
|
||||
if ($line !~ /^fpr:::::::::([^:]+):/) {
|
||||
next;
|
||||
}
|
||||
# if this fingerprint is not known by apt, then we need to
|
||||
# add the signed-by option
|
||||
# if this fingerprint is not known by apt, then we need
|
||||
#to add the signed-by option
|
||||
if (none { $_ eq $1 } @aptfingerprints) {
|
||||
$signedby = " [signed-by=\"$keyring\"]";
|
||||
last;
|
||||
}
|
||||
}
|
||||
close $suitefh;
|
||||
close $fh;
|
||||
}
|
||||
if ($? != 0) {
|
||||
error "gpg failed";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue