language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/test/os/mac/software_spec_spec.rb | @@ -13,11 +13,40 @@
allow(OS::Mac).to receive(:version).and_return(OS::Mac::Version.new(sierra_os_version))
end
- it "doesn't add a dependency" do
+ it "adds a macOS dependency if the OS version meets requirements" do
+ spec.uses_from_macos("foo", since: :el_capitan)
+
+ expect(spec.deps).to be_empty
+ expect(spec.uses_from_macos_elements.first).to eq("foo")
+ end
+
+ it "doesn't add a macOS dependency if the OS version doesn't meet requirements" do
+ spec.uses_from_macos("foo", since: :high_sierra)
+
+ expect(spec.deps.first.name).to eq("foo")
+ expect(spec.uses_from_macos_elements).to be_empty
+ end
+
+ it "works with tags" do
+ spec.uses_from_macos("foo" => :build, :since => :high_sierra)
+
+ dep = spec.deps.first
+
+ expect(dep.name).to eq("foo")
+ expect(dep.tags).to include(:build)
+ end
+
+ it "doesn't add a dependency if no OS version is specified" do
spec.uses_from_macos("foo")
spec.uses_from_macos("bar" => :build)
expect(spec.deps).to be_empty
end
+
+ it "raises an error if passing invalid OS versions" do
+ expect {
+ spec.uses_from_macos("foo", since: :bar)
+ }.to raise_error(ArgumentError, "unknown version :bar")
+ end
end
end | true |
Other | Homebrew | brew | eb303dd65438417c20c860bf1c5246d0535dc9bf.json | software_spec: add uses_from_macos since bound | Library/Homebrew/test/software_spec_spec.rb | @@ -147,8 +147,8 @@
end
it "ignores OS version specifications", :needs_linux do
- subject.uses_from_macos("foo")
- subject.uses_from_macos("bar" => :build)
+ subject.uses_from_macos("foo", since: :mojave)
+ subject.uses_from_macos("bar" => :build, :since => :mojave)
expect(subject.deps.first.name).to eq("foo")
expect(subject.deps.last.name).to eq("bar") | true |
Other | Homebrew | brew | cad8be3278923c926df2424b7a22be489ed03ded.json | Add broken test, revealing test helper flaw
This commit adds a broken test, which is meant to expose a flaw in the
constructor of `Cask::Config`.
That (broken) test still passes because there’s also a flaw in our
test helper code.
The helper flaw happens to neutralize the `Cask::Config` flaw. | Library/Homebrew/test/cask/config_spec.rb | @@ -67,7 +67,18 @@
end
context "when installing a cask and then adding a global default dir" do
- let(:config) { described_class.new(default: { appdir: "/default/path/before/adding/fontdir" }) }
+ let(:config) {
+ json = <<~EOS
+ {
+ "default": {
+ "appdir": "/default/path/before/adding/fontdir"
+ },
+ "env": {},
+ "explicit": {}
+ }
+ EOS
+ described_class.from_json(json)
+ }
describe "#appdir" do
it "honors metadata of the installed cask" do | false |
Other | Homebrew | brew | dd3267ece0b2252c13f23e10a8d905f96f067406.json | Add test for JSON-based cask config loader
Previously, the JSON-based cask config loader was untested.
This commit changes the interface to accept a string, making the loader
easier to test. The commit also adds a test. | Library/Homebrew/cask/config.rb | @@ -34,15 +34,15 @@ def self.clear
def self.for_cask(cask)
if cask.config_path.exist?
- from_file(cask.config_path)
+ from_json(File.read(cask.config_path))
else
global
end
end
- def self.from_file(path)
+ def self.from_json(json)
config = begin
- JSON.parse(File.read(path))
+ JSON.parse(json)
rescue JSON::ParserError => e
raise e, "Cannot parse #{path}: #{e}", e.backtrace
end | true |
Other | Homebrew | brew | dd3267ece0b2252c13f23e10a8d905f96f067406.json | Add test for JSON-based cask config loader
Previously, the JSON-based cask config loader was untested.
This commit changes the interface to accept a string, making the loader
easier to test. The commit also adds a test. | Library/Homebrew/test/cask/config_spec.rb | @@ -3,6 +3,21 @@
describe Cask::Config, :cask do
subject(:config) { described_class.new }
+ describe "::from_json" do
+ it "deserializes a configuration in JSON format" do
+ config = described_class.from_json <<~EOS
+ {
+ "default": {
+ "appdir": "/path/to/apps"
+ },
+ "env": {},
+ "explicit": {}
+ }
+ EOS
+ expect(config.appdir).to eq(Pathname("/path/to/apps"))
+ end
+ end
+
describe "#default" do
it "returns the default directories" do
expect(config.default[:appdir]).to eq(Pathname(TEST_TMPDIR).join("cask-appdir")) | true |
Other | Homebrew | brew | 95f226cf51ae3df39ed3930cf27a77e077a177f0.json | cmd/list: fix Hombrew typo | Library/Homebrew/cmd/list.rb | @@ -55,7 +55,7 @@ def list
# Unbrewed uses the PREFIX, which will exist
# Things below use the CELLAR, which doesn't until the first formula is installed.
unless HOMEBREW_CELLAR.exist?
- raise NoSuchKegError, Hombrew.args.named.first if args.named.present?
+ raise NoSuchKegError, args.named.first if args.named.present?
return
end | false |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.10/ncurses.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.10/ncursesw.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.11/ncurses.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.11/ncursesw.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.12/ncurses.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.12/ncursesw.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.13/ncurses.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.13/ncursesw.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.14/ncurses.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.14/ncursesw.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.15/ncurses.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.15/ncursesw.pc | @@ -0,0 +1,14 @@
+homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
+prefix=${homebrew_sdkroot}/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.9/ncurses.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncurses
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | 29c121be98f4e8b95395153534bf6a84706179e2.json | os/mac/pkgconfig: add ncurses.pc & ncursesw.pc | Library/Homebrew/os/mac/pkgconfig/10.9/ncursesw.pc | @@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+major_version=5
+version=5.7.20081102
+
+Name: ncursesw
+Description: ncurses 5.7 library
+Version: ${version}
+Requires:
+Libs: -L${libdir} -lncurses
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | dabbfe3e3e4d5a6cd2f66ed274a9ec8ef7999f25.json | Fix linter offenses | Library/Homebrew/cask/cask.rb | @@ -125,9 +125,9 @@ def outdated_versions(greedy = false)
def outdated_info(greedy, verbose, json)
if json
{
- name: token,
+ name: token,
installed_versions: outdated_versions(greedy).join(", "),
- current_version: version
+ current_version: version,
}
elsif verbose
outdated_info = token << " (#{outdated_versions(greedy).join(", ")})" | true |
Other | Homebrew | brew | dabbfe3e3e4d5a6cd2f66ed274a9ec8ef7999f25.json | Fix linter offenses | Library/Homebrew/test/cask/cmd/outdated_spec.rb | @@ -93,15 +93,15 @@
it "lists outdated Casks in JSON format" do
result = [
{
- name: "local-caffeine",
+ name: "local-caffeine",
installed_versions: "1.2.2",
- current_version: "1.2.3"
+ current_version: "1.2.3",
},
{
- name: "local-transmission",
+ name: "local-transmission",
installed_versions: "2.60",
- current_version: "2.61"
- }
+ current_version: "2.61",
+ },
].to_json
expect {
@@ -114,15 +114,15 @@
it "ignores --quiet and lists outdated Casks in JSON format" do
result = [
{
- name: "local-caffeine",
+ name: "local-caffeine",
installed_versions: "1.2.2",
- current_version: "1.2.3"
+ current_version: "1.2.3",
},
{
- name: "local-transmission",
+ name: "local-transmission",
installed_versions: "2.60",
- current_version: "2.61"
- }
+ current_version: "2.61",
+ },
].to_json
expect {
@@ -135,25 +135,25 @@
it 'includes the Casks with "auto_updates true" or "version latest" in JSON format' do
result = [
{
- name: "auto-updates",
+ name: "auto-updates",
installed_versions: "2.57",
- current_version: "2.61"
+ current_version: "2.61",
},
{
- name: "local-caffeine",
+ name: "local-caffeine",
installed_versions: "1.2.2",
- current_version: "1.2.3"
+ current_version: "1.2.3",
},
{
- name: "local-transmission",
+ name: "local-transmission",
installed_versions: "2.60",
- current_version: "2.61"
+ current_version: "2.61",
},
{
- name: "version-latest-string",
+ name: "version-latest-string",
installed_versions: "latest",
- current_version: "latest"
- }
+ current_version: "latest",
+ },
].to_json
expect {
@@ -167,20 +167,20 @@
result = [
{
- name: "local-caffeine",
+ name: "local-caffeine",
installed_versions: "1.2.2",
- current_version: "1.2.3"
+ current_version: "1.2.3",
},
{
- name: "local-transmission",
+ name: "local-transmission",
installed_versions: "2.60",
- current_version: "2.61"
+ current_version: "2.61",
},
{
- name: "version-latest-string",
+ name: "version-latest-string",
installed_versions: "latest",
- current_version: "latest"
- }
+ current_version: "latest",
+ },
].to_json
expect { | true |
Other | Homebrew | brew | f2fa2c5d3095438b4bb387d58c426ad91f2b1378.json | Add JSON support to brew cask outdated
* brew outdated already has JSON support, now users and tools can get
similar results with brew cask outdated --json | Library/Homebrew/cask/cmd/outdated.rb | @@ -5,30 +5,21 @@ class Cmd
class Outdated < AbstractCommand
option "--greedy", :greedy, false
option "--quiet", :quiet, false
+ option "--json", :json, false
def initialize(*)
super
self.verbose = ($stdout.tty? || verbose?) && !quiet?
- end
-
- def run
- casks(alternative: -> { Caskroom.casks }).each do |cask|
+ @outdated_casks = casks(alternative: -> { Caskroom.casks }).select do |cask|
odebug "Checking update info of Cask #{cask}"
- self.class.list_if_outdated(cask, greedy?, verbose?)
+ cask.outdated?(greedy?)
end
end
- def self.list_if_outdated(cask, greedy, verbose)
- return unless cask.outdated?(greedy)
+ def run
+ output = @outdated_casks.map { |cask| cask.outdated_info(greedy?, verbose?, json?) }
- if verbose
- outdated_versions = cask.outdated_versions(greedy)
- outdated_info = "#{cask.token} (#{outdated_versions.join(", ")})"
- current_version = cask.version.to_s
- puts "#{outdated_info} != #{current_version}"
- else
- puts cask.token
- end
+ puts json? ? JSON.generate(output) : output
end
def self.help | true |
Other | Homebrew | brew | f2fa2c5d3095438b4bb387d58c426ad91f2b1378.json | Add JSON support to brew cask outdated
* brew outdated already has JSON support, now users and tools can get
similar results with brew cask outdated --json | Library/Homebrew/test/cask/cmd/outdated_spec.rb | @@ -88,4 +88,104 @@
EOS
end
end
+
+ describe "--json" do
+ it "lists outdated Casks in JSON format" do
+ result = [
+ {
+ name: "local-caffeine",
+ installed_versions: "1.2.2",
+ current_version: "1.2.3"
+ },
+ {
+ name: "local-transmission",
+ installed_versions: "2.60",
+ current_version: "2.61"
+ }
+ ].to_json
+
+ expect {
+ described_class.run("--json")
+ }.to output(result + "\n").to_stdout
+ end
+ end
+
+ describe "--json overrides --quiet" do
+ it "ignores --quiet and lists outdated Casks in JSON format" do
+ result = [
+ {
+ name: "local-caffeine",
+ installed_versions: "1.2.2",
+ current_version: "1.2.3"
+ },
+ {
+ name: "local-transmission",
+ installed_versions: "2.60",
+ current_version: "2.61"
+ }
+ ].to_json
+
+ expect {
+ described_class.run("--json", "--quiet")
+ }.to output(result + "\n").to_stdout
+ end
+ end
+
+ describe "--json and --greedy" do
+ it 'includes the Casks with "auto_updates true" or "version latest" in JSON format' do
+ result = [
+ {
+ name: "auto-updates",
+ installed_versions: "2.57",
+ current_version: "2.61"
+ },
+ {
+ name: "local-caffeine",
+ installed_versions: "1.2.2",
+ current_version: "1.2.3"
+ },
+ {
+ name: "local-transmission",
+ installed_versions: "2.60",
+ current_version: "2.61"
+ },
+ {
+ name: "version-latest-string",
+ installed_versions: "latest",
+ current_version: "latest"
+ }
+ ].to_json
+
+ expect {
+ described_class.run("--json", "--greedy")
+ }.to output(result + "\n").to_stdout
+ end
+
+ it 'does not include the Casks with "auto_updates true" with no version change in JSON format' do
+ cask = Cask::CaskLoader.load(cask_path("auto-updates"))
+ InstallHelper.install_with_caskfile(cask)
+
+ result = [
+ {
+ name: "local-caffeine",
+ installed_versions: "1.2.2",
+ current_version: "1.2.3"
+ },
+ {
+ name: "local-transmission",
+ installed_versions: "2.60",
+ current_version: "2.61"
+ },
+ {
+ name: "version-latest-string",
+ installed_versions: "latest",
+ current_version: "latest"
+ }
+ ].to_json
+
+ expect {
+ described_class.run("--json", "--greedy")
+ }.to output(result + "\n").to_stdout
+ end
+ end
end | true |
Other | Homebrew | brew | 65ff9155f8bb5b4e598fa015431b856b6115184b.json | Add Cask#outdated_info to format output | Library/Homebrew/cask/cask.rb | @@ -122,6 +122,21 @@ def outdated_versions(greedy = false)
installed.reject { |v| v == version }
end
+ def outdated_info(greedy, verbose, json)
+ if json
+ {
+ name: token,
+ installed_versions: outdated_versions(greedy).join(", "),
+ current_version: version
+ }
+ elsif verbose
+ outdated_info = token << " (#{outdated_versions(greedy).join(", ")})"
+ "#{outdated_info} != #{version}"
+ else
+ token
+ end
+ end
+
def to_s
@token
end | false |
Other | Homebrew | brew | c6545687ea9475e93f26cff6f5e4e90cf3447a9f.json | completions/bash: add flags for create
Sorts flags also. | completions/bash/brew | @@ -147,7 +147,25 @@ _brew_create() {
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
-*)
- __brewcomp "--autotools --cmake --meson --no-fetch --HEAD --set-name --set-version --tap --force --verbose --debug --help"
+ __brewcomp "
+ --HEAD
+ --autotools
+ --cmake
+ --debug
+ --force
+ --go
+ --help
+ --meson
+ --no-fetch
+ --perl
+ --python
+ --ruby
+ --rust
+ --set-name
+ --set-version
+ --tap
+ --verbose
+ "
return
;;
esac | false |
Other | Homebrew | brew | fb65d5a1f89a1e3a7e63386a5b1f6b510ebae484.json | shims/super/cc: relax restrictions with -Xclang | Library/Homebrew/shims/super/cc | @@ -185,7 +185,7 @@ class Cmd
"-fuse-linker-plugin", "-frounding-math"
# clang doesn't support these flags
args << arg unless tool =~ /^clang/
- when "-Xpreprocessor"
+ when "-Xpreprocessor", "-Xclang"
# used for -Xpreprocessor -fopenmp
args << arg << enum.next
when /-mmacosx-version-min=10\.(\d+)/ | false |
Other | Homebrew | brew | f9a84075ac0abe92e903a384cc0a83dfe9725e2c.json | workflows/tests: link old gettext.
This is failing `brew doctor` on GitHub Actions. | .github/workflows/tests.yml | @@ -68,6 +68,9 @@ jobs:
else
# Allow Xcode to be outdated
export HOMEBREW_GITHUB_ACTIONS=1
+
+ # Link old gettext (otherwise `brew doctor` is sad)
+ brew link gettext
fi
brew doctor
| false |
Other | Homebrew | brew | 374f788a3c6a8f295de4e5eb134d979eb3dc3513.json | cask/config_spec: add failing test
We recently added a new global artifact and then updated a cask to
make use of that new artifact. This caused a number of `brew cask`
commands to fail for users who had the cask installed before the
artifact was added.
This commit adds test cases for that failure mode.
See also:
- https://github.com/Homebrew/brew/pull/7286#issuecomment-613376568
- https://discourse.brew.sh/t/cask-definition-is-invalid-invalid-mdimporter-stanza-key-not-found-mdimporterdir | Library/Homebrew/test/cask/config_spec.rb | @@ -50,4 +50,20 @@
expect(config.explicit[:appdir]).to eq(Pathname("/explicit/path/to/apps"))
end
end
+
+ context "when installing a cask and then adding a global default dir" do
+ let(:config) { described_class.new(default: { appdir: "/default/path/before/adding/fontdir" }) }
+
+ describe "#appdir" do
+ it "honors metadata of the installed cask" do
+ expect(config.appdir).to eq(Pathname("/default/path/before/adding/fontdir"))
+ end
+ end
+
+ describe "#fontdir" do
+ it "falls back to global default on incomplete metadata" do
+ expect(config.default).to include(fontdir: Pathname(TEST_TMPDIR).join("cask-fontdir"))
+ end
+ end
+ end
end | false |
Other | Homebrew | brew | bd24f5a45eae5f8c2c2a97d0b6c4451e51db0659.json | bintray: fix package creation | Library/Homebrew/bintray.rb | @@ -56,16 +56,27 @@ def official_org?(org: @bintray_org)
end
def create_package(repo:, package:, **extra_data_args)
- url = "#{API_URL}/packages/#{@bintray_org}/#{repo}/#{package}"
+ url = "#{API_URL}/packages/#{@bintray_org}/#{repo}"
data = { name: package, public_download_numbers: true }
data[:public_stats] = official_org?
data.merge! extra_data_args
- open_api url, "--request", "POST", "--data", data.to_json
+ open_api url, "--header", "Content-Type: application/json", "--request", "POST", "--data", data.to_json
end
def package_exists?(repo:, package:)
url = "#{API_URL}/packages/#{@bintray_org}/#{repo}/#{package}"
- open_api url, "--output", "/dev/null", auth: false
+ begin
+ open_api url, "--silent", "--output", "/dev/null", auth: false
+ rescue ErrorDuringExecution => e
+ stderr = e.output.select { |type,| type == :stderr }
+ .map { |_, line| line }
+ .join
+ raise if e.status.exitstatus != 22 && !stderr.include?("404 Not Found")
+
+ false
+ else
+ true
+ end
end
def file_published?(repo:, remote_file:)
@@ -113,7 +124,7 @@ def upload_bottle_json(json_files, publish_package: false)
end
if !formula_packaged[formula_name] && !package_exists?(repo: bintray_repo, package: bintray_package)
- odebug "Creating package #{@bintray_org}/#{bintray_repo}/#{package}"
+ odebug "Creating package #{@bintray_org}/#{bintray_repo}/#{bintray_package}"
create_package repo: bintray_repo, package: bintray_package
formula_packaged[formula_name] = true
end | true |
Other | Homebrew | brew | bd24f5a45eae5f8c2c2a97d0b6c4451e51db0659.json | bintray: fix package creation | Library/Homebrew/test/bintray_spec.rb | @@ -19,7 +19,7 @@
describe "::package_exists?" do
it "detects a package" do
results = bintray.package_exists?(repo: "bottles", package: "hello")
- expect(results.status.exitstatus).to be 0
+ expect(results).to be true
end
end
end | true |
Other | Homebrew | brew | 6b547a5c5e9ad31054d3fae0f851c66a0b82ddb7.json | pr-upload: Fix a bug introduced by PR #7406
Fix the error:
Error: No such file or directory @ rb_sysopen - bottle | Library/Homebrew/dev-cmd/pr-upload.rb | @@ -38,7 +38,7 @@ def pr_upload
if args.dry_run?
puts "brew #{bottle_args.join " "}"
else
- system HOMEBREW_BREW_FILE, "bottle", *bottle_args
+ system HOMEBREW_BREW_FILE, *bottle_args
end
if args.dry_run? | false |
Other | Homebrew | brew | 9457d1af5e546bb07dacaff5cb516c0bdb9187fb.json | pull: fix head_revision definition.
Fixes #7405. | Library/Homebrew/dev-cmd/pull.rb | @@ -110,7 +110,7 @@ def pull
old_versions = current_versions_from_info_external(patch_changes[:formulae].first) if is_bumpable
patch_puller.apply_patch
- end_revision = head_revision(url)
+ end_revision = `git rev-parse --short HEAD`.strip
changed_formulae_names = []
@@ -197,10 +197,6 @@ def check_bumps(patch_changes)
end
end
- def head_revision(_url, fetched)
- Utils.popen_read("git", "rev-parse", fetched ? "FETCH_HEAD" : "HEAD").strip
- end
-
class PatchPuller
attr_reader :base_url
attr_reader :patch_url | false |
Other | Homebrew | brew | ffb405019d1e76d36fd1bf3b20094044aa94b818.json | uses_from_macos: Add gzip rsync to the white list
/usr/bin/gzip and /usr/bin/rsync are provided by macOS. | Library/Homebrew/rubocops/uses_from_macos.rb | @@ -62,12 +62,14 @@ class UsesFromMacos < FormulaCop
bash
expect
groff
+ gzip
openssl
openssl@1.1
perl
php
python
python@3
+ rsync
vim
xz
zsh | false |
Other | Homebrew | brew | 29ae5678689ab79b9eb7afc375ed36754c1a6f5f.json | pr-upload: Add argument root-url
The argument root-url is needed for third-party taps. | Library/Homebrew/dev-cmd/pr-upload.rb | @@ -19,6 +19,8 @@ def pr_upload_args
description: "Print what would be done rather than doing it."
flag "--bintray-org=",
description: "Upload to the specified Bintray organisation (default: homebrew)."
+ flag "--root-url=",
+ description: "Use the specified <URL> as the root of the bottle's URL instead of Homebrew's default."
end
end
@@ -28,10 +30,15 @@ def pr_upload
bintray_org = args.bintray_org || "homebrew"
bintray = Bintray.new(org: bintray_org)
+ bottle_args = ["bottle", "--merge", "--write"]
+ bottle_args << "--root-url=#{args.root_url}" if args.root_url
+ odie "No JSON files found in the current working directory" if Dir["*.json"].empty?
+ bottle_args += Dir["*.json"]
+
if args.dry_run?
- puts "brew bottle --merge --write #{Dir["*.json"].join " "}"
+ puts "brew #{bottle_args.join " "}"
else
- system HOMEBREW_BREW_FILE, "bottle", "--merge", "--write", *Dir["*.json"]
+ system HOMEBREW_BREW_FILE, "bottle", *bottle_args
end
if args.dry_run? | false |
Other | Homebrew | brew | fb0fa419abc750bf33695a396244b9cffbea1554.json | cask/cmd/upgrade_spec: remove more flaky tests. | Library/Homebrew/test/cask/cmd/upgrade_spec.rb | @@ -97,152 +97,6 @@
end
end
- context "dry run upgrade" do
- let(:installed) {
- [
- "outdated/local-caffeine",
- "outdated/local-transmission",
- "outdated/auto-updates",
- "outdated/version-latest",
- ]
- }
-
- before do
- installed.each { |cask| Cask::Cmd::Install.run(cask) }
-
- allow_any_instance_of(described_class).to receive(:verbose?).and_return(true)
- end
-
- describe 'without --greedy it ignores the Casks with "version latest" or "auto_updates true"' do
- it "would update all the installed Casks when no token is provided" do
- local_caffeine = Cask::CaskLoader.load("local-caffeine")
- local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
- local_transmission = Cask::CaskLoader.load("local-transmission")
- local_transmission_path = Cask::Config.global.appdir.join("Transmission.app")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
-
- described_class.run("--dry-run")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
- expect(local_caffeine.versions).not_to include("1.2.3")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
- expect(local_transmission.versions).not_to include("2.61")
- end
-
- it "would update only the Casks specified in the command line" do
- local_caffeine = Cask::CaskLoader.load("local-caffeine")
- local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
- local_transmission = Cask::CaskLoader.load("local-transmission")
- local_transmission_path = Cask::Config.global.appdir.join("Transmission.app")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
-
- described_class.run("--dry-run", "local-caffeine")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
- expect(local_caffeine.versions).not_to include("1.2.3")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
- expect(local_transmission.versions).not_to include("2.61")
- end
- end
-
- describe "with --greedy it checks additional Casks" do
- it 'would include the Casks with "auto_updates true" or "version latest"' do
- local_caffeine = Cask::CaskLoader.load("local-caffeine")
- local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
- auto_updates = Cask::CaskLoader.load("auto-updates")
- auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
- local_transmission = Cask::CaskLoader.load("local-transmission")
- local_transmission_path = Cask::Config.global.appdir.join("Transmission.app")
- version_latest = Cask::CaskLoader.load("version-latest")
- version_latest_path_1 = Cask::Config.global.appdir.join("Caffeine Mini.app")
- version_latest_path_2 = Cask::Config.global.appdir.join("Caffeine Pro.app")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.57")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
-
- expect(version_latest).to be_installed
- expect(version_latest_path_1).to be_a_directory
- expect(version_latest.versions).to include("latest")
-
- described_class.run("--greedy", "--dry-run")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
- expect(local_caffeine.versions).not_to include("1.2.3")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.57")
- expect(auto_updates.versions).not_to include("2.61")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
- expect(local_transmission.versions).not_to include("2.61")
-
- expect(version_latest).to be_installed
- expect(version_latest_path_2).to be_a_directory
- end
-
- it 'does not include the Casks with "auto_updates true" when the version did not change' do
- cask = Cask::CaskLoader.load("auto-updates")
- cask_path = cask.config.appdir.join("MyFancyApp.app")
-
- expect(cask).to be_installed
- expect(cask_path).to be_a_directory
- expect(cask.versions).to include("2.57")
-
- described_class.run("--dry-run", "auto-updates", "--greedy")
-
- expect(cask).to be_installed
- expect(cask_path).to be_a_directory
- expect(cask.versions).to include("2.57")
- expect(cask.versions).not_to include("2.61")
-
- described_class.run("--dry-run", "auto-updates", "--greedy")
-
- expect(cask).to be_installed
- expect(cask_path).to be_a_directory
- expect(cask.versions).to include("2.57")
- expect(cask.versions).not_to include("2.61")
- end
- end
- end
-
context "failed upgrade" do
let(:installed) {
[ | false |
Other | Homebrew | brew | 75c74e4674d3f6a85c4afce79a6096bcc5cca9fc.json | cask/cmd/upgrade_spec: remove flaky test. | Library/Homebrew/test/cask/cmd/upgrade_spec.rb | @@ -167,33 +167,6 @@
expect(local_transmission.versions).to include("2.60")
expect(local_transmission.versions).not_to include("2.61")
end
-
- it 'would update "auto_updates" and "latest" Casks when their tokens are provided in the command line' do
- local_caffeine = Cask::CaskLoader.load("local-caffeine")
- local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
- auto_updates = Cask::CaskLoader.load("auto-updates")
- auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.57")
-
- described_class.run("--dry-run", "local-caffeine", "auto-updates")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
- expect(local_caffeine.versions).not_to include("1.2.3")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.57")
- expect(auto_updates.versions).not_to include("2.61")
- end
end
describe "with --greedy it checks additional Casks" do | false |
Other | Homebrew | brew | b6809f2dda1a36eccc6eafec48e485407293398e.json | analytics: rearrange help into subcommand format | Library/Homebrew/cmd/analytics.rb | @@ -10,12 +10,17 @@ def analytics_args
usage_banner <<~EOS
`analytics` [<subcommand>]
- If `on` or `off` is passed, turn Homebrew's analytics on or off respectively.
-
- If `state` is passed, display the current anonymous user behaviour analytics state.
+ Control Homebrew's anonymous aggregate user behaviour analytics.
Read more at <https://docs.brew.sh/Analytics>.
- If `regenerate-uuid` is passed, regenerate the UUID used in Homebrew's analytics.
+ `brew analytics` [`state`]:
+ Display the current state of Homebrew's analytics.
+
+ `brew analytics` [`on`|`off`]:
+ Turn Homebrew's analytics on or off respectively.
+
+ `brew analytics regenerate-uuid`:
+ Regenerate the UUID used for Homebrew's analytics.
EOS
switch :verbose
switch :debug
@@ -41,7 +46,7 @@ def analytics
when "regenerate-uuid"
Utils::Analytics.regenerate_uuid!
else
- raise UsageError, "unknown subcommand"
+ raise UsageError, "unknown subcommand: #{args.named.first}"
end
end
end | false |
Other | Homebrew | brew | 8cb90595b3ff0ef66813c3d4b130027b06cc4679.json | dev-cmd/audit: add TODOs for RuboCop migrations. | Library/Homebrew/dev-cmd/audit.rb | @@ -240,6 +240,7 @@ def audit_style
end
def audit_file
+ # TODO: check could be in RuboCop
actual_mode = formula.path.stat.mode
# Check that the file is world-readable.
if actual_mode & 0444 != 0444
@@ -263,10 +264,13 @@ def audit_file
path: formula.path)
end
+ # TODO: check could be in RuboCop
problem "'DATA' was found, but no '__END__'" if text.data? && !text.end?
+ # TODO: check could be in RuboCop
problem "'__END__' was found, but 'DATA' is not used" if text.end? && !text.data?
+ # TODO: check could be in RuboCop
if text.to_s.match?(/inreplace [^\n]* do [^\n]*\n[^\n]*\.gsub![^\n]*\n\ *end/m)
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
end
@@ -477,13 +481,15 @@ def audit_keg_only
first_word = reason.split.first
if reason =~ /\A[A-Z]/ && !reason.start_with?(*whitelist)
+ # TODO: check could be in RuboCop
problem <<~EOS
'#{first_word}' from the keg_only reason should be '#{first_word.downcase}'.
EOS
end
return unless reason.end_with?(".")
+ # TODO: check could be in RuboCop
problem "keg_only reason should not end with a period."
end
@@ -932,58 +938,70 @@ def audit_lines
def line_problems(line, _lineno)
# Check for string interpolation of single values.
if line =~ /(system|inreplace|gsub!|change_make_var!).*[ ,]"#\{([\w.]+)\}"/
+ # TODO: check could be in RuboCop
problem "Don't need to interpolate \"#{Regexp.last_match(2)}\" with #{Regexp.last_match(1)}"
end
# Check for string concatenation; prefer interpolation
if line =~ /(#\{\w+\s*\+\s*['"][^}]+\})/
+ # TODO: check could be in RuboCop
problem "Try not to concatenate paths in string interpolation:\n #{Regexp.last_match(1)}"
end
# Prefer formula path shortcuts in Pathname+
if line =~ %r{\(\s*(prefix\s*\+\s*(['"])(bin|include|libexec|lib|sbin|share|Frameworks)[/'"])}
+ # TODO: check could be in RuboCop
problem(
"\"(#{Regexp.last_match(1)}...#{Regexp.last_match(2)})\" should" \
" be \"(#{Regexp.last_match(3).downcase}+...)\"",
)
end
+ # TODO: check could be in RuboCop
problem "Use separate make calls" if line.include?("make && make")
if line =~ /JAVA_HOME/i &&
[formula.name, *formula.deps.map(&:name)].none? { |name| name.match?(/^openjdk(@|$)/) } &&
formula.requirements.none? { |req| req.is_a?(JavaRequirement) }
+ # TODO: check could be in RuboCop
problem "Use `depends_on :java` to set JAVA_HOME"
end
return unless @strict
+ # TODO: check could be in RuboCop
problem "`env :userpaths` in formulae is deprecated" if line.include?("env :userpaths")
if line =~ /system ((["'])[^"' ]*(?:\s[^"' ]*)+\2)/
bad_system = Regexp.last_match(1)
unless %w[| < > & ; *].any? { |c| bad_system.include? c }
good_system = bad_system.gsub(" ", "\", \"")
+ # TODO: check could be in RuboCop
problem "Use `system #{good_system}` instead of `system #{bad_system}` "
end
end
+ # TODO: check could be in RuboCop
problem "`#{Regexp.last_match(1)}` is now unnecessary" if line =~ /(require ["']formula["'])/
if line.match?(%r{#\{share\}/#{Regexp.escape(formula.name)}[/'"]})
+ # TODO: check could be in RuboCop
problem "Use \#{pkgshare} instead of \#{share}/#{formula.name}"
end
if !@core_tap && line =~ /depends_on .+ if build\.with(out)?\?\(?["']\w+["']\)?/
+ # TODO: check could be in RuboCop
problem "`Use :optional` or `:recommended` instead of `#{Regexp.last_match(0)}`"
end
if line =~ %r{share(\s*[/+]\s*)(['"])#{Regexp.escape(formula.name)}(?:\2|/)}
+ # TODO: check could be in RuboCop
problem "Use pkgshare instead of (share#{Regexp.last_match(1)}\"#{formula.name}\")"
end
return unless @core_tap
+ # TODO: check could be in RuboCop
problem "`env :std` in homebrew/core formulae is deprecated" if line.include?("env :std")
end
@@ -1083,6 +1101,7 @@ def audit_version
if version.nil?
problem "missing version"
elsif version.blank?
+ # TODO: check could be in RuboCop
problem "version is set to an empty string"
elsif !version.detected_from_url?
version_text = version
@@ -1092,21 +1111,25 @@ def audit_version
end
end
+ # TODO: check could be in RuboCop
problem "version #{version} should not have a leading 'v'" if version.to_s.start_with?("v")
return unless version.to_s.match?(/_\d+$/)
+ # TODO: check could be in RuboCop
problem "version #{version} should not end with an underline and a number"
end
def audit_download_strategy
if url =~ %r{^(cvs|bzr|hg|fossil)://} || url =~ %r{^(svn)\+http://}
+ # TODO: check could be in RuboCop
problem "Use of the #{$&} scheme is deprecated, pass `:using => :#{Regexp.last_match(1)}` instead"
end
url_strategy = DownloadStrategyDetector.detect(url)
if using == :git || url_strategy == GitDownloadStrategy
+ # TODO: check could be in RuboCop
problem "Git should specify :revision when a :tag is specified." if specs[:tag] && !specs[:revision]
end
| false |
Other | Homebrew | brew | 3546c39581aac81e811c7ab26aab0be10c490a8a.json | audit: remove trailing newline check.
This is already done by the default RuboCop configuration. | Library/Homebrew/dev-cmd/audit.rb | @@ -271,8 +271,6 @@ def audit_file
problem "'inreplace ... do' was used for a single substitution (use the non-block form instead)."
end
- problem "File should end with a newline" unless text.trailing_newline?
-
if formula.core_formula? && @versioned_formula
unversioned_formula = begin
# build this ourselves as we want e.g. homebrew/core to be present | false |
Other | Homebrew | brew | 4132ccbf66ec3bb8ca0a44aeed355cba4e1e8bca.json | rubocop.yml: remove formula exclusions.
These have now been fixed so are no longer needed. | Library/.rubocop.yml | @@ -15,11 +15,6 @@ AllCops:
# don't allow cops to be disabled in formulae
Style/DisableCopsWithinSourceCodeDirective:
Enabled: true
- Exclude:
- # TODO: really long lines but hard to resolve (but would be nice to do).
- - '**/Formula/libgraphqlparser.rb'
- # TODO: false positive in RuboCop, see if it can be worked around/fixed.
- - '**/Formula/rpm.rb'
# make our hashes consistent
Layout/HashAlignment: | false |
Other | Homebrew | brew | 8a0e6a1603ce823eb66cc183a692f722668d9c67.json | test/cask/cmd/upgrade_spec: remove flaky test.
This is the second flaky test removed in this file. Tempting to just
remove the whole file if there's more. | Library/Homebrew/test/cask/cmd/upgrade_spec.rb | @@ -74,54 +74,6 @@
end
describe "with --greedy it checks additional Casks" do
- it 'includes the Casks with "auto_updates true" or "version latest"' do
- local_caffeine = Cask::CaskLoader.load("local-caffeine")
- local_caffeine_path = Cask::Config.global.appdir.join("Caffeine.app")
- auto_updates = Cask::CaskLoader.load("auto-updates")
- auto_updates_path = Cask::Config.global.appdir.join("MyFancyApp.app")
- local_transmission = Cask::CaskLoader.load("local-transmission")
- local_transmission_path = Cask::Config.global.appdir.join("Transmission.app")
- version_latest = Cask::CaskLoader.load("version-latest")
- version_latest_path_1 = Cask::Config.global.appdir.join("Caffeine Mini.app")
- version_latest_path_2 = Cask::Config.global.appdir.join("Caffeine Pro.app")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.2")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.57")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.60")
-
- expect(version_latest).to be_installed
- expect(version_latest_path_1).to be_a_directory
- expect(version_latest_path_2).to be_a_directory
- expect(version_latest.versions).to include("latest")
-
- described_class.run("--greedy")
-
- expect(local_caffeine).to be_installed
- expect(local_caffeine_path).to be_a_directory
- expect(local_caffeine.versions).to include("1.2.3")
-
- expect(auto_updates).to be_installed
- expect(auto_updates_path).to be_a_directory
- expect(auto_updates.versions).to include("2.61")
-
- expect(local_transmission).to be_installed
- expect(local_transmission_path).to be_a_directory
- expect(local_transmission.versions).to include("2.61")
-
- expect(version_latest).to be_installed
- expect(version_latest_path_1).to be_a_directory
- expect(version_latest_path_2).to be_a_directory
- expect(version_latest.versions).to include("latest")
- end
-
it 'does not include the Casks with "auto_updates true" when the version did not change' do
cask = Cask::CaskLoader.load("auto-updates")
cask_path = cask.config.appdir.join("MyFancyApp.app") | false |
Other | Homebrew | brew | d6cf14fd1e9a8a4804947a616b50770f58816720.json | audit: add libiconv to uses_from_macos whitelist
This lives at /usr/lib/libiconv.dylib | Library/Homebrew/rubocops/uses_from_macos.rb | @@ -19,6 +19,7 @@ class UsesFromMacos < FormulaCop
krb5
libedit
libffi
+ libiconv
libpcap
libxml2
libxslt | false |
Other | Homebrew | brew | 4dc9312f3c5e40848d59c0bad345b9dcd31e7b45.json | workflows: fix docker tag | .github/workflows/tests.yml | @@ -163,8 +163,7 @@ jobs:
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut
- # TODO: reenable when we figure out issue
- # docker tag homebrew_sut brew
+ docker tag brew_sut brew
else
brew test-bot
fi | false |
Other | Homebrew | brew | bc964282076efc9ba32cccd5b3414b849800779d.json | rubocop.yml: enable new rules. | Library/.rubocop.yml | @@ -8,6 +8,19 @@ FormulaAudit:
FormulaAuditStrict:
Enabled: true
+# enable all pending rubocops
+AllCops:
+ NewCops: enable
+
+# don't allow cops to be disabled in formulae
+Style/DisableCopsWithinSourceCodeDirective:
+ Enabled: true
+ Exclude:
+ # TODO: really long lines but hard to resolve (but would be nice to do).
+ - '**/Formula/libgraphqlparser.rb'
+ # TODO: false positive in RuboCop, see if it can be worked around/fixed.
+ - '**/Formula/rpm.rb'
+
# make our hashes consistent
Layout/HashAlignment:
EnforcedHashRocketStyle: table
@@ -46,12 +59,6 @@ Lint/AmbiguousRegexpLiteral:
Lint/ParenthesesAsGroupedExpression:
Enabled: false
-# not enabled by default but nice to have
-Lint/RaiseException:
- Enabled: true
-Lint/StructNewOverride:
- Enabled: true
-
# most metrics don't make sense to apply for formulae/taps
Metrics/AbcSize:
Enabled: false | true |
Other | Homebrew | brew | bc964282076efc9ba32cccd5b3414b849800779d.json | rubocop.yml: enable new rules. | Library/.rubocop_rspec.yml | @@ -8,6 +8,10 @@ AllCops:
Exclude:
- '**/vendor/**/*'
+# allow style to be disabled in non-formulae code
+Style/DisableCopsWithinSourceCodeDirective:
+ Enabled: false
+
# Intentionally disabled as it doesn't fit with our code style.
RSpec/AnyInstance:
Enabled: false | true |
Other | Homebrew | brew | 286488f753b547d06f7f10cbba305df603480551.json | github: add sponsors GraphQL API | Library/Homebrew/utils/github.rb | @@ -480,6 +480,34 @@ def get_artifact_url(user, repo, pr, workflow_id: "tests.yml", artifact_name: "b
artifact.first["archive_download_url"]
end
+ def sponsors_by_tier(user)
+ url = "https://api.github.com/graphql"
+ data = {
+ query: <<~EOS,
+ {
+ organization(login: "#{user}") {
+ sponsorsListing {
+ tiers(first: 100) {
+ nodes {
+ monthlyPriceInDollars
+ adminInfo {
+ sponsorships(first: 100) {
+ totalCount
+ nodes {
+ sponsor { login }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ EOS
+ }
+ open_api(url, scopes: ["admin:org", "user"], data: data, request_method: "POST")
+ end
+
def api_errors
[GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError,
GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze | false |
Other | Homebrew | brew | f8536d0b5bffaafa0f317c1e3526cb01d6112b10.json | formula: add standard meson args
libdir is especially important on Fedora based distributions,
where it might default to "lib64", but everything else expects "lib",
so forcing the libdir is necessary there. | Library/Homebrew/formula.rb | @@ -1373,6 +1373,11 @@ def std_cabal_v2_args
["--jobs=#{ENV.make_jobs}", "--max-backjumps=100000", "--install-method=copy", "--installdir=#{bin}"]
end
+ # Standard parameters for meson builds.
+ def std_meson_args
+ ["--prefix=#{prefix}", "--libdir=#{lib}"]
+ end
+
# an array of all core {Formula} names
# @private
def self.core_names | true |
Other | Homebrew | brew | f8536d0b5bffaafa0f317c1e3526cb01d6112b10.json | formula: add standard meson args
libdir is especially important on Fedora based distributions,
where it might default to "lib64", but everything else expects "lib",
so forcing the libdir is necessary there. | Library/Homebrew/formula_creator.rb | @@ -142,7 +142,7 @@ def install
system "go", "build", *std_go_args
<% elsif mode == :meson %>
mkdir "build" do
- system "meson", "--prefix=\#{prefix}", ".."
+ system "meson", *std_meson_args, ".."
system "ninja", "-v"
system "ninja", "install", "-v"
end | true |
Other | Homebrew | brew | 9a8a4cff9fc98b953cc81447d0c99c957e3531a3.json | test/dev-cmd/style_spec: fix flaky test | Library/Homebrew/test/.rubocop_todo.yml | @@ -12,7 +12,7 @@ RSpec/ExampleLength:
Exclude:
- 'rubocops/patches_spec.rb'
-# Offense count: 37
+# Offense count: 41
# Configuration parameters: CustomTransform, IgnoreMethods.
RSpec/FilePath:
Exclude:
@@ -53,6 +53,7 @@ RSpec/FilePath:
- 'rubocops/formula_desc_spec.rb'
- 'search_spec.rb'
- 'string_spec.rb'
+ - 'style_spec.rb'
- 'system_command_result_spec.rb'
- 'unpack_strategy/p7zip_spec.rb'
- 'utils/github_spec.rb' | true |
Other | Homebrew | brew | 9a8a4cff9fc98b953cc81447d0c99c957e3531a3.json | test/dev-cmd/style_spec: fix flaky test | Library/Homebrew/test/dev-cmd/style_spec.rb | @@ -5,80 +5,3 @@
describe "Homebrew.style_args" do
it_behaves_like "parseable arguments"
end
-
-describe "brew style" do
- around do |example|
- FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew"
- FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml"
- FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml"
-
- example.run
- ensure
- FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew"
- FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml"
- FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml"
- end
-
- before do
- allow(Homebrew).to receive(:install_bundler_gems!)
- end
-
- describe "Homebrew::check_style_json" do
- let(:dir) { mktmpdir }
-
- it "returns RubocopResults when RuboCop reports offenses" do
- formula = dir/"my-formula.rb"
-
- formula.write <<~'EOS'
- class MyFormula < Formula
-
- end
- EOS
-
- rubocop_result = Homebrew::Style.check_style_json([formula])
-
- expect(rubocop_result.file_offenses(formula.realpath.to_s).map(&:message))
- .to include("Extra empty line detected at class body beginning.")
- end
-
- it "corrected offense output format" do
- formula = dir/"my-formula-2.rb"
-
- formula.write <<~EOS
- class MyFormula2 < Formula
- desc "Test formula"
- homepage "https://foo.org"
- url "https://foo.org/foo-1.7.5.tgz"
- sha256 "cc692fb9dee0cc288757e708fc1a3b6b56ca1210ca181053a371cb11746969da"
-
- depends_on "foo"
- depends_on "bar-config" => :build
-
- test do
- assert_equal 5, 5
- end
- end
- EOS
- rubocop_result = Homebrew::Style.check_style_json(
- [formula],
- fix: true, only_cops: ["FormulaAudit/DependencyOrder"],
- )
- offense_string = rubocop_result.file_offenses(formula.realpath).first.to_s
- expect(offense_string).to match(/\[Corrected\]/)
- end
- end
-
- describe "Homebrew::check_style_and_print" do
- let(:dir) { mktmpdir }
-
- it "returns false for conforming file with only audit-level violations" do
- # This file is known to use non-rocket hashes and other things that trigger audit,
- # but not regular, cop violations
- target_file = HOMEBREW_LIBRARY_PATH/"utils.rb"
-
- rubocop_result = Homebrew::Style.check_style_and_print([target_file])
-
- expect(rubocop_result).to eq true
- end
- end
-end | true |
Other | Homebrew | brew | 9a8a4cff9fc98b953cc81447d0c99c957e3531a3.json | test/dev-cmd/style_spec: fix flaky test | Library/Homebrew/test/style_spec.rb | @@ -0,0 +1,80 @@
+# frozen_string_literal: true
+
+require "style"
+
+describe Homebrew::Style do
+ around do |example|
+ FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew"
+ FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop.yml", HOMEBREW_LIBRARY/".rubocop.yml"
+ FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml"
+
+ example.run
+ ensure
+ FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew"
+ FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop.yml"
+ FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml"
+ end
+
+ before do
+ allow(Homebrew).to receive(:install_bundler_gems!)
+ end
+
+ describe ".check_style_json" do
+ let(:dir) { mktmpdir }
+
+ it "returns RubocopResults when RuboCop reports offenses" do
+ formula = dir/"my-formula.rb"
+
+ formula.write <<~'EOS'
+ class MyFormula < Formula
+
+ end
+ EOS
+
+ rubocop_result = described_class.check_style_json([formula])
+
+ expect(rubocop_result.file_offenses(formula.realpath.to_s).map(&:message))
+ .to include("Extra empty line detected at class body beginning.")
+ end
+
+ it "corrected offense output format" do
+ formula = dir/"my-formula-2.rb"
+
+ formula.write <<~EOS
+ class MyFormula2 < Formula
+ desc "Test formula"
+ homepage "https://foo.org"
+ url "https://foo.org/foo-1.7.5.tgz"
+ sha256 "cc692fb9dee0cc288757e708fc1a3b6b56ca1210ca181053a371cb11746969da"
+
+ depends_on "foo"
+ depends_on "bar-config" => :build
+
+ test do
+ assert_equal 5, 5
+ end
+ end
+ EOS
+ rubocop_result = described_class.check_style_json(
+ [formula],
+ fix: true, only_cops: ["FormulaAudit/DependencyOrder"],
+ )
+ offense_string = rubocop_result.file_offenses(formula.realpath).first.to_s
+ expect(offense_string).to match(/\[Corrected\]/)
+ end
+ end
+
+ describe ".check_style_and_print" do
+ let(:dir) { mktmpdir }
+
+ it "returns false for conforming file with only audit-level violations" do
+ # This file is known to use non-rocket hashes and other things that trigger audit,
+ # but not regular, cop violations
+ target_file = HOMEBREW_LIBRARY_PATH/"utils.rb"
+
+ rubocop_result = described_class.check_style_and_print([target_file])
+
+ expect(rubocop_result).to eq true
+ end
+ end
+end | true |
Other | Homebrew | brew | 4e5c8a35e54cf999b85eb3f393b043d208bae2c3.json | cmd/upgrade: handle nil runtime_dependencies.
Fixes #7360 | Library/Homebrew/cmd/upgrade.rb | @@ -223,8 +223,8 @@ def upgrade_formula(f)
# @private
def depends_on(a, b)
if a.opt_or_installed_prefix_keg
- .runtime_dependencies
- .any? { |d| d["full_name"] == b.full_name }
+ &.runtime_dependencies
+ &.any? { |d| d["full_name"] == b.full_name }
1
else
a <=> b | false |
Other | Homebrew | brew | 5366da76fd19bb945599bea47a0cf924c4c9e2dc.json | cli/args: add formulae_paths helper.
This allows getting the formulae passed as arguments while not having
to read the file or raising an exception on invalid syntax. | Library/Homebrew/cli/args.rb | @@ -99,6 +99,12 @@ def resolved_formulae
end.uniq(&:name)
end
+ def formulae_paths
+ @formulae_paths ||= (downcased_unique_named - casks).map do |name|
+ Formulary.path(name)
+ end.uniq(&:name)
+ end
+
def casks
@casks ||= downcased_unique_named.grep HOMEBREW_CASK_TAP_CASK_REGEX
end | false |
Other | Homebrew | brew | 9cfef076821e03a2c3e5988cc9a69eb6017f64c7.json | dev-cmd/extract: instruct users to run git fetch unshallow | Library/Homebrew/dev-cmd/extract.rb | @@ -132,7 +132,15 @@ def extract
loop do
rev = rev.nil? ? "HEAD" : "#{rev}~1"
rev, (path,) = Git.last_revision_commit_of_files(repo, pattern, before_commit: rev)
- odie "Could not find #{name}! The formula or version may not have existed." if rev.nil?
+ if rev.nil? && source_tap.shallow?
+ odie <<~EOS
+ Could not find #{name} but #{source_tap} is a shallow clone!
+ Try again after running:
+ git -C "#{source_tap.path}" fetch --unshallow
+ EOS
+ elsif rev.nil?
+ odie "Could not find #{name}! The formula or version may not have existed."
+ end
file = repo/path
result = Git.last_revision_of_file(repo, file, before_commit: rev) | false |
Other | Homebrew | brew | 951cf09d4b76ffa14b76f089e30b4be06cf00011.json | pr-pull: eliminate another curl call
We're setting the basename, so no need to make a curl call to figure out
what it ought to be. This should speed up bottle pulls even more. | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -1,18 +1,11 @@
# frozen_string_literal: true
+require "download_strategy"
require "cli/parser"
require "utils/github"
require "tmpdir"
require "bintray"
-class CurlNoResumeDownloadStrategy < CurlDownloadStrategy
- private
-
- def _fetch(url:, resolved_url:)
- curl("--location", "--remote-time", "--create-dirs", "--output", temporary_path, resolved_url)
- end
-end
-
module Homebrew
module_function
@@ -148,6 +141,27 @@ def formulae_need_bottles?(tap, original_commit)
nil
end
+ def download_artifact(url, dir, pr)
+ token, username = GitHub.api_credentials
+ case GitHub.api_credentials_type
+ when :env_username_password, :keychain_username_password
+ curl_args = ["--user", "#{username}:#{token}"]
+ when :env_token
+ curl_args = ["--header", "Authorization: token #{token}"]
+ when :none
+ raise Error, "Credentials must be set to access the Artifacts API"
+ end
+
+ # Download the artifact as a zip file and unpack it into `dir`. This is
+ # preferred over system `curl` and `tar` as this leverages the Homebrew
+ # cache to avoid repeated downloads of (possibly large) bottles.
+ FileUtils.chdir dir do
+ downloader = GitHubArtifactDownloadStrategy.new(url, "artifact", pr, curl_args: curl_args, secrets: [token])
+ downloader.fetch
+ downloader.stage
+ end
+ end
+
def pr_pull
pr_pull_args.parse
@@ -163,7 +177,7 @@ def pr_pull
workflow = args.workflow || "tests.yml"
artifact = args.artifact || "bottles"
- tap = Tap.fetch(args.tap || "homebrew/core")
+ tap = Tap.fetch(args.tap || CoreTap.instance.name)
setup_git_environment!
@@ -187,9 +201,8 @@ def pr_pull
next
end
- GitHub.fetch_artifact(user, repo, pr, dir, workflow_id: workflow,
- artifact_name: artifact,
- strategy: CurlNoResumeDownloadStrategy)
+ url = GitHub.get_artifact_url(user, repo, pr, workflow_id: workflow, artifact_name: artifact)
+ download_artifact(url, dir, pr)
if Homebrew.args.dry_run?
puts "brew bottle --merge --write #{Dir["*.json"].join " "}"
@@ -209,3 +222,32 @@ def pr_pull
end
end
end
+
+class GitHubArtifactDownloadStrategy < AbstractFileDownloadStrategy
+ def fetch
+ ohai "Downloading #{url}"
+ if cached_location.exist?
+ puts "Already downloaded: #{cached_location}"
+ else
+ begin
+ curl "--location", "--create-dirs", "--output", temporary_path, url,
+ *meta.fetch(:curl_args, []),
+ secrets: meta.fetch(:secrets, [])
+ rescue ErrorDuringExecution
+ raise CurlDownloadStrategyError, url
+ end
+ ignore_interrupts do
+ cached_location.dirname.mkpath
+ temporary_path.rename(cached_location)
+ symlink_location.dirname.mkpath
+ end
+ end
+ FileUtils.ln_s cached_location.relative_path_from(symlink_location.dirname), symlink_location, force: true
+ end
+
+ private
+
+ def resolved_basename
+ "artifact.zip"
+ end
+end | true |
Other | Homebrew | brew | 951cf09d4b76ffa14b76f089e30b4be06cf00011.json | pr-pull: eliminate another curl call
We're setting the basename, so no need to make a curl call to figure out
what it ought to be. This should speed up bottle pulls even more. | Library/Homebrew/utils/github.rb | @@ -1,6 +1,5 @@
# frozen_string_literal: true
-require "download_strategy"
require "tempfile"
require "uri"
@@ -435,8 +434,7 @@ def dispatch_event(user, repo, event, **payload)
scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
end
- def fetch_artifact(user, repo, pr, dir,
- workflow_id: "tests.yml", artifact_name: "bottles", strategy: CurlDownloadStrategy)
+ def get_artifact_url(user, repo, pr, workflow_id: "tests.yml", artifact_name: "bottles")
scopes = CREATE_ISSUE_FORK_OR_PR_SCOPES
base_url = "#{API_URL}/repos/#{user}/#{repo}"
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
@@ -479,28 +477,7 @@ def fetch_artifact(user, repo, pr, dir,
EOS
end
- artifact_url = artifact.first["archive_download_url"]
-
- token, username = api_credentials
- case api_credentials_type
- when :env_username_password, :keychain_username_password
- curl_args = { user: "#{username}:#{token}" }
- when :env_token
- curl_args = { header: "Authorization: token #{token}" }
- when :none
- raise Error, "Credentials must be set to access the Artifacts API"
- end
-
- # Download the artifact as a zip file and unpack it into `dir`. This is
- # preferred over system `curl` and `tar` as this leverages the Homebrew
- # cache to avoid repeated downloads of (possibly large) bottles.
- FileUtils.chdir dir do
- curl_args[:cache] = Pathname.new(dir)
- curl_args[:secrets] = [token]
- downloader = strategy.new(artifact_url, "artifact", pr, **curl_args)
- downloader.fetch
- downloader.stage
- end
+ artifact.first["archive_download_url"]
end
def api_errors | true |
Other | Homebrew | brew | a6d3e3c47c1e5e346b92721868f45f55379a9295.json | utils/github: form encode workflow branch | Library/Homebrew/utils/github.rb | @@ -441,7 +441,7 @@ def fetch_artifact(user, repo, pr, dir,
base_url = "#{API_URL}/repos/#{user}/#{repo}"
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
pr_sha = pr_payload["head"]["sha"]
- pr_branch = pr_payload["head"]["ref"]
+ pr_branch = URI.encode_www_form_component(pr_payload["head"]["ref"])
workflow = open_api("#{base_url}/actions/workflows/#{workflow_id}/runs?branch=#{pr_branch}", scopes: scopes)
workflow_run = workflow["workflow_runs"].select do |run| | false |
Other | Homebrew | brew | 632813d9693562af041fd8b98ac459099704a957.json | rubocops/patches: reduce required revision length. | Library/Homebrew/rubocops/patches.rb | @@ -44,7 +44,7 @@ def patch_problems(patch)
%r{gist\.github\.com/.+/raw},
%r{gist\.githubusercontent\.com/.+/raw}])
if regex_match_group(patch, gh_patch_patterns)
- unless patch_url.match?(/[a-fA-F0-9]{40}/)
+ unless patch_url.match?(%r{/[a-fA-F0-9]{6,40}/})
problem <<~EOS.chomp
GitHub/Gist patches should specify a revision:
#{patch_url} | false |
Other | Homebrew | brew | ea77fce409879406b9caa6a745f6eef63cc32b3e.json | rubocops/lines: move strict cop. | Library/Homebrew/rubocops/lines.rb | @@ -196,26 +196,6 @@ def autocorrect(node)
end
class Miscellaneous < FormulaCop
- MAKE_CHECK_WHITELIST = %w[
- beecrypt
- ccrypt
- git
- gmp
- gnupg
- gnupg@1.4
- google-sparsehash
- jemalloc
- jpeg-turbo
- mpfr
- nettle
- open-mpi
- openssl@1.1
- pcre
- protobuf
- wolfssl
- xz
- ].freeze
-
def audit_formula(_node, _class_node, _parent_class_node, body_node)
# FileUtils is included in Formula
# encfs modifies a file with this name, so check for some leading characters
@@ -260,18 +240,18 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
# Avoid hard-coding compilers
find_every_method_call_by_name(body_node, :system).each do |method|
param = parameters(method).first
- if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)\s?})
+ if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)[\s"]?})
problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[2]}\""
- elsif match = regex_match_group(param, %r{^(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?})
+ elsif match = regex_match_group(param, %r{^(/usr/bin/)?((g|llvm-g|clang)\+\+)[\s"]?})
problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\""
end
end
find_instance_method_call(body_node, "ENV", :[]=) do |method|
param = parameters(method)[1]
- if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)\s?})
+ if match = regex_match_group(param, %r{^(/usr/bin/)?(gcc|llvm-gcc|clang)[\s"]?})
problem "Use \"\#{ENV.cc}\" instead of hard-coding \"#{match[2]}\""
- elsif match = regex_match_group(param, %r{^(/usr/bin/)?((g|llvm-g|clang)\+\+)\s?})
+ elsif match = regex_match_group(param, %r{^(/usr/bin/)?((g|llvm-g|clang)\+\+)[\s"]?})
problem "Use \"\#{ENV.cxx}\" instead of hard-coding \"#{match[2]}\""
end
end
@@ -439,25 +419,6 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Use the `#{match}` Ruby method instead of `#{method.source}`"
end
-
- return if formula_tap != "homebrew-core"
-
- # Avoid build-time checks in homebrew/core
- find_every_method_call_by_name(body_node, :system).each do |method|
- next if @formula_name.start_with?("lib")
- next if MAKE_CHECK_WHITELIST.include?(@formula_name)
-
- params = parameters(method)
- next unless node_equals?(params[0], "make")
-
- params[1..].each do |arg|
- next unless regex_match_group(arg, /^(checks?|tests?)$/)
-
- offending_node(method)
- problem "Formulae in homebrew/core (except e.g. cryptography, libraries) " \
- "should not run build-time checks"
- end
- end
end
def modifier?(node)
@@ -493,5 +454,50 @@ def modifier?(node)
EOS
end
end
+
+ module FormulaAuditStrict
+ class MakeCheck < FormulaCop
+ MAKE_CHECK_WHITELIST = %w[
+ beecrypt
+ ccrypt
+ git
+ gmp
+ gnupg
+ gnupg@1.4
+ google-sparsehash
+ jemalloc
+ jpeg-turbo
+ mpfr
+ nettle
+ open-mpi
+ openssl@1.1
+ pcre
+ protobuf
+ wolfssl
+ xz
+ ].freeze
+
+ def audit_formula(_node, _class_node, _parent_class_node, body_node)
+ return if formula_tap != "homebrew-core"
+
+ # Avoid build-time checks in homebrew/core
+ find_every_method_call_by_name(body_node, :system).each do |method|
+ next if @formula_name.start_with?("lib")
+ next if MAKE_CHECK_WHITELIST.include?(@formula_name)
+
+ params = parameters(method)
+ next unless node_equals?(params[0], "make")
+
+ params[1..].each do |arg|
+ next unless regex_match_group(arg, /^(checks?|tests?)$/)
+
+ offending_node(method)
+ problem "Formulae in homebrew/core (except e.g. cryptography, libraries) " \
+ "should not run build-time checks"
+ end
+ end
+ end
+ end
+ end
end
end | true |
Other | Homebrew | brew | ea77fce409879406b9caa6a745f6eef63cc32b3e.json | rubocops/lines: move strict cop. | Library/Homebrew/test/rubocops/lines_spec.rb | @@ -349,17 +349,6 @@ class Foo < Formula
subject(:cop) { described_class.new }
context "When auditing formula" do
- it "build-time checks in homebrew/core" do
- expect_offense(<<~RUBY, "/homebrew-core/")
- class Foo < Formula
- desc "foo"
- url 'https://brew.sh/foo-1.0.tgz'
- system "make", "-j1", "test"
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks
- end
- RUBY
- end
-
it "FileUtils usage" do
expect_offense(<<~RUBY)
class Foo < Formula
@@ -860,6 +849,21 @@ class Foo < Formula
RUBY
end
end
+end
+
+describe RuboCop::Cop::FormulaAuditStrict::MakeCheck do
+ subject(:cop) { described_class.new }
+
+ it "build-time checks in homebrew/core" do
+ expect_offense(<<~RUBY, "/homebrew-core/")
+ class Foo < Formula
+ desc "foo"
+ url 'https://brew.sh/foo-1.0.tgz'
+ system "make", "-j1", "test"
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Formulae in homebrew/core (except e.g. cryptography, libraries) should not run build-time checks
+ end
+ RUBY
+ end
include_examples "formulae exist", described_class::MAKE_CHECK_WHITELIST
end | true |
Other | Homebrew | brew | a920f74671d0a9acf5bc50939333dbce98468b0c.json | dev-cmd/pr-pull: fix strategy error | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -187,7 +187,9 @@ def pr_pull
next
end
- GitHub.fetch_artifact(user, repo, pr, dir, workflow_id: workflow, artifact_name: artifact)
+ GitHub.fetch_artifact(user, repo, pr, dir, workflow_id: workflow,
+ artifact_name: artifact,
+ strategy: CurlNoResumeDownloadStrategy)
if Homebrew.args.dry_run?
puts "brew bottle --merge --write #{Dir["*.json"].join " "}"
@@ -200,9 +202,7 @@ def pr_pull
if Homebrew.args.dry_run?
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
else
- bintray.upload_bottle_json Dir["*.json"],
- publish_package: !args.no_publish?,
- strategy: CurlNoResumeDownloadStrategy
+ bintray.upload_bottle_json Dir["*.json"], publish_package: !args.no_publish?
end
end
end | false |
Other | Homebrew | brew | c1ba9975b8349c9eff2bf55bd4319c0bbe45dc73.json | pr-pull: fetch artifacts with no-resume strategy | Library/Homebrew/dev-cmd/pr-pull.rb | @@ -5,6 +5,14 @@
require "tmpdir"
require "bintray"
+class CurlNoResumeDownloadStrategy < CurlDownloadStrategy
+ private
+
+ def _fetch(url:, resolved_url:)
+ curl("--location", "--remote-time", "--create-dirs", "--output", temporary_path, resolved_url)
+ end
+end
+
module Homebrew
module_function
@@ -192,7 +200,9 @@ def pr_pull
if Homebrew.args.dry_run?
puts "Upload bottles described by these JSON files to Bintray:\n #{Dir["*.json"].join("\n ")}"
else
- bintray.upload_bottle_json Dir["*.json"], publish_package: !args.no_publish?
+ bintray.upload_bottle_json Dir["*.json"],
+ publish_package: !args.no_publish?,
+ strategy: CurlNoResumeDownloadStrategy
end
end
end | true |
Other | Homebrew | brew | c1ba9975b8349c9eff2bf55bd4319c0bbe45dc73.json | pr-pull: fetch artifacts with no-resume strategy | Library/Homebrew/utils/github.rb | @@ -435,7 +435,8 @@ def dispatch_event(user, repo, event, **payload)
scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES)
end
- def fetch_artifact(user, repo, pr, dir, workflow_id: "tests.yml", artifact_name: "bottles")
+ def fetch_artifact(user, repo, pr, dir,
+ workflow_id: "tests.yml", artifact_name: "bottles", strategy: CurlDownloadStrategy)
scopes = CREATE_ISSUE_FORK_OR_PR_SCOPES
base_url = "#{API_URL}/repos/#{user}/#{repo}"
pr_payload = open_api("#{base_url}/pulls/#{pr}", scopes: scopes)
@@ -496,7 +497,7 @@ def fetch_artifact(user, repo, pr, dir, workflow_id: "tests.yml", artifact_name:
FileUtils.chdir dir do
curl_args[:cache] = Pathname.new(dir)
curl_args[:secrets] = [token]
- downloader = CurlDownloadStrategy.new(artifact_url, "artifact", pr, **curl_args)
+ downloader = strategy.new(artifact_url, "artifact", pr, **curl_args)
downloader.fetch
downloader.stage
end | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/extend/os/formula.rb | @@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+if OS.mac?
+ require "extend/os/mac/formula"
+elsif OS.linux?
+ require "extend/os/linux/formula"
+end | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/extend/os/linux/formula.rb | @@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class Formula
+ class << self
+ undef on_linux
+
+ def on_linux(&_block)
+ yield
+ end
+ end
+end | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/extend/os/mac/formula.rb | @@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class Formula
+ class << self
+ undef on_macos
+
+ def on_macos(&_block)
+ yield
+ end
+ end
+end | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/formula.rb | @@ -2423,10 +2423,25 @@ def depends_on(dep)
specs.each { |spec| spec.depends_on(dep) }
end
+ # Indicates use of dependencies provided by macOS.
+ # On macOS this is a no-op (as we use the system libraries there).
+ # On Linux this will act as `depends_on`.
def uses_from_macos(dep)
specs.each { |spec| spec.uses_from_macos(dep) }
end
+ # Block executed only executed on macOS. No-op on Linux.
+ # <pre>on_macos do
+ # depends_on "mac_only_dep"
+ # end</pre>
+ def on_macos(&_block); end
+
+ # Block executed only executed on Linux. No-op on macOS.
+ # <pre>on_linux do
+ # depends_on "linux_only_dep"
+ # end</pre>
+ def on_linux(&_block); end
+
# @!attribute [w] option
# Options can be used as arguments to `brew install`.
# To switch features on/off: `"with-something"` or `"with-otherthing"`.
@@ -2657,3 +2672,5 @@ def link_overwrite_paths
end
end
end
+
+require "extend/os/formula" | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/test/os/linux/formula_spec.rb | @@ -20,4 +20,82 @@
expect(f.class.head.deps.first.name).to eq("foo")
end
end
+
+ describe "#on_linux" do
+ it "defines an url on Linux only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ on_macos do
+ url "https://brew.sh/test-macos-0.1.tbz"
+ sha256 TEST_SHA256
+ end
+
+ on_linux do
+ url "https://brew.sh/test-linux-0.1.tbz"
+ sha256 TEST_SHA256
+ end
+ end
+
+ expect(f.stable.url).to eq("https://brew.sh/test-linux-0.1.tbz")
+ end
+ end
+
+ describe "#on_linux" do
+ it "adds a dependency on Linux only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ url "https://brew.sh/test-0.1.tbz"
+ sha256 TEST_SHA256
+
+ depends_on "hello_both"
+
+ on_macos do
+ depends_on "hello_macos"
+ end
+
+ on_linux do
+ depends_on "hello_linux"
+ end
+ end
+
+ expect(f.class.stable.deps[0].name).to eq("hello_both")
+ expect(f.class.stable.deps[1].name).to eq("hello_linux")
+ expect(f.class.stable.deps[2]).to eq(nil)
+ end
+ end
+
+ describe "#on_linux" do
+ it "adds a patch on Linux only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ url "https://brew.sh/test-0.1.tbz"
+ sha256 TEST_SHA256
+
+ patch do
+ url "patch_both"
+ end
+
+ on_macos do
+ patch do
+ url "patch_macos"
+ end
+ end
+
+ on_linux do
+ patch do
+ url "patch_linux"
+ end
+ end
+ end
+
+ expect(f.patchlist.length).to eq(2)
+ expect(f.patchlist.first.strip).to eq(:p1)
+ expect(f.patchlist.first.url).to eq("patch_both")
+ expect(f.patchlist.second.strip).to eq(:p1)
+ expect(f.patchlist.second.url).to eq("patch_linux")
+ end
+ end
end | true |
Other | Homebrew | brew | c7927f5af594c0d2c20cea6957adfb78bdf9b98c.json | formula: add linux and macos only function blocks | Library/Homebrew/test/os/mac/formula_spec.rb | @@ -0,0 +1,83 @@
+# frozen_string_literal: true
+
+require "formula"
+
+describe Formula do
+ describe "#on_macos" do
+ it "defines an url on macos only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ on_macos do
+ url "https://brew.sh/test-macos-0.1.tbz"
+ sha256 TEST_SHA256
+ end
+
+ on_linux do
+ url "https://brew.sh/test-linux-0.1.tbz"
+ sha256 TEST_SHA256
+ end
+ end
+
+ expect(f.stable.url).to eq("https://brew.sh/test-macos-0.1.tbz")
+ end
+ end
+
+ describe "#on_macos" do
+ it "adds a dependency on macos only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ url "https://brew.sh/test-0.1.tbz"
+ sha256 TEST_SHA256
+
+ depends_on "hello_both"
+
+ on_macos do
+ depends_on "hello_macos"
+ end
+
+ on_linux do
+ depends_on "hello_linux"
+ end
+ end
+
+ expect(f.class.stable.deps[0].name).to eq("hello_both")
+ expect(f.class.stable.deps[1].name).to eq("hello_macos")
+ expect(f.class.stable.deps[2]).to eq(nil)
+ end
+ end
+
+ describe "#on_macos" do
+ it "adds a patch on macos only" do
+ f = formula do
+ homepage "https://brew.sh"
+
+ url "https://brew.sh/test-0.1.tbz"
+ sha256 TEST_SHA256
+
+ patch do
+ url "patch_both"
+ end
+
+ on_macos do
+ patch do
+ url "patch_macos"
+ end
+ end
+
+ on_linux do
+ patch do
+ url "patch_linux"
+ end
+ end
+ end
+
+ expect(f.patchlist.length).to eq(2)
+ expect(f.patchlist.first.strip).to eq(:p1)
+ expect(f.patchlist.first.url).to eq("patch_both")
+ expect(f.patchlist.second.strip).to eq(:p1)
+ expect(f.patchlist.second.url).to eq("patch_macos")
+ end
+ end
+end | true |
Other | Homebrew | brew | b752efbd37d75f58e423a86a05476b248031c374.json | Fix KeyOnlyReason property access. | Library/Homebrew/cmd/link.rb | @@ -68,7 +68,7 @@ def link
if keg_only
if Homebrew.default_prefix?
f = keg.to_formula
- if f.keg_only_reason.reason.by_macos?
+ if f.keg_only_reason.by_macos?
caveats = Caveats.new(f)
opoo <<~EOS
Refusing to link macOS provided/shadowed software: #{keg.name} | false |
Other | Homebrew | brew | 32744e174651c8892381ec27fbc640c61fdaf5f3.json | ENV/std: remove space in -isysroot | Library/Homebrew/extend/os/mac/extend/ENV/std.rb | @@ -60,9 +60,9 @@ def remove_macosxsdk(version = MacOS.version)
return unless (sdk = MacOS.sdk_path_if_needed(version))
delete("SDKROOT")
- remove_from_cflags "-isysroot #{sdk}"
- remove "CPPFLAGS", "-isysroot #{sdk}"
- remove "LDFLAGS", "-isysroot #{sdk}"
+ remove_from_cflags "-isysroot#{sdk}"
+ remove "CPPFLAGS", "-isysroot#{sdk}"
+ remove "LDFLAGS", "-isysroot#{sdk}"
if HOMEBREW_PREFIX.to_s == "/usr/local"
delete("CMAKE_PREFIX_PATH")
else
@@ -87,10 +87,10 @@ def macosxsdk(version = MacOS.version)
# Tell clang/gcc where system include's are:
append_path "CPATH", "#{sdk}/usr/include"
# The -isysroot is needed, too, because of the Frameworks
- append_to_cflags "-isysroot #{sdk}"
- append "CPPFLAGS", "-isysroot #{sdk}"
+ append_to_cflags "-isysroot#{sdk}"
+ append "CPPFLAGS", "-isysroot#{sdk}"
# And the linker needs to find sdk/usr/lib
- append "LDFLAGS", "-isysroot #{sdk}"
+ append "LDFLAGS", "-isysroot#{sdk}"
# Needed to build cmake itself and perhaps some cmake projects:
append_path "CMAKE_PREFIX_PATH", "#{sdk}/usr"
append_path "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks" | false |
Other | Homebrew | brew | 45908d8ff269d20bc12ce2ad6df17bf594e44126.json | uses_from_macos: update openssl in whitelist. | Library/Homebrew/rubocops/uses_from_macos.rb | @@ -26,7 +26,7 @@ class UsesFromMacos < FormulaCop
m4
ncurses
openldap
- openssl
+ openssl@1.1
perl
php
ruby | false |
Other | Homebrew | brew | fbeeae96eff0c02fd51b21d2671f76656ce5783c.json | rubocops/text: check openssl and openssl@1.1. | Library/Homebrew/rubocops/text.rb | @@ -12,7 +12,7 @@ def audit_formula(_node, _class_node, _parent_class_node, body_node)
problem "Please set plist_options when using a formula-defined plist."
end
- if depends_on?("openssl") && depends_on?("libressl")
+ if (depends_on?("openssl") || depends_on?("openssl@1.1")) && depends_on?("libressl")
problem "Formulae should not depend on both OpenSSL and LibreSSL (even optionally)."
end
| false |
Other | Homebrew | brew | 2e74e50f822c9f8e74b418f83c2df2acee3a981c.json | rubocop/conflicts: use full name in whitelist. | Library/Homebrew/rubocops/conflicts.rb | @@ -12,13 +12,13 @@ class Conflicts < FormulaCop
"Use `keg_only :versioned_formula` instead."
WHITELIST = %w[
- bash-completion@
+ bash-completion@2
].freeze
def audit_formula(_node, _class_node, _parent_class_node, body)
return unless versioned_formula?
- problem MSG if !@formula_name.start_with?(*WHITELIST) &&
+ problem MSG if !WHITELIST.include?(@formula_name) &&
method_called_ever?(body, :conflicts_with)
end
end | false |
Other | Homebrew | brew | 373650d00d51c466fe5c9eaf5d09afdcb018baf7.json | KegOnlyReason: add reason helpers, rename valid. | Library/Homebrew/dev-cmd/audit.rb | @@ -396,8 +396,8 @@ def audit_deps
end
if @new_formula &&
- dep_f.keg_only_reason&.reason == :provided_by_macos &&
- dep_f.keg_only_reason.valid? &&
+ dep_f.keg_only_reason.provided_by_macos? &&
+ dep_f.keg_only_reason.applicable? &&
!%w[apr apr-util openblas openssl openssl@1.1].include?(dep.name)
new_formula_problem(
"Dependency '#{dep.name}' is provided by macOS; " \
@@ -507,13 +507,14 @@ def audit_versioned_keg_only
return unless @core_tap
if formula.keg_only?
- return if formula.keg_only_reason.reason == :versioned_formula
+ return if formula.keg_only_reason.versioned_formula?
if formula.name.start_with?("openssl", "libressl") &&
- formula.keg_only_reason.reason == :provided_by_macos
+ formula.keg_only_reason.provided_by_macos?
return
end
end
+ # TODO: verify formulae still exist
keg_only_whitelist = %w[
autoconf@2.13
bash-completion@2 | true |
Other | Homebrew | brew | 373650d00d51c466fe5c9eaf5d09afdcb018baf7.json | KegOnlyReason: add reason helpers, rename valid. | Library/Homebrew/extend/os/mac/formula_support.rb | @@ -1,7 +1,7 @@
# frozen_string_literal: true
class KegOnlyReason
- def valid?
+ def applicable?
true
end
end | true |
Other | Homebrew | brew | 373650d00d51c466fe5c9eaf5d09afdcb018baf7.json | KegOnlyReason: add reason helpers, rename valid. | Library/Homebrew/formula.rb | @@ -1045,7 +1045,7 @@ def caveats
def keg_only?
return false unless keg_only_reason
- keg_only_reason.valid?
+ keg_only_reason.applicable?
end
# @private | true |
Other | Homebrew | brew | 373650d00d51c466fe5c9eaf5d09afdcb018baf7.json | KegOnlyReason: add reason helpers, rename valid. | Library/Homebrew/formula_support.rb | @@ -13,24 +13,41 @@ def initialize(reason, explanation)
@explanation = explanation
end
- def valid?
- ![:provided_by_macos, :provided_by_osx, :shadowed_by_macos].include?(@reason)
+ def versioned_formula?
+ @reason == :versioned_formula
+ end
+
+ def provided_by_macos?
+ @reason == :provided_by_macos
+ end
+
+ def shadowed_by_macos?
+ @reason == :shadowed_by_macos
+ end
+
+ def by_macos?
+ provided_by_macos? || shadowed_by_macos?
+ end
+
+ def applicable?
+ # macOS reasons aren't applicable on other OSs
+ # (see extend/os/mac/formula_support for override on macOS)
+ !by_macos?
end
def to_s
return @explanation unless @explanation.empty?
- case @reason
- when :versioned_formula
+ if versioned_formula?
<<~EOS
this is an alternate version of another formula
EOS
- when :provided_by_macos
+ elsif provided_by_macos?
<<~EOS
macOS already provides this software and installing another version in
parallel can cause all kinds of trouble
EOS
- when :shadowed_by_macos
+ elsif shadowed_by_macos?
<<~EOS
macOS provides similar software and installing this software in
parallel can cause all kinds of trouble | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/libcurl.pc | @@ -37,4 +37,4 @@ Description: Library to transfer files with ftp, http, etc.
Version: 7.54.0
Libs: -L${libdir} -lcurl
Libs.private: -lldap -lz
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/libexslt.pc | @@ -10,4 +10,4 @@ Version: 0.8.17
Description: EXSLT Extension library
Requires: libxml-2.0
Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/libxml-2.0.pc | @@ -2,7 +2,7 @@ homebrew_sdkroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+includedir=${prefix}/include/libxml2
modules=1
Name: libXML
@@ -11,4 +11,4 @@ Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lz -lpthread -licucore -lm
-Cflags: -I${includedir}/libxml2
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/libxslt.pc | @@ -10,4 +10,4 @@ Version: 1.1.29
Description: XSLT library version 2.
Requires: libxml-2.0
Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/sqlite3.pc | @@ -9,4 +9,4 @@ Description: SQL database engine
Version: 3.24.0
Libs: -L${libdir} -lsqlite3
Libs.private:
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/uuid.pc | @@ -3,12 +3,12 @@ prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
-includedir=${prefix}/include
+includedir=${prefix}/include/uuid
Name: uuid
Description: Universally unique id library
Version: 1.0
Requires:
Libs:
-Cflags: -I${includedir}/uuid
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.14/zlib.pc | @@ -11,4 +11,4 @@ Version: 1.2.11
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/libcurl.pc | @@ -37,4 +37,4 @@ Description: Library to transfer files with ftp, http, etc.
Version: 7.64.1
Libs: -L${libdir} -lcurl
Libs.private: -lldap -lz
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/libexslt.pc | @@ -10,4 +10,4 @@ Version: 0.8.17
Description: EXSLT Extension library
Requires: libxml-2.0
Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/libxml-2.0.pc | @@ -11,4 +11,4 @@ Description: libXML library version2.
Requires:
Libs: -L${libdir} -lxml2
Libs.private: -lz -lpthread -licucore -lm
-Cflags: -I${includedir}/libxml2
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/libxslt.pc | @@ -10,4 +10,4 @@ Version: 1.1.29
Description: XSLT library version 2.
Requires: libxml-2.0
Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/sqlite3.pc | @@ -9,4 +9,4 @@ Description: SQL database engine
Version: 3.28.0
Libs: -L${libdir} -lsqlite3
Libs.private:
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/uuid.pc | @@ -3,12 +3,12 @@ prefix=${homebrew_sdkroot}/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
sharedlibdir=${libdir}
-includedir=${prefix}/include
+includedir=${prefix}/include/uuid
Name: uuid
Description: Universally unique id library
Version: 1.0
Requires:
Libs:
-Cflags: -I${includedir}/uuid
+Cflags: -I${includedir} | true |
Other | Homebrew | brew | d8b1c4ff1f3d80f0baceb21f3bce1766aeb2c0df.json | os/mac/pkgconfig: delete most cflags on 10.14+ | Library/Homebrew/os/mac/pkgconfig/10.15/zlib.pc | @@ -11,4 +11,4 @@ Version: 1.2.11
Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
-Cflags: -I${includedir}
+Cflags: | true |
Other | Homebrew | brew | bec303de86f9cef21a79ebea55da59dfa57fbdbb.json | tap: update shallowing logic
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com> | Library/Homebrew/cmd/tap.rb | @@ -55,8 +55,8 @@ def tap
else
full_clone = if args.full?
true
- elsif args.shallow?.nil?
- !ENV["CI"]
+ elsif !args.shallow?
+ ENV["CI"].blank?
else
!args.shallow?
end | false |
Other | Homebrew | brew | 8900e852d6b204af6524cadfcdf42f9f933621c6.json | Revert "ENV/std: withdraw support for Homebrew supplied *.pc files"
This reverts commit fa3591681800f9da06cd2d0179a5ef9e63b10729. | Library/Homebrew/extend/os/mac/extend/ENV/std.rb | @@ -3,7 +3,11 @@
module Stdenv
# @private
- undef x11
+ undef homebrew_extra_pkg_config_paths, x11
+
+ def homebrew_extra_pkg_config_paths
+ ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"]
+ end
def x11
# There are some config scripts here that should go in the PATH | false |
Other | Homebrew | brew | a6be0e62affe150a11d5361636505930744318b0.json | Improve spec helper. | Library/Homebrew/test/spec_helper.rb | @@ -173,24 +173,25 @@ def find_files
@__argv = ARGV.dup
@__env = ENV.to_hash # dup doesn't work on ENV
+ @__stdout = $stdout.clone
+ @__stderr = $stderr.clone
+
unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
- @__stdout = $stdout.clone
- @__stderr = $stderr.clone
$stdout.reopen(File::NULL)
$stderr.reopen(File::NULL)
end
example.run
+ rescue SystemExit => e
+ raise "Unexpected exit with status #{e.status}."
ensure
ARGV.replace(@__argv)
ENV.replace(@__env)
- unless example.metadata.key?(:focus) || ENV.key?("VERBOSE_TESTS")
- $stdout.reopen(@__stdout)
- $stderr.reopen(@__stderr)
- @__stdout.close
- @__stderr.close
- end
+ $stdout.reopen(@__stdout)
+ $stderr.reopen(@__stderr)
+ @__stdout.close
+ @__stderr.close
Formulary.clear_cache
Tap.clear_cache | false |
Other | Homebrew | brew | 7787dde7b763ee789f5253f5f213d5890403945a.json | dev-cmd/pr-publish: fix undefined method error on invalid input | Library/Homebrew/dev-cmd/pr-publish.rb | @@ -29,8 +29,8 @@ def pr_publish
arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive?
url_match = arg.match HOMEBREW_PULL_OR_COMMIT_URL_REGEX
_, user, repo, issue = *url_match
- tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
odie "Not a GitHub pull request: #{arg}" unless issue
+ tap = Tap.fetch(user, repo) if repo.match?(HOMEBREW_OFFICIAL_REPO_PREFIXES_REGEX)
ohai "Dispatching #{tap} pull request ##{issue}"
GitHub.dispatch_event(user, repo, "Publish ##{issue}", pull_request: issue)
end | false |
Other | Homebrew | brew | 757cc24f7ec81acaec97d23dace4f6ceb462b4df.json | ENV/std: restore original make_jobs return type | Library/Homebrew/extend/ENV/std.rb | @@ -188,7 +188,7 @@ def set_cpu_cflags(map = Hardware::CPU.optimization_flags) # rubocop:disable Nam
end
def make_jobs
- Homebrew::EnvConfig.make_jobs
+ Homebrew::EnvConfig.make_jobs.to_i
end
# This method does nothing in stdenv since there's no arg refurbishment | false |
Other | Homebrew | brew | 4e07d7b9f4f8aee223725258b946fa383f65047c.json | Set HOMEBREW_GITHUB_API_TOKEN from GITHUB_TOKEN.
If `HOMEBREW_GITHUB_API_TOKEN` is not set and `GITHUB_TOKEN` is: let's
use it. `GITHUB_TOKEN` is a somewhat standard env var to set for
GitHub authentication tokens (e.g. used by `hub`). | Library/Homebrew/env_config.rb | @@ -126,11 +126,12 @@ module EnvConfig
"such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.",
},
HOMEBREW_GITHUB_API_TOKEN: {
- description: "A personal access token for the GitHub API, used by Homebrew for features such as " \
+ description: "A personal access token for the GitHub API, used by Homebrew for features such as " \
"`brew search`. You can create one at <https://github.com/settings/tokens>. If set, " \
"GitHub will allow you a greater number of API requests. For more information, see: " \
"<https://developer.github.com/v3/#rate-limiting>\n\n *Note:* Homebrew doesn't " \
"require permissions for any of the scopes.",
+ default_text: "`$GITHUB_TOKEN`.",
},
HOMEBREW_GITHUB_API_USERNAME: {
description: "GitHub username for authentication with the GitHub API, used by Homebrew for features " \ | true |
Other | Homebrew | brew | 4e07d7b9f4f8aee223725258b946fa383f65047c.json | Set HOMEBREW_GITHUB_API_TOKEN from GITHUB_TOKEN.
If `HOMEBREW_GITHUB_API_TOKEN` is not set and `GITHUB_TOKEN` is: let's
use it. `GITHUB_TOKEN` is a somewhat standard env var to set for
GitHub authentication tokens (e.g. used by `hub`). | bin/brew | @@ -79,6 +79,12 @@ then
export HOMEBREW_EDITOR="$VISUAL"
fi
+# Use GITHUB_TOKEN if HOMEBREW_GITHUB_API_TOKEN is unset.
+if [[ -z "$HOMEBREW_GITHUB_API_TOKEN" && -n "$GITHUB_TOKEN" ]]
+then
+ export HOMEBREW_GITHUB_API_TOKEN="$GITHUB_TOKEN"
+fi
+
# Set CI variable for GitHub Actions, Azure Pipelines, Jenkins
# (Set by default on Circle and Travis CI)
if [[ -n "$GITHUB_ACTIONS" || -n "$TF_BUILD" || -n "$JENKINS_HOME" ]] | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.