-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Optionally use download_queue
for brew install
#20245
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -44,6 +44,9 @@ class FormulaInstaller | |||||||||||||||||||||||||||||
sig { returns(T::Boolean) } | ||||||||||||||||||||||||||||||
attr_accessor :link_keg | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { returns(T.nilable(Homebrew::DownloadQueue)) } | ||||||||||||||||||||||||||||||
attr_accessor :download_queue | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { | ||||||||||||||||||||||||||||||
params( | ||||||||||||||||||||||||||||||
formula: Formula, | ||||||||||||||||||||||||||||||
|
@@ -136,9 +139,12 @@ def initialize( | |||||||||||||||||||||||||||||
@hold_locks = T.let(false, T::Boolean) | ||||||||||||||||||||||||||||||
@show_summary_heading = T.let(false, T::Boolean) | ||||||||||||||||||||||||||||||
@etc_var_preinstall = T.let([], T::Array[Pathname]) | ||||||||||||||||||||||||||||||
@download_queue = T.let(nil, T.nilable(Homebrew::DownloadQueue)) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# Take the original formula instance, which might have been swapped from an API instance to a source instance | ||||||||||||||||||||||||||||||
@formula = T.let(T.must(previously_fetched_formula), Formula) if previously_fetched_formula | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
@ran_prelude_fetch = T.let(false, T::Boolean) | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { returns(T::Boolean) } | ||||||||||||||||||||||||||||||
|
@@ -294,7 +300,7 @@ def install_bottle_for?(dep, build) | |||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { void } | ||||||||||||||||||||||||||||||
def prelude | ||||||||||||||||||||||||||||||
def prelude_fetch | ||||||||||||||||||||||||||||||
deprecate_disable_type = DeprecateDisable.type(formula) | ||||||||||||||||||||||||||||||
if deprecate_disable_type.present? | ||||||||||||||||||||||||||||||
message = "#{formula.full_name} has been #{DeprecateDisable.message(formula)}" | ||||||||||||||||||||||||||||||
|
@@ -312,8 +318,24 @@ def prelude | |||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# Needs to be done before expand_dependencies for compute_dependencies | ||||||||||||||||||||||||||||||
fetch_bottle_tab if pour_bottle? | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
@ran_prelude_fetch = true | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { void } | ||||||||||||||||||||||||||||||
def prelude | ||||||||||||||||||||||||||||||
prelude_fetch unless @ran_prelude_fetch | ||||||||||||||||||||||||||||||
MikeMcQuaid marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Tab.clear_cache | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# Setup bottle_tab_runtime_dependencies for compute_dependencies | ||||||||||||||||||||||||||||||
@bottle_tab_runtime_dependencies = formula.bottle_tab_attributes | ||||||||||||||||||||||||||||||
.fetch("runtime_dependencies", []).then { |deps| deps || [] } | ||||||||||||||||||||||||||||||
.each_with_object({}) { |dep, h| h[dep["full_name"]] = dep } | ||||||||||||||||||||||||||||||
.freeze | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
verify_deps_exist unless ignore_deps? | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
forbidden_license_check | ||||||||||||||||||||||||||||||
|
@@ -778,13 +800,15 @@ def install_dependencies(deps) | |||||||||||||||||||||||||||||
if deps.empty? && only_deps? | ||||||||||||||||||||||||||||||
puts "All dependencies for #{formula.full_name} are satisfied." | ||||||||||||||||||||||||||||||
elsif !deps.empty? | ||||||||||||||||||||||||||||||
oh1 "Installing dependencies for #{formula.full_name}: " \ | ||||||||||||||||||||||||||||||
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}", | ||||||||||||||||||||||||||||||
truncate: false | ||||||||||||||||||||||||||||||
if deps.length > 1 | ||||||||||||||||||||||||||||||
oh1 "Installing dependencies for #{formula.full_name}: " \ | ||||||||||||||||||||||||||||||
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}", | ||||||||||||||||||||||||||||||
truncate: false | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
deps.each { |dep, options| install_dependency(dep, options) } | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
@show_header = true unless deps.empty? | ||||||||||||||||||||||||||||||
@show_header = true if deps.length > 1 | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
sig { params(dep: Dependency).void } | ||||||||||||||||||||||||||||||
|
@@ -808,6 +832,7 @@ def fetch_dependency(dep) | |||||||||||||||||||||||||||||
quiet: quiet?, | ||||||||||||||||||||||||||||||
verbose: verbose?, | ||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||
fi.download_queue = download_queue | ||||||||||||||||||||||||||||||
fi.prelude | ||||||||||||||||||||||||||||||
fi.fetch | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
@@ -830,7 +855,7 @@ def install_dependency(dep, inherited_options) | |||||||||||||||||||||||||||||
installed_keg = Keg.new(df.prefix) | ||||||||||||||||||||||||||||||
tab ||= installed_keg.tab | ||||||||||||||||||||||||||||||
tmp_keg = Pathname.new("#{installed_keg}.tmp") | ||||||||||||||||||||||||||||||
installed_keg.rename(tmp_keg) | ||||||||||||||||||||||||||||||
installed_keg.rename(tmp_keg) unless tmp_keg.directory? | ||||||||||||||||||||||||||||||
MikeMcQuaid marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
if df.tap.present? && tab.present? && (tab_tap = tab.source["tap"].presence) && | ||||||||||||||||||||||||||||||
|
@@ -867,6 +892,7 @@ def install_dependency(dep, inherited_options) | |||||||||||||||||||||||||||||
verbose: verbose?, | ||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||
oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}" | ||||||||||||||||||||||||||||||
fi.prelude | ||||||||||||||||||||||||||||||
fi.install | ||||||||||||||||||||||||||||||
fi.finish | ||||||||||||||||||||||||||||||
# Handle all possible exceptions installing deps. | ||||||||||||||||||||||||||||||
|
@@ -1337,9 +1363,13 @@ def fetch_dependencies | |||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
return if deps.empty? | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
oh1 "Fetching dependencies for #{formula.full_name}: " \ | ||||||||||||||||||||||||||||||
"#{deps.map(&:first).map { Formatter.identifier(_1) }.to_sentence}", | ||||||||||||||||||||||||||||||
truncate: false | ||||||||||||||||||||||||||||||
unless download_queue | ||||||||||||||||||||||||||||||
dependencies_string = deps.map(&:first) | ||||||||||||||||||||||||||||||
.map { Formatter.identifier(_1) } | ||||||||||||||||||||||||||||||
.to_sentence | ||||||||||||||||||||||||||||||
oh1 "Fetching dependencies for #{formula.full_name}: #{dependencies_string}", | ||||||||||||||||||||||||||||||
truncate: false | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
deps.each { |(dep, _options)| fetch_dependency(dep) } | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
@@ -1360,15 +1390,18 @@ def previously_fetched_formula | |||||||||||||||||||||||||||||
def fetch_bottle_tab(quiet: false) | ||||||||||||||||||||||||||||||
return if @fetch_bottle_tab | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
begin | ||||||||||||||||||||||||||||||
formula.fetch_bottle_tab(quiet: quiet) | ||||||||||||||||||||||||||||||
@bottle_tab_runtime_dependencies = formula.bottle_tab_attributes | ||||||||||||||||||||||||||||||
.fetch("runtime_dependencies", []).then { |deps| deps || [] } | ||||||||||||||||||||||||||||||
.each_with_object({}) { |dep, h| h[dep["full_name"]] = dep } | ||||||||||||||||||||||||||||||
.freeze | ||||||||||||||||||||||||||||||
rescue DownloadError, Resource::BottleManifest::Error | ||||||||||||||||||||||||||||||
# do nothing | ||||||||||||||||||||||||||||||
if (download_queue = self.download_queue) && | ||||||||||||||||||||||||||||||
(bottle = formula.bottle) && | ||||||||||||||||||||||||||||||
(manifest_resource = bottle.github_packages_manifest_resource) | ||||||||||||||||||||||||||||||
download_queue.enqueue(manifest_resource) | ||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||
begin | ||||||||||||||||||||||||||||||
formula.fetch_bottle_tab(quiet: quiet) | ||||||||||||||||||||||||||||||
rescue DownloadError, Resource::BottleManifest::Error | ||||||||||||||||||||||||||||||
# do nothing | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
Comment on lines
+1393
to
1403
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to incorporate the retry logic in brew/Library/Homebrew/bottle.rb Lines 123 to 132 in e804860
fetch_bottle_tab anymore. Perhaps by some custom callbacks from the queue or something
The final There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see where that PR changes this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bo98 This is triggering a manual retry on bottle manifest download errors. That PR is automatically triggering a manual retry on any bottle manifest errors under the download queue. Do you mean this logic needs reincorporated for the non-download queue case and that's missing/changed and still needs resolved beyond #20282? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh right I see what you mean - I misunderstood there. We do however also need a retry (with a brew/Library/Homebrew/resource.rb Lines 316 to 319 in 6261551
Try modify a locally-cached manifest to e.g. remove all arm64 bottles and see if that works as a reproducer. (I've not retested this after the changes yet.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bo98 gotcha, thanks, on it (and holding release on it) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Bo98 Not blocking release but working on a fix for this as it only affects download queue case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
@fetch_bottle_tab = T.let(true, T.nilable(TrueClass)) | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
|
@@ -1381,7 +1414,7 @@ def fetch | |||||||||||||||||||||||||||||
return if only_deps? | ||||||||||||||||||||||||||||||
return if formula.local_bottle_path.present? | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
oh1 "Fetching #{Formatter.identifier(formula.full_name)}".strip | ||||||||||||||||||||||||||||||
oh1 "Fetching #{Formatter.identifier(formula.full_name)}".strip unless download_queue | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
downloadable_object = downloadable | ||||||||||||||||||||||||||||||
check_attestation = if pour_bottle?(output_warning: true) | ||||||||||||||||||||||||||||||
|
@@ -1391,19 +1424,31 @@ def fetch | |||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||
@formula = Homebrew::API::Formula.source_download(formula) if formula.loaded_from_api? | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
formula.fetch_patches | ||||||||||||||||||||||||||||||
formula.resources.each(&:fetch) | ||||||||||||||||||||||||||||||
if (download_queue = self.download_queue) | ||||||||||||||||||||||||||||||
formula.enqueue_resources_and_patches(download_queue:) | ||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||
formula.fetch_patches | ||||||||||||||||||||||||||||||
formula.resources.each(&:fetch) | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
downloadable_object = downloadable | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
false | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
downloadable_object.fetch | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
if (download_queue = self.download_queue) | ||||||||||||||||||||||||||||||
download_queue.enqueue(downloadable_object) | ||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||
downloadable_object.fetch | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
# We skip `gh` to avoid a bootstrapping cycle, in the off-chance a user attempts | ||||||||||||||||||||||||||||||
# to explicitly `brew install gh` without already having a version for bootstrapping. | ||||||||||||||||||||||||||||||
# We also skip bottle installs from local bottle paths, as these are done in CI | ||||||||||||||||||||||||||||||
# as part of the build lifecycle before attestations are produced. | ||||||||||||||||||||||||||||||
if check_attestation && | ||||||||||||||||||||||||||||||
# TODO: support this for download queues at some point | ||||||||||||||||||||||||||||||
download_queue.nil? && | ||||||||||||||||||||||||||||||
Homebrew::Attestation.enabled? && | ||||||||||||||||||||||||||||||
formula.tap&.core_tap? && | ||||||||||||||||||||||||||||||
formula.name != "gh" | ||||||||||||||||||||||||||||||
|
@@ -1489,7 +1534,10 @@ def downloadable | |||||||||||||||||||||||||||||
sig { void } | ||||||||||||||||||||||||||||||
def pour | ||||||||||||||||||||||||||||||
HOMEBREW_CELLAR.cd do | ||||||||||||||||||||||||||||||
downloadable.downloader.stage | ||||||||||||||||||||||||||||||
# download queue has already done the actual staging but we'll lie about | ||||||||||||||||||||||||||||||
# pouring now for nicer output | ||||||||||||||||||||||||||||||
ohai "Pouring #{downloadable.downloader.basename}" | ||||||||||||||||||||||||||||||
downloadable.downloader.stage unless download_queue | ||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
Tab.clear_cache | ||||||||||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.