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
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`).
docs/Manpage.md
@@ -1282,6 +1282,8 @@ Note that environment variables must have a value set to be detected. For exampl *Note:* Homebrew doesn't require permissions for any of the scopes. + *Default:* `$GITHUB_TOKEN`. + * `HOMEBREW_GITHUB_API_USERNAME`: GitHub username for authentication with the GitHub API, used by Homebrew for features such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.
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`).
manpages/brew.1
@@ -1637,6 +1637,9 @@ A personal access token for the GitHub API, used by Homebrew for features such a .IP \fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\. . +.IP +\fIDefault:\fR \fB$GITHUB_TOKEN\fR\. +. .TP \fBHOMEBREW_GITHUB_API_USERNAME\fR GitHub username for authentication with the GitHub API, used by Homebrew for features such as \fBbrew search\fR\. We strongly recommend using \fBHOMEBREW_GITHUB_API_TOKEN\fR instead\.
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.4
@@ -1 +0,0 @@ -10.5 \ No newline at end of file
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.5/libcrypto.pc
@@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: OpenSSL-libcrypto -Description: OpenSSL cryptography library -Version: 0.9.7l -Requires: -Libs: -L${libdir} -lcrypto -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.5/libcurl.pc
@@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: libcurl -URL: http://curl.haxx.se/ -Description: Library to transfer files with ftp, http, etc. -Version: 7.16.4 -Libs: -L${libdir} -lcurl -Libs.private: -lssl -lcrypto -Wl,-weak-lldap -Wl,-weak-lgssapi_krb5 -lresolv -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.5/uuid.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: uuid -Description: Universally unique id library -Version: 1.0 - -Requires: -Libs: -Cflags: -I${includedir}/uuid
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.6/sqlite3.pc
@@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: SQLite -Description: SQL database engine -Version: 3.6.12 -Libs: -L${libdir} -lsqlite3 -Libs.private: -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.6/uuid.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: uuid -Description: Universally unique id library -Version: 1.0 - -Requires: -Libs: -Cflags: -I${includedir}/uuid
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.6/zlib.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: zlib -Description: zlib compression library -Version: 1.2.3 - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.7/sqlite3.pc
@@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: SQLite -Description: SQL database engine -Version: 3.7.7 -Libs: -L${libdir} -lsqlite3 -Libs.private: -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.7/uuid.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: uuid -Description: Universally unique id library -Version: 1.0 - -Requires: -Libs: -Cflags: -I${includedir}/uuid
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.7/zlib.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: zlib -Description: zlib compression library -Version: 1.2.5 - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/libcurl.pc
@@ -1,39 +0,0 @@ -#*************************************************************************** -# _ _ ____ _ -# Project ___| | | | _ \| | -# / __| | | | |_) | | -# | (__| |_| | _ <| |___ -# \___|\___/|_| \_\_____| -# -# Copyright (C) 2004 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. -# -# This software is licensed as described in the file COPYING, which -# you should have received as part of this distribution. The terms -# are also available at http://curl.haxx.se/docs/copyright.html. -# -# You may opt to use, copy, modify, merge, publish, distribute and/or sell -# copies of the Software, and permit persons to whom the Software is -# furnished to do so, under the terms of the COPYING file. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# -########################################################################### - -# This should most probably benefit from getting a "Requires:" field added -# dynamically by configure. -# -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include -supported_protocols="DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP" -supported_features="SSL IPv6 libz AsynchDNS NTLM" - -Name: libcurl -URL: http://curl.haxx.se/ -Description: Library to transfer files with ftp, http, etc. -Version: 7.24.0 -Libs: -L${libdir} -lcurl -Libs.private: -lssl -lcrypto -Wl,-weak-lldap -Wl,-weak-lgssapi_krb5 -lresolv -lssl -lcrypto -lz -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/libexslt.pc
@@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - - -Name: libexslt -Version: 0.8.15 -Description: EXSLT Extension library -Requires: libxml-2.0 -Libs: -L${libdir} -lexslt -lxslt -lxml2 -lz -lpthread -licucore -lm -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/libxml-2.0.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include -modules=1 - -Name: libXML -Version: 2.7.8 -Description: libXML library version2. -Requires: -Libs: -L${libdir} -lxml2 -Libs.private: -lpthread -lz -lm -Cflags: -I${includedir}/libxml2
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/libxslt.pc
@@ -1,12 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - - -Name: libxslt -Version: 1.1.26 -Description: XSLT library version 2. -Requires: libxml-2.0 -Libs: -L${libdir} -lxslt -lxml2 -lz -lpthread -licucore -lm -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/sqlite3.pc
@@ -1,11 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -includedir=${prefix}/include - -Name: SQLite -Description: SQL database engine -Version: 3.7.12 -Libs: -L${libdir} -lsqlite3 -Libs.private: -Cflags: -I${includedir}
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/uuid.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: uuid -Description: Universally unique id library -Version: 1.0 - -Requires: -Libs: -Cflags: -I${includedir}/uuid
true
Other
Homebrew
brew
6cfd8065fc3ba9855f898bd84509bbce000da930.json
Remove old pkgconfig files. Homebrew no longer runs on these macOS versions.
Library/Homebrew/os/mac/pkgconfig/10.8/zlib.pc
@@ -1,13 +0,0 @@ -prefix=/usr -exec_prefix=${prefix} -libdir=${exec_prefix}/lib -sharedlibdir=${libdir} -includedir=${prefix}/include - -Name: zlib -Description: zlib compression library -Version: 1.2.5 - -Requires: -Libs: -L${libdir} -L${sharedlibdir} -lz -Cflags: -I${includedir}
true
Other
Homebrew
brew
fb0052068f3f948e0103066bb6a80099c13cc600.json
env_config: unify environment variables. cli/parser but for environment variables. This makes it easier to set, check, document and set defaults for environment variables in a single location that can be used for query and documentation generation.
Library/Homebrew/env_config.rb
@@ -0,0 +1,308 @@ +# frozen_string_literal: true + +module Homebrew + module EnvConfig + module_function + + ENVS = { + HOMEBREW_ARCH: { + description: "Linux only: Homebrew will pass the set value to type name to the compiler's `-march` option.", + default: "native", + }, + HOMEBREW_ARTIFACT_DOMAIN: { + description: "Instructs Homebrew to prefix all download URLs, including those for bottles, with this " \ + "variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a " \ + "formula with the URL `https://example.com/foo.tar.gz` to instead download from " \ + "`http://localhost:8080/example.com/foo.tar.gz`.", + }, + HOMEBREW_AUTO_UPDATE_SECS: { + description: "Homebrew will only check for autoupdates once per this seconds interval.", + default: 300, + }, + HOMEBREW_BAT: { + description: "Homebrew will use `bat` for the `brew cat` command.", + boolean: true, + }, + HOMEBREW_BINTRAY_KEY: { + description: "Homebrew uses this API key when accessing the Bintray API (where bottles are stored).", + }, + HOMEBREW_BINTRAY_USER: { + description: "Homebrew uses this username when accessing the Bintray API (where bottles are stored).", + }, + HOMEBREW_BOTTLE_DOMAIN: { + description: "Instructs Homebrew to use the specified URL as its download mirror for bottles. " \ + "For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to " \ + "download from the prefix `http://localhost:8080/`.", + default_text: "macOS: `https://homebrew.bintray.com/`, Linux: `https://linuxbrew.bintray.com/`.", + default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN, + }, + HOMEBREW_BREW_GIT_REMOTE: { + description: "Instructs Homebrew to use the specified URL as its Homebrew/brew `git`(1) remote.", + default: HOMEBREW_BREW_DEFAULT_GIT_REMOTE, + }, + HOMEBREW_BROWSER: { + description: "Homebrew uses this setting as the browser when opening project homepages.", + default_text: "`$BROWSER` or the OS's default browser.", + }, + HOMEBREW_CACHE: { + description: "Instructs Homebrew to use the specified directory as the download cache.", + default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \ + "Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.", + default: HOMEBREW_DEFAULT_CACHE, + }, + HOMEBREW_COLOR: { + description: "Homebrew force colour output on non-TTY outputs.", + boolean: true, + }, + HOMEBREW_CORE_GIT_REMOTE: { + description: "instructs Homebrew to use the specified URL as its Homebrew/homebrew-core `git`(1) remote.", + default_text: "macOS: `https://github.com/Homebrew/homebrew-core`, " \ + "Linux: `https://github.com/Homebrew/linuxbrew-core`.", + default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE, + }, + HOMEBREW_CURLRC: { + description: "Homebrew will not pass `--disable` when invoking `curl`(1), which disables the " \ + "use of `curlrc`.", + boolean: true, + }, + HOMEBREW_CURL_RETRIES: { + description: "Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).", + default: 3, + }, + HOMEBREW_CURL_VERBOSE: { + description: "Homebrew will pass `--verbose` when invoking `curl`(1).", + boolean: true, + }, + HOMEBREW_DEVELOPER: { + description: "Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or " \ + "budding), e.g. turning warnings into errors.", + boolean: true, + }, + HOMEBREW_DISABLE_LOAD_FORMULA: { + description: "Homebrew will refuse to load formulae. This is useful when formulae are not trusted (such " \ + "as in pull requests).", + boolean: true, + }, + HOMEBREW_DISPLAY: { + description: "Homebrew will use this X11 display when opening a page in a browser, for example with " \ + "`brew home`. Primarily useful on Linux.", + default_text: "`$DISPLAY`.", + }, + HOMEBREW_DISPLAY_INSTALL_TIMES: { + description: "Homebrew will print install times for each formula at the end of the run.", + boolean: true, + }, + HOMEBREW_EDITOR: { + description: "Homebrew will use this editor when editing a single formula, or several formulae in the " \ + "same directory.\n\n *Note:* `brew edit` will open all of Homebrew as discontinuous files " \ + "and directories. Visual Studio Code can handle this correctly in project mode, but many " \ + "editors will do strange things in this case.", + default_text: "`$EDITOR` or `$VISUAL`.", + }, + HOMEBREW_FAIL_LOG_LINES: { + description: "Homebrew will output this many lines of output on formula `system` failures.", + default: 15, + }, + HOMEBREW_FORCE_BREWED_CURL: { + description: "Homebrew will always use a Homebrew-installed `curl`(1) rather than the system version. " \ + "Automatically set if the system version of `curl` is too old.", + }, + HOMEBREW_FORCE_BREWED_GIT: { + description: "Homebrew will always use a Homebrew-installed `git`(1) rather than the system version. " \ + "Automatically set if the system version of `git` is too old.", + }, + HOMEBREW_FORCE_HOMEBREW_ON_LINUX: { + description: "Homebrew running on Linux will use URLs for Homebrew on macOS. This is useful when merging" \ + "pull requests on Linux for macOS.", + boolean: true, + }, + HOMEBREW_FORCE_VENDOR_RUBY: { + description: "Homebrew will always use its vendored, relocatable Ruby version even if the system version " \ + "of Ruby is new enough.", + boolean: true, + }, + HOMEBREW_GITHUB_API_PASSWORD: { + description: "GitHub password for authentication with the GitHub API, used by Homebrew for features" \ + "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 " \ + "`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.", + }, + HOMEBREW_GITHUB_API_USERNAME: { + description: "GitHub username for authentication with the GitHub API, used by Homebrew for features " \ + "such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.", + }, + HOMEBREW_GIT_EMAIL: { + description: "Homebrew will set the Git author and committer name to this value.", + }, + HOMEBREW_GIT_NAME: { + description: "Homebrew will set the Git author and committer email to this value.", + }, + HOMEBREW_INSTALL_BADGE: { + description: "Text printed before the installation summary of each successful build.", + default_text: 'The "Beer Mug" emoji.', + default: "🍺", + }, + HOMEBREW_LOGS: { + description: "IHomebrew will use the specified directory to store log files.", + default_text: "macOS: `$HOME/Library/Logs/Homebrew`, "\ + "Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`.", + default: HOMEBREW_DEFAULT_LOGS, + }, + HOMEBREW_MAKE_JOBS: { + description: "Instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as the number of " \ + "parallel jobs to run when building with `make`(1).", + default_text: "The number of available CPU cores.", + default: lambda { + require "os" + require "hardware" + Hardware::CPU.cores + }, + }, + HOMEBREW_NO_ANALYTICS: { + description: "Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics>.", + boolean: true, + }, + HOMEBREW_NO_AUTO_UPDATE: { + description: "Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`.", + boolean: true, + }, + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: { + description: "Homebrew will fail on the failure of installation from a bottle rather than " \ + "falling back to building from source.", + boolean: true, + }, + HOMEBREW_NO_COLOR: { + description: "Homebrew will not print text with colour added.", + default_text: "`$NO_COLOR`.", + boolean: true, + }, + HOMEBREW_NO_COMPAT: { + description: "Homebrew disables all use of legacy compatibility code.", + boolean: true, + }, + HOMEBREW_NO_EMOJI: { + description: "Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build." \ + "\n\n *Note:* Homebrew will only try to print emoji on OS X Lion or newer.", + boolean: true, + }, + HOMEBREW_NO_GITHUB_API: { + description: "Homebrew will not use the GitHub API, e.g. for searches or fetching relevant issues " \ + "on a failed install.", + boolean: true, + }, + HOMEBREW_NO_INSECURE_REDIRECT: { + description: "Homebrew will not permit redirects from secure HTTPS to insecure HTTP." \ + "\n\n *Note:* While ensuring your downloads are fully secure, this is likely to cause " \ + "from-source SourceForge, some GNU & GNOME based formulae to fail to download.", + boolean: true, + }, + HOMEBREW_NO_INSTALL_CLEANUP: { + description: "`brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup " \ + "installed/upgraded/reinstalled formulae or all formulae every 30 days.", + boolean: true, + }, + HOMEBREW_PRY: { + description: "Homebrew will use Pry for the `brew irb` command.", + boolean: true, + }, + HOMEBREW_SKIP_OR_LATER_BOTTLES: { + description: "Along with `HOMEBREW_DEVELOPER` Homebrew will not use bottles from older versions of macOS. " \ + "This is useful in Homebrew development on new macOS versions.", + boolean: true, + }, + HOMEBREW_SVN: { + description: "Forces Homebrew to use a particular `svn` binary. Otherwise, a Homebrew-built Subversion " \ + "if installed, or the system-provided binary.", + }, + HOMEBREW_TEMP: { + description: "Instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory for building " \ + "packages. This may be needed if your system temp directory and Homebrew prefix are on " \ + "different volumes, as macOS has trouble moving symlinks across volumes when the target" \ + "does not yet exist. This issue typically occurs when using FileVault or custom SSD" \ + "configurations.", + default_text: "macOS: `/private/tmp`, Linux: `/tmp`.", + default: HOMEBREW_DEFAULT_TEMP, + }, + HOMEBREW_UPDATE_TO_TAG: { + description: "Instructs Homebrew to always use the latest stable tag (even if developer commands " \ + "have been run).", + boolean: true, + }, + HOMEBREW_VERBOSE: { + description: "Homebrew always assumes `--verbose` when running commands.", + boolean: true, + }, + HOMEBREW_VERBOSE_USING_DOTS: { + boolean: true, + description: "Homebrew's verbose output will print a `.` no more than once a minute. This can be " \ + "useful to avoid long-running Homebrew commands being killed due to no output.", + }, + all_proxy: { + description: "Sets the SOCKS5 proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + ftp_proxy: { + description: "Sets the FTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + http_proxy: { + description: "Sets the HTTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + https_proxy: { + description: "Sets the HTTPS proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \ + "through Homebrew.", + }, + no_proxy: { + description: "Sets the comma-separated list of hostnames and domain names that should be excluded " \ + "from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.", + }, + }.freeze + + def env_method_name(env, hash) + method_name = env.to_s + .sub(/^HOMEBREW_/, "") + .downcase + method_name = "#{method_name}?" if hash[:boolean] + method_name + end + + ENVS.each do |env, hash| + method_name = env_method_name(env, hash) + env = env.to_s + + if hash[:boolean] + define_method(method_name) do + ENV[env].present? + end + elsif hash[:default].present? + # Needs a custom implementation. + next if env == "HOMEBREW_MAKE_JOBS" + + define_method(method_name) do + ENV[env].presence || hash.fetch(:default).to_s + end + else + define_method(method_name) do + ENV[env].presence + end + end + end + + # Needs a custom implementation. + def make_jobs + jobs = ENV["HOMEBREW_MAKE_JOBS"].to_i + return jobs.to_s if jobs.positive? + + ENVS.fetch(:HOMEBREW_MAKE_JOBS) + .fetch(:default) + .call + .to_s + end + end +end
false
Other
Homebrew
brew
37dcbbaf65e0faf918069f1689ba332e58f2e6ac.json
download_strategy: unlink the lock file after unlocking it
Library/Homebrew/download_strategy.rb
@@ -326,6 +326,7 @@ def fetch end ensure download_lock&.unlock + download_lock&.path&.unlink end def clear_cache
false
Other
Homebrew
brew
692b3e5a7bfb5ff8fef3c6d952962ab8bb7bad8e.json
shims/mac/super/pkg-config: fix macOS <=10.13 compatibility Fixes #7290.
Library/Homebrew/shims/mac/super/pkg-config
@@ -1,5 +1,11 @@ #!/bin/sh -exec "$HOMEBREW_OPT/pkg-config/bin/pkg-config" \ +pkg_config="$HOMEBREW_OPT/pkg-config/bin/pkg-config" + +if [ -z "$HOMEBREW_SDKROOT" ]; then + exec "$pkg_config" "$@" +fi + +exec "$pkg_config" \ "--define-variable=homebrew_sdkroot=$HOMEBREW_SDKROOT" \ "$@"
false
Other
Homebrew
brew
1a32ba3d2bdc43d38d7aaece9ea87947745a4d87.json
system_command_spec: Make part of bash error regex optional
Library/Homebrew/test/system_command_spec.rb
@@ -37,7 +37,7 @@ it "unsets them" do expect { command.run! - }.to raise_error(/C: parameter null or not set/) + }.to raise_error(/C: parameter (null or )?not set/) end end
false
Other
Homebrew
brew
fa3591681800f9da06cd2d0179a5ef9e63b10729.json
ENV/std: withdraw support for Homebrew supplied *.pc files
Library/Homebrew/extend/os/mac/extend/ENV/std.rb
@@ -3,11 +3,7 @@ module Stdenv # @private - undef homebrew_extra_pkg_config_paths, x11 - - def homebrew_extra_pkg_config_paths - ["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}"] - end + undef x11 def x11 # There are some config scripts here that should go in the PATH
false
Other
Homebrew
brew
845c71270e2cf47bde3c1508654460b1e5c5958c.json
rubocop.yml: enable non-default checks. Closes https://github.com/Homebrew/brew/pull/7258
Library/.rubocop.yml
@@ -50,6 +50,12 @@ 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
false
Other
Homebrew
brew
a298d7d8fea477e73b5ea507a4214345e1166890.json
formula_cellar_checks: check Python site packages
Library/Homebrew/formula_cellar_checks.rb
@@ -165,6 +165,40 @@ def check_elisp_root(share, name) EOS end + def check_python_packages(lib, deps) + return unless lib.directory? + + lib_subdirs = lib.children + .select(&:directory?) + .map(&:basename) + + pythons = lib_subdirs.map do |p| + match = p.to_s.match(/^python(\d+\.\d+)$/) + next if match.blank? + next if match.captures.blank? + + match.captures.first + end.compact + + python_deps = deps.map(&:name) + .grep(/^python(@.*)?$/) + .map { |d| Formula[d].version.to_s[/^\d+\.\d+/] } + .compact + + return if python_deps.blank? + return if pythons.any? { |v| python_deps.include? v } + + pythons = pythons.map { |v| "Python #{v}" } + python_deps = python_deps.map { |v| "Python #{v}" } + + <<~EOS + Packages have been installed for: + #{pythons * "\n "} + but this formula depends on: + #{python_deps * "\n "} + EOS + end + def audit_installed @new_formula ||= false @@ -179,6 +213,7 @@ def audit_installed problem_if_output(check_easy_install_pth(formula.lib)) problem_if_output(check_elisp_dirname(formula.share, formula.name)) problem_if_output(check_elisp_root(formula.share, formula.name)) + problem_if_output(check_python_packages(formula.lib, formula.deps)) end alias generic_audit_installed audit_installed
false
Other
Homebrew
brew
e1ce5c852dc68783ab4741173173824b1e79a266.json
github: return output if JSON parsing is not desired
Library/Homebrew/utils/github.rb
@@ -172,7 +172,7 @@ def api_credentials_error_message(response_headers, needed_scopes) end end - def open_api(url, data: nil, request_method: nil, scopes: [].freeze) + def open_api(url, data: nil, request_method: nil, scopes: [].freeze, parse_json: true) # This is a no-op if the user is opting out of using the GitHub API. return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] @@ -227,11 +227,11 @@ def open_api(url, data: nil, request_method: nil, scopes: [].freeze) return if http_code == "204" # No Content - json = JSON.parse output + output = JSON.parse output if parse_json if block_given? - yield json + yield output else - json + output end rescue JSON::ParserError => e raise Error, "Failed to parse JSON response\n#{e.message}", e.backtrace
false
Other
Homebrew
brew
4265540cc41959c4bf5d68cd5e9f046b8aa79cc5.json
load_path: trim entries where possible to fix Ruby crashes
Library/Homebrew/load_path.rb
@@ -4,6 +4,9 @@ HOMEBREW_LIBRARY_PATH = Pathname(__dir__).realpath.freeze -$LOAD_PATH.push(HOMEBREW_LIBRARY_PATH.to_s) unless $LOAD_PATH.include?(HOMEBREW_LIBRARY_PATH.to_s) +$LOAD_PATH.push HOMEBREW_LIBRARY_PATH.to_s require "vendor/bundle/bundler/setup" + +$LOAD_PATH.select! { |d| Pathname(d).directory? } +$LOAD_PATH.uniq!
true
Other
Homebrew
brew
4265540cc41959c4bf5d68cd5e9f046b8aa79cc5.json
load_path: trim entries where possible to fix Ruby crashes
Library/Homebrew/test/support/helper/spec/shared_context/integration_test.rb
@@ -9,11 +9,6 @@ RSpec.shared_context "integration test" do extend RSpec::Matchers::DSL - if OS.mac? && - !RUBY_BIN.to_s.match?(%r{^/(System/Library/Frameworks/Ruby\.framework/Versions/(Current|\d+\.\d+)/)usr/bin$}) - skip "integration test requires system Ruby" - end - matcher :be_a_success do match do |actual| status = actual.is_a?(Proc) ? actual.call : actual
true
Other
Homebrew
brew
bfcba0f5f0a4c039939441c6f257b771f054c649.json
Library/Homebrew: add free_port test helper Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/dev-cmd/test.rb
@@ -36,6 +36,7 @@ def test test_args.parse require "formula_assertions" + require "formula_free_port" args.resolved_formulae.each do |f| # Cannot test uninstalled formulae
true
Other
Homebrew
brew
bfcba0f5f0a4c039939441c6f257b771f054c649.json
Library/Homebrew: add free_port test helper Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/formula_free_port.rb
@@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Homebrew + module FreePort + require "socket" + + def free_port + server = TCPServer.new 0 + _, port, = server.addr + server.close + + port + end + end +end
true
Other
Homebrew
brew
bfcba0f5f0a4c039939441c6f257b771f054c649.json
Library/Homebrew: add free_port test helper Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/test.rb
@@ -7,6 +7,7 @@ require "timeout" require "debrew" require "formula_assertions" +require "formula_free_port" require "fcntl" require "socket" require "cli/parser" @@ -26,6 +27,7 @@ formula = Homebrew.args.resolved_formulae.first formula.extend(Homebrew::Assertions) + formula.extend(Homebrew::FreePort) formula.extend(Debrew::Formula) if Homebrew.args.debug? # tests can also return false to indicate failure
true
Other
Homebrew
brew
bfcba0f5f0a4c039939441c6f257b771f054c649.json
Library/Homebrew: add free_port test helper Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/test/formula_free_port_spec.rb
@@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require "socket" +require "formula_free_port" + +module Homebrew + describe FreePort do + include described_class + + describe "#free_port" do + # IANA suggests user port from 1024 to 49151 + # and dynamic port for 49152 to 65535 + # http://www.iana.org/assignments/port-numbers + MIN_PORT = 1024 + MAX_PORT = 65535 + + it "returns a free TCP/IP port" do + port = free_port + + expect(port).to be_between(MIN_PORT, MAX_PORT) + expect { TCPServer.new(port).close }.not_to raise_error + end + end + end +end
true
Other
Homebrew
brew
0d3a4d98c0ebb7e5a97cb8151f7c348e6955002a.json
utils/github: add test for fetch_artifact
Library/Homebrew/test/utils/github_spec.rb
@@ -41,4 +41,18 @@ expect(results.first["title"]).to eq("Shall we run `brew update` automatically?") end end + + describe "::fetch_artifact", :needs_network do + it "fails to find a nonexistant workflow" do + expect { + subject.fetch_artifact("Homebrew", "homebrew-core", 1, ".") + }.to raise_error(/No matching workflow run found/) + end + + it "fails to find artifacts that don't exist" do + expect { + subject.fetch_artifact("Homebrew", "homebrew-core", 51971, ".", artifact_name: "false_bottles") + }.to raise_error(/No artifact .+ was found/) + end + end end
false
Other
Homebrew
brew
5b1d0786a45e69b4af1d71d433cc11bb676fd6b6.json
utils/github: add fetch_artifact API
Library/Homebrew/utils/github.rb
@@ -1,7 +1,8 @@ # frozen_string_literal: true -require "uri" +require "download_strategy" require "tempfile" +require "uri" module GitHub module_function @@ -438,6 +439,70 @@ 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") + base_url = "#{API_URL}/repos/#{user}/#{repo}" + pr_payload = open_api("#{base_url}/pulls/#{pr}") + pr_sha = pr_payload["head"]["sha"] + pr_branch = pr_payload["head"]["ref"] + + workflow = open_api("#{base_url}/actions/workflows/#{workflow_id}/runs?branch=#{pr_branch}") + workflow_run = workflow["workflow_runs"].select do |run| + run["head_sha"] == pr_sha + end + + if workflow_run.empty? + raise Error, <<~EOS + No matching workflow run found for these criteria! + Commit SHA: #{pr_sha} + Branch ref: #{pr_branch} + Pull request: #{pr} + Workflow: #{workflow_id} + EOS + end + + status = workflow_run.first["status"].sub("_", " ") + if status != "completed" + raise Error, <<~EOS + The newest workflow run for ##{pr} is still #{status}! + #{Formatter.url workflow_run.first["html_url"]} + EOS + end + + artifacts = open_api(workflow_run.first["artifacts_url"]) + + artifact = artifacts["artifacts"].select do |art| + art["name"] == artifact_name + end + + if artifact.empty? + raise Error, <<~EOS + No artifact with the name `#{artifact_name}` was found! + #{Formatter.url workflow_run.first["html_url"]} + 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}" } + 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 = CurlDownloadStrategy.new(artifact_url, "artifact", pr, **curl_args) + downloader.fetch + downloader.stage + end + end + def api_errors [GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError, GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze
false
Other
Homebrew
brew
c241dccbc8d4eca71a6130208ef09ec8e89a42c9.json
test/resource_spec: fix flaky test
Library/Homebrew/test/resource_spec.rb
@@ -157,7 +157,7 @@ end specify "#verify_download_integrity_mismatch" do - fn = double(file?: true) + fn = double(file?: true, basename: "foo") checksum = subject.sha256(TEST_SHA256) expect(fn).to receive(:verify_checksum).with(checksum)
false
Other
Homebrew
brew
3955e7e13b980ad4f8d38ffc3c0253d86204902e.json
language/test: add shebang tests
Library/Homebrew/test/language/perl/shebang_spec.rb
@@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require "language/perl" +require "utils/shebang" + +describe Language::Perl::Shebang do + let(:file) { Tempfile.new("perl-shebang") } + let(:perl_f) do + formula "perl" do + url "https://brew.sh/perl-1.0.tgz" + end + end + let(:f) do + formula "foo" do + url "https://brew.sh/foo-1.0.tgz" + + uses_from_macos "perl" + end + end + + before do + file.write <<~EOS + #!/usr/bin/env perl + a + b + c + EOS + file.flush + end + + after { file.unlink } + + describe "#detected_perl_shebang" do + it "can be used to replace Perl shebangs" do + allow(Formulary).to receive(:factory).with(perl_f.name).and_return(perl_f) + Utils::Shebang.rewrite_shebang described_class.detected_perl_shebang(f), file + + expected_shebang = if OS.mac? + "/usr/bin/perl" + else + HOMEBREW_PREFIX/"opt/perl/bin/perl" + end + + expect(File.read(file)).to eq <<~EOS + #!#{expected_shebang} + a + b + c + EOS + end + end +end
true
Other
Homebrew
brew
3955e7e13b980ad4f8d38ffc3c0253d86204902e.json
language/test: add shebang tests
Library/Homebrew/test/language/python_spec.rb
@@ -2,6 +2,7 @@ require "language/python" require "resource" +require "utils/shebang" describe Language::Python, :needs_python do describe "#major_minor_version" do @@ -32,6 +33,48 @@ end end +describe Language::Python::Shebang do + let(:file) { Tempfile.new("python-shebang") } + let(:python_f) do + formula "python" do + url "https://brew.sh/python-1.0.tgz" + end + end + let(:f) do + formula "foo" do + url "https://brew.sh/foo-1.0.tgz" + + depends_on "python" + end + end + + before do + file.write <<~EOS + #!/usr/bin/env python3 + a + b + c + EOS + file.flush + end + + after { file.unlink } + + describe "#detected_python_shebang" do + it "can be used to replace Python shebangs" do + expect(Formulary).to receive(:factory).with(python_f.name).and_return(python_f) + Utils::Shebang.rewrite_shebang described_class.detected_python_shebang(f), file + + expect(File.read(file)).to eq <<~EOS + #!#{HOMEBREW_PREFIX}/opt/python/bin/python3 + a + b + c + EOS + end + end +end + describe Language::Python::Virtualenv::Virtualenv do subject { described_class.new(formula, dir, "python") }
true
Other
Homebrew
brew
931e379fec26977f7a0409016632f32a8692edec.json
remove extra space
Library/Homebrew/download_strategy.rb
@@ -421,7 +421,7 @@ def _curl_args args += ["--user", meta.fetch(:user)] if meta.key?(:user) - args += [meta[:header], meta[:headers]].compact.flatten.flat_map { |h| ["--header", h.strip] } + args += [meta[:header], meta[:headers]].compact.flatten.flat_map { |h| ["--header", h.strip] } args end
false
Other
Homebrew
brew
f3307193e0ae3ac6dd2061020a93a9a5da04790b.json
.github/workflows/tests.yml: Deploy Docker image Deploy the latest Docker image on a push to master. Deploy a tagged Docker image upon publication of a release.
.github/workflows/tests.yml
@@ -3,6 +3,9 @@ on: push: branches: master pull_request: [] + release: + types: + - published jobs: tests: if: github.repository == 'Homebrew/brew' @@ -140,6 +143,22 @@ jobs: run: | if [ "$RUNNER_OS" = "Linux" ]; then docker-compose -f Dockerfile.yml run --rm -v $GITHUB_WORKSPACE:/tmp/test-bot sut + docker tag homebrew_sut brew else brew test-bot fi + + - name: Deploy the latest Docker image + if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/master' + run: | + docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}} + docker tag brew docker.pkg.github.com/homebrew/brew/brew + docker push docker.pkg.github.com/homebrew/brew/brew + + - name: Deploy the tagged Docker image + if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/') + run: | + docker login docker.pkg.github.com -u BrewTestBot -p ${{secrets.GITHUB_TOKEN}} + v=${GITHUB_REF:10} + docker tag brew "docker.pkg.github.com/homebrew/brew/brew:$v" + docker push "docker.pkg.github.com/homebrew/brew/brew:$v"
false
Other
Homebrew
brew
626f9406b1987932382814bc7d7cae3b41b771f4.json
remove flaky cask upgrade test
Library/Homebrew/test/cask/cmd/upgrade_spec.rb
@@ -71,31 +71,6 @@ expect(local_transmission_path).to be_a_directory expect(local_transmission.versions).to include("2.60") end - - it 'updates "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("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.3") - - expect(auto_updates).to be_installed - expect(auto_updates_path).to be_a_directory - expect(auto_updates.versions).to include("2.61") - end end describe "with --greedy it checks additional Casks" do
false
Other
Homebrew
brew
4bb66c12e8afa79d838fd9f0b4c86021050c33eb.json
utils/github: add repository_dispatch API
Library/Homebrew/utils/github.rb
@@ -431,6 +431,13 @@ def issue_comment_exists?(user, repo, pr, body) comments.any? { |comment| comment["body"].eql?(body) } end + def dispatch(user, repo, event, **payload) + url = "#{API_URL}/repos/#{user}/#{repo}/dispatches" + open_api(url, data: { event_type: event, client_payload: payload }, + request_method: :POST, + scopes: CREATE_ISSUE_FORK_OR_PR_SCOPES) + end + def api_errors [GitHub::AuthenticationFailedError, GitHub::HTTPNotFoundError, GitHub::RateLimitExceededError, GitHub::Error, JSON::ParserError].freeze
false
Other
Homebrew
brew
096a5bdfb431b366d9a67340366195e805efc748.json
FormulaInstaller: link tmp kegs during rescue In #6807, the FormulaInstaller began to rescue from FormulaInstallationAlreadyAttemptedError but there is the potential for tmp kegs to remain unlinked in the cellar. I've merged the rescue statements so they both re-link tmp kegs, but it doesn't raise for FormulaInstallationAlreadyAttemptedError.
Library/Homebrew/formula_installer.rb
@@ -598,16 +598,16 @@ def install_dependency(dep, inherited_options) oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}" fi.install fi.finish - rescue FormulaInstallationAlreadyAttemptedError - # We already attempted to install f as part of the dependency tree of - # another formula. In that case, don't generate an error, just move on. - nil - rescue Exception # rubocop:disable Lint/RescueException + rescue Exception => e # rubocop:disable Lint/RescueException ignore_interrupts do tmp_keg.rename(installed_keg) if tmp_keg && !installed_keg.directory? linked_keg.link if keg_was_linked end - raise + raise unless e.is_a? FormulaInstallationAlreadyAttemptedError + + # We already attempted to install f as part of another formula's + # dependency tree. In that case, don't generate an error, just move on. + nil else ignore_interrupts { tmp_keg.rmtree if tmp_keg&.directory? } end
false
Other
Homebrew
brew
2dffdf5ddf91d9a2d55b18a887c6bdcb56cec4ed.json
docs: fix broken link
docs/Brew-Test-Bot.md
@@ -8,7 +8,7 @@ by [our Kickstarter in 2013](https://www.kickstarter.com/projects/homebrew/brew- It comprises four Mac Minis and three Xserves running in two data centres which host [a Jenkins instance at https://jenkins.brew.sh](https://jenkins.brew.sh) and run the -[`brew-test-bot.rb`](https://github.com/Homebrew/homebrew-test-bot/blob/master/cmd/brew-test-bot.rb) +[`test-bot.rb`](https://github.com/Homebrew/homebrew-test-bot/blob/master/cmd/test-bot.rb) Ruby script to perform automated testing of commits to the master branch, pull requests and custom builds requested by maintainers.
false
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/cmd/install.rb
@@ -315,6 +315,7 @@ def install end def install_formula(f) + opoo "#{f.name} has been deprecated" if f.is_deprecated? f.print_tap_action build_options = f.build
true
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/cmd/reinstall.rb
@@ -61,6 +61,7 @@ def reinstall onoe "#{f.full_name} is pinned. You must unpin it to reinstall." next end + opoo "#{f.name} has been deprecated" if f.is_deprecated? Migrator.migrate_if_needed(f) reinstall_formula(f) Cleanup.install_formula_clean!(f)
true
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/cmd/upgrade.rb
@@ -150,6 +150,8 @@ def upgrade_formulae(formulae_to_install) def upgrade_formula(f) return if args.dry_run? + opoo "#{f.name} has been deprecated" if f.is_deprecated? + if f.opt_prefix.directory? keg = Keg.new(f.opt_prefix.resolved_path) keg_had_linked_opt = true
true
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/formula.rb
@@ -51,6 +51,7 @@ class Formula include FileUtils include Utils::Inreplace include Utils::Shell + include Utils::Deprecate extend Enumerable extend Forwardable extend Cachable @@ -175,6 +176,16 @@ class Formula attr_accessor :follow_installed_alias alias follow_installed_alias? follow_installed_alias + # A Boolean indicating whether this formula is deprecated or not + # Defaults to false + attr_accessor :is_deprecated + alias is_deprecated? is_deprecated + + # A Boolean indicating whether this formula is disabled + # Defaults to false + attr_accessor :is_disabled + alias is_disabled? is_disabled + # @private def initialize(name, path, spec, alias_path: nil) @name = name @@ -211,6 +222,8 @@ def initialize(name, path, spec, alias_path: nil) @follow_installed_alias = true @prefix_returns_versioned_prefix = false @oldname_lock = nil + @is_deprecated = false + @is_disabled = false end # @private
true
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/utils.rb
@@ -13,6 +13,7 @@ require "utils/popen" require "utils/svn" require "utils/tty" +require "utils/deprecate" require "tap_constants" require "time"
true
Other
Homebrew
brew
7a62973de296e3d11cdbf17acd3bc7b19ca0d5bc.json
add deprecate module
Library/Homebrew/utils/deprecate.rb
@@ -0,0 +1,35 @@ +# frozen_string_literal: true + +module Utils + module Deprecate + # This module is common for both formulae and casks. + # To-do : Add support for casks + add disable method + + def deprecate + self.is_deprecated = true + + # deprecate all formulae dependent on this deprecated formula + all_formulae = ObjectSpace.each_object(Class).select { |klass| klass < Formula } + all_formulae.each do |f| + dependencies = f.recursive_dependencies.map(&:name) + f.is_deprecated = true if (dependencies.include? self.name) + end + end + + # Deprecation can be revoked if the underlying problem is fixed + def revoke_deprecation + self.is_deprecated = false + + # revoke deprecation from dependents as well + all_formulae = ObjectSpace.each_object(Class).select { |klass| klass < Formula } + all_formulae.each do |f| + dependencies = f.recursive_dependencies.map(&:name) + revoke = true + dependencies.each do |d| + revoke = !(d != self && d.is_deprecated?) + end + f.is_deprecated = false if revoke && (dependencies.include? self.name) + end + end + end +end
true
Other
Homebrew
brew
b37c3e9cb252a7f83db2b58e3cf2e020523d1d51.json
rubocops/patches: suggest url with full_index=1
Library/Homebrew/rubocops/patches.rb
@@ -57,7 +57,7 @@ def patch_problems(patch) if match_obj = regex_match_group(patch, gh_patch_diff_pattern) problem <<~EOS use GitHub pull request URLs: - https://github.com/#{match_obj[1]}/#{match_obj[2]}/pull/#{match_obj[3]}.patch + https://github.com/#{match_obj[1]}/#{match_obj[2]}/pull/#{match_obj[3]}.patch?full_index=1 Rather than patch-diff: #{patch_url} EOS
true
Other
Homebrew
brew
b37c3e9cb252a7f83db2b58e3cf2e020523d1d51.json
rubocops/patches: suggest url with full_index=1
Library/Homebrew/test/rubocops/patches_spec.rb
@@ -94,7 +94,7 @@ def patches [{ message: <<~EOS, use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch + https://github.com/foo/foo-bar/pull/100.patch?full_index=1 Rather than patch-diff: https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch EOS @@ -231,7 +231,7 @@ class Foo < Formula [{ message: <<~EOS, use GitHub pull request URLs: - https://github.com/foo/foo-bar/pull/100.patch + https://github.com/foo/foo-bar/pull/100.patch?full_index=1 Rather than patch-diff: https://patch-diff.githubusercontent.com/raw/foo/foo-bar/pull/100.patch EOS
true
Other
Homebrew
brew
c48352aa6ca409bcf2d05f7a046c264565243068.json
cask/cmd/list: fix ambiguous params.
Library/Homebrew/cask/cmd/list.rb
@@ -47,7 +47,7 @@ def list_installed elsif versions? puts installed_casks.map(&self.class.method(:format_versioned)) elsif full_name? - puts installed_casks.map(&:full_name).sort &tap_and_name_comparison + puts installed_casks.map(&:full_name).sort(&tap_and_name_comparison) elsif !installed_casks.empty? puts Formatter.columns(installed_casks.map(&:to_s)) end
false
Other
Homebrew
brew
57109a175a5ca268025e6d39d39867ea05c910bc.json
diagnostic: add doctor check for CPU arch on Linux Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/extend/os/linux/diagnostic.rb
@@ -2,6 +2,7 @@ require "tempfile" require "utils/shell" +require "hardware" require "os/linux/diagnostic" require "os/linux/glibc" require "os/linux/kernel" @@ -13,6 +14,7 @@ def supported_configuration_checks %w[ check_glibc_minimum_version check_kernel_minimum_version + check_supported_architecture ].freeze end @@ -71,6 +73,16 @@ def check_umask_not_zero EOS end + def check_supported_architecture + return if Hardware::CPU.arch == :x86_64 + + <<~EOS + Your CPU architecture (#{Hardware::CPU.arch}) is not supported. We only support + x86_64 CPU architectures. You will be unable to use binary packages (bottles). + #{please_create_pull_requests} + EOS + end + def check_glibc_minimum_version return unless OS::Linux::Glibc.below_minimum_version?
true
Other
Homebrew
brew
57109a175a5ca268025e6d39d39867ea05c910bc.json
diagnostic: add doctor check for CPU arch on Linux Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
Library/Homebrew/test/os/linux/diagnostic_spec.rb
@@ -3,6 +3,13 @@ require "diagnostic" describe Homebrew::Diagnostic::Checks do + specify "#check_supported_architecture" do + allow(Hardware::CPU).to receive(:type).and_return(:arm64) + + expect(subject.check_supported_architecture) + .to match(/Your CPU architecture .+ is not supported/) + end + specify "#check_glibc_minimum_version" do allow(OS::Linux::Glibc).to receive(:below_minimum_version?).and_return(true)
true
Other
Homebrew
brew
cd3ced48e97f8fdab67b0737ba5441d4057457e9.json
rubocop: set LineLength to 118. GitHub diff UI wraps beyond 118 characters. This also allows enabling `Style/IfUnlessModifier` (which autocorrects).
Library/.rubocop.yml
@@ -78,9 +78,9 @@ Metrics/ModuleLength: Metrics/PerceivedComplexity: Enabled: false -# GitHub diff UI wraps beyond 118 characters (so that's the goal) +# GitHub diff UI wraps beyond 118 characters Layout/LineLength: - Max: 167 + Max: 118 # ignore manpage comments and long single-line strings IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
true
Other
Homebrew
brew
cd3ced48e97f8fdab67b0737ba5441d4057457e9.json
rubocop: set LineLength to 118. GitHub diff UI wraps beyond 118 characters. This also allows enabling `Style/IfUnlessModifier` (which autocorrects).
Library/.rubocop_shared.yml
@@ -58,9 +58,9 @@ Style/HashTransformKeys: Style/HashTransformValues: Enabled: true -# This shouldn't be enabled until LineLength is lower. +# Enabled now LineLength is lowish. Style/IfUnlessModifier: - Enabled: false + Enabled: true # Only use this for numbers >= `1_000_000`. Style/NumericLiterals:
true
Other
Homebrew
brew
cd3ced48e97f8fdab67b0737ba5441d4057457e9.json
rubocop: set LineLength to 118. GitHub diff UI wraps beyond 118 characters. This also allows enabling `Style/IfUnlessModifier` (which autocorrects).
Library/Homebrew/.rubocop.yml
@@ -61,12 +61,6 @@ Metrics/PerceivedComplexity: Enabled: true Max: 100 -# GitHub diff UI wraps beyond 118 characters -Layout/LineLength: - Max: 118 - # ignore manpage comments - IgnoredPatterns: ['#: '] - # we won't change backward compatible predicate names Naming/PredicateName: Exclude:
true
Other
Homebrew
brew
278bba05236c0a2ca62fa686ae99a42dc8b20fcb.json
Use concise method for both header and headers
Library/Homebrew/download_strategy.rb
@@ -423,7 +423,7 @@ def _curl_args args += ["--header", meta.fetch(:header)] if meta.key?(:header) - meta.fetch(:headers).each { |h| args += ["--header", h.strip] } if meta.key?(:headers) + args += [meta.fetch(:header), *meta.fetch(:headers)].compact.flat_map { |h| ["--header", h.strip] } args end
false
Other
Homebrew
brew
020d6e28438109849511d00dfb20383c1a8f5619.json
upgrade: suggest full_name when appropriate. Otherwise `brew install foo/bar/baz` when an older version of `baz` is installed will tell you to run `brew upgrade baz` which won't work.
Library/Homebrew/cmd/install.rb
@@ -173,7 +173,7 @@ def install optlinked_version = Keg.for(f.opt_prefix).version onoe <<~EOS #{f.full_name} #{optlinked_version} is already installed - To upgrade to #{f.version}, run `brew upgrade #{f.name}` + To upgrade to #{f.version}, run `brew upgrade #{f.full_name}` EOS elsif args.only_dependencies? formulae << f
true
Other
Homebrew
brew
020d6e28438109849511d00dfb20383c1a8f5619.json
upgrade: suggest full_name when appropriate. Otherwise `brew install foo/bar/baz` when an older version of `baz` is installed will tell you to run `brew upgrade baz` which won't work.
Library/Homebrew/formula_installer.rb
@@ -228,7 +228,7 @@ def install EOS if formula.outdated? && !formula.head? message += <<~EOS - To upgrade to #{formula.pkg_version}, run `brew upgrade #{formula.name}`. + To upgrade to #{formula.pkg_version}, run `brew upgrade #{formula.full_name}`. EOS elsif only_deps? message = nil
true
Other
Homebrew
brew
40432d86f94c52fb7ee5249fbce34c20e18b15ec.json
cmd/uninstall: handle unparsed arguments. If `Homebrew.args` hasn't yet been populated then `named` will return `nil`. Instead, ensure it is an array before we try to `join` it. This is pretty much only a test-time problem but has been causing flaky builds.
Library/Homebrew/cmd/uninstall.rb
@@ -130,7 +130,7 @@ def initialize(requireds, dependents) protected def sample_command - "brew uninstall --ignore-dependencies #{Homebrew.args.named.join(" ")}" + "brew uninstall --ignore-dependencies #{Array(Homebrew.args.named).join(" ")}" end def are_required_by_deps
false
Other
Homebrew
brew
2594e7093ea082daa1add40104e69616a7e1ef15.json
language/python: fix virtualenv symlinks for versioned Python
Library/Homebrew/language/python.rb
@@ -220,14 +220,21 @@ def create next unless f.symlink? next unless (rp = f.realpath.to_s).start_with? HOMEBREW_CELLAR - new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python/[^/]+}, Formula["python"].opt_prefix + version = rp.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/} + version = "@#{version.captures.first}" unless version.nil? + + new_target = rp.sub %r{#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix f.unlink f.make_symlink new_target end Pathname.glob(@venv_root/"lib/python*/orig-prefix.txt").each do |prefix_file| prefix_path = prefix_file.read - prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/python/[^/]+}, Formula["python"].opt_prefix + + version = prefix_path.match %r{^#{HOMEBREW_CELLAR}/python@(.*?)/} + version = "@#{version.captures.first}" unless version.nil? + + prefix_path.sub! %r{^#{HOMEBREW_CELLAR}/python#{version}/[^/]+}, Formula["python#{version}"].opt_prefix prefix_file.atomic_write prefix_path end end
false
Other
Homebrew
brew
38da4dcac02d70f5518115bf8c2a9f3a5d4e4810.json
Add headers option to URLs in forumlas
Library/Homebrew/download_strategy.rb
@@ -423,6 +423,8 @@ def _curl_args args += ["--header", meta.fetch(:header)] if meta.key?(:header) + meta.fetch(:headers).each { |h| args += ["--header", h.strip] } if meta.key?(:headers) + args end
false
Other
Homebrew
brew
1d6159fe65fdb11f2c634824746906f12d184c0a.json
add https checking for links
docs/Rakefile
@@ -20,6 +20,7 @@ task test: :build do check_opengraph: true, check_html: true, check_img_http: true, + enforce_https: true, file_ignore: [ %r{Kickstarter-Supporters}, ],
false
Other
Homebrew
brew
2592b937706a4393ad2f275da32ae9dab48e594d.json
formula: ensure CMake uses the desired SDK
Library/Homebrew/formula.rb
@@ -1335,6 +1335,10 @@ def std_cmake_args # CMake cache entries for other weak symbols may be added here as needed. args << "-DHAVE_CLOCK_GETTIME:INTERNAL=0" if MacOS.version == "10.11" && MacOS::Xcode.version >= "8.0" + # Ensure CMake is using the same SDK we are using. + sdk = MacOS.sdk_path_if_needed + args << "-DCMAKE_OSX_SYSROOT=#{sdk}" if sdk + args end
false
Other
Homebrew
brew
43d6caf0e3c093bf03d1ecf8516ee4201285a6e7.json
patch: add support for changing directory
Library/Homebrew/patch.rb
@@ -135,7 +135,7 @@ def owner=(owner) end def apply - dir = Pathname.pwd + base_dir = Pathname.pwd resource.unpack do patch_dir = Pathname.pwd if patch_files.empty? @@ -149,6 +149,8 @@ def apply patch_files << children.first.basename end + dir = base_dir + dir /= resource.directory if resource.directory.present? dir.cd do patch_files.each do |patch_file| ohai "Applying #{patch_file}"
true
Other
Homebrew
brew
43d6caf0e3c093bf03d1ecf8516ee4201285a6e7.json
patch: add support for changing directory
Library/Homebrew/resource.rb
@@ -198,6 +198,7 @@ class PatchResource < Resource def initialize(&block) @patch_files = [] + @directory = nil super "patch", &block end @@ -206,6 +207,12 @@ def apply(*paths) @patch_files.concat(paths) @patch_files.uniq! end + + def directory(val = nil) + return @directory if val.nil? + + @directory = val + end end end
true
Other
Homebrew
brew
a0df23ec8db39d24913322d274d7107dc56f8e01.json
Fix broken link on docs man page
docs/README.md
@@ -23,7 +23,7 @@ - [External Commands](External-Commands.md) - [Ruby Gems, Python Eggs and Perl Modules](Gems,-Eggs-and-Perl-Modules.md) - [Python](Homebrew-and-Python.md) -- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md) +- [How To Build Software Outside Homebrew With Homebrew `keg_only` dependencies](How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md) - [Xcode](Xcode.md) - [Kickstarter Supporters](Kickstarter-Supporters.md)
false
Other
Homebrew
brew
1f29f7092979470b6cfb56160ef7cd8f530298d5.json
os/mac: prefer CLT SDK over Xcode
Library/Homebrew/os/mac.rb
@@ -85,10 +85,10 @@ def active_developer_dir # if available. Otherwise, the latest SDK is returned. def sdk(v = nil) - @locator ||= if Xcode.installed? - XcodeSDKLocator.new - else + @locator ||= if CLT.installed? && CLT.provides_sdk? CLTSDKLocator.new + else + XcodeSDKLocator.new end @locator.sdk_if_applicable(v) @@ -101,7 +101,7 @@ def sdk_path(v = nil) end def sdk_path_if_needed(v = nil) - # Prefer Xcode SDK when both Xcode and the CLT are installed. + # Prefer CLT SDK when both Xcode and the CLT are installed. # Expected results: # 1. On Xcode-only systems, return the Xcode SDK. # 2. On Xcode-and-CLT systems where headers are provided by the system, return nil.
false
Other
Homebrew
brew
9bab0869676e5c7edfa904090df52ef736f2dfda.json
rewrite_python_shebang: move loop invariants out of loop
Library/Homebrew/language/python.rb
@@ -88,9 +88,9 @@ def self.setup_install_args(prefix) end def self.rewrite_python_shebang(python_path) + regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)$} + maximum_regex_length = 28 # the length of "#! /usr/bin/env pythonx.yyy$" Pathname(".").find do |f| - regex = %r{^#! ?/usr/bin/(env )?python([23](\.\d{1,2})?)$} - maximum_regex_length = "#! /usr/bin/env pythonx.yyy$".length next unless f.file? next unless regex.match?(f.read(maximum_regex_length))
false
Other
Homebrew
brew
68047abc0e01faf146eccf2fc958d1835aaf3daf.json
audit: ignore group write bit
Library/Homebrew/dev-cmd/audit.rb
@@ -242,15 +242,26 @@ def audit_style end def audit_file - # Under normal circumstances (umask 0022), we expect a file mode of 644. If - # the user's umask is more restrictive, respect that by masking out the - # corresponding bits. (The also included 0100000 flag means regular file.) - wanted_mode = 0100644 & ~File.umask actual_mode = formula.path.stat.mode - unless actual_mode == wanted_mode - problem format("Incorrect file permissions (%03<actual>o): chmod %03<wanted>o %<path>s", + # Check that the file is world-readable. + if actual_mode & 0444 != 0444 + problem format("Incorrect file permissions (%03<actual>o): chmod %<wanted>s %<path>s", actual: actual_mode & 0777, - wanted: wanted_mode & 0777, + wanted: "+r", + path: formula.path) + end + # Check that the file is user-writeable. + if actual_mode & 0200 != 0200 + problem format("Incorrect file permissions (%03<actual>o): chmod %<wanted>s %<path>s", + actual: actual_mode & 0777, + wanted: "u+w", + path: formula.path) + end + # Check that the file is *not* other-writeable. + if actual_mode & 0002 == 002 + problem format("Incorrect file permissions (%03<actual>o): chmod %<wanted>s %<path>s", + actual: actual_mode & 0777, + wanted: "o-w", path: formula.path) end
true
Other
Homebrew
brew
68047abc0e01faf146eccf2fc958d1835aaf3daf.json
audit: ignore group write bit
Library/Homebrew/test/dev-cmd/audit_spec.rb
@@ -106,11 +106,40 @@ class Foo < Formula RUBY path = fa.formula.path - path.chmod 0400 + path.chmod 0600 fa.audit_file expect(fa.problems) - .to eq(["Incorrect file permissions (400): chmod 644 #{path}"]) + .to eq([ + "Incorrect file permissions (600): chmod +r #{path}", + ]) + fa.problems.clear + + path.chmod 0444 + fa.audit_file + expect(fa.problems) + .to eq([ + "Incorrect file permissions (444): chmod u+w #{path}", + ]) + fa.problems.clear + + path.chmod 0646 + fa.audit_file + expect(fa.problems) + .to eq([ + "Incorrect file permissions (646): chmod o-w #{path}", + ]) + fa.problems.clear + + path.chmod 0002 + fa.audit_file + expect(fa.problems) + .to eq([ + "Incorrect file permissions (002): chmod +r #{path}", + "Incorrect file permissions (002): chmod u+w #{path}", + "Incorrect file permissions (002): chmod o-w #{path}", + ]) + fa.problems.clear end specify "DATA but no __END__" do
true
Other
Homebrew
brew
c7c9f83ff6bb234302b93f2139381f38124b89e3.json
rubocop.yml: reduce Max LineLength. Fixed the formulae in homebrew/core. Slowly but surely...
Library/.rubocop.yml
@@ -80,7 +80,7 @@ Metrics/PerceivedComplexity: # GitHub diff UI wraps beyond 118 characters (so that's the goal) Layout/LineLength: - Max: 170 + Max: 167 # ignore manpage comments and long single-line strings IgnoredPatterns: ['#: ', ' url "', ' mirror "', ' plist_options :']
false
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/audit.rb
@@ -79,12 +79,12 @@ def audit ENV.activate_extensions! ENV.setup_build_environment - if Homebrew.args.named.blank? + if args.no_named? ff = Formula files = Tap.map(&:formula_dir) else - ff = Homebrew.args.resolved_formulae - files = Homebrew.args.resolved_formulae.map(&:path) + ff = args.resolved_formulae + files = args.resolved_formulae.map(&:path) end only_cops = args.only_cops
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/bottle.rb
@@ -79,17 +79,17 @@ def bottle_args switch :verbose switch :debug conflicts "--no-rebuild", "--keep-old" + min_named 1 end end def bottle bottle_args.parse return merge if args.merge? - raise KegUnspecifiedError if args.remaining.empty? ensure_relocation_formulae_installed! unless args.skip_relocation? - Homebrew.args.resolved_formulae.each do |f| + args.resolved_formulae.each do |f| bottle_formula f end end @@ -435,10 +435,7 @@ def bottle_formula(f) end def merge - write = args.write? - raise UsageError, "--merge requires a JSON file path argument" if Homebrew.args.named.blank? - - bottles_hash = Homebrew.args.named.reduce({}) do |hash, json_file| + bottles_hash = args.named.reduce({}) do |hash, json_file| hash.deep_merge(JSON.parse(IO.read(json_file))) do |key, first, second| if key == "cellar" # Prioritize HOMEBREW_CELLAR over :any over :any_skip_relocation @@ -478,7 +475,7 @@ def merge output = bottle_output bottle - if write + if args.write? path = Pathname.new((HOMEBREW_REPOSITORY/bottle_hash["formula"]["path"]).to_s) update_or_add = nil
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/bump-formula-pr.rb
@@ -116,7 +116,7 @@ def bump_formula_pr # Use the user's browser, too. ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"] - formula = Homebrew.args.formulae.first + formula = args.formulae.first if formula tap_full_name, origin_branch, previous_branch = use_correct_linux_tap(formula) @@ -315,7 +315,7 @@ def bump_formula_pr new_formula_version = formula_version(formula, requested_spec, new_contents) if !new_mirrors && !formula_spec.mirrors.empty? - if Homebrew.args.force? + if args.force? opoo "#{formula}: Removing all mirrors because a --mirror= argument was not specified." else odie <<~EOS @@ -433,7 +433,7 @@ def inreplace_pairs(path, replacement_pairs) contents = path.open("r") { |f| Formulary.ensure_utf8_encoding(f).read } contents.extend(StringInreplaceExtension) replacement_pairs.each do |old, new| - ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet? + ohai "replace #{old.inspect} with #{new.inspect}" unless args.quiet? raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old contents.gsub!(old, new) @@ -445,7 +445,7 @@ def inreplace_pairs(path, replacement_pairs) else Utils::Inreplace.inreplace(path) do |s| replacement_pairs.each do |old, new| - ohai "replace #{old.inspect} with #{new.inspect}" unless Homebrew.args.quiet? + ohai "replace #{old.inspect} with #{new.inspect}" unless args.quiet? raise "No old value for new value #{new}! Did you pass the wrong arguments?" unless old s.gsub!(old, new) @@ -485,11 +485,11 @@ def check_for_duplicate_pull_requests(formula, tap_full_name) #{pull_requests.map { |pr| "#{pr["title"]} #{pr["html_url"]}" }.join("\n")} EOS error_message = "Duplicate PRs should not be opened. Use --force to override this error." - if Homebrew.args.force? && !Homebrew.args.quiet? + if args.force? && !args.quiet? opoo duplicates_message - elsif !Homebrew.args.force? && Homebrew.args.quiet? + elsif !args.force? && args.quiet? odie error_message - elsif !Homebrew.args.force? + elsif !args.force? odie <<~EOS #{duplicates_message.chomp} #{error_message}
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/bump-revision.rb
@@ -33,7 +33,7 @@ def bump_revision # user path, too. ENV["PATH"] = ENV["HOMEBREW_PATH"] - formulae = Homebrew.args.formulae + formulae = args.formulae raise FormulaUnspecifiedError if formulae.empty? formula = formulae.first @@ -64,7 +64,7 @@ def bump_revision end if args.dry_run? - ohai "replace #{old.inspect} with #{replacement.inspect}" unless Homebrew.args.quiet? + ohai "replace #{old.inspect} with #{replacement.inspect}" unless args.quiet? else Utils::Inreplace.inreplace(formula.path) do |s| s.gsub!(old, replacement)
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/create.rb
@@ -49,20 +49,18 @@ def create_args switch :verbose switch :debug conflicts "--autotools", "--cmake", "--go", "--meson", "--perl", "--python", "--rust" - max_named 1 + named 1 end end # Create a formula from a tarball URL def create create_args.parse - raise UsageError if ARGV.named.empty? - # Ensure that the cache exists so we can fetch the tarball HOMEBREW_CACHE.mkpath - url = ARGV.named.first # Pull the first (and only) url from ARGV + url = args.named.first # Pull the first (and only) url from ARGV version = args.set_version name = args.set_name
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/edit.rb
@@ -32,10 +32,10 @@ def edit end # If no brews are listed, open the project root in an editor. - paths = [HOMEBREW_REPOSITORY] if ARGV.named.empty? + paths = [HOMEBREW_REPOSITORY] if args.no_named? - # Don't use ARGV.formulae as that will throw if the file doesn't parse - paths ||= ARGV.named.map do |name| + # Don't use args.formulae as that will throw if the file doesn't parse + paths ||= args.named.map do |name| path = Formulary.path(name) raise FormulaUnavailableError, name if !path.file? && !args.force?
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/extract.rb
@@ -91,26 +91,23 @@ def extract_args description: "Extract the specified <version> of <formula> instead of the most recent." switch :force switch :debug - max_named 2 + named 2 end end def extract extract_args.parse - # Expect exactly two named arguments: formula and tap - raise UsageError, "This command requires formula and tap arguments" if args.remaining.length != 2 - - if args.remaining.first !~ HOMEBREW_TAP_FORMULA_REGEX - name = args.remaining.first.downcase + if args.named.first !~ HOMEBREW_TAP_FORMULA_REGEX + name = args.named.first.downcase source_tap = CoreTap.instance else name = Regexp.last_match(3).downcase source_tap = Tap.fetch(Regexp.last_match(1), Regexp.last_match(2)) raise TapFormulaUnavailableError.new(source_tap, name) unless source_tap.installed? end - destination_tap = Tap.fetch(args.remaining.second) + destination_tap = Tap.fetch(args.named.second) unless ARGV.homebrew_developer? odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap? odie "Cannot extract formula to the same tap!" if destination_tap == source_tap @@ -190,7 +187,7 @@ def extract path = destination_tap.path/"Formula/#{name}@#{version}.rb" if path.exist? - unless Homebrew.args.force? + unless args.force? odie <<~EOS Destination formula already exists: #{path} To overwrite it and continue anyways, run:
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/formula.rb
@@ -15,14 +15,13 @@ def formula_args EOS switch :verbose switch :debug + min_named :formula end end def formula formula_args.parse - raise FormulaUnspecifiedError if Homebrew.args.named.blank? - - Homebrew.args.resolved_formulae.each { |f| puts f.path } + args.resolved_formulae.each { |f| puts f.path } end end
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/linkage.rb
@@ -33,10 +33,10 @@ def linkage linkage_args.parse CacheStoreDatabase.use(:linkage) do |db| - kegs = if Homebrew.args.kegs.empty? + kegs = if args.kegs.empty? Formula.installed.map(&:opt_or_installed_prefix_keg).reject(&:nil?) else - Homebrew.args.kegs + args.kegs end kegs.each do |keg| ohai "Checking #{keg.name} linkage" if kegs.size > 1
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/mirror.rb
@@ -15,19 +15,18 @@ def mirror_args switch :verbose switch :debug hide_from_man_page! + min_named :formula end end def mirror mirror_args.parse - raise FormulaUnspecifiedError if args.remaining.empty? - bintray_user = ENV["HOMEBREW_BINTRAY_USER"] bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key - Homebrew.args.formulae.each do |f| + args.formulae.each do |f| bintray_package = Utils::Bottles::Bintray.package f.name bintray_repo_url = "https://api.bintray.com/packages/homebrew/mirror" package_url = "#{bintray_repo_url}/#{bintray_package}"
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/pull.rb
@@ -62,6 +62,7 @@ def pull_args description: "Pull the bottle block commit from the specified <user> on GitHub." switch :verbose switch :debug + min_named 1 end end @@ -70,10 +71,6 @@ def pull pull_args.parse - if ARGV.named.empty? - raise UsageError, "This command requires at least one argument containing a URL or pull request number" - end - # Passthrough Git environment variables for e.g. git am ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"] ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"] @@ -96,7 +93,7 @@ def pull tap = nil - ARGV.named.each do |arg| + args.named.each do |arg| arg = "#{CoreTap.instance.default_remote}/pull/#{arg}" if arg.to_i.positive? if (testing_match = arg.match %r{/job/Homebrew.*Testing/(\d+)}) tap = ARGV.value("tap")
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/release-notes.rb
@@ -23,13 +23,13 @@ def release_notes_args def release_notes release_notes_args.parse - previous_tag = ARGV.named.first + previous_tag = args.named.first previous_tag ||= Utils.popen_read( "git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname" ).lines.first.chomp odie "Could not find any previous tags!" unless previous_tag - end_ref = ARGV.named.second || "origin/master" + end_ref = args.named.second || "origin/master" [previous_tag, end_ref].each do |ref| next if quiet_system "git", "-C", HOMEBREW_REPOSITORY, "rev-parse", "--verify", "--quiet", ref
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/tap-new.rb
@@ -15,16 +15,14 @@ def tap_new_args EOS switch :verbose switch :debug - max_named 1 + named 1 end end def tap_new tap_new_args.parse - raise UsageError, "This command requires a tap argument" if ARGV.named.empty? - - tap = Tap.fetch(ARGV.named.first) + tap = Tap.fetch(args.named.first) titleized_user = tap.user.dup titleized_repo = tap.repo.dup titleized_user[0] = titleized_user[0].upcase
true
Other
Homebrew
brew
e3ac94fc5dee89a4037e2b857be2dbce67adeb57.json
dev-cmd: use more and cleanup new args APIs.
Library/Homebrew/dev-cmd/test.rb
@@ -28,17 +28,16 @@ def test_args switch :verbose switch :debug conflicts "--devel", "--HEAD" + min_named :formula end end def test test_args.parse - raise FormulaUnspecifiedError if ARGV.named.empty? - require "formula_assertions" - Homebrew.args.resolved_formulae.each do |f| + args.resolved_formulae.each do |f| # Cannot test uninstalled formulae unless f.latest_version_installed? ofail "Testing requires the latest version of #{f.full_name}" @@ -52,7 +51,7 @@ def test end # Don't test unlinked formulae - if !Homebrew.args.force? && !f.keg_only? && !f.linked? + if !args.force? && !f.keg_only? && !f.linked? ofail "#{f.full_name} is not linked" next end @@ -75,19 +74,19 @@ def test env = ENV.to_hash begin - args = %W[ + exec_args = %W[ #{RUBY_PATH} -W0 -I #{$LOAD_PATH.join(File::PATH_SEPARATOR)} -- #{HOMEBREW_LIBRARY_PATH}/test.rb #{f.path} - ].concat(Homebrew.args.options_only) + ].concat(args.options_only) if f.head? - args << "--HEAD" + exec_args << "--HEAD" elsif f.devel? - args << "--devel" + exec_args << "--devel" end Utils.safe_fork do @@ -102,9 +101,9 @@ def test sandbox.allow_write_path(HOMEBREW_PREFIX/"var/homebrew/locks") sandbox.allow_write_path(HOMEBREW_PREFIX/"var/log") sandbox.allow_write_path(HOMEBREW_PREFIX/"var/run") - sandbox.exec(*args) + sandbox.exec(*exec_args) else - exec(*args) + exec(*exec_args) end end rescue Exception => e # rubocop:disable Lint/RescueException
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/--cache.rb
@@ -26,10 +26,10 @@ def __cache_args def __cache __cache_args.parse - if ARGV.named.empty? + if args.no_named? puts HOMEBREW_CACHE else - Homebrew.args.formulae.each do |f| + args.formulae.each do |f| if Fetch.fetch_bottle?(f) puts f.bottle.cached_download else
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/--cellar.rb
@@ -22,10 +22,10 @@ def __cellar_args def __cellar __cellar_args.parse - if Homebrew.args.named.blank? + if args.no_named? puts HOMEBREW_CELLAR else - puts Homebrew.args.resolved_formulae.map(&:rack) + puts args.resolved_formulae.map(&:rack) end end end
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/--env.rb
@@ -30,9 +30,8 @@ def __env __env_args.parse ENV.activate_extensions! - ENV.deps = Homebrew.args.formulae if superenv? + ENV.deps = args.formulae if superenv? ENV.setup_build_environment - ENV.universal_binary if ARGV.build_universal? shell = if args.plain? nil
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/--prefix.rb
@@ -22,10 +22,10 @@ def __prefix_args def __prefix __prefix_args.parse - if Homebrew.args.named.blank? + if args.no_named? puts HOMEBREW_PREFIX else - puts Homebrew.args.resolved_formulae.map { |f| + puts args.resolved_formulae.map { |f| f.opt_prefix.exist? ? f.opt_prefix : f.installed_prefix } end
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/--repository.rb
@@ -20,10 +20,10 @@ def __repository_args def __repository __repository_args.parse - if ARGV.named.empty? + if args.no_named? puts HOMEBREW_REPOSITORY else - puts ARGV.named.map { |tap| Tap.fetch(tap).path } + puts args.named.map { |tap| Tap.fetch(tap).path } end end end
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/analytics.rb
@@ -26,7 +26,7 @@ def analytics_args def analytics analytics_args.parse - case args.remaining.first + case args.named.first when nil, "state" if Utils::Analytics.disabled? puts "Analytics are disabled." @@ -41,7 +41,7 @@ def analytics when "regenerate-uuid" Utils::Analytics.regenerate_uuid! else - raise UsageError, "Unknown subcommand." + raise UsageError, "unknown subcommand" end end end
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/cat.rb
@@ -12,24 +12,19 @@ def cat_args Display the source of <formula>. EOS - max_named 1 + named :formula end end def cat cat_args.parse - # do not "fix" this to support multiple arguments, the output would be - # unparsable; if the user wants to cat multiple formula they can call - # `brew cat` multiple times. - formulae = Homebrew.args.formulae - raise FormulaUnspecifiedError if formulae.empty? cd HOMEBREW_REPOSITORY pager = if ENV["HOMEBREW_BAT"].nil? "cat" else "#{HOMEBREW_PREFIX}/bin/bat" end - safe_system pager, formulae.first.path, *Homebrew.args.passthrough + safe_system pager, args.formulae.first.path, *args.passthrough end end
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/cleanup.rb
@@ -33,7 +33,7 @@ def cleanup_args def cleanup cleanup_args.parse - cleanup = Cleanup.new(*args.remaining, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i) + cleanup = Cleanup.new(*args.named, dry_run: args.dry_run?, scrub: args.s?, days: args.prune&.to_i) if args.prune_prefix? cleanup.prune_prefix_symlinks_and_directories return
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/command.rb
@@ -15,15 +15,14 @@ def command_args EOS switch :verbose switch :debug + min_named 1 end end def command command_args.parse - raise UsageError, "This command requires a command argument" if args.remaining.empty? - - args.remaining.each do |cmd| + args.named.each do |cmd| path = Commands.path(cmd) odie "Unknown command: #{cmd}" unless path puts path
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/deps.rb
@@ -62,7 +62,7 @@ def deps Formulary.enable_factory_cache! recursive = !args.send("1?") - installed = args.installed? || ARGV.formulae.all?(&:opt_or_installed_prefix_keg) + installed = args.installed? || args.formulae.all?(&:opt_or_installed_prefix_keg) @use_runtime_dependencies = installed && recursive && !args.include_build? && @@ -74,27 +74,27 @@ def deps if args.installed? puts_deps_tree Formula.installed.sort, recursive else - raise FormulaUnspecifiedError if Homebrew.args.remaining.empty? + raise FormulaUnspecifiedError if args.no_named? - puts_deps_tree Homebrew.args.formulae, recursive + puts_deps_tree args.formulae, recursive end return elsif args.all? puts_deps Formula.sort, recursive return - elsif !Homebrew.args.remaining.empty? && args.for_each? - puts_deps Homebrew.args.formulae, recursive + elsif !args.no_named? && args.for_each? + puts_deps args.formulae, recursive return end - if Homebrew.args.remaining.empty? + if args.no_named? raise FormulaUnspecifiedError unless args.installed? puts_deps Formula.installed.sort, recursive return end - all_deps = deps_for_formulae(Homebrew.args.formulae, recursive, &(args.union? ? :| : :&)) + all_deps = deps_for_formulae(args.formulae, recursive, &(args.union? ? :| : :&)) all_deps = condense_requirements(all_deps) all_deps.select!(&:installed?) if args.installed? all_deps.map!(&method(:dep_display_name))
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/desc.rb
@@ -40,16 +40,16 @@ def desc search_type << :either if args.search search_type << :name if args.name search_type << :desc if args.description - odie "You must provide a search term." if search_type.present? && ARGV.named.empty? + odie "You must provide a search term." if search_type.present? && args.no_named? results = if search_type.empty? - raise FormulaUnspecifiedError if ARGV.named.empty? + raise FormulaUnspecifiedError if args.no_named? desc = {} - Homebrew.args.formulae.each { |f| desc[f.full_name] = f.desc } + args.formulae.each { |f| desc[f.full_name] = f.desc } Descriptions.new(desc) else - arg = ARGV.named.join(" ") + arg = args.named.join(" ") string_or_regex = query_regexp(arg) CacheStoreDatabase.use(:descriptions) do |db| cache_store = DescriptionCacheStore.new(db)
true
Other
Homebrew
brew
a7fe0ed8472a67362793059cf633d3030ffa11d9.json
cmd: use more and cleanup new args APIs.
Library/Homebrew/cmd/doctor.rb
@@ -39,14 +39,14 @@ def doctor exit end - if ARGV.named.empty? + if args.no_named? slow_checks = %w[ check_for_broken_symlinks check_missing_deps ] methods = (checks.all.sort - slow_checks) + slow_checks else - methods = ARGV.named + methods = args.named end first_warning = true
true