Skip to content

Commit

Permalink
Merge pull request #997 from MikeMcQuaid/skip_official_tap
Browse files Browse the repository at this point in the history
Only skip unbottled formulae from official taps.
  • Loading branch information
MikeMcQuaid authored Aug 12, 2021
2 parents 0fe4760 + 8f18dc0 commit 699eea1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/bundle/brew_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def formula_to_hash(formula)
bottle_files[:all].present? || bottle_files[Utils::Bottles.tag.to_sym].present?
end
end

\
{
name: formula.name,
desc: formula.desc,
Expand All @@ -177,6 +177,7 @@ def formula_to_hash(formula)
poured_from_bottle?: (poured_from_bottle || false),
bottle: (bottle_hash || false),
bottled_or_disabled: (bottled_or_disabled || false),
official_tap: (formula.tap&.official? || false),
}
end
private_class_method :formula_to_hash
Expand Down
4 changes: 3 additions & 1 deletion lib/bundle/skipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class << self
def skip?(entry, silent: false)
if Hardware::CPU.arm? && !MacOS.version.prerelease? &&
entry.type == :brew && entry.name.exclude?("/") &&
!BrewDumper.formulae_by_full_name(entry.name)[:bottled_or_disabled]
(formula = BrewDumper.formulae_by_full_name(entry.name)) &&
formula[:official_tap] &&
!formula[:bottled_or_disabled]
puts Formatter.warning "Skipping #{entry.name} (no bottle for Apple Silicon)" unless silent
return true
end
Expand Down
10 changes: 8 additions & 2 deletions spec/bundle/brew_dumper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
pinned?: false,
outdated?: false,
bottle_defined?: false,
bottle_disabled?: false)
bottle_disabled?: false,
tap: OpenStruct.new(official?: false))
end
let(:foo_hash) do
{
Expand All @@ -49,6 +50,7 @@
pinned?: false,
poured_from_bottle?: false,
version: nil,
official_tap: false,
}
end
let(:bar) do
Expand All @@ -71,6 +73,7 @@
bottle_defined?: true,
bottle_disabled?: false,
linked_keg: linked_keg,
tap: OpenStruct.new(official?: true),
bottle_hash: {
cellar: ":any",
files: {
Expand Down Expand Up @@ -110,6 +113,7 @@
pinned?: true,
poured_from_bottle?: true,
version: "1.0",
official_tap: true,
}
end
let(:baz) do
Expand All @@ -129,7 +133,8 @@
pinned?: false,
outdated?: false,
bottle_defined?: false,
bottle_disabled?: false)
bottle_disabled?: false,
tap: OpenStruct.new(official?: false))
end
let(:baz_hash) do
{
Expand All @@ -152,6 +157,7 @@
pinned?: false,
poured_from_bottle?: false,
version: nil,
official_tap: false,
}
end

Expand Down
4 changes: 4 additions & 0 deletions spec/stub/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,8 @@ def outdated?
def any_installed_prefix
opt_prefix
end

def tap
OpenStruct.new official?: true
end
end

0 comments on commit 699eea1

Please sign in to comment.