diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3271c22bf3..5c4549a3cb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -198,9 +198,9 @@ jobs: labels: ${{ needs.generate-tags.outputs.labels }} - name: Run brew test-bot --only-setup - # TODO: Remove this conditional when `brew doctor` no longer throws an error on ARM64 Linux. - if: matrix.arch == 'x86_64' - run: docker run --rm brew brew test-bot --only-setup + run: docker run --env HOMEBREW_ARM64_TESTING --rm brew brew test-bot --only-setup + env: + HOMEBREW_ARM64_TESTING: 1 - name: Log in to GitHub Packages (BrewTestBot) if: fromJSON(steps.attributes.outputs.push) diff --git a/Dockerfile b/Dockerfile index 64ce1a2019..8286aa9625 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu # shellcheck disable=SC1091,SC2154,SC2292 RUN apt-get update \ && apt-get install -y --no-install-recommends software-properties-common gnupg-agent \ - && add-apt-repository -y ppa:git-core/ppa \ + && if [ "$(uname -m)" != aarch64 ]; then add-apt-repository -y ppa:git-core/ppa; fi \ && apt-get update \ && apt-get install -y --no-install-recommends \ acl \ diff --git a/Library/Homebrew/bottle_specification.rb b/Library/Homebrew/bottle_specification.rb index 1984a3c64e..eab4311ac2 100644 --- a/Library/Homebrew/bottle_specification.rb +++ b/Library/Homebrew/bottle_specification.rb @@ -118,11 +118,12 @@ class BottleSpecification tags = collector.tags.sort_by do |tag| version = tag.to_macos_version # Give `arm64` bottles a higher priority so they are first. - priority = (tag.arch == :arm64) ? 2 : 1 + priority = (tag.arch == :arm64) ? 3 : 2 "#{priority}.#{version}_#{tag}" rescue MacOSVersion::Error - # Sort non-macOS tags below macOS tags. - "0.#{tag}" + # Sort non-macOS tags below macOS tags, and arm64 tags before other tags. + priority = (tag.arch == :arm64) ? 1 : 0 + "#{priority}.#{tag}" end tags.reverse.map do |tag| spec = collector.specification_for(tag) diff --git a/Library/Homebrew/extend/os/linux/diagnostic.rb b/Library/Homebrew/extend/os/linux/diagnostic.rb index 2aad96cc0c..b3d0e5a510 100644 --- a/Library/Homebrew/extend/os/linux/diagnostic.rb +++ b/Library/Homebrew/extend/os/linux/diagnostic.rb @@ -143,7 +143,14 @@ module OS return if gcc_dependents.empty? badly_linked = gcc_dependents.select do |dependent| - keg = Keg.new(dependent.prefix) + dependent_prefix = dependent.any_installed_prefix + # Keg.new() may raise an error if it is not a directory. + # As the result `brew doctor` may display `Error: is not a directory` + # instead of proper `doctor` information. + # There are other checks that test that, we can skip broken kegs. + next if dependent_prefix.nil? || !dependent_prefix.exist? || !dependent_prefix.directory? + + keg = Keg.new(dependent_prefix) keg.binary_executable_or_library_files.any? do |binary| paths = binary.rpaths versioned_linkage = paths.any? { |path| path.match?(%r{lib/gcc/\d+$}) } diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index c23a06e824..b5c81ee078 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -98,7 +98,7 @@ module Hardware when 0x11 :amd_k8_k10_hybrid when 0x12 - :amd_k12 + :amd_k10_llano when 0x14 :bobcat when 0x15 diff --git a/Library/Homebrew/rubocops/bottle.rb b/Library/Homebrew/rubocops/bottle.rb index e6de4adc11..866decd520 100644 --- a/Library/Homebrew/rubocops/bottle.rb +++ b/Library/Homebrew/rubocops/bottle.rb @@ -149,26 +149,35 @@ module RuboCop end end - arm64_nodes = [] - intel_nodes = [] + arm64_macos_nodes = [] + intel_macos_nodes = [] + arm64_linux_nodes = [] + intel_linux_nodes = [] sha256_nodes.each do |node| version = sha256_bottle_tag node - if version.to_s.start_with? "arm64" - arm64_nodes << node + if version == :arm64_linux + arm64_linux_nodes << node + elsif version.to_s.start_with?("arm64") + arm64_macos_nodes << node + elsif version.to_s.end_with?("_linux") + intel_linux_nodes << node else - intel_nodes << node + intel_macos_nodes << node end end - return if sha256_order(sha256_nodes) == sha256_order(arm64_nodes + intel_nodes) + sorted_nodes = arm64_macos_nodes + intel_macos_nodes + arm64_linux_nodes + intel_linux_nodes + return if sha256_order(sha256_nodes) == sha256_order(sorted_nodes) offending_node(bottle_node) problem "ARM bottles should be listed before Intel bottles" do |corrector| lines = ["bottle do"] lines += non_sha256_nodes.map { |node| " #{node.source}" } - lines += arm64_nodes.map { |node| " #{node.source}" } - lines += intel_nodes.map { |node| " #{node.source}" } + lines += arm64_macos_nodes.map { |node| " #{node.source}" } + lines += intel_macos_nodes.map { |node| " #{node.source}" } + lines += arm64_linux_nodes.map { |node| " #{node.source}" } + lines += intel_linux_nodes.map { |node| " #{node.source}" } lines << " end" corrector.replace(bottle_node.source_range, lines.join("\n")) end diff --git a/Library/Homebrew/test/hardware/cpu_spec.rb b/Library/Homebrew/test/hardware/cpu_spec.rb index 465d09ea53..6bf63294d2 100644 --- a/Library/Homebrew/test/hardware/cpu_spec.rb +++ b/Library/Homebrew/test/hardware/cpu_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Hardware::CPU do :amd_k8, :amd_k8_k10_hybrid, :amd_k10, - :amd_k12, + :amd_k10_llano, :arm, :arm_blizzard_avalanche, :arm_brava, diff --git a/Library/Homebrew/test/support/fixtures/test.dmg.gz b/Library/Homebrew/test/support/fixtures/test.dmg.gz index 887cb330d1..9d000cfb14 100644 Binary files a/Library/Homebrew/test/support/fixtures/test.dmg.gz and b/Library/Homebrew/test/support/fixtures/test.dmg.gz differ diff --git a/Library/Homebrew/unpack_strategy/dmg.rb b/Library/Homebrew/unpack_strategy/dmg.rb index f6969fb7cf..b12a5ab2c9 100644 --- a/Library/Homebrew/unpack_strategy/dmg.rb +++ b/Library/Homebrew/unpack_strategy/dmg.rb @@ -14,18 +14,20 @@ module UnpackStrategy module Bom extend SystemCommand::Mixin - DMG_METADATA = T.let(Set.new(%w[ - .background - .com.apple.timemachine.donotpresent - .com.apple.timemachine.supported - .DocumentRevisions-V100 - .DS_Store - .fseventsd - .MobileBackups - .Spotlight-V100 - .TemporaryItems - .Trashes - .VolumeIcon.icns + DMG_METADATA = T.let(Set.new([ + ".background", + ".com.apple.timemachine.donotpresent", + ".com.apple.timemachine.supported", + ".DocumentRevisions-V100", + ".DS_Store", + ".fseventsd", + ".MobileBackups", + ".Spotlight-V100", + ".TemporaryItems", + ".Trashes", + ".VolumeIcon.icns", + ".HFS+ Private Directory Data\r", # do not remove `\r`, it is a part of directory name + ".HFS+ Private Data\r", ]).freeze, T::Set[String]) private_constant :DMG_METADATA diff --git a/docs/Common-Issues.md b/docs/Common-Issues.md index 8871db6c5b..261a9c2b6c 100644 --- a/docs/Common-Issues.md +++ b/docs/Common-Issues.md @@ -259,3 +259,10 @@ Help us by [submitting a fix](https://github.com/Homebrew/homebrew-cask/blob/HEA ## Other local issues If your Homebrew installation gets messed up (and fixing the issues found by `brew doctor` doesn't solve the problem), reinstalling Homebrew may help to reset to a normal state. To easily reinstall Homebrew, use [Homebrew Bundle](https://github.com/Homebrew/homebrew-bundle) to automatically restore your installed formulae and casks. To do so, run `brew bundle dump`, [uninstall](https://docs.brew.sh/FAQ#how-do-i-uninstall-homebrew), [reinstall](https://docs.brew.sh/Installation) and run `brew bundle install`. + +## Possible `curl` issues + +Sometimes, the user's computer, configuration or network connection may cause issues downloading with `curl` which are outside Homebrew's control. Homebrew requires good internet connectivity and correct configuration to function correctly. Here some links that could help you identify cURL issues based on `curl`'s and `libcurl`'s exit codes: + +* https://everything.curl.dev/cmdline/exitcode.html +* https://curl.se/libcurl/c/libcurl-errors.html