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

gpg_requirement: add standalone requirement

GPG 1.x has stopped receiving new features, some of which we may well want to
take advantage of sooner or later in Homebrew. Upstream has also been attempting
to work out for a while how well used it still is which suggests it may "go away"
at some point in the future.

Debian is also in the process of migrating GnuPG 1.x to a `gpg1` executable
whilst GnuPG 2.1.x assumes the `gpg` executable. There's a detailed video
discussion of this from DebConf 2015 at:
http://meetings-archive.debian.net/pub/debian-meetings/2015/debconf15/GnuPG_in_Debian_report.webm

It's unsafe to assume every `gpg` executable is going to forever equal 1.x and
every `gpg2` executable is going to forever equal 2.x. MacGPG2 has been symlinking
2.x as a vanilla `gpg` for a while, for example, and we will be soon as well.

You'll still be able to plonk the `libexec/bin` path of `gpg` in your PATH to
access a vanilla `gpg` 1.x executable if you want to, but we're not going to
actively keep adding gpg1 support to formulae going forwards. There's really no
reason why 99.9% of projects should not or cannot use `gpg2` these days.

This uses detection methods to determine regardless of what the executable
is called we're always hitting a 2.0 GnuPG or nothing.
parent 9515e95a
No related branches found
No related tags found
No related merge requests found
require "requirement"
require "requirements/apr_requirement"
require "requirements/fortran_requirement"
require "requirements/gpg_requirement"
require "requirements/language_module_requirement"
require "requirements/minimum_macos_requirement"
require "requirements/maximum_macos_requirement"
......
require "requirement"
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
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