Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpg: tweaks #3098

Merged
merged 4 commits into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 20 additions & 3 deletions Library/Homebrew/gpg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ def self.find_gpg(executable)
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

Expand Down Expand Up @@ -38,12 +37,30 @@ def self.create_test_key(path)
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Passphrase: ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think this was just added; does %no-protection do the same thing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye.

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
6 changes: 3 additions & 3 deletions Library/Homebrew/requirements/gpg2_requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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