Merge pull request #3350 from DomT4/gpg_executable

gpg: a little intentional yak shaving
This commit is contained in:
Mike McQuaid 2017-10-22 19:48:57 +01:00 committed by GitHub
commit 357b7bb0b7
2 changed files with 6 additions and 12 deletions

View File

@ -11,18 +11,12 @@ class Gpg
end end
end end
def self.gpg def self.executable
find_gpg("gpg") find_gpg("gpg") || find_gpg("gpg2")
end end
def self.gpg2
find_gpg("gpg2")
end
GPG_EXECUTABLE = gpg || gpg2
def self.available? def self.available?
File.executable?(GPG_EXECUTABLE.to_s) File.executable?(executable.to_s)
end end
def self.version def self.version
@ -43,12 +37,12 @@ class Gpg
%no-protection %no-protection
%commit %commit
EOS EOS
system GPG_EXECUTABLE, "--batch", "--gen-key", "batch.gpg" system executable, "--batch", "--gen-key", "batch.gpg"
end end
def self.cleanup_test_processes! def self.cleanup_test_processes!
odie "No GPG present to test against!" unless available? odie "No GPG present to test against!" unless available?
gpgconf = Pathname.new(GPG_EXECUTABLE).parent/"gpgconf" gpgconf = Pathname.new(executable).parent/"gpgconf"
system gpgconf, "--kill", "gpg-agent" system gpgconf, "--kill", "gpg-agent"
system gpgconf, "--homedir", "keyrings/live", "--kill", system gpgconf, "--homedir", "keyrings/live", "--kill",

View File

@ -8,5 +8,5 @@ class GPG2Requirement < Requirement
# GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing # GPGTools installs GnuPG 2.0.x as a `gpg` symlink pointing
# to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`. # to `gpg2`. Our `gnupg` installs only a non-symlink `gpg`.
# The aim is to retain support for any version above 2.0. # The aim is to retain support for any version above 2.0.
satisfy(build_env: false) { Gpg.gpg || Gpg.gpg2 } satisfy(build_env: false) { Gpg.available? }
end end