diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/gpg.rb | 23 | ||||
| -rw-r--r-- | Library/Homebrew/requirements/gpg2_requirement.rb | 6 |
2 files changed, 23 insertions, 6 deletions
diff --git a/Library/Homebrew/gpg.rb b/Library/Homebrew/gpg.rb index f56473df3..de2089dda 100644 --- a/Library/Homebrew/gpg.rb +++ b/Library/Homebrew/gpg.rb @@ -7,8 +7,7 @@ class Gpg next unless gpg_short_version gpg_version = Version.create(gpg_short_version.to_s) @version = gpg_version - gpg_version == Version.create("2.1") || - gpg_version == Version.create("2.0") + gpg_version >= Version.create("2.0") end end @@ -38,12 +37,30 @@ class Gpg Key-Length: 2048 Subkey-Type: RSA Subkey-Length: 2048 - Passphrase: '' Name-Real: Testing Name-Email: testing@foo.bar Expire-Date: 1d + %no-protection %commit EOS system GPG_EXECUTABLE, "--batch", "--gen-key", "batch.gpg" end + + def self.cleanup_test_processes! + odie "No GPG present to test against!" unless available? + gpgconf = Pathname.new(GPG_EXECUTABLE).parent/"gpgconf" + + system gpgconf, "--kill", "gpg-agent" + system gpgconf, "--homedir", "keyrings/live", "--kill", + "gpg-agent" + end + + def self.test(path) + create_test_key(path) + begin + yield + ensure + cleanup_test_processes! + end + end end diff --git a/Library/Homebrew/requirements/gpg2_requirement.rb b/Library/Homebrew/requirements/gpg2_requirement.rb index d570983eb..ebdd71f6e 100644 --- a/Library/Homebrew/requirements/gpg2_requirement.rb +++ b/Library/Homebrew/requirements/gpg2_requirement.rb @@ -5,8 +5,8 @@ class GPG2Requirement < Requirement fatal true default_formula "gnupg" - # GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink - # pointing to `gpg2`. Homebrew install 2.1.x as a non-symlink `gpg`. - # We support both the 2.0.x "stable" and 2.1.x "modern" series here. + # GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing + # to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`. + # The aim is to retain support for any version above 2.0. satisfy(build_env: false) { Gpg.gpg || Gpg.gpg2 } end |
