Skip to content
Snippets Groups Projects
Unverified Commit e62fc26b authored by Dominyk Tiller's avatar Dominyk Tiller
Browse files

gpg_requirement: centralise logic in Gpg class

Removes the detection logic from the Requirement in favour of it living inside
the Gpg class & us calling it from there. It's a bit nicer & avoids us calling
Requirement code from outside of direct requirement handling & fulfillment.
parent 15916338
No related branches found
No related tags found
No related merge requests found
require "requirement"
require "gpg"
class GPGRequirement < Requirement
fatal true
default_formula "gnupg2"
satisfy(:build_env => false) { gpg2 || gpg }
# MacGPG2/GPGTools installs GnuPG 2.0.x as a vanilla `gpg` symlink
# pointing to `gpg2`, as do we. Ensure we're actually using a 2.0 `gpg`.
# Temporarily, only support 2.0.x rather than the 2.1.x "modern" series.
def gpg
which_all("gpg").detect do |gpg|
gpg_short_version = Utils.popen_read(gpg, "--version")[/\d\.\d/, 0]
next unless gpg_short_version
Version.create(gpg_short_version.to_s) == Version.create("2.0")
end
end
def gpg2
which_all("gpg2").detect do |gpg2|
gpg2_short_version = Utils.popen_read(gpg2, "--version")[/\d\.\d/, 0]
next unless gpg2_short_version
Version.create(gpg2_short_version.to_s) == Version.create("2.0")
end
end
satisfy(:build_env => false) { Gpg.gpg2 || Gpg.gpg }
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment