@@ -165,8 +165,14 @@ sub _vercmp {
165
165
}
166
166
167
167
sub _has_gpg {
168
- my $gpg = _which_gpg() or return ;
168
+ my %args = (@_ );
169
+ my $gpg = _which_gpg(%args ) or return ;
169
170
` $gpg --version` =~ / GnuPG.*?(\S +)\s *$ /m or return ;
171
+ # This is a workaround for RT#126994 meant to be reverted when no longer
172
+ # needed. Run git blame on this line to find out which commit that is.
173
+ if ($args {gpg1 }) {
174
+ _vercmp($1 , " 1.9.0" ) < 0 or return ;
175
+ }
170
176
return $1 ;
171
177
}
172
178
@@ -245,8 +251,15 @@ my $which_gpg;
245
251
sub _which_gpg {
246
252
# Cache it so we don't need to keep checking.
247
253
return $which_gpg if $which_gpg ;
254
+ my %args = (@_ );
255
+ my @cands ;
256
+ if ($args {gpg1 }) {
257
+ @cands = (' gpg1' , ' gpg' , ' gnupg1' , ' gnupg' );
258
+ } else {
259
+ @cands = (' gpg' , ' gpg2' , ' gnupg' , ' gnupg2' );
260
+ }
248
261
249
- for my $gpg_bin (' gpg ' , ' gpg2 ' , ' gnupg ' , ' gnupg2 ' ) {
262
+ foreach my $gpg_bin (@cands ) {
250
263
my $version = ` $gpg_bin --version 2>&1` ;
251
264
if ( $version && $version =~ / GnuPG/ ) {
252
265
$which_gpg = $gpg_bin ;
@@ -424,7 +437,7 @@ sub sign {
424
437
return unless <STDIN > =~ / [Yy]/ ;
425
438
}
426
439
427
- if (my $version = _has_gpg()) {
440
+ if (my $version = _has_gpg(gpg1 => 1 )) {
428
441
_sign_gpg($SIGNATURE , $plaintext , $version );
429
442
}
430
443
elsif (eval {require Crypt::OpenPGP; 1}) {
@@ -449,7 +462,7 @@ sub _sign_gpg {
449
462
local *D;
450
463
my $set_key = ' ' ;
451
464
$set_key = qq{ --default-key "$AUTHOR "} if ($AUTHOR );
452
- open D, " | $gpg $set_key --clearsign --openpgp --personal-digest-preferences RIPEMD160 >> $sigfile .tmp"
465
+ open D, " | $gpg $set_key --clearsign --openpgp --personal-digest-preferences SHA1 >> $sigfile .tmp"
453
466
or die " Could not call $gpg : $! " ;
454
467
print D $plaintext ;
455
468
close D;
0 commit comments