Mike McQuaid 5cc6722372
Optionally use DownloadQueue for brew install
Allowing using `HOMEBREW_DOWNLOAD_CONCURRENCY` to use the
`DownloadQueue` for `brew install` by downloading and extracting
bottles in parallel.

This requires some fixes in e.g. `Dependency` and `FormulaInstaller`
to be able to front-load all downloads and handle parallelisation of
bottle pouring.

Behaviour without `HOMEBREW_DOWNLOAD_CONCURRENCY` set should be
unchanged.

Attestations are not handled for now and the UI should be improved
before we roll this out to users.

Post-install upgrades are not yet parallelised.

Co-authored-by: Carlo Cabrera <github@carlo.cab>
2025-07-18 15:00:23 +01:00

23 lines
633 B
Ruby

# frozen_string_literal: true
require "download_strategy"
RSpec.describe AbstractDownloadStrategy do
subject(:strategy) { Class.new(described_class).new(url, name, version, **specs) }
let(:specs) { {} }
let(:name) { "foo" }
let(:url) { "https://example.com/foo.tar.gz" }
let(:version) { nil }
let(:args) { %w[foo bar baz] }
specify "#source_modified_time" do
mktmpdir("mtime").cd do
FileUtils.touch "foo", mtime: Time.now - 10
FileUtils.touch "bar", mtime: Time.now - 100
FileUtils.ln_s "not-exist", "baz"
expect(strategy.source_modified_time).to eq(File.mtime("foo"))
end
end
end