Merge pull request #3279 from sjackman/pull
Support `brew pull --bottle` for taps in organizations other than Homebrew
This commit is contained in:
commit
15096e7289
@ -73,6 +73,8 @@ Metrics/CyclomaticComplexity:
|
|||||||
|
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 324
|
Max: 324
|
||||||
|
# ignore manpage comments
|
||||||
|
IgnoredPatterns: ['#: ']
|
||||||
|
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 222
|
Max: 222
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] <patch-source> [<patch-source>]:
|
#: * `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=`<bintray-org>] [`--test-bot-user=`<test-bot-user>] <patch-source> [<patch-source>]:
|
||||||
#:
|
#:
|
||||||
#: Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
|
#: Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
|
||||||
#: Optionally, installs the formulae changed by the patch.
|
#: Optionally, installs the formulae changed by the patch.
|
||||||
@ -41,6 +41,12 @@
|
|||||||
#:
|
#:
|
||||||
#: If `--warn-on-publish-failure` was passed, do not exit if there's a
|
#: If `--warn-on-publish-failure` was passed, do not exit if there's a
|
||||||
#: failure publishing bottles on Bintray.
|
#: failure publishing bottles on Bintray.
|
||||||
|
#:
|
||||||
|
#: If `--bintray-org=`<bintray-org> is passed, publish at the given Bintray
|
||||||
|
#: organisation.
|
||||||
|
#:
|
||||||
|
#: If `--test-bot-user=`<test-bot-user> is passed, pull the bottle block
|
||||||
|
#: commit from the specified user on GitHub.
|
||||||
|
|
||||||
require "net/http"
|
require "net/http"
|
||||||
require "net/https"
|
require "net/https"
|
||||||
@ -52,6 +58,18 @@ require "tap"
|
|||||||
require "version"
|
require "version"
|
||||||
require "pkg_version"
|
require "pkg_version"
|
||||||
|
|
||||||
|
module GitHub
|
||||||
|
module_function
|
||||||
|
|
||||||
|
# Return the corresponding test-bot user name for the given GitHub organization.
|
||||||
|
def test_bot_user(user)
|
||||||
|
test_bot = ARGV.value "test-bot-user"
|
||||||
|
return test_bot if test_bot
|
||||||
|
return "BrewTestBot" if user.casecmp("homebrew").zero?
|
||||||
|
"#{user.capitalize}TestBot"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
@ -225,7 +243,7 @@ module Homebrew
|
|||||||
url
|
url
|
||||||
else
|
else
|
||||||
bottle_branch = "pull-bottle-#{issue}"
|
bottle_branch = "pull-bottle-#{issue}"
|
||||||
"https://github.com/BrewTestBot/homebrew-#{tap.repo}/compare/homebrew:master...pr-#{issue}"
|
"https://github.com/#{GitHub.test_bot_user user}/homebrew-#{tap.repo}/compare/#{user}:master...pr-#{issue}"
|
||||||
end
|
end
|
||||||
|
|
||||||
curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url
|
curl "--silent", "--fail", "--output", "/dev/null", "--head", bottle_commit_url
|
||||||
@ -257,7 +275,7 @@ module Homebrew
|
|||||||
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
str.force_encoding("UTF-8") if str.respond_to?(:force_encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def publish_changed_formula_bottles(_tap, changed_formulae_names)
|
def publish_changed_formula_bottles(tap, changed_formulae_names)
|
||||||
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"]
|
||||||
raise "Need to load formulae to publish them!"
|
raise "Need to load formulae to publish them!"
|
||||||
end
|
end
|
||||||
@ -268,7 +286,8 @@ module Homebrew
|
|||||||
changed_formulae_names.each do |name|
|
changed_formulae_names.each do |name|
|
||||||
f = Formula[name]
|
f = Formula[name]
|
||||||
next if f.bottle_unneeded? || f.bottle_disabled?
|
next if f.bottle_unneeded? || f.bottle_disabled?
|
||||||
next unless publish_bottle_file_on_bintray(f, bintray_creds)
|
bintray_org = ARGV.value("bintray-org") || tap.user.downcase
|
||||||
|
next unless publish_bottle_file_on_bintray(f, bintray_org, bintray_creds)
|
||||||
published << f.full_name
|
published << f.full_name
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -420,7 +439,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Publishes the current bottle files for a given formula to Bintray
|
# Publishes the current bottle files for a given formula to Bintray
|
||||||
def publish_bottle_file_on_bintray(f, creds)
|
def publish_bottle_file_on_bintray(f, bintray_org, creds)
|
||||||
repo = Utils::Bottles::Bintray.repository(f.tap)
|
repo = Utils::Bottles::Bintray.repository(f.tap)
|
||||||
package = Utils::Bottles::Bintray.package(f.name)
|
package = Utils::Bottles::Bintray.package(f.name)
|
||||||
info = FormulaInfoFromJson.lookup(f.name)
|
info = FormulaInfoFromJson.lookup(f.name)
|
||||||
@ -437,7 +456,7 @@ module Homebrew
|
|||||||
"--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST",
|
"--user", "#{creds[:user]}:#{creds[:key]}", "--request", "POST",
|
||||||
"--header", "Content-Type: application/json",
|
"--header", "Content-Type: application/json",
|
||||||
"--data", '{"publish_wait_for_secs": 0}',
|
"--data", '{"publish_wait_for_secs": 0}',
|
||||||
"https://api.bintray.com/content/homebrew/#{repo}/#{package}/#{version}/publish"
|
"https://api.bintray.com/content/#{bintray_org}/#{repo}/#{package}/#{version}/publish"
|
||||||
true
|
true
|
||||||
rescue => e
|
rescue => e
|
||||||
raise unless ARGV.include?("--warn-on-publish-failure")
|
raise unless ARGV.include?("--warn-on-publish-failure")
|
||||||
|
|||||||
@ -770,7 +770,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
Additionally, the date used in new manpages will match those in the existing
|
Additionally, the date used in new manpages will match those in the existing
|
||||||
manpages (to allow comparison without factoring in the date).
|
manpages (to allow comparison without factoring in the date).
|
||||||
|
|
||||||
* `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] `patch-source` [`patch-source`]:
|
* `pull` [`--bottle`] [`--bump`] [`--clean`] [`--ignore-whitespace`] [`--resolve`] [`--branch-okay`] [`--no-pbcopy`] [`--no-publish`] [`--warn-on-publish-failure`] [`--bintray-org=``bintray-org`] [`--test-bot-user=``test-bot-user`] `patch-source` [`patch-source`]:
|
||||||
|
|
||||||
Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
|
Gets a patch from a GitHub commit or pull request and applies it to Homebrew.
|
||||||
Optionally, installs the formulae changed by the patch.
|
Optionally, installs the formulae changed by the patch.
|
||||||
@ -814,6 +814,12 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
|
|||||||
If `--warn-on-publish-failure` was passed, do not exit if there's a
|
If `--warn-on-publish-failure` was passed, do not exit if there's a
|
||||||
failure publishing bottles on Bintray.
|
failure publishing bottles on Bintray.
|
||||||
|
|
||||||
|
If `--bintray-org=``bintray-org` is passed, publish at the given Bintray
|
||||||
|
organisation.
|
||||||
|
|
||||||
|
If `--test-bot-user=``test-bot-user` is passed, pull the bottle block
|
||||||
|
commit from the specified user on GitHub.
|
||||||
|
|
||||||
* `release-notes` [`--markdown`] [`previous_tag`] [`end_ref`]:
|
* `release-notes` [`--markdown`] [`previous_tag`] [`end_ref`]:
|
||||||
Output the merged pull requests on Homebrew/brew between two Git refs.
|
Output the merged pull requests on Homebrew/brew between two Git refs.
|
||||||
If no `previous_tag` is provided it defaults to the newest tag.
|
If no `previous_tag` is provided it defaults to the newest tag.
|
||||||
|
|||||||
@ -797,7 +797,7 @@ Generate Homebrew\'s manpages\.
|
|||||||
If \fB\-\-fail\-if\-changed\fR is passed, the command will return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date)\.
|
If \fB\-\-fail\-if\-changed\fR is passed, the command will return a failing status code if changes are detected in the manpage outputs\. This can be used for CI to be notified when the manpages are out of date\. Additionally, the date used in new manpages will match those in the existing manpages (to allow comparison without factoring in the date)\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] [\fB\-\-warn\-on\-publish\-failure\fR] \fIpatch\-source\fR [\fIpatch\-source\fR]:
|
\fBpull\fR [\fB\-\-bottle\fR] [\fB\-\-bump\fR] [\fB\-\-clean\fR] [\fB\-\-ignore\-whitespace\fR] [\fB\-\-resolve\fR] [\fB\-\-branch\-okay\fR] [\fB\-\-no\-pbcopy\fR] [\fB\-\-no\-publish\fR] [\fB\-\-warn\-on\-publish\-failure\fR] [\fB\-\-bintray\-org=\fR\fIbintray\-org\fR] [\fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR] \fIpatch\-source\fR [\fIpatch\-source\fR]:
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\.
|
Gets a patch from a GitHub commit or pull request and applies it to Homebrew\. Optionally, installs the formulae changed by the patch\.
|
||||||
@ -844,6 +844,12 @@ If \fB\-\-no\-publish\fR is passed, do not publish bottles to Bintray\.
|
|||||||
.IP
|
.IP
|
||||||
If \fB\-\-warn\-on\-publish\-failure\fR was passed, do not exit if there\'s a failure publishing bottles on Bintray\.
|
If \fB\-\-warn\-on\-publish\-failure\fR was passed, do not exit if there\'s a failure publishing bottles on Bintray\.
|
||||||
.
|
.
|
||||||
|
.IP
|
||||||
|
If \fB\-\-bintray\-org=\fR\fIbintray\-org\fR is passed, publish at the given Bintray organisation\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
If \fB\-\-test\-bot\-user=\fR\fItest\-bot\-user\fR is passed, pull the bottle block commit from the specified user on GitHub\.
|
||||||
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]
|
\fBrelease\-notes\fR [\fB\-\-markdown\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]
|
||||||
Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the newest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\.
|
Output the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the newest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user