-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14479 from hyuraku/apply-extend/os-to-dev-cmd/bottle
move `dev-cmd/bottle` methods to extend/os
- Loading branch information
Showing
4 changed files
with
76 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
if OS.mac? | ||
require "extend/os/mac/dev-cmd/bottle" | ||
elsif OS.linux? | ||
require "extend/os/linux/dev-cmd/bottle" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
extend T::Sig | ||
|
||
module_function | ||
|
||
def setup_tar_and_args!(args, mtime) | ||
default_tar_args = generic_setup_tar_and_args!(args, mtime) | ||
return default_tar_args unless args.only_json_tab? | ||
|
||
["tar", gnutar_args(mtime)].freeze | ||
end | ||
|
||
def formula_ignores(f) | ||
cellar_regex = Regexp.escape(HOMEBREW_CELLAR) | ||
prefix_regex = Regexp.escape(HOMEBREW_PREFIX) | ||
|
||
ignores = generic_formula_ignores(f) | ||
|
||
ignores << case f.name | ||
# On Linux, GCC installation can be moved so long as the whole directory tree is moved together: | ||
# https://gcc-help.gcc.gnu.narkive.com/GnwuCA7l/moving-gcc-from-the-installation-path-is-it-allowed. | ||
when Version.formula_optionally_versioned_regex(:gcc) | ||
Regexp.union(%r{#{cellar_regex}/gcc}, %r{#{prefix_regex}/opt/gcc}) | ||
# binutils is relocatable for the same reason: https://github.com/Homebrew/brew/pull/11899#issuecomment-906804451. | ||
when Version.formula_optionally_versioned_regex(:binutils) | ||
%r{#{cellar_regex}/binutils} | ||
end | ||
|
||
ignores.compact | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
module Homebrew | ||
extend T::Sig | ||
|
||
module_function | ||
|
||
def setup_tar_and_args!(args, mtime) | ||
default_tar_args = generic_setup_tar_and_args!(args, mtime) | ||
return default_tar_args unless args.only_json_tab? | ||
|
||
# Use gnu-tar on macOS as it can be set up for reproducibility better than libarchive. | ||
begin | ||
gnu_tar = Formula["gnu-tar"] | ||
rescue FormulaUnavailableError | ||
return default_tar_args | ||
end | ||
|
||
ensure_formula_installed!(gnu_tar, reason: "bottling") | ||
|
||
["#{gnu_tar.opt_bin}/gtar", gnutar_args(mtime)].freeze | ||
end | ||
end |