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 | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | Library/Homebrew/utils/analytics.rb | @@ -35,7 +35,7 @@ def report(type, metadata = {})
end
# Send analytics. Don't send or store any personally identifiable information.
- # https://github.com/Homebrew/brew/blob/master/docs/Analytics.md
+ # http://docs.brew.sh/Analytics.html
# https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
if ENV["HOMEBREW_ANALYTICS_DEBUG"] | true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | Library/Homebrew/utils/analytics.sh | @@ -107,7 +107,7 @@ report-analytics-screenview-command() {
)
# Send analytics. Don't send or store any personally identifiable information.
- # https://github.com/Homebrew/brew/blob/master/docs/Analytics.md
+ # http://docs.brew.sh/Analytics.html
# https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide#screenView
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
if [[ -z "$HOMEBREW_ANALYTICS_DEBUG" ]] | true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | README.md | @@ -18,7 +18,7 @@ cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew updat
## Troubleshooting
First, please run `brew update` and `brew doctor`.
-Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting).
+Second, read the [Troubleshooting Checklist](http://docs.brew.sh/Troubleshooting.html).
**If you don't read these it will take us far longer to help you with your problem.**
@@ -27,7 +27,7 @@ We'd love you to contribute to Homebrew. First, please read our [Contribution Gu
We explicitly welcome contributions from people who have never contributed to open-source before: we were all beginners once! We can help build on a partially working pull request with the aim of getting it merged. We are also actively seeking to diversify our contributors and especially welcome contributions from women from all backgrounds and people of colour.
-A good starting point for contributing is running `brew audit` (or `brew audit --strict`) with some of the packages you use (e.g. `brew audit wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit` shows no results and [submit a pull request](https://github.com/Homebrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md). If no formulae you use have warnings you can run `brew audit` without arguments to have it run on all packages and pick one. Good luck!
+A good starting point for contributing is running `brew audit` (or `brew audit --strict`) with some of the packages you use (e.g. `brew audit wget` if you use `wget`) and then read through the warnings, try to fix them until `brew audit` shows no results and [submit a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html). If no formulae you use have warnings you can run `brew audit` without arguments to have it run on all packages and pick one. Good luck!
## Security
Please report security issues to security@brew.sh.
@@ -61,7 +61,7 @@ Please consider a regular donation through Patreon:
[](https://www.patreon.com/homebrew)
## Sponsors
-Our CI infrastructure was paid for by [our Kickstarter supporters](https://github.com/Homebrew/brew/blob/master/docs/Kickstarter-Supporters.md).
+Our CI infrastructure was paid for by [our Kickstarter supporters](http://docs.brew.sh/Kickstarter-Supporters.html).
Our CI infrastructure is hosted by [The Positive Internet Company](http://www.positive-internet.com).
| true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | docs/Formula-Cookbook.md | @@ -352,7 +352,7 @@ If you have already forked Homebrew on GitHub, then you can manually push (just
git push https://github.com/myname/homebrew-core/ <what-you-called-your-branch>
```
-Now, please [open a pull request](https://github.com/Homebrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md#how-to-open-a-homebrew-pull-request-and-get-it-merged) for your changes.
+Now, please [open a pull request](http://docs.brew.sh/How-To-Open-a-Homebrew-Pull-Request.html) for your changes.
* One formula per commit; one commit per formula
* Keep merge commits out of the pull request | true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | docs/Tips-N'-Tricks.md | @@ -3,8 +3,7 @@
## Installing previous versions of formulae
The supported method of installing specific versions of
-some formulae is to see if there is a versions formula like e.g. `gcc@6` available. If the version you’re looking for isn’t available, consider [opening a
-pull request](https://github.com/Homebrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md)!
+some formulae is to see if there is a versions formula like e.g. `gcc@6` available. If the version you’re looking for isn’t available, consider [opening a pull request](How-To-Open-a-Homebrew-Pull-Request.md)!
### Installing directly from pull-requests
You can [browse pull requests](https://github.com/Homebrew/homebrew-core/pulls) | true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | docs/brew.1.html | @@ -36,7 +36,7 @@ <h2 id="COMMANDS">COMMANDS</h2>
<dl>
<dt><code>analytics</code> [<code>state</code>]</dt><dd><p>Display anonymous user behaviour analytics state.
-Read more at <a href="https://git.io/brew-analytics" data-bare-link="true">https://git.io/brew-analytics</a>.</p></dd>
+Read more at <a href="http://docs.brew.sh/Analytics.html" data-bare-link="true">http://docs.brew.sh/Analytics.html</a>.</p></dd>
<dt><code>analytics</code> (<code>on</code>|<code>off</code>)</dt><dd><p>Turn on/off Homebrew's analytics.</p></dd>
<dt><code>analytics</code> <code>regenerate-uuid</code></dt><dd><p>Regenerate UUID used in Homebrew's analytics.</p></dd>
<dt><code>cat</code> <var>formula</var></dt><dd><p>Display the source to <var>formula</var>.</p></dd>
@@ -152,7 +152,7 @@ <h2 id="COMMANDS">COMMANDS</h2>
information on all installed formulae.</p>
<p>See the docs for examples of using the JSON:
-<a href="https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md</a></p></dd>
+<a href="http://docs.brew.sh/Querying-Brew.html" data-bare-link="true">http://docs.brew.sh/Querying-Brew.html</a></p></dd>
<dt><code>install</code> [<code>--debug</code>] [<code>--env=</code><var>std</var>|<var>super</var>] [<code>--ignore-dependencies</code>] [<code>--only-dependencies</code>] [<code>--cc=</code><var>compiler</var>] [<code>--build-from-source</code>] [<code>--devel</code>|<code>--HEAD</code>] [<code>--keep-tmp</code>] <var>formula</var></dt><dd><p>Install <var>formula</var>.</p>
<p><var>formula</var> is usually the name of the formula to install, but it can be specified
@@ -352,7 +352,7 @@ <h2 id="COMMANDS">COMMANDS</h2>
<p>Pass <code>--installed</code> to get information on installed taps.</p>
<p>See the docs for examples of using the JSON:
-<a href="https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md</a></p></dd>
+<a href="http://docs.brew.sh/Querying-Brew.html" data-bare-link="true">http://docs.brew.sh/Querying-Brew.html</a></p></dd>
<dt><code>tap-pin</code> <var>tap</var></dt><dd><p>Pin <var>tap</var>, prioritizing its formulae over core when formula names are supplied
by the user. See also <code>tap-unpin</code>.</p></dd>
<dt><code>tap-unpin</code> <var>tap</var></dt><dd><p>Unpin <var>tap</var> so its formulae are no longer prioritized. See also <code>tap-pin</code>.</p></dd>
@@ -641,7 +641,7 @@ <h2 id="CUSTOM-EXTERNAL-COMMANDS">CUSTOM EXTERNAL COMMANDS</h2>
to create your own commands without modifying Homebrew's internals.</p>
<p>Instructions for creating your own commands can be found in the docs:
-<a href="https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md</a></p>
+<a href="http://docs.brew.sh/External-Commands.html" data-bare-link="true">http://docs.brew.sh/External-Commands.html</a></p>
<h2 id="SPECIFYING-FORMULAE">SPECIFYING FORMULAE</h2>
@@ -720,7 +720,7 @@ <h2 id="ENVIRONMENT">ENVIRONMENT</h2>
the number of parallel jobs to run when building with <code>make</code>(1).</p>
<p><em>Default:</em> the number of available CPU cores.</p></dd>
-<dt><code>HOMEBREW_NO_ANALYTICS</code></dt><dd><p>If set, Homebrew will not send analytics. See: <a href="https://github.com/Homebrew/brew/blob/master/docs/Analytics.md#analytics" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/docs/Analytics.md#analytics</a></p></dd>
+<dt><code>HOMEBREW_NO_ANALYTICS</code></dt><dd><p>If set, Homebrew will not send analytics. See: <a href="http://docs.brew.sh/Analytics.html" data-bare-link="true">http://docs.brew.sh/Analytics.html</a></p></dd>
<dt><code>HOMEBREW_NO_AUTO_UPDATE</code></dt><dd><p>If set, Homebrew will not auto-update before running <code>brew install</code>,
<code>brew upgrade</code> or <code>brew tap</code>.</p></dd>
<dt><code>HOMEBREW_NO_EMOJI</code></dt><dd><p>If set, Homebrew will not print the <code>HOMEBREW_INSTALL_BADGE</code> on a | true |
Other | Homebrew | brew | a3bffe70bcf33e6051140b1a93c9f48714605af6.json | Use docs.brew.sh links. | manpages/brew.1 | @@ -45,7 +45,7 @@ Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is su
.
.TP
\fBanalytics\fR [\fBstate\fR]
-Display anonymous user behaviour analytics state\. Read more at \fIhttps://git\.io/brew\-analytics\fR\.
+Display anonymous user behaviour analytics state\. Read more at \fIhttp://docs\.brew\.sh/Analytics\.html\fR\.
.
.TP
\fBanalytics\fR (\fBon\fR|\fBoff\fR)
@@ -213,7 +213,7 @@ Print a JSON representation of \fIformulae\fR\. Currently the only accepted valu
Pass \fB\-\-all\fR to get information on all formulae, or \fB\-\-installed\fR to get information on all installed formulae\.
.
.IP
-See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Querying\-Brew\.md\fR
+See the docs for examples of using the JSON: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR
.
.TP
\fBinstall\fR [\fB\-\-debug\fR] [\fB\-\-env=\fR\fIstd\fR|\fIsuper\fR] [\fB\-\-ignore\-dependencies\fR] [\fB\-\-only\-dependencies\fR] [\fB\-\-cc=\fR\fIcompiler\fR] [\fB\-\-build\-from\-source\fR] [\fB\-\-devel\fR|\fB\-\-HEAD\fR] [\fB\-\-keep\-tmp\fR] \fIformula\fR
@@ -479,7 +479,7 @@ Print a JSON representation of \fItaps\fR\. Currently the only accepted value fo
Pass \fB\-\-installed\fR to get information on installed taps\.
.
.IP
-See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Querying\-Brew\.md\fR
+See the docs for examples of using the JSON: \fIhttp://docs\.brew\.sh/Querying\-Brew\.html\fR
.
.TP
\fBtap\-pin\fR \fItap\fR
@@ -838,7 +838,7 @@ Integrates Homebrew formulae with macOS\'s \fBlaunchctl\fR manager: \fIhttps://g
Homebrew, like \fBgit\fR(1), supports external commands\. These are executable scripts that reside somewhere in the \fBPATH\fR, named \fBbrew\-\fR\fIcmdname\fR or \fBbrew\-\fR\fIcmdname\fR\fB\.rb\fR, which can be invoked like \fBbrew\fR \fIcmdname\fR\. This allows you to create your own commands without modifying Homebrew\'s internals\.
.
.P
-Instructions for creating your own commands can be found in the docs: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/External\-Commands\.md\fR
+Instructions for creating your own commands can be found in the docs: \fIhttp://docs\.brew\.sh/External\-Commands\.html\fR
.
.SH "SPECIFYING FORMULAE"
Many Homebrew commands accept one or more \fIformula\fR arguments\. These arguments can take several different forms:
@@ -957,7 +957,7 @@ If set, instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the n
.
.TP
\fBHOMEBREW_NO_ANALYTICS\fR
-If set, Homebrew will not send analytics\. See: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Analytics\.md#analytics\fR
+If set, Homebrew will not send analytics\. See: \fIhttp://docs\.brew\.sh/Analytics\.html\fR
.
.TP
\fBHOMEBREW_NO_AUTO_UPDATE\fR | true |
Other | Homebrew | brew | a175a1241efbec95f442257919fffe867bdf26cf.json | license: remove copyright ending year
See https://github.com/Homebrew/brew/pull/1771#issuecomment-270143292. | LICENSE.txt | @@ -1,6 +1,6 @@
BSD 2-Clause License
-Copyright (c) 2009-2016, Homebrew contributors
+Copyright (c) 2009-present, Homebrew contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without | false |
Other | Homebrew | brew | bc0aa4e64ce4eaf53476aa448b71b711feb9939e.json | Add versions documentation. | docs/Formula-Cookbook.md | @@ -9,7 +9,7 @@ A formula is a package definition written in Ruby. It can be created with `brew
| **Keg** | The installation prefix of a **Formula** | `/usr/local/Cellar/foo/0.1` |
| **opt prefix** | A symlink to the active version of a **Keg** | `/usr/local/opt/foo ` |
| **Cellar** | All **Kegs** are installed here | `/usr/local/Cellar` |
-| **Tap** | An Git repository of **Formulae** and/or commands | `/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` |
+| **Tap** | A Git repository of **Formulae** and/or commands | `/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` |
| **Bottle** | Pre-built **Keg** used instead of building from source | `qt-4.8.4.mavericks.bottle.tar.gz` |
| **Cask** | An [extension of homebrew](https://github.com/caskroom/homebrew-cask) to install macOS native apps | `/Applications/MacDown.app/Contents/SharedSupport/bin/macdown` |
| **Brew Bundle**| An [extension of homebrew](https://github.com/Homebrew/homebrew-bundle) to describe dependencies | `brew 'myservice', restart_service: true` | | true |
Other | Homebrew | brew | bc0aa4e64ce4eaf53476aa448b71b711feb9939e.json | Add versions documentation. | docs/Tips-N'-Tricks.md | @@ -2,8 +2,8 @@
## Installing previous versions of formulae
-The preferred and supported method of installing specific versions of
-formulae is to use formula like e.g. `gcc@6`. If the version you’re looking for isn’t available, consider [opening a
+The supported method of installing specific versions of
+some formulae is to see if there is a versions formula like e.g. `gcc@6` available. If the version you’re looking for isn’t available, consider [opening a
pull request](https://github.com/Homebrew/brew/blob/master/docs/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md)!
### Installing directly from pull-requests | true |
Other | Homebrew | brew | bc0aa4e64ce4eaf53476aa448b71b711feb9939e.json | Add versions documentation. | docs/Versions.md | @@ -0,0 +1,15 @@
+# Versions
+Now that [Homebrew/versions](https://github.com/homebrew/homebrew-versions) has been deprecated [Homebrew/core](https://github.com/homebrew/homebrew-core) supports multiple versions of formulae with a new naming format.
+
+In [Homebrew/versions](https://github.com/homebrew/homebrew-versions) the formula for GCC 6 was named `gcc6.rb` and began `class Gcc6 < Formula`. In [Homebrew/core](https://github.com/homebrew/homebrew-core) this same formula is named `gcc@6.rb` and begins `class GccAT6 < Formula`.
+
+## Acceptable Versioned Formulae
+Homebrew's versions are not intended to be used for any old versions you personally require for your project; formulae submitted should be expected to be used by a large number of people and still supported by their upstream projects.
+
+Versioned formulae we include must meet the following standards:
+
+* Versioned formulae should differ in major/minor (not patch) versions from the current stable release. This is because patch versions indicate bug or security updates and we want to ensure you apply security updates.
+* Formulae that depend on versioned formulae must not depend on the same formulae at two different versions twice in their recursive dependencies. For example, if you depend on `openssl@1.0` and `foo`, and `foo` depends on `openssl` then you must instead use `openssl`.
+* Versioned formulae should strive to be linked at the same time as their non-versioned counterpart (without patching). If this is not possible, favour either `conflicts_with` or `keg_only` depending on whether users expect to have multiple versions installed at once or not.
+
+You should create your own [tap](https://github.com/Homebrew/brew/blob/master/docs/How-to-Create-and-Maintain-a-Tap.md) for formulae you or your organisation wishes to control the versioning of or those that do not meet the above standards. | true |
Other | Homebrew | brew | 294781cc9efb330af98e9dfa701a2b64d41bf819.json | cask depends_on arch: remove everything but 64-bit intel | Library/Homebrew/cask/lib/hbc/dsl/depends_on.rb | @@ -13,30 +13,9 @@ class DependsOn
].freeze
VALID_ARCHES = {
- intel: { type: :intel, bits: [32, 64] },
- ppc: { type: :ppc, bits: [32, 64] },
+ intel: { type: :intel, bits: 64 },
# specific
- i386: { type: :intel, bits: 32 },
x86_64: { type: :intel, bits: 64 },
- ppc_7400: { type: :ppc, bits: 32 },
- ppc_64: { type: :ppc, bits: 64 },
- }.freeze
-
- # Intentionally undocumented: catch variant spellings.
- ARCH_SYNONYMS = {
- x86_32: :i386,
- x8632: :i386,
- x8664: :x86_64,
- intel_32: :i386,
- intel32: :i386,
- intel_64: :x86_64,
- intel64: :x86_64,
- amd_64: :x86_64,
- amd64: :x86_64,
- ppc7400: :ppc_7400,
- ppc_32: :ppc_7400,
- ppc32: :ppc_7400,
- ppc64: :ppc_64,
}.freeze
attr_accessor :java
@@ -100,8 +79,7 @@ def macos=(*args)
def arch=(*args)
@arch ||= []
arches = args.map do |elt|
- elt = elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
- ARCH_SYNONYMS.key?(elt) ? ARCH_SYNONYMS[elt] : elt
+ elt.to_s.downcase.sub(/^:/, "").tr("-", "_").to_sym
end
invalid_arches = arches - VALID_ARCHES.keys
raise "invalid 'depends_on arch' values: #{invalid_arches.inspect}" unless invalid_arches.empty? | true |
Other | Homebrew | brew | 294781cc9efb330af98e9dfa701a2b64d41bf819.json | cask depends_on arch: remove everything but 64-bit intel | Library/Homebrew/cask/test/cask/depends_on_test.rb | @@ -79,15 +79,6 @@
Hbc::Installer.new(arch_cask).install
end
end
-
- it "raises an exception when depends_on arch is not satisfied" do
- arch_cask = Hbc.load("with-depends-on-arch-failure")
- lambda {
- shutup do
- Hbc::Installer.new(arch_cask).install
- end
- }.must_raise(Hbc::CaskError)
- end
end
describe "depends_on x11" do | true |
Other | Homebrew | brew | 294781cc9efb330af98e9dfa701a2b64d41bf819.json | cask depends_on arch: remove everything but 64-bit intel | Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb | @@ -1,12 +0,0 @@
-test_cask 'with-depends-on-arch-failure' do
- version '1.2.3'
- sha256 '67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94'
-
- url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
- homepage 'http://example.com/with-depends-on-arch-failure'
-
- # guarantee mismatched hardware
- depends_on arch: Hardware::CPU.intel? ? :ppc : :intel
-
- app 'Caffeine.app'
-end | true |
Other | Homebrew | brew | 294781cc9efb330af98e9dfa701a2b64d41bf819.json | cask depends_on arch: remove everything but 64-bit intel | Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb | @@ -6,7 +6,7 @@
homepage 'http://example.com/with-depends-on-arch'
# covers all known hardware; always succeeds
- depends_on arch: [:ppc, :intel]
+ depends_on arch: :intel
app 'Caffeine.app'
end | true |
Other | Homebrew | brew | e1d7d44e5a13d16bc7773a7afb09c1a789878f5a.json | tests: optlink fake kegs in uninstall test | Library/Homebrew/test/uninstall_test.rb | @@ -9,7 +9,10 @@ def setup
depends_on "dependency"
end
- [@dependency, @dependent].each { |f| f.installed_prefix.mkpath }
+ [@dependency, @dependent].each do |f|
+ f.installed_prefix.mkpath
+ Keg.new(f.installed_prefix).optlink
+ end
tab = Tab.empty
tab.homebrew_version = "1.1.6"
@@ -25,7 +28,10 @@ def setup
def teardown
Homebrew.failed = false
- [@dependency, @dependent].each { |f| f.rack.rmtree }
+ [@dependency, @dependent].each do |f|
+ f.installed_kegs.each(&:remove_opt_record)
+ f.rack.rmtree
+ end
end
def handle_unsatisfied_dependents | false |
Other | Homebrew | brew | e4856143a6a43a306101abcbf0f2d71d00354a18.json | keg: check installed dependencies iff optlinked | Library/Homebrew/keg.rb | @@ -385,7 +385,7 @@ def to_formula
end
def installed_dependents
- return [] if !linked? && !to_formula.keg_only?
+ return [] unless optlinked?
tap = Tab.for_keg(self).source["tap"]
Keg.all.select do |keg|
tab = Tab.for_keg(keg) | true |
Other | Homebrew | brew | e4856143a6a43a306101abcbf0f2d71d00354a18.json | keg: check installed dependencies iff optlinked | Library/Homebrew/test/keg_test.rb | @@ -467,8 +467,8 @@ def test_fallback_for_old_versions
assert_equal [[@keg], ["bar"]], Keg.find_some_installed_dependents([@keg])
end
- def test_unlinked
- @keg.unlink
+ def test_nonoptlinked
+ @keg.remove_opt_record
dependencies [{ "full_name" => "foo", "version" => "1.0" }]
assert_empty @keg.installed_dependents
assert_nil Keg.find_some_installed_dependents([@keg]) | true |
Other | Homebrew | brew | 8b30abe0600df5c9d3da5b4c31ca88a71a1c3e03.json | keg: handle dependencies of moved/renamed formulae
In #1497 I switched from Keg#to_formula for comparing kegs to formulae
to comparing the name and tap in the keg's tab to the name and tap of
the formula.
However, this fails to match if the name and tap of the formula have
changed since the keg was installed, so it's clearly better to use
Keg#to_formula where possible, and fall back to the information in the
tab when #to_formula can't be used. | Library/Homebrew/keg.rb | @@ -126,7 +126,18 @@ def self.find_some_installed_dependents(kegs)
end
keg_names = kegs.map(&:name)
- kegs_by_source = kegs.group_by { |k| [k.name, Tab.for_keg(k).tap] }
+ kegs_by_source = kegs.group_by do |keg|
+ begin
+ # First, attempt to resolve the keg to a formula
+ # to get up-to-date name and tap information.
+ f = keg.to_formula
+ [f.name, f.tap]
+ rescue FormulaUnavailableError
+ # If the formula for the keg can't be found,
+ # fall back to the information in the tab.
+ [keg.name, Tab.for_keg(keg).tap]
+ end
+ end
remaining_formulae.each do |dependent|
required = dependent.missing_dependencies(hide: keg_names) | true |
Other | Homebrew | brew | 8b30abe0600df5c9d3da5b4c31ca88a71a1c3e03.json | keg: handle dependencies of moved/renamed formulae
In #1497 I switched from Keg#to_formula for comparing kegs to formulae
to comparing the name and tap in the keg's tab to the name and tap of
the formula.
However, this fails to match if the name and tap of the formula have
changed since the keg was installed, so it's clearly better to use
Keg#to_formula where possible, and fall back to the information in the
tab when #to_formula can't be used. | Library/Homebrew/test/keg_test.rb | @@ -373,6 +373,7 @@ def test_unknown_formula
t.source["tap"] = "some/tap"
t.source["path"] = nil
end
+
dependencies [{ "full_name" => "some/tap/foo", "version" => "1.0" }]
assert_equal [@dependent], @keg.installed_dependents
assert_equal [[@keg], ["bar 1.0"]], Keg.find_some_installed_dependents([@keg])
@@ -388,7 +389,7 @@ def test_a_dependency_with_no_tap_in_tab
Formula["bar"].class.depends_on "baz"
result = Keg.find_some_installed_dependents([@keg, @tap_dep])
- assert_equal [[@tap_dep], ["bar"]], result
+ assert_equal [[@keg, @tap_dep], ["bar"]], result
end
def test_no_dependencies_anywhere
@@ -411,6 +412,23 @@ def test_uninstalling_dependent_and_dependency
assert_nil Keg.find_some_installed_dependents([@keg, @dependent])
end
+ def test_renamed_dependency
+ dependencies nil
+
+ stub_formula_loader Formula["foo"], "homebrew/core/foo-old"
+ renamed_path = HOMEBREW_CELLAR/"foo-old"
+ (HOMEBREW_CELLAR/"foo").rename(renamed_path)
+ renamed_keg = Keg.new(renamed_path.join("1.0"))
+
+ Formula["bar"].class.depends_on "foo"
+
+ result = Keg.find_some_installed_dependents([renamed_keg])
+ assert_equal [[renamed_keg], ["bar"]], result
+ ensure
+ # Move it back to where it was so it'll be cleaned up.
+ (HOMEBREW_CELLAR/"foo-old").rename(HOMEBREW_CELLAR/"foo")
+ end
+
def test_empty_dependencies_in_tab
dependencies []
assert_empty @keg.installed_dependents | true |
Other | Homebrew | brew | 49310667b4e6327d8276752a74fe480c1d7fb135.json | Revert "uninstall: remove nil requireds/dependents"
This reverts commit d7e72899e6f24dca5e02a734d5a4e64e39fc680e. | Library/Homebrew/cmd/uninstall.rb | @@ -102,8 +102,8 @@ class DependentsMessage
attr_reader :reqs, :deps
def initialize(requireds, dependents)
- @reqs = requireds.compact
- @deps = dependents.compact
+ @reqs = requireds
+ @deps = dependents
end
protected | false |
Other | Homebrew | brew | 35ae78f43d45369f86b8c56c04ccca1119fdb1d1.json | formula_versions: handle uncommitted formulae.
Otherwise an uncommitted formula can trigger an invalid `brew audit`
result.
Fixes #1731. | Library/Homebrew/formula_versions.rb | @@ -15,6 +15,7 @@ def initialize(formula, options = {})
@repository = formula.tap.path
@entry_name = @path.relative_path_from(repository).to_s
@max_depth = options[:max_depth]
+ @current_formula = formula
end
def rev_list(branch)
@@ -64,25 +65,33 @@ def version_attributes_map(attributes, branch)
attributes.each do |attribute|
attributes_map[attribute] ||= {}
+ # Set the attributes for the current formula in case it's not been
+ # committed yet.
+ set_attribute_map(attributes_map[attribute], @current_formula, attribute)
end
rev_list(branch) do |rev|
formula_at_revision(rev) do |f|
attributes.each do |attribute|
- map = attributes_map[attribute]
- if f.stable
- map[:stable] ||= {}
- map[:stable][f.stable.version] ||= []
- map[:stable][f.stable.version] << f.send(attribute)
- end
- next unless f.devel
- map[:devel] ||= {}
- map[:devel][f.devel.version] ||= []
- map[:devel][f.devel.version] << f.send(attribute)
+ set_attribute_map(attributes_map[attribute], f, attribute)
end
end
end
attributes_map
end
+
+ private
+
+ def set_attribute_map(map, f, attribute)
+ if f.stable
+ map[:stable] ||= {}
+ map[:stable][f.stable.version] ||= []
+ map[:stable][f.stable.version] << f.send(attribute)
+ end
+ return unless f.devel
+ map[:devel] ||= {}
+ map[:devel][f.devel.version] ||= []
+ map[:devel][f.devel.version] << f.send(attribute)
+ end
end | false |
Other | Homebrew | brew | 01e1f7d49e91b6f02037997ffb465b37d2426b80.json | keg: fix fallback dependencies with multiple kegs
Fixes #1524. | Library/Homebrew/keg.rb | @@ -105,7 +105,13 @@ def self.find_some_installed_dependents(kegs)
#
# This happens after the initial dependency check because it's sloooow.
remaining_formulae = Formula.installed.select do |f|
- f.installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
+ installed_kegs = f.installed_kegs
+
+ # All installed kegs are going to be removed anyway,
+ # so it doesn't matter what they depend on.
+ next false if (installed_kegs - kegs).empty?
+
+ installed_kegs.any? { |k| Tab.for_keg(k).runtime_dependencies.nil? }
end
keg_names = kegs.map(&:name) | true |
Other | Homebrew | brew | 01e1f7d49e91b6f02037997ffb465b37d2426b80.json | keg: fix fallback dependencies with multiple kegs
Fixes #1524. | Library/Homebrew/test/keg_test.rb | @@ -382,6 +382,13 @@ def test_missing_formula_dependency
assert_equal [[@keg], ["bar"]], Keg.find_some_installed_dependents([@keg])
end
+ def test_uninstalling_dependent_and_dependency
+ dependencies nil
+ Formula["bar"].class.depends_on "foo"
+ assert_empty @keg.installed_dependents
+ assert_nil Keg.find_some_installed_dependents([@keg, @dependent])
+ end
+
def test_empty_dependencies_in_tab
dependencies []
assert_empty @keg.installed_dependents | true |
Other | Homebrew | brew | a69997cab03988f381894b08d4b82d25014e8fed.json | tests: include homebrew version in receipt fixture | Library/Homebrew/test/support/fixtures/receipt.json | @@ -1,4 +1,5 @@
{
+ "homebrew_version": "1.1.6",
"used_options": [
"--with-foo",
"--without-bar" | false |
Other | Homebrew | brew | c31f959ec1955999d4be4446914eaab2e715058a.json | Hide `update` from `brew cask help`. | Library/Homebrew/compat/hbc/cli/update.rb | @@ -11,8 +11,12 @@ def self.run(*_ignored)
exit result.exit_status
end
+ def self.visible
+ false
+ end
+
def self.help
- Formatter.warning("deprecated: use `brew update` instead")
+ "a synonym for 'brew update'"
end
end
end | false |
Other | Homebrew | brew | 0f8cb4ba277968fb24bf438468b37466075fd18a.json | Add option to disable methods on specific date. | Library/Homebrew/test/utils_test.rb | @@ -216,7 +216,7 @@ def test_odeprecated
e = assert_raises(MethodDeprecatedError) do
odeprecated("method", "replacement",
caller: ["#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/"],
- die: true)
+ disable: true)
end
assert_match "method", e.message
assert_match "replacement", e.message | true |
Other | Homebrew | brew | 0f8cb4ba277968fb24bf438468b37466075fd18a.json | Add option to disable methods on specific date. | Library/Homebrew/utils.rb | @@ -11,6 +11,7 @@
require "utils/inreplace"
require "utils/popen"
require "utils/tty"
+require "time"
def ohai(title, *sput)
title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?
@@ -44,24 +45,32 @@ def odie(error)
exit 1
end
-def odeprecated(method, replacement = nil, options = {})
- verb = if options[:die]
- "disabled"
- else
- "deprecated"
- end
-
+def odeprecated(method, replacement = nil, disable: false, disable_on: nil, caller: send(:caller))
replacement_message = if replacement
"Use #{replacement} instead."
else
"There is no replacement."
end
+ unless disable_on.nil?
+ if disable_on > Time.now
+ will_be_disabled_message = " and will be disabled on #{disable_on.strftime("%Y-%m-%d")}"
+ else
+ disable = true
+ end
+ end
+
+ verb = if disable
+ "disabled"
+ else
+ "deprecated#{will_be_disabled_message}"
+ end
+
# Try to show the most relevant location in message, i.e. (if applicable):
# - Location in a formula.
# - Location outside of 'compat/'.
# - Location of caller of deprecated method (if all else fails).
- backtrace = options.fetch(:caller, caller)
+ backtrace = caller
tap_message = nil
caller_message = backtrace.detect do |line|
next unless line =~ %r{^#{Regexp.escape HOMEBREW_LIBRARY}/Taps/([^/]+/[^/]+)/}
@@ -80,7 +89,7 @@ def odeprecated(method, replacement = nil, options = {})
#{caller_message}#{tap_message}
EOS
- if ARGV.homebrew_developer? || options[:die] ||
+ if ARGV.homebrew_developer? || disable ||
Homebrew.raise_deprecation_exceptions?
raise MethodDeprecatedError, message
else
@@ -89,7 +98,7 @@ def odeprecated(method, replacement = nil, options = {})
end
def odisabled(method, replacement = nil, options = {})
- options = { die: true, caller: caller }.merge(options)
+ options = { disable: true, caller: caller }.merge(options)
odeprecated(method, replacement, options)
end
| true |
Other | Homebrew | brew | 59180ec370560d461d9fa44a3e510e9f1ea68375.json | audit: improve reliability of homepage audit.
- Don't run on Yosemite where the system Curl is too old for some modern
HTTPS homepages
- Try up to 3 times in case of transient failures. | Library/Homebrew/dev-cmd/audit.rb | @@ -569,9 +569,20 @@ def audit_homepage
end
return unless @online
- status_code, = curl_output "--connect-timeout", "15", "--output", "/dev/null", "--range", "0-0",
- "--write-out", "%{http_code}", homepage
- return if status_code.start_with? "20"
+
+ # The system Curl is too old and unreliable with HTTPS homepages on
+ # Yosemite and below.
+ return unless MacOS.version >= :el_capitan
+
+ retries = 3
+ retries.times do
+ status_code, = curl_output "--connect-timeout", "15",
+ "--output", "/dev/null",
+ "--range", "0-0",
+ "--write-out", "%{http_code}",
+ homepage
+ return if status_code.start_with? "20"
+ end
problem "The homepage #{homepage} is not reachable (HTTP status code #{status_code})"
end
| false |
Other | Homebrew | brew | 6f44dc41d5316e26a3ac533019199da502f430fc.json | development_tools: remove unused method. | Library/Homebrew/development_tools.rb | @@ -119,10 +119,6 @@ def clear_version_cache
@clang_version = @clang_build_version = nil
@non_apple_gcc_version = {}
end
-
- def tar_supports_xz?
- false
- end
end
end
| true |
Other | Homebrew | brew | 6f44dc41d5316e26a3ac533019199da502f430fc.json | development_tools: remove unused method. | Library/Homebrew/extend/os/mac/development_tools.rb | @@ -76,9 +76,5 @@ def default_compiler
end
end
end
-
- def tar_supports_xz?
- false
- end
end
end | true |
Other | Homebrew | brew | 3a27d8121970dab95f2d28db81189ddf9619c0f5.json | keg: fix dependents with unavailable formulae
Because of an accidental use of `=` instead of `==`, the source formula
check would be skipped when determining if a keg depended on another one
(so only the versions would be compared).
Fixed that comparison, and updated the corresponding test.
Glad I caught that! | Library/Homebrew/keg.rb | @@ -357,7 +357,7 @@ def to_formula
end
def installed_dependents
- my_tab = Tab.for_keg(self)
+ tap = Tab.for_keg(self).source["tap"]
Keg.all.select do |keg|
tab = Tab.for_keg(keg)
next if tab.runtime_dependencies.nil? # no dependency information saved.
@@ -368,7 +368,7 @@ def installed_dependents
dep_formula = Formulary.factory(dep["full_name"])
next false unless dep_formula == to_formula
rescue FormulaUnavailableError
- next false unless my_tab["full_name"] = dep["full_name"]
+ next false unless "#{tap}/#{name}" == dep["full_name"]
end
dep["version"] == version.to_s | true |
Other | Homebrew | brew | 3a27d8121970dab95f2d28db81189ddf9619c0f5.json | keg: fix dependents with unavailable formulae
Because of an accidental use of `=` instead of `==`, the source formula
check would be skipped when determining if a keg depended on another one
(so only the versions would be compared).
Fixed that comparison, and updated the corresponding test.
Glad I caught that! | Library/Homebrew/test/keg_test.rb | @@ -360,9 +360,11 @@ def dependencies(deps)
# from a file path or URL.
def test_unknown_formula
Formulary.unstub(:loader_for)
- alter_tab { |t| t.source["tap"] = "some/tap" }
- dependencies [{ "full_name" => "some/tap/bar", "version" => "1.0" }]
- alter_tab { |t| t.source["path"] = nil }
+ alter_tab(@keg) do |t|
+ t.source["tap"] = "some/tap"
+ t.source["path"] = nil
+ end
+ dependencies [{ "full_name" => "some/tap/foo", "version" => "1.0" }]
assert_equal [@dependent], @keg.installed_dependents
assert_equal [[@keg], ["bar 1.0"]], Keg.find_some_installed_dependents([@keg])
end | true |
Other | Homebrew | brew | 3ebd7df62d0b05a8a010bec74793cc4e688a2fc8.json | bump-formula-pr: fix removal of old mirrors
Previously, old mirrors are only removed if the requested spec is
stable, and if the mirror lines only have two leading spaces. This leads
to stale mirror line(s) when the formula a stable block like
stable do
url "http://example.com/v1.0.tar.gz"
mirror "http://example.net/v1.0.tar.gz"
end
where the mirror line is lead by four spaces.
In this commit, we discard the /(^ mirror .*\n)?/ pattern, and instead
create a pattern with the exact url and flexible leading spaces for each
mirror of the requested spec. | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -156,7 +156,9 @@ def bump_formula_pr
replacement_pairs << [/^ revision \d+\n(\n( head "))?/m, "\\2"]
end
- replacement_pairs << [/(^ mirror .*\n)?/, ""] if requested_spec == :stable
+ replacement_pairs += formula_spec.mirrors.map do |mirror|
+ [/ +mirror \"#{mirror}\"\n/m, ""]
+ end
replacement_pairs += if new_url_hash
[ | false |
Other | Homebrew | brew | cc09bb14c16c8e4f6b360f30074522c2ee25167b.json | brew create: add meson support
meson is quickly gaining popularity as build system, in combination with
ninja. Several Gnome projects for example are currently transitioning
from autotools to meson, mostly because it allows for Visual Studio
builds, which is impossible to accomplish with autotools.
In order to facilitate generating meson based Formulas, I added support
for meson to brew-create. | Library/Homebrew/dev-cmd/create.rb | @@ -1,4 +1,4 @@
-#: * `create` <URL> [`--autotools`|`--cmake`] [`--no-fetch`] [`--set-name` <name>] [`--set-version` <version>] [`--tap` <user>`/`<repo>]:
+#: * `create` <URL> [`--autotools`|`--cmake`|`--meson`] [`--no-fetch`] [`--set-name` <name>] [`--set-version` <version>] [`--tap` <user>`/`<repo>]:
#: Generate a formula for the downloadable file at <URL> and open it in the editor.
#: Homebrew will attempt to automatically derive the formula name
#: and version, but if it fails, you'll have to make your own template. The `wget`
@@ -8,6 +8,7 @@
#:
#: If `--autotools` is passed, create a basic template for an Autotools-style build.
#: If `--cmake` is passed, create a basic template for a CMake-style build.
+#: If `--meson` is passed, create a basic template for a Meson-style build.
#:
#: If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
#: will thus not add the SHA256 to the formula for you.
@@ -59,6 +60,8 @@ def create
:cmake
elsif ARGV.include? "--autotools"
:autotools
+ elsif ARGV.include? "--meson"
+ :meson
end
if fc.name.nil? || fc.name.strip.empty?
@@ -175,6 +178,9 @@ class #{Formulary.class_s(name)} < Formula
<% if mode == :cmake %>
depends_on "cmake" => :build
+ <% elsif mode == :meson %>
+ depends_on "meson" => :build
+ depends_on "ninja" => :build
<% elsif mode.nil? %>
# depends_on "cmake" => :build
<% end %>
@@ -191,6 +197,13 @@ def install
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=\#{prefix}"
+ <% elsif mode == :meson %>
+ mkdir "build" do
+ system "meson", "--prefix=\#{prefix}", ".."
+ system "ninja"
+ system "ninja", "test"
+ system "ninja", "install"
+ end
<% else %>
# Remove unrecognized options if warned by configure
system "./configure", "--disable-debug",
@@ -199,7 +212,9 @@ def install
"--prefix=\#{prefix}"
# system "cmake", ".", *std_cmake_args
<% end %>
+ <% if mode != :meson %>
system "make", "install" # if this fails, try separate make/make install steps
+ <% end %>
end
test do | true |
Other | Homebrew | brew | cc09bb14c16c8e4f6b360f30074522c2ee25167b.json | brew create: add meson support
meson is quickly gaining popularity as build system, in combination with
ninja. Several Gnome projects for example are currently transitioning
from autotools to meson, mostly because it allows for Visual Studio
builds, which is impossible to accomplish with autotools.
In order to facilitate generating meson based Formulas, I added support
for meson to brew-create. | docs/brew.1.html | @@ -504,15 +504,16 @@ <h2 id="DEVELOPER-COMMANDS">DEVELOPER COMMANDS</h2>
url-and-sha256 style specification into a tag-and-revision style
specification, nor vice versa. It must use whichever style specification
the preexisting formula already uses.</p></dd>
-<dt><code>create</code> <var>URL</var> [<code>--autotools</code>|<code>--cmake</code>] [<code>--no-fetch</code>] [<code>--set-name</code> <var>name</var>] [<code>--set-version</code> <var>version</var>] [<code>--tap</code> <var>user</var><code>/</code><var>repo</var>]</dt><dd><p>Generate a formula for the downloadable file at <var>URL</var> and open it in the editor.
+<dt><code>create</code> <var>URL</var> [<code>--autotools</code>|<code>--cmake</code>|<code>--meson</code>] [<code>--no-fetch</code>] [<code>--set-name</code> <var>name</var>] [<code>--set-version</code> <var>version</var>] [<code>--tap</code> <var>user</var><code>/</code><var>repo</var>]</dt><dd><p>Generate a formula for the downloadable file at <var>URL</var> and open it in the editor.
Homebrew will attempt to automatically derive the formula name
and version, but if it fails, you'll have to make your own template. The <code>wget</code>
formula serves as a simple example. For the complete API have a look at</p>
<p><a href="http://www.rubydoc.info/github/Homebrew/brew/master/Formula" data-bare-link="true">http://www.rubydoc.info/github/Homebrew/brew/master/Formula</a></p>
<p>If <code>--autotools</code> is passed, create a basic template for an Autotools-style build.
-If <code>--cmake</code> is passed, create a basic template for a CMake-style build.</p>
+If <code>--cmake</code> is passed, create a basic template for a CMake-style build.
+If <code>--meson</code> is passed, create a basic template for a Meson-style build.</p>
<p>If <code>--no-fetch</code> is passed, Homebrew will not download <var>URL</var> to the cache and
will thus not add the SHA256 to the formula for you.</p> | true |
Other | Homebrew | brew | cc09bb14c16c8e4f6b360f30074522c2ee25167b.json | brew create: add meson support
meson is quickly gaining popularity as build system, in combination with
ninja. Several Gnome projects for example are currently transitioning
from autotools to meson, mostly because it allows for Visual Studio
builds, which is impossible to accomplish with autotools.
In order to facilitate generating meson based Formulas, I added support
for meson to brew-create. | manpages/brew-cask.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW\-CASK" "1" "November 2016" "Homebrew" "brew-cask"
+.TH "BREW\-CASK" "1" "December 2016" "Homebrew" "brew-cask"
.
.SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS | true |
Other | Homebrew | brew | cc09bb14c16c8e4f6b360f30074522c2ee25167b.json | brew create: add meson support
meson is quickly gaining popularity as build system, in combination with
ninja. Several Gnome projects for example are currently transitioning
from autotools to meson, mostly because it allows for Visual Studio
builds, which is impossible to accomplish with autotools.
In order to facilitate generating meson based Formulas, I added support
for meson to brew-create. | manpages/brew.1 | @@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "BREW" "1" "November 2016" "Homebrew" "brew"
+.TH "BREW" "1" "December 2016" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The missing package manager for macOS
@@ -695,14 +695,14 @@ If \fB\-\-message=\fR\fImessage\fR is passed, append \fImessage\fR to the defaul
Note that this command cannot be used to transition a formula from a url\-and\-sha256 style specification into a tag\-and\-revision style specification, nor vice versa\. It must use whichever style specification the preexisting formula already uses\.
.
.TP
-\fBcreate\fR \fIURL\fR [\fB\-\-autotools\fR|\fB\-\-cmake\fR] [\fB\-\-no\-fetch\fR] [\fB\-\-set\-name\fR \fIname\fR] [\fB\-\-set\-version\fR \fIversion\fR] [\fB\-\-tap\fR \fIuser\fR\fB/\fR\fIrepo\fR]
+\fBcreate\fR \fIURL\fR [\fB\-\-autotools\fR|\fB\-\-cmake\fR|\fB\-\-meson\fR] [\fB\-\-no\-fetch\fR] [\fB\-\-set\-name\fR \fIname\fR] [\fB\-\-set\-version\fR \fIversion\fR] [\fB\-\-tap\fR \fIuser\fR\fB/\fR\fIrepo\fR]
Generate a formula for the downloadable file at \fIURL\fR and open it in the editor\. Homebrew will attempt to automatically derive the formula name and version, but if it fails, you\'ll have to make your own template\. The \fBwget\fR formula serves as a simple example\. For the complete API have a look at
.
.IP
\fIhttp://www\.rubydoc\.info/github/Homebrew/brew/master/Formula\fR
.
.IP
-If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\.
+If \fB\-\-autotools\fR is passed, create a basic template for an Autotools\-style build\. If \fB\-\-cmake\fR is passed, create a basic template for a CMake\-style build\. If \fB\-\-meson\fR is passed, create a basic template for a Meson\-style build\.
.
.IP
If \fB\-\-no\-fetch\fR is passed, Homebrew will not download \fIURL\fR to the cache and will thus not add the SHA256 to the formula for you\. | true |
Other | Homebrew | brew | 41a248786f0310fa27d2df65d09b58d6ff12c241.json | audit: handle a nil revision map. | Library/Homebrew/dev-cmd/audit.rb | @@ -706,7 +706,7 @@ def audit_revision_and_version_scheme
return if formula.revision.zero?
if formula.stable
revision_map = attributes_map[:revision][:stable]
- stable_revisions = revision_map[formula.stable.version]
+ stable_revisions = revision_map[formula.stable.version] if revision_map
if !stable_revisions || stable_revisions.empty?
problem "'revision #{formula.revision}' should be removed"
end | false |
Other | Homebrew | brew | d21f6954b647948b35da41ca8d02e80880ede2b6.json | update-reset: add new command.
Add new `brew update-reset` command to provide a helpful troubleshooting
fallback to fetch and reset all repositories. This could have lived in
`brew update` but it makes sense to avoid the complexity of sharing
logic between these scripts and keeping this one simpler. | Library/Homebrew/cmd/update-reset.sh | @@ -0,0 +1,43 @@
+#: @hide_from_man_page
+#: * `update-reset`:
+#: Fetches and resets Homebrew and all tap repositories using `git`(1) to
+#: their latest `origin/master`.
+
+homebrew-update-reset() {
+ local DIR
+
+ for option in "$@"
+ do
+ case "$option" in
+ -\?|-h|--help|--usage) brew help update-reset; exit $? ;;
+ --debug) HOMEBREW_DEBUG=1 ;;
+ -*)
+ [[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
+ ;;
+ *)
+ odie <<EOS
+This command updates brew itself, and does not take formula names.
+Use 'brew upgrade <formula>'.
+EOS
+ ;;
+ esac
+ done
+
+ if [[ -n "$HOMEBREW_DEBUG" ]]
+ then
+ set -x
+ fi
+
+ for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*
+ do
+ [[ -d "$DIR/.git" ]] || continue
+ cd "$DIR" || continue
+ echo "==> Fetching $DIR..."
+ git fetch --tags --force origin
+ echo
+
+ echo "==> Resetting $DIR..."
+ git checkout -B master origin/master
+ echo
+ done
+} | false |
Other | Homebrew | brew | ebb659af7da12771efe134e1f9386324423f4246.json | Add Kaby Lake to Linux hardware list
Note that no Mac hardware using a Kaby Lake processor has been released
yet, so do not add it to the equivalent list for macOS. | Library/Homebrew/extend/os/linux/hardware/cpu.rb | @@ -47,6 +47,8 @@ def family
:haswell
when 0x3d, 0x47, 0x4f, 0x56
:broadwell
+ when 0x8e
+ :kabylake
else
cpu_family_model
end | true |
Other | Homebrew | brew | ebb659af7da12771efe134e1f9386324423f4246.json | Add Kaby Lake to Linux hardware list
Note that no Mac hardware using a Kaby Lake processor has been released
yet, so do not add it to the equivalent list for macOS. | Library/Homebrew/test/hardware_test.rb | @@ -8,7 +8,7 @@ def test_hardware_cpu_type
if Hardware::CPU.intel?
def test_hardware_intel_family
- families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :dunno]
+ families = [:core, :core2, :penryn, :nehalem, :arrandale, :sandybridge, :ivybridge, :haswell, :broadwell, :skylake, :kabylake, :dunno]
assert_includes families, Hardware::CPU.family
end
end | true |
Other | Homebrew | brew | 3088faaf9c1bea9fdbf923a05a6aea984d32fedd.json | Fix error message when cask fails to install. | Library/Homebrew/cask/lib/hbc/installer.rb | @@ -146,14 +146,13 @@ def install_artifacts
end
rescue StandardError => e
begin
- ofail e.message
already_installed_artifacts.each do |artifact|
odebug "Reverting installation of artifact of class #{artifact}"
artifact.new(@cask, options).uninstall_phase
end
ensure
purge_versioned_files
- raise e.class, "An error occured during installation of Cask #{@cask}: #{e.message}"
+ raise e
end
end
| false |
Other | Homebrew | brew | ab060c9d52f4edca8551aa44315c816fe1381fd4.json | super/cc: loosen cellar formula regex.
Match HOMEBREW_TAP_FORMULA_REGEX to avoid skipping valid cellar regexes. | Library/Homebrew/shims/super/cc | @@ -31,7 +31,7 @@ class Cmd
@deps = Set.new(ENV.fetch("HOMEBREW_DEPENDENCIES") { "" }.split(","))
@formula_prefix = ENV["HOMEBREW_FORMULA_PREFIX"]
# matches opt or cellar prefix and formula name
- @keg_regex = %r[(#{Regexp.escape(opt)}|#{Regexp.escape(cellar)})/([\w\-_\+]+)]
+ @keg_regex = %r[(#{Regexp.escape(opt)}|#{Regexp.escape(cellar)})/([\w+-.@]+)]
end
def mode | false |
Other | Homebrew | brew | 478e4f112c5482a0424c0a27c6d9d10fea3d2c07.json | formulary: call tap not formula
Fixes #1668 | Library/Homebrew/formulary.rb | @@ -211,7 +211,7 @@ def get_formula(spec, alias_path: nil)
def load_file
super
rescue MethodDeprecatedError => e
- e.issues_url = formula.tap.issues_url || formula.tap.to_s
+ e.issues_url = tap.issues_url || tap.to_s
raise
end
end | false |
Other | Homebrew | brew | f7f15673a8e8ecb6817435c7bd51c7e8077220e4.json | Fix dependency option handling.
- formula_installer: only recompute dependencies when necessary i.e.
when a bottle pour fails.
- formula_installer: re-add accidentally remove dependency options
- dependency: missing options are only those that actually exist on a
formula | Library/Homebrew/dependency.rb | @@ -43,8 +43,12 @@ def satisfied?(inherited_options)
end
def missing_options(inherited_options)
- required = options | inherited_options
- required - Tab.for_formula(to_formula).used_options
+ formula = to_formula
+ required = options
+ required |= inherited_options
+ required &= formula.options.to_a
+ required -= Tab.for_formula(formula).used_options
+ required
end
def modify_build_environment | true |
Other | Homebrew | brew | f7f15673a8e8ecb6817435c7bd51c7e8077220e4.json | Fix dependency option handling.
- formula_installer: only recompute dependencies when necessary i.e.
when a bottle pour fails.
- formula_installer: re-add accidentally remove dependency options
- dependency: missing options are only those that actually exist on a
formula | Library/Homebrew/formula_installer.rb | @@ -236,8 +236,7 @@ def install
@@attempted << formula
- pour_bottle = pour_bottle?(warn: true)
- if pour_bottle
+ if pour_bottle?(warn: true)
begin
pour
rescue Exception => e
@@ -251,18 +250,17 @@ def install
onoe e.message
opoo "Bottle installation failed: building from source."
raise BuildToolsError, [formula] unless DevelopmentTools.installed?
+ compute_and_install_dependencies unless skip_deps_check?
else
- puts_requirement_messages
@poured_bottle = true
end
end
+ puts_requirement_messages
+
build_bottle_preinstall if build_bottle?
unless @poured_bottle
- not_pouring = !pour_bottle || @pour_failed
- compute_and_install_dependencies if not_pouring && !ignore_deps?
- puts_requirement_messages
build
clean
@@ -467,6 +465,7 @@ def install_dependency(dep, inherited_options)
fi = DependencyInstaller.new(df)
fi.options |= tab.used_options
+ fi.options |= Tab.remap_deprecated_options(df.deprecated_options, dep.options)
fi.options |= inherited_options
fi.options &= df.options
fi.build_from_source = ARGV.build_formula_from_source?(df) | true |
Other | Homebrew | brew | 25242fe4e9649ecc5033510c408e6db5b6fe8bcc.json | Minimize line length | docs/FAQ.md | @@ -96,7 +96,8 @@ will use a bottled version of $FORMULA, but
`brew install $FORMULA --enable-bar` will trigger a source build.
* The `--build-from-source` option is invoked.
* The environment variable `HOMEBREW_BUILD_FROM_SOURCE` is set.
-* The machine is not running a supported version of macOS as all bottled builds are generated only for supported macOS versions.
+* The machine is not running a supported version of macOS as all
+bottled builds are generated only for supported macOS versions.
* Homebrew is installed to a prefix other than the standard
`/usr/local` (although some bottles support this)
| false |
Other | Homebrew | brew | 417f27f40f112bdc228b9f2ab27fef8cea7c7d97.json | bump-formula-pr: use correct version in download
When a --version is specified, use this specified version in the name of
the downloaded file rather than the default that is parsed from the URL.
For instance,
brew bump-formula-pr --devel \
--url=http://www.zsh.org/pub/development/zsh-5.2-test-2.tar.gz \
--version=5.2-test-2 zsh
should download to $HOMEBREW_CACHE/zsh-5.2-test-2.tar.gz (correct
behavior after this commit) rather than
$HOMEBREW_CACHE/zsh-2.tar.gz (wrong behavior before this commit). | Library/Homebrew/dev-cmd/bump-formula-pr.rb | @@ -134,6 +134,7 @@ def bump_formula_pr
rsrc = Resource.new { @url = rsrc_url }
rsrc.download_strategy = CurlDownloadStrategy
rsrc.owner = Resource.new(formula.name)
+ rsrc.version = forced_version if forced_version
rsrc_path = rsrc.fetch
if Utils.popen_read("/usr/bin/tar", "-tf", rsrc_path) =~ %r{/.*\.}
new_hash = rsrc_path.sha256 | false |
Other | Homebrew | brew | 59f926cfd3da207d53e5ebc168fbff54a36edb6a.json | boneyard-formula-pr: checkout last branch when done
Make its behavior more consistent with that of bump-formula-pr. | Library/Homebrew/dev-cmd/boneyard-formula-pr.rb | @@ -88,6 +88,8 @@ def boneyard_formula_pr
ohai "git push $HUB_REMOTE #{branch}:#{branch}"
ohai "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
+
+ ohai "git checkout -"
else
cd formula.tap.path
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
@@ -108,6 +110,8 @@ def boneyard_formula_pr
EOS
pr_url = Utils.popen_read("hub", "pull-request", "-m", pr_message).chomp
end
+
+ safe_system "git", "checkout", "-"
end
if ARGV.dry_run?
@@ -128,6 +132,8 @@ def boneyard_formula_pr
ohai "git push $HUB_REMOTE #{branch}:#{branch}"
ohai "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
+
+ ohai "git checkout -"
else
cd boneyard_tap.formula_dir
safe_system "git", "checkout", "--no-track", "-b", branch, "origin/master"
@@ -153,6 +159,8 @@ def boneyard_formula_pr
Created with `brew boneyard-formula-pr`#{reason}.
EOS
end
+
+ safe_system "git", "checkout", "-"
end
end
end | false |
Other | Homebrew | brew | 0fe532c242d73c73eeb2b87a15a46ec9602685df.json | boneyard-formula-pr: use ohai to print messages
Make its behavior more consistent with that of bump-formula-pr. | Library/Homebrew/dev-cmd/boneyard-formula-pr.rb | @@ -35,18 +35,18 @@ def boneyard_formula_pr
boneyard_tap = Tap.fetch("homebrew", "boneyard")
tap_migrations_path = formula.tap.path/"tap_migrations.json"
if ARGV.dry_run?
- puts "brew update"
- puts "brew tap #{boneyard_tap.name}"
- puts "cd #{formula.tap.path}"
+ ohai "brew update"
+ ohai "brew tap #{boneyard_tap.name}"
+ ohai "cd #{formula.tap.path}"
cd formula.tap.path
- puts "cp #{formula_relpath} #{boneyard_tap.path}"
- puts "git rm #{formula_relpath}"
+ ohai "cp #{formula_relpath} #{boneyard_tap.path}"
+ ohai "git rm #{formula_relpath}"
unless File.exist? tap_migrations_path
- puts "Creating tap_migrations.json for #{formula.tap.name}"
- puts "git add #{tap_migrations_path}"
+ ohai "Creating tap_migrations.json for #{formula.tap.name}"
+ ohai "git add #{tap_migrations_path}"
end
- puts "Loading tap_migrations.json"
- puts "Adding #{formula.name} to tap_migrations.json"
+ ohai "Loading tap_migrations.json"
+ ohai "Adding #{formula.name} to tap_migrations.json"
else
safe_system HOMEBREW_BREW_FILE, "update"
safe_system HOMEBREW_BREW_FILE, "tap", boneyard_tap.name
@@ -67,7 +67,7 @@ def boneyard_formula_pr
end
unless which("hub") || local_only
if ARGV.dry_run?
- puts "brew install hub"
+ ohai "brew install hub"
else
safe_system HOMEBREW_BREW_FILE, "install", "hub"
end
@@ -77,16 +77,16 @@ def boneyard_formula_pr
reason = " because #{reason}" if reason
if ARGV.dry_run?
- puts "cd #{formula.tap.path}"
- puts "git checkout --no-track -b #{branch} origin/master"
- puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
+ ohai "cd #{formula.tap.path}"
+ ohai "git checkout --no-track -b #{branch} origin/master"
+ ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate to boneyard\" -- #{formula_relpath} #{tap_migrations_path.basename}"
unless local_only
- puts "hub fork --no-remote"
- puts "hub fork"
- puts "hub fork (to read $HUB_REMOTE)"
- puts "git push $HUB_REMOTE #{branch}:#{branch}"
- puts "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
+ ohai "hub fork --no-remote"
+ ohai "hub fork"
+ ohai "hub fork (to read $HUB_REMOTE)"
+ ohai "git push $HUB_REMOTE #{branch}:#{branch}"
+ ohai "hub pull-request -m $'#{formula.name}: migrate to boneyard\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
else
cd formula.tap.path
@@ -111,22 +111,22 @@ def boneyard_formula_pr
end
if ARGV.dry_run?
- puts "cd #{boneyard_tap.path}"
- puts "git checkout --no-track -b #{branch} origin/master"
+ ohai "cd #{boneyard_tap.path}"
+ ohai "git checkout --no-track -b #{branch} origin/master"
if bottle_block
- puts "Removing bottle block"
+ ohai "Removing bottle block"
else
- puts "No bottle block to remove"
+ ohai "No bottle block to remove"
end
- puts "git add #{formula_file}"
- puts "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
+ ohai "git add #{formula_file}"
+ ohai "git commit --no-edit --verbose --message=\"#{formula.name}: migrate from #{formula.tap.repo}\" -- #{formula_file}"
unless local_only
- puts "hub fork --no-remote"
- puts "hub fork"
- puts "hub fork (to read $HUB_REMOTE)"
- puts "git push $HUB_REMOTE #{branch}:#{branch}"
- puts "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
+ ohai "hub fork --no-remote"
+ ohai "hub fork"
+ ohai "hub fork (to read $HUB_REMOTE)"
+ ohai "git push $HUB_REMOTE #{branch}:#{branch}"
+ ohai "hub pull-request --browse -m $'#{formula.name}: migrate from #{formula.tap.repo}\\n\\nGoes together with $PR_URL\\n\\nCreated with `brew boneyard-formula-pr`#{reason}.'"
end
else
cd boneyard_tap.formula_dir | false |
Other | Homebrew | brew | 006f25d8cfa5ffa9e4c531d49dcc99fe312edff6.json | Use Homebrew to detect if X11 is installed. | Library/Homebrew/cask/lib/hbc/installer.rb | @@ -179,7 +179,7 @@ def arch_dependencies
def x11_dependencies
return unless @cask.depends_on.x11
- raise CaskX11DependencyError, @cask.token if Hbc.x11_libpng.select(&:exist?).empty?
+ raise CaskX11DependencyError, @cask.token unless MacOS::X11.installed?
end
def formula_dependencies | true |
Other | Homebrew | brew | 006f25d8cfa5ffa9e4c531d49dcc99fe312edff6.json | Use Homebrew to detect if X11 is installed. | Library/Homebrew/cask/lib/hbc/locations.rb | @@ -171,14 +171,6 @@ def tcc_db
def pre_mavericks_accessibility_dotfile
@pre_mavericks_accessibility_dotfile ||= Pathname.new("/private/var/db/.AccessibilityAPIEnabled")
end
-
- def x11_executable
- @x11_executable ||= Pathname.new("/usr/X11/bin/X")
- end
-
- def x11_libpng
- @x11_libpng ||= [Pathname.new("/opt/X11/lib/libpng.dylib"), Pathname.new("/usr/X11/lib/libpng.dylib")]
- end
end
end
end | true |
Other | Homebrew | brew | 006f25d8cfa5ffa9e4c531d49dcc99fe312edff6.json | Use Homebrew to detect if X11 is installed. | Library/Homebrew/cask/test/cask/depends_on_test.rb | @@ -93,14 +93,15 @@
describe "depends_on x11" do
it "succeeds when depends_on x11 is satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
+ MacOS::X11.stubs(:installed?).returns(true)
shutup do
Hbc::Installer.new(x11_cask).install
end
end
it "raises an exception when depends_on x11 is not satisfied" do
x11_cask = Hbc.load("with-depends-on-x11")
- Hbc.stubs(:x11_libpng).returns([Pathname.new("/usr/path/does/not/exist")])
+ MacOS::X11.stubs(:installed?).returns(false)
lambda {
shutup do
Hbc::Installer.new(x11_cask).install
@@ -110,7 +111,7 @@
it "never raises when depends_on x11: false" do
x11_cask = Hbc.load("with-depends-on-x11-false")
- Hbc.stubs(:x11_executable).returns(Pathname.new("/usr/path/does/not/exist"))
+ MacOS::X11.stubs(:installed?).returns(false)
lambda do
shutup do
Hbc::Installer.new(x11_cask).install | true |
Other | Homebrew | brew | 1995f653086ec0b4ab56618105c5678331949106.json | Add a method for installing fish function files
Fish shell allows third-party software vendors to put their own function files in a directory for their software.
For brew installed Fish shell, this is /usr/local/share/fish/vendor_functions.d | Library/Homebrew/caveats.rb | @@ -19,6 +19,7 @@ def caveats
caveats << bash_completion_caveats
caveats << zsh_completion_caveats
caveats << fish_completion_caveats
+ caveats << fish_function_caveats
caveats << plist_caveats
caveats << python_caveats
caveats << app_caveats
@@ -99,6 +100,17 @@ def fish_completion_caveats
EOS
end
+ def fish_function_caveats
+ return unless keg
+ return unless keg.fish_functions_installed?
+ return unless which("fish")
+
+ <<-EOS.undent
+ fish functions have been installed to:
+ #{HOMEBREW_PREFIX}/share/fish/vendor_functions.d
+ EOS
+ end
+
def python_caveats
return unless keg
return unless keg.python_site_packages_installed? | true |
Other | Homebrew | brew | 1995f653086ec0b4ab56618105c5678331949106.json | Add a method for installing fish function files
Fish shell allows third-party software vendors to put their own function files in a directory for their software.
For brew installed Fish shell, this is /usr/local/share/fish/vendor_functions.d | Library/Homebrew/formula.rb | @@ -778,6 +778,14 @@ def var
HOMEBREW_PREFIX+"var"
end
+ # The directory where the formula's fish function files should be
+ # installed.
+ # This is symlinked into `HOMEBREW_PREFIX` after installation or with
+ # `brew link` for formulae that are not keg-only.
+ def fish_function
+ share+"fish/vendor_functions.d"
+ end
+
# The directory where the formula's Bash completion files should be
# installed.
# This is symlinked into `HOMEBREW_PREFIX` after installation or with | true |
Other | Homebrew | brew | 1995f653086ec0b4ab56618105c5678331949106.json | Add a method for installing fish function files
Fish shell allows third-party software vendors to put their own function files in a directory for their software.
For brew installed Fish shell, this is /usr/local/share/fish/vendor_functions.d | Library/Homebrew/keg.rb | @@ -303,6 +303,11 @@ def completion_installed?(shell)
dir && dir.directory? && !dir.children.empty?
end
+ def fish_functions_installed?
+ dir = path.join("share", "fish", "vendor_functions.d")
+ dir && dir.directory? && !dir.children.empty?
+ end
+
def plist_installed?
!Dir["#{path}/*.plist"].empty?
end | true |
Other | Homebrew | brew | dc8189833165ce263ce323a1c8de5dfd44597e3b.json | travis: use Xcode 8.1 on Sierra.
For code coverage from `brew test-bot`. | .travis.yml | @@ -3,7 +3,7 @@ language: ruby
matrix:
include:
- os: osx
- osx_image: xcode8.0
+ osx_image: xcode8.1
rvm: system
- os: linux
rvm: 2.0.0
@@ -13,7 +13,7 @@ before_install:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
HOMEBREW_REPOSITORY="$(brew --repo)";
sudo rm -rf "$HOMEBREW_REPOSITORY";
- ln -s "$PWD" "$HOMEBREW_REPOSITORY";
+ sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";
else
export PATH="$PWD/bin:$PATH";
umask 022; | true |
Other | Homebrew | brew | dc8189833165ce263ce323a1c8de5dfd44597e3b.json | travis: use Xcode 8.1 on Sierra.
For code coverage from `brew test-bot`. | Library/Homebrew/cask/cmd/brew-cask-tests.rb | @@ -24,7 +24,11 @@ def run_tests(executable, files, args = [])
rspec = ARGV.flag?("--rspec") || !ARGV.flag?("--minitest")
minitest = ARGV.flag?("--minitest") || !ARGV.flag?("--rspec")
- ENV["HOMEBREW_TESTS_COVERAGE"] = "1" if ARGV.flag?("--coverage")
+ p [:coverage, ARGV.flag?("--coverage"), ENV["CI"], ENV["TRAVIS"]]
+ if ARGV.flag?("--coverage")
+ ENV["HOMEBREW_TESTS_COVERAGE"] = "1"
+ upload_coverage = ENV["CODECOV_TOKEN"] || ENV["TRAVIS"]
+ end
failed = false
@@ -46,7 +50,8 @@ def run_tests(executable, files, args = [])
Homebrew.failed = failed
- if ENV["CODECOV_TOKEN"]
+ if upload_coverage
+ puts "Submitting Codecov coverage..."
system "bundle", "exec", "rake", "test:coverage:upload"
end
end | true |
Other | Homebrew | brew | 3f6d31dee1ab2ef84185899caca1011cb0b54345.json | bash_test: handle race condition.
Other tests may delete Bash files (e.g. `shcmd.sh`) while tests are
ongoing so ensure this doesn't cause a test failure. | Library/Homebrew/test/bash_test.rb | @@ -2,6 +2,7 @@
class BashTests < Homebrew::TestCase
def assert_valid_bash_syntax(file)
+ return unless file.exist?
output = Utils.popen_read("/bin/bash -n #{file} 2>&1")
assert $?.success?, output
end | false |
Other | Homebrew | brew | a24a919a40f09930c5ef9f2fe811d16e83fa963a.json | install_test: add HEAD tests | Library/Homebrew/test/install_test.rb | @@ -72,6 +72,50 @@ def test_install_keg_only_outdated
cmd("install", "testball1", "--force")
end
+ def test_install_head_installed
+ initial_env = ENV.to_hash
+ %w[AUTHOR COMMITTER].each do |role|
+ ENV["GIT_#{role}_NAME"] = "brew tests"
+ ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost"
+ ENV["GIT_#{role}_DATE"] = "Thu May 21 00:04:11 2009 +0100"
+ end
+
+ repo_path = HOMEBREW_CACHE.join("repo")
+ repo_path.join("bin").mkpath
+
+ repo_path.cd do
+ shutup do
+ system "git", "init"
+ system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
+ FileUtils.touch "bin/something.bin"
+ FileUtils.touch "README"
+ system "git", "add", "--all"
+ system "git", "commit", "-m", "Initial repo commit"
+ end
+ end
+
+ setup_test_formula "testball1", <<-EOS.undent
+ version "1.0"
+ head "file://#{repo_path}", :using => :git
+ def install
+ prefix.install Dir["*"]
+ end
+ EOS
+
+ # Ignore dependencies, because we'll try to resolve requirements in build.rb
+ # and there will be the git requirement, but we cannot instantiate git
+ # formula since we only have testball1 formula.
+ assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-2ccdf4f", cmd("install", "testball1", "--HEAD", "--ignore-dependencies")
+ assert_match "testball1-HEAD-2ccdf4f already installed",
+ cmd("install", "testball1", "--HEAD", "--ignore-dependencies")
+ assert_match "#{HOMEBREW_CELLAR}/testball1/HEAD-2ccdf4f", cmd("unlink", "testball1")
+ assert_match "#{HOMEBREW_CELLAR}/testball1/1.0", cmd("install", "testball1")
+
+ ensure
+ ENV.replace(initial_env)
+ repo_path.rmtree
+ end
+
def test_install_with_invalid_option
setup_test_formula "testball1"
assert_match "testball1: this formula has no --with-fo option so it will be ignored!", | false |
Other | Homebrew | brew | 52526c962b235e16da03415dd78cf911afcf8106.json | formula: add new methods
* `Formula#linked?` returns true if formula linked
* `Formula#optlinked?` returns true if formula linked to opt
formula installed to the Cellar
* `Formula#prefix_linked?` returns true if linked keg points to the prefix
passed as an argument
* `Formula#linked_version` to get linked version of the formula | Library/Homebrew/formula.rb | @@ -553,6 +553,28 @@ def prefix(v = pkg_version)
Pathname.new("#{HOMEBREW_CELLAR}/#{name}/#{v}")
end
+ # Is the formula linked?
+ def linked?
+ linked_keg.symlink?
+ end
+
+ # Is the formula linked to opt?
+ def optlinked?
+ opt_prefix.symlink?
+ end
+
+ # Is formula's linked keg points to the prefix.
+ def prefix_linked?(v = pkg_version)
+ return false unless linked?
+ linked_keg.resolved_path == prefix(v)
+ end
+
+ # {PkgVersion} of the linked keg for the formula.
+ def linked_version
+ return unless linked?
+ Keg.for(linked_keg).version
+ end
+
# The parent of the prefix; the named directory in the cellar containing all
# installed versions of this software
# @private | false |
Other | Homebrew | brew | bff8e8440e965365360547c585dd10c29cc2bf81.json | update.sh: Use full path to pkill
Fixes #1600. | Library/Homebrew/cmd/update.sh | @@ -417,7 +417,7 @@ EOS
safe_cd "$HOMEBREW_REPOSITORY"
# kill all of subprocess on interrupt
- trap '{ pkill -P $$; wait; exit 130; }' SIGINT
+ trap '{ /usr/bin/pkill -P $$; wait; exit 130; }' SIGINT
local update_failed_file="$HOMEBREW_REPOSITORY/.git/UPDATE_FAILED"
rm -f "$update_failed_file" | false |
Other | Homebrew | brew | 8f82e89d0b26108e32a10b5d95b67e5e21ff0df6.json | README: update license name. | README.md | @@ -45,7 +45,7 @@ Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo)
Former maintainers with significant contributions include [Dominyk Tiller](https://github.com/DomT4), [Brett Koonce](https://github.com/asparagui), [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
## License
-Code is under the [BSD 2 Clause (NetBSD) license](https://github.com/Homebrew/brew/tree/master/LICENSE.txt).
+Code is under the [BSD 2-clause "Simplified" License](https://github.com/Homebrew/brew/tree/master/LICENSE.txt).
Documentation is under the [Creative Commons Attribution license](https://creativecommons.org/licenses/by/4.0/).
## Donations | false |
Other | Homebrew | brew | eb20f594a2729254fddd53b56b5d769d7e105801.json | ISSUE_TEMPLATE: point people to the right repo. | .github/ISSUE_TEMPLATE.md | @@ -5,6 +5,7 @@ If Homebrew was updated on Aug 10-11th 2016 and `brew update` always says `Alrea
- [ ] Ran `brew update` and retried your prior step?
- [ ] Ran `brew doctor`, fixed as many issues as possible and retried your prior step?
- [ ] If you're seeing permission errors tried running `sudo chown -R $(whoami) $(brew --prefix)`?
+- [ ] Confirmed this is problem with Homebrew/brew and not specific formulae? If it's a formulae-specific problem please file this issue at https://github.com/Homebrew/homebrew-core/issues/new
_You can erase any parts of this template not applicable to your Issue._
| false |
Other | Homebrew | brew | 726045b2f4d04a0896383975d63da0d269bc8f22.json | rubocop: exclude more files.
We never want to check these for any e.g. taps that use them. | Library/.rubocop.yml | @@ -1,7 +1,10 @@
AllCops:
TargetRubyVersion: 2.0
Exclude:
+ - '**/Rakefile'
+ - '**/.*'
- '**/Casks/**/*'
+ - '**/vendor/**/*'
Metrics/AbcSize:
Enabled: false | false |
Other | Homebrew | brew | 282c0a30b61edc46c22b0b1d50ea59d275b64a63.json | Fix macOS version comparison | Library/Homebrew/os/mac/xcode.rb | @@ -256,7 +256,7 @@ def detect_version
return MacOS::Xcode.version if MacOS::Xcode.installed? && Xcode::Version.new(MacOS::Xcode.version) < "3.0"
[MAVERICKS_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].find do |id|
- if Xcode::Version.new(MacOS.version) >= :mavericks.to_s
+ if MacOS.version >= :mavericks
next unless File.exist?("#{MAVERICKS_PKG_PATH}/usr/bin/clang")
end
version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1] | false |
Other | Homebrew | brew | e330047ff9881eee9cbad8828ed1ef2f16b3050e.json | diagnostic: silence a Jenkins doctor warning.
Allow our Jenkins CI testing for Homebrew/brew to live outside of
`/usr/local` without complaint (as it's not using any binary packages
anyway). | Library/Homebrew/diagnostic.rb | @@ -407,6 +407,12 @@ def check_access_cellar
def check_homebrew_prefix
return if HOMEBREW_PREFIX.to_s == "/usr/local"
+ # Allow our Jenkins CI tests to live outside of /usr/local.
+ if ENV["JENKINS_HOME"] &&
+ ENV["GIT_URL"].to_s.start_with?("https://github.com/Homebrew/brew")
+ return
+ end
+
<<-EOS.undent
Your Homebrew's prefix is not /usr/local.
You can install Homebrew anywhere you want but some bottles (binary packages) | true |
Other | Homebrew | brew | e330047ff9881eee9cbad8828ed1ef2f16b3050e.json | diagnostic: silence a Jenkins doctor warning.
Allow our Jenkins CI testing for Homebrew/brew to live outside of
`/usr/local` without complaint (as it's not using any binary packages
anyway). | Library/Homebrew/test/diagnostic_test.rb | @@ -84,6 +84,7 @@ def test_check_access_cellar
end
def test_check_homebrew_prefix
+ ENV.delete("JENKINS_HOME")
# the integration tests are run in a special prefix
assert_match "Your Homebrew's prefix is not /usr/local.",
@checks.check_homebrew_prefix | true |
Other | Homebrew | brew | d41e2ea5e8714d80948033c04165137f0d46e9ac.json | update-report: allow skipping analytics message.
This is used by the install script so it can simplify it's logic and
make the analytics messaging more prominent. | Library/Homebrew/cmd/update-report.rb | @@ -26,7 +26,7 @@ def update_report
analytics_disabled = \
Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsdisabled").chuzzle
if analytics_message_displayed != "true" && analytics_disabled != "true" &&
- !ENV["HOMEBREW_NO_ANALYTICS"]
+ !ENV["HOMEBREW_NO_ANALYTICS"] && !ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"]
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
# Use the shell's audible bell.
print "\a" | false |
Other | Homebrew | brew | 2b34e67af7a9481595dd3fd78ed39469236e9d03.json | Change my site address
I no longer maintain my former site so it's better to link to my GitHub account. | docs/Kickstarter-Supporters.md | @@ -378,7 +378,7 @@ These wonderful people supported our Kickstarter by giving us £10 or more:
* [Andrew Brown](http://pvalu.es)
* [Bethany Sumner](http://www.bethanysumner.com/)
* [Orta](http://orta.io)
-* [Michał Gołębiowski](https://mgol.eu)
+* [Michał Gołębiowski](https://github.com/mgol)
* [Adam C. Foltzer](http://www.acfoltzer.net/)
* [Steve Hiemstra](https://www.speg.com)
* [Anton Sipos](http://www.softwarefuturism.com) | false |
Other | Homebrew | brew | 227975110317b144988b0c5656b338292462f863.json | Fix broken link | Library/Homebrew/formula.rb | @@ -26,7 +26,7 @@
# @see SharedEnvExtension
# @see FileUtils
# @see Pathname
-# @see http://www.rubydoc.info/github/Homebrew/brew/file/docs/Formula-Cookbook.md Formula Cookbook
+# @see https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md Formula Cookbook
# @see https://github.com/styleguide/ruby Ruby Style Guide
#
# <pre>class Wget < Formula | false |
Other | Homebrew | brew | 0271e76f08f122b4b6dde90f7e49066696072953.json | README: add Patreon badge. | README.md | @@ -51,16 +51,8 @@ Documentation is under the [Creative Commons Attribution license](https://creati
## Donations
Homebrew is a non-profit project run entirely by unpaid volunteers. We need your funds to pay for software, hardware and hosting around continuous integration and future improvements to the project. Every donation will be spent on making Homebrew better for our users.
-Homebrew is a member of the [Software Freedom Conservancy](http://sfconservancy.org) which provides us with an ability to receive tax-deductible, Homebrew earmarked donations (and [many other services](http://sfconservancy.org/members/services/)). Software Freedom Conservancy, Inc. is a 501(c)(3) organization incorporated in New York, and donations made to it are fully tax-deductible to the extent permitted by law.
-
-- [Donate with PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=V6ZE57MJRYC8L)
-- Donate by USA $ check from a USA bank:
- - Make check payable to "Software Freedom Conservancy, Inc." and place "Directed donation: Homebrew" in the memo field. Checks should then be mailed to:
- - Software Freedom Conservancy, Inc.
- 137 Montague ST STE 380
- BROOKLYN, NY 11201 USA
-- Donate by wire transfer: contact accounting@sfconservancy.org for wire transfer details.
-- Donate with Flattr or PayPal Giving Fund: coming soon.
+Please consider a regular donation through Patreon:
+[](https://www.patreon.com/homebrew)
## Sponsors
Our CI infrastructure was paid for by [our Kickstarter supporters](https://github.com/Homebrew/brew/blob/master/docs/Kickstarter-Supporters.md). | false |
Other | Homebrew | brew | 1980af52deb5629c9f605017c6261a94f9e2b3e7.json | audit: allow deprecated options on new @ formulae.
As these may be migrations from another tap where we want to migrate
options across correctly. | Library/Homebrew/dev-cmd/audit.rb | @@ -461,6 +461,7 @@ def audit_options
return unless @new_formula
return if formula.deprecated_options.empty?
+ return if formula.name.include?("@")
problem "New formulae should not use `deprecated_option`."
end
| false |
Other | Homebrew | brew | 00b18c3587cb445c5b1db43d43968f5cebf0d67f.json | osxfuse_requirement: add library and include paths
In the installation whose prefix is other than /usr/local,
osxfuse library and include path must explicitly be specified during build.
Although brew's pkg-config is configured to prepend appropriates paths,
the prepended paths (/usr/local) supercede the original HOMEBREW_PREFIX.
This behavior will cause the linker to select libraries outside brew's tree.
By adding /usr/local to HOMEBREW_LIBRARY_PATHS, superenv ensures that appears
only after the HOMEBREW_PREFIX, and thus fixes this problem.
HOMEBREW_INCLUDE_PATHS is also configured like keg-only Formulae. | Library/Homebrew/requirements/osxfuse_requirement.rb | @@ -14,6 +14,11 @@ def self.binary_osxfuse_installed?
env do
ENV.append_path "PKG_CONFIG_PATH", HOMEBREW_LIBRARY/"Homebrew/os/mac/pkgconfig/fuse"
+
+ unless HOMEBREW_PREFIX.to_s == "/usr/local"
+ ENV.append_path "HOMEBREW_LIBRARY_PATHS", "/usr/local/lib"
+ ENV.append_path "HOMEBREW_INCLUDE_PATHS", "/usr/local/include/osxfuse"
+ end
end
end
| false |
Other | Homebrew | brew | c1688be78035b5b0ec7ccf1dbae30c5c93c4ee58.json | version/null: add inspect method.
This makes it easier to identify null versions when inspecting them. | Library/Homebrew/version/null.rb | @@ -34,5 +34,9 @@ def to_s
""
end
alias_method :to_str, :to_s
+
+ def inspect
+ "#<Version::NULL>".freeze
+ end
end.new
end | false |
Other | Homebrew | brew | 4a9601ab82c1f8093d8d3643bed8b2532f7c4890.json | audit: check formula name against blacklisted names. | Library/Homebrew/dev-cmd/audit.rb | @@ -35,6 +35,7 @@
require "cmd/search"
require "cmd/style"
require "date"
+require "blacklist"
module Homebrew
module_function
@@ -310,6 +311,10 @@ def audit_formula_name
name = formula.name
full_name = formula.full_name
+ if blacklisted?(name)
+ problem "'#{name}' is blacklisted."
+ end
+
if Formula.aliases.include? name
problem "Formula name conflicts with existing aliases."
return | false |
Other | Homebrew | brew | 28072021031836937a01e9fd995b03995fe49443.json | cask: use Tempfile and some style fixes | Library/Homebrew/cask/lib/hbc/artifact/pkg.rb | @@ -55,19 +55,16 @@ def run_installer(pkg_description)
args << "-verboseR" if Hbc.verbose
args << "-allowUntrusted" if pkg_install_opts :allow_untrusted
if pkg_install_opts :choices
- args << "-applyChoiceChangesXML"
- args << choices_xml
+ choices_file = choices_xml
+ args << "-applyChoiceChangesXML" << choices_file.path
end
@command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true)
end
def choices_xml
- path = @cask.staged_path.join("Choices.xml")
- unless File.exist? path
- choices = pkg_install_opts :choices
- IO.write path, Plist::Emit.dump(choices)
- end
- path
+ file = Tempfile.open(["", ".xml"])
+ file.write Plist::Emit.dump(pkg_install_opts(:choices))
+ file
end
end
end | true |
Other | Homebrew | brew | 28072021031836937a01e9fd995b03995fe49443.json | cask: use Tempfile and some style fixes | Library/Homebrew/cask/test/cask/artifact/pkg_test.rb | @@ -40,31 +40,32 @@
end
it "passes the choice changes xml to the system installer" do
- pkg = Hbc::Artifact::Pkg.new(@cask,
- command: Hbc::FakeSystemCommand)
-
- Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", @cask.staged_path.join("Choices.xml")])
+ pkg = Hbc::Artifact::Pkg.new(@cask, command: Hbc::FakeSystemCommand)
- shutup do
- pkg.install_phase
- end
-
- IO.read(@cask.staged_path.join("Choices.xml")).must_equal <<-EOS.undent
+ file = mock
+ file.expects(:write).with <<-EOS.undent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
- <dict>
- <key>attributeSetting</key>
- <integer>1</integer>
- <key>choiceAttribute</key>
- <string>selected</string>
- <key>choiceIdentifier</key>
- <string>choice1</string>
- </dict>
+ \t<dict>
+ \t\t<key>attributeSetting</key>
+ \t\t<integer>1</integer>
+ \t\t<key>choiceAttribute</key>
+ \t\t<string>selected</string>
+ \t\t<key>choiceIdentifier</key>
+ \t\t<string>choice1</string>
+ \t</dict>
</array>
</plist>
EOS
+ file.stubs path: Pathname.new("/tmp/choices.xml")
+ Tempfile.expects(:open).returns(file)
+ Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", @cask.staged_path.join("/tmp/choices.xml")])
+
+ shutup do
+ pkg.install_phase
+ end
end
end
end | true |
Other | Homebrew | brew | f4a3bc100b4b98a3d06222c15934abb36bf16594.json | cask: add the choices option to pkg stanza
installer command accepts -applyChoiceChangesXML option to change
customize options on the GUI installer from the commandline.
(`man installer` for more detailed information)
The introduced option `choice` enables the choice changes to be supplied
via pkg stanza without tricks in preflight code. | Library/Homebrew/cask/lib/hbc/artifact/pkg.rb | @@ -2,6 +2,8 @@
require "hbc/utils/hash_validator"
+require "vendor/plist/plist"
+
module Hbc
module Artifact
class Pkg < Base
@@ -16,7 +18,7 @@ def load_pkg_description(pkg_description)
@pkg_install_opts = pkg_description.shift
begin
if @pkg_install_opts.respond_to?(:keys)
- @pkg_install_opts.extend(HashValidator).assert_valid_keys(:allow_untrusted)
+ @pkg_install_opts.extend(HashValidator).assert_valid_keys(:allow_untrusted, :choices)
elsif @pkg_install_opts
raise
end
@@ -52,8 +54,21 @@ def run_installer(pkg_description)
]
args << "-verboseR" if Hbc.verbose
args << "-allowUntrusted" if pkg_install_opts :allow_untrusted
+ if pkg_install_opts :choices
+ args << "-applyChoiceChangesXML"
+ args << choices_xml
+ end
@command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true)
end
+
+ def choices_xml
+ path = @cask.staged_path.join("Choices.xml")
+ unless File.exist? path
+ choices = pkg_install_opts :choices
+ IO.write path, Plist::Emit.dump(choices)
+ end
+ path
+ end
end
end
end | true |
Other | Homebrew | brew | f4a3bc100b4b98a3d06222c15934abb36bf16594.json | cask: add the choices option to pkg stanza
installer command accepts -applyChoiceChangesXML option to change
customize options on the GUI installer from the commandline.
(`man installer` for more detailed information)
The introduced option `choice` enables the choice changes to be supplied
via pkg stanza without tricks in preflight code. | Library/Homebrew/cask/test/cask/artifact/pkg_test.rb | @@ -30,4 +30,41 @@
end
end
end
+
+ describe "choices" do
+ before do
+ @cask = Hbc.load("with-choices")
+ shutup do
+ TestHelper.install_without_artifacts(@cask)
+ end
+ end
+
+ it "passes the choice changes xml to the system installer" do
+ pkg = Hbc::Artifact::Pkg.new(@cask,
+ command: Hbc::FakeSystemCommand)
+
+ Hbc::FakeSystemCommand.expects_command(["/usr/bin/sudo", "-E", "--", "/usr/sbin/installer", "-pkg", @cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), "-target", "/", "-applyChoiceChangesXML", @cask.staged_path.join("Choices.xml")])
+
+ shutup do
+ pkg.install_phase
+ end
+
+ IO.read(@cask.staged_path.join("Choices.xml")).must_equal <<-EOS.undent
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <array>
+ <dict>
+ <key>attributeSetting</key>
+ <integer>1</integer>
+ <key>choiceAttribute</key>
+ <string>selected</string>
+ <key>choiceIdentifier</key>
+ <string>choice1</string>
+ </dict>
+ </array>
+ </plist>
+ EOS
+ end
+ end
end | true |
Other | Homebrew | brew | f4a3bc100b4b98a3d06222c15934abb36bf16594.json | cask: add the choices option to pkg stanza
installer command accepts -applyChoiceChangesXML option to change
customize options on the GUI installer from the commandline.
(`man installer` for more detailed information)
The introduced option `choice` enables the choice changes to be supplied
via pkg stanza without tricks in preflight code. | Library/Homebrew/cask/test/support/Casks/with-choices.rb | @@ -0,0 +1,16 @@
+test_cask 'with-choices' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip"
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg',
+ choices: [
+ {
+ 'choiceIdentifier' => 'choice1',
+ 'choiceAttribute' => 'selected',
+ 'attributeSetting' => 1,
+ },
+ ]
+end | true |
Other | Homebrew | brew | e9815bf2bd2950b5450f0c3ed3bb7eadd3b4cbb3.json | install: add tests with custom requirements | Library/Homebrew/test/install_test.rb | @@ -27,4 +27,27 @@ def test_install_with_invalid_option
assert_match "testball1: this formula has no --with-fo option so it will be ignored!",
cmd("install", "testball1", "--with-fo")
end
+
+ def test_install_with_nonfatal_requirement
+ setup_test_formula "testball1", <<-EOS.undent
+ class NonFatalRequirement < Requirement
+ satisfy { false }
+ end
+ depends_on NonFatalRequirement
+ EOS
+ message = "NonFatalRequirement unsatisfied!"
+ assert_equal 1, cmd("install", "testball1").scan(message).size
+ end
+
+ def test_install_with_fatal_requirement
+ setup_test_formula "testball1", <<-EOS.undent
+ class FatalRequirement < Requirement
+ fatal true
+ satisfy { false }
+ end
+ depends_on FatalRequirement
+ EOS
+ message = "FatalRequirement unsatisfied!"
+ assert_equal 1, cmd_fail("install", "testball1").scan(message).size
+ end
end | false |
Other | Homebrew | brew | 39a0fec95d884ed6b6b620ff6fcb3d16fc23ff9f.json | uninstall: ignore deprecations when uninstalling.
Handle `MethodDeprecatedError` because we want people to be able to
uninstall regardless of the content of their formula. | Library/Homebrew/cmd/uninstall.rb | @@ -81,6 +81,9 @@ def handle_unsatisfied_dependents(kegs_by_rack)
all_kegs = kegs_by_rack.values.flatten(1)
check_for_dependents all_kegs
+ rescue MethodDeprecatedError
+ # Silently ignore deprecations when uninstalling.
+ nil
end
def check_for_dependents(kegs) | false |
Other | Homebrew | brew | 4278ec38e49285fe4ca4cb71878eef738154276c.json | utils/json: Replace OkJson with Ruby's core JSON.
Removes OkJson from vendor/, as Ruby has included its own JSON
parser in corelib since 1.9.x and Homebrew is now guaranteed to be
running on 2.x+. | Library/Homebrew/utils/json.rb | @@ -1,4 +1,4 @@
-require "vendor/okjson"
+require "json"
module Utils
module JSON
@@ -7,13 +7,13 @@ module JSON
Error = Class.new(StandardError)
def load(str)
- Vendor::OkJson.decode(str)
- rescue Vendor::OkJson::Error => e
+ ::JSON.load(str)
+ rescue ::JSON::ParserError => e
raise Error, e.message
end
def dump(obj)
- Vendor::OkJson.encode(stringify_keys(obj))
+ ::JSON.generate(obj)
end
def stringify_keys(obj) | true |
Other | Homebrew | brew | 4278ec38e49285fe4ca4cb71878eef738154276c.json | utils/json: Replace OkJson with Ruby's core JSON.
Removes OkJson from vendor/, as Ruby has included its own JSON
parser in corelib since 1.9.x and Homebrew is now guaranteed to be
running on 2.x+. | Library/Homebrew/vendor/README.md | @@ -1,36 +1,12 @@
Vendored Dependencies
=====================
-* [okjson](https://github.com/kr/okjson), version 43
-
* [plist](https://github.com/bleything/plist), version 3.1.0
* [ruby-macho](https://github.com/Homebrew/ruby-macho), version 0.2.6
## Licenses:
-### okjson
-
-> Copyright 2011, 2012 Keith Rarick
->
-> Permission is hereby granted, free of charge, to any person obtaining a copy
-> of this software and associated documentation files (the "Software"), to deal
-> in the Software without restriction, including without limitation the rights
-> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-> copies of the Software, and to permit persons to whom the Software is
-> furnished to do so, subject to the following conditions:
->
-> The above copyright notice and this permission notice shall be included in
-> all copies or substantial portions of the Software.
->
-> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-> THE SOFTWARE.
-
### plist
> Copyright (c) 2006-2010, Ben Bleything and Patrick May | true |
Other | Homebrew | brew | 4278ec38e49285fe4ca4cb71878eef738154276c.json | utils/json: Replace OkJson with Ruby's core JSON.
Removes OkJson from vendor/, as Ruby has included its own JSON
parser in corelib since 1.9.x and Homebrew is now guaranteed to be
running on 2.x+. | Library/Homebrew/vendor/okjson.rb | @@ -1,602 +0,0 @@
-# encoding: UTF-8
-#
-# Copyright 2011, 2012 Keith Rarick
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-# See https://github.com/kr/okjson for updates.
-
-require 'stringio'
-
-# Some parts adapted from
-# http://golang.org/src/pkg/json/decode.go and
-# http://golang.org/src/pkg/utf8/utf8.go
-module Vendor
- module OkJson
- Upstream = '43'
- extend self
-
-
- # Decodes a json document in string s and
- # returns the corresponding ruby value.
- # String s must be valid UTF-8. If you have
- # a string in some other encoding, convert
- # it first.
- #
- # String values in the resulting structure
- # will be UTF-8.
- def decode(s)
- ts = lex(s)
- v, ts = textparse(ts)
- if ts.length > 0
- raise Error, 'trailing garbage'
- end
- v
- end
-
-
- # Encodes x into a json text. It may contain only
- # Array, Hash, String, Numeric, true, false, nil.
- # (Note, this list excludes Symbol.)
- # X itself must be an Array or a Hash.
- # No other value can be encoded, and an error will
- # be raised if x contains any other value, such as
- # Nan, Infinity, Symbol, and Proc, or if a Hash key
- # is not a String.
- # Strings contained in x must be valid UTF-8.
- def encode(x)
- case x
- when Hash then objenc(x)
- when Array then arrenc(x)
- else
- raise Error, 'root value must be an Array or a Hash'
- end
- end
-
-
- def valenc(x)
- case x
- when Hash then objenc(x)
- when Array then arrenc(x)
- when String then strenc(x)
- when Numeric then numenc(x)
- when true then "true"
- when false then "false"
- when nil then "null"
- else
- raise Error, "cannot encode #{x.class}: #{x.inspect}"
- end
- end
-
-
- private
-
-
- # Parses a "json text" in the sense of RFC 4627.
- # Returns the parsed value and any trailing tokens.
- # Note: this is almost the same as valparse,
- # except that it does not accept atomic values.
- def textparse(ts)
- if ts.length <= 0
- raise Error, 'empty'
- end
-
- typ, _, val = ts[0]
- case typ
- when '{' then objparse(ts)
- when '[' then arrparse(ts)
- else
- raise Error, "unexpected #{val.inspect}"
- end
- end
-
-
- # Parses a "value" in the sense of RFC 4627.
- # Returns the parsed value and any trailing tokens.
- def valparse(ts)
- if ts.length <= 0
- raise Error, 'empty'
- end
-
- typ, _, val = ts[0]
- case typ
- when '{' then objparse(ts)
- when '[' then arrparse(ts)
- when :val,:str then [val, ts[1..-1]]
- else
- raise Error, "unexpected #{val.inspect}"
- end
- end
-
-
- # Parses an "object" in the sense of RFC 4627.
- # Returns the parsed value and any trailing tokens.
- def objparse(ts)
- ts = eat('{', ts)
- obj = {}
-
- if ts[0][0] == '}'
- return obj, ts[1..-1]
- end
-
- k, v, ts = pairparse(ts)
- obj[k] = v
-
- if ts[0][0] == '}'
- return obj, ts[1..-1]
- end
-
- loop do
- ts = eat(',', ts)
-
- k, v, ts = pairparse(ts)
- obj[k] = v
-
- if ts[0][0] == '}'
- return obj, ts[1..-1]
- end
- end
- end
-
-
- # Parses a "member" in the sense of RFC 4627.
- # Returns the parsed values and any trailing tokens.
- def pairparse(ts)
- (typ, _, k), ts = ts[0], ts[1..-1]
- if typ != :str
- raise Error, "unexpected #{k.inspect}"
- end
- ts = eat(':', ts)
- v, ts = valparse(ts)
- [k, v, ts]
- end
-
-
- # Parses an "array" in the sense of RFC 4627.
- # Returns the parsed value and any trailing tokens.
- def arrparse(ts)
- ts = eat('[', ts)
- arr = []
-
- if ts[0][0] == ']'
- return arr, ts[1..-1]
- end
-
- v, ts = valparse(ts)
- arr << v
-
- if ts[0][0] == ']'
- return arr, ts[1..-1]
- end
-
- loop do
- ts = eat(',', ts)
-
- v, ts = valparse(ts)
- arr << v
-
- if ts[0][0] == ']'
- return arr, ts[1..-1]
- end
- end
- end
-
-
- def eat(typ, ts)
- if ts[0][0] != typ
- raise Error, "expected #{typ} (got #{ts[0].inspect})"
- end
- ts[1..-1]
- end
-
-
- # Scans s and returns a list of json tokens,
- # excluding white space (as defined in RFC 4627).
- def lex(s)
- ts = []
- while s.length > 0
- typ, lexeme, val = tok(s)
- if typ == nil
- raise Error, "invalid character at #{s[0,10].inspect}"
- end
- if typ != :space
- ts << [typ, lexeme, val]
- end
- s = s[lexeme.length..-1]
- end
- ts
- end
-
-
- # Scans the first token in s and
- # returns a 3-element list, or nil
- # if s does not begin with a valid token.
- #
- # The first list element is one of
- # '{', '}', ':', ',', '[', ']',
- # :val, :str, and :space.
- #
- # The second element is the lexeme.
- #
- # The third element is the value of the
- # token for :val and :str, otherwise
- # it is the lexeme.
- def tok(s)
- case s[0]
- when ?{ then ['{', s[0,1], s[0,1]]
- when ?} then ['}', s[0,1], s[0,1]]
- when ?: then [':', s[0,1], s[0,1]]
- when ?, then [',', s[0,1], s[0,1]]
- when ?[ then ['[', s[0,1], s[0,1]]
- when ?] then [']', s[0,1], s[0,1]]
- when ?n then nulltok(s)
- when ?t then truetok(s)
- when ?f then falsetok(s)
- when ?" then strtok(s)
- when Spc, ?\t, ?\n, ?\r then [:space, s[0,1], s[0,1]]
- else
- numtok(s)
- end
- end
-
-
- def nulltok(s); s[0,4] == 'null' ? [:val, 'null', nil] : [] end
- def truetok(s); s[0,4] == 'true' ? [:val, 'true', true] : [] end
- def falsetok(s); s[0,5] == 'false' ? [:val, 'false', false] : [] end
-
-
- def numtok(s)
- m = /-?([1-9][0-9]+|[0-9])([.][0-9]+)?([eE][+-]?[0-9]+)?/.match(s)
- if m && m.begin(0) == 0
- if !m[2] && !m[3]
- [:val, m[0], Integer(m[0])]
- elsif m[2]
- [:val, m[0], Float(m[0])]
- else
- [:val, m[0], Integer(m[1])*(10**Integer(m[3][1..-1]))]
- end
- else
- []
- end
- end
-
-
- def strtok(s)
- m = /"([^"\\]|\\["\/\\bfnrt]|\\u[0-9a-fA-F]{4})*"/.match(s)
- if ! m
- raise Error, "invalid string literal at #{abbrev(s)}"
- end
- [:str, m[0], unquote(m[0])]
- end
-
-
- def abbrev(s)
- t = s[0,10]
- p = t['`']
- t = t[0,p] if p
- t = t + '...' if t.length < s.length
- '`' + t + '`'
- end
-
-
- # Converts a quoted json string literal q into a UTF-8-encoded string.
- # The rules are different than for Ruby, so we cannot use eval.
- # Unquote will raise an error if q contains control characters.
- def unquote(q)
- q = q[1...-1]
- a = q.dup # allocate a big enough string
- # In ruby >= 1.9, a[w] is a codepoint, not a byte.
- if rubydoesenc?
- a.force_encoding('UTF-8')
- end
- r, w = 0, 0
- while r < q.length
- c = q[r]
- if c == ?\\
- r += 1
- if r >= q.length
- raise Error, "string literal ends with a \"\\\": \"#{q}\""
- end
-
- case q[r]
- when ?",?\\,?/,?'
- a[w] = q[r]
- r += 1
- w += 1
- when ?b,?f,?n,?r,?t
- a[w] = Unesc[q[r]]
- r += 1
- w += 1
- when ?u
- r += 1
- uchar = begin
- hexdec4(q[r,4])
- rescue RuntimeError => e
- raise Error, "invalid escape sequence \\u#{q[r,4]}: #{e}"
- end
- r += 4
- if surrogate? uchar
- if q.length >= r+6
- uchar1 = hexdec4(q[r+2,4])
- uchar = subst(uchar, uchar1)
- if uchar != Ucharerr
- # A valid pair; consume.
- r += 6
- end
- end
- end
- if rubydoesenc?
- a[w] = '' << uchar
- w += 1
- else
- w += ucharenc(a, w, uchar)
- end
- else
- raise Error, "invalid escape char #{q[r]} in \"#{q}\""
- end
- elsif c == ?" || c < Spc
- raise Error, "invalid character in string literal \"#{q}\""
- else
- # Copy anything else byte-for-byte.
- # Valid UTF-8 will remain valid UTF-8.
- # Invalid UTF-8 will remain invalid UTF-8.
- # In ruby >= 1.9, c is a codepoint, not a byte,
- # in which case this is still what we want.
- a[w] = c
- r += 1
- w += 1
- end
- end
- a[0,w]
- end
-
-
- # Encodes unicode character u as UTF-8
- # bytes in string a at position i.
- # Returns the number of bytes written.
- def ucharenc(a, i, u)
- if u <= Uchar1max
- a[i] = (u & 0xff).chr
- 1
- elsif u <= Uchar2max
- a[i+0] = (Utag2 | ((u>>6)&0xff)).chr
- a[i+1] = (Utagx | (u&Umaskx)).chr
- 2
- elsif u <= Uchar3max
- a[i+0] = (Utag3 | ((u>>12)&0xff)).chr
- a[i+1] = (Utagx | ((u>>6)&Umaskx)).chr
- a[i+2] = (Utagx | (u&Umaskx)).chr
- 3
- else
- a[i+0] = (Utag4 | ((u>>18)&0xff)).chr
- a[i+1] = (Utagx | ((u>>12)&Umaskx)).chr
- a[i+2] = (Utagx | ((u>>6)&Umaskx)).chr
- a[i+3] = (Utagx | (u&Umaskx)).chr
- 4
- end
- end
-
-
- def hexdec4(s)
- if s.length != 4
- raise Error, 'short'
- end
- (nibble(s[0])<<12) | (nibble(s[1])<<8) | (nibble(s[2])<<4) | nibble(s[3])
- end
-
-
- def subst(u1, u2)
- if Usurr1 <= u1 && u1 < Usurr2 && Usurr2 <= u2 && u2 < Usurr3
- return ((u1-Usurr1)<<10) | (u2-Usurr2) + Usurrself
- end
- return Ucharerr
- end
-
-
- def surrogate?(u)
- Usurr1 <= u && u < Usurr3
- end
-
-
- def nibble(c)
- if ?0 <= c && c <= ?9 then c.ord - ?0.ord
- elsif ?a <= c && c <= ?z then c.ord - ?a.ord + 10
- elsif ?A <= c && c <= ?Z then c.ord - ?A.ord + 10
- else
- raise Error, "invalid hex code #{c}"
- end
- end
-
-
- def objenc(x)
- '{' + x.map{|k,v| keyenc(k) + ':' + valenc(v)}.join(',') + '}'
- end
-
-
- def arrenc(a)
- '[' + a.map{|x| valenc(x)}.join(',') + ']'
- end
-
-
- def keyenc(k)
- case k
- when String then strenc(k)
- else
- raise Error, "Hash key is not a string: #{k.inspect}"
- end
- end
-
-
- def strenc(s)
- t = StringIO.new
- t.putc(?")
- r = 0
-
- while r < s.length
- case s[r]
- when ?" then t.print('\\"')
- when ?\\ then t.print('\\\\')
- when ?\b then t.print('\\b')
- when ?\f then t.print('\\f')
- when ?\n then t.print('\\n')
- when ?\r then t.print('\\r')
- when ?\t then t.print('\\t')
- else
- c = s[r]
- # In ruby >= 1.9, s[r] is a codepoint, not a byte.
- if rubydoesenc?
- begin
- # c.ord will raise an error if c is invalid UTF-8
- if c.ord < Spc.ord
- c = "\\u%04x" % [c.ord]
- end
- t.write(c)
- rescue
- t.write(Ustrerr)
- end
- elsif c < Spc
- t.write("\\u%04x" % c)
- elsif Spc <= c && c <= ?~
- t.putc(c)
- else
- n = ucharcopy(t, s, r) # ensure valid UTF-8 output
- r += n - 1 # r is incremented below
- end
- end
- r += 1
- end
- t.putc(?")
- t.string
- end
-
-
- def numenc(x)
- if ((x.nan? || x.infinite?) rescue false)
- raise Error, "Numeric cannot be represented: #{x}"
- end
- "#{x}"
- end
-
-
- # Copies the valid UTF-8 bytes of a single character
- # from string s at position i to I/O object t, and
- # returns the number of bytes copied.
- # If no valid UTF-8 char exists at position i,
- # ucharcopy writes Ustrerr and returns 1.
- def ucharcopy(t, s, i)
- n = s.length - i
- raise Utf8Error if n < 1
-
- c0 = s[i].ord
-
- # 1-byte, 7-bit sequence?
- if c0 < Utagx
- t.putc(c0)
- return 1
- end
-
- raise Utf8Error if c0 < Utag2 # unexpected continuation byte?
-
- raise Utf8Error if n < 2 # need continuation byte
- c1 = s[i+1].ord
- raise Utf8Error if c1 < Utagx || Utag2 <= c1
-
- # 2-byte, 11-bit sequence?
- if c0 < Utag3
- raise Utf8Error if ((c0&Umask2)<<6 | (c1&Umaskx)) <= Uchar1max
- t.putc(c0)
- t.putc(c1)
- return 2
- end
-
- # need second continuation byte
- raise Utf8Error if n < 3
-
- c2 = s[i+2].ord
- raise Utf8Error if c2 < Utagx || Utag2 <= c2
-
- # 3-byte, 16-bit sequence?
- if c0 < Utag4
- u = (c0&Umask3)<<12 | (c1&Umaskx)<<6 | (c2&Umaskx)
- raise Utf8Error if u <= Uchar2max
- t.putc(c0)
- t.putc(c1)
- t.putc(c2)
- return 3
- end
-
- # need third continuation byte
- raise Utf8Error if n < 4
- c3 = s[i+3].ord
- raise Utf8Error if c3 < Utagx || Utag2 <= c3
-
- # 4-byte, 21-bit sequence?
- if c0 < Utag5
- u = (c0&Umask4)<<18 | (c1&Umaskx)<<12 | (c2&Umaskx)<<6 | (c3&Umaskx)
- raise Utf8Error if u <= Uchar3max
- t.putc(c0)
- t.putc(c1)
- t.putc(c2)
- t.putc(c3)
- return 4
- end
-
- raise Utf8Error
- rescue Utf8Error
- t.write(Ustrerr)
- return 1
- end
-
-
- def rubydoesenc?
- ::String.method_defined?(:force_encoding)
- end
-
-
- class Utf8Error < ::StandardError
- end
-
-
- class Error < ::StandardError
- end
-
-
- Utagx = 0b1000_0000
- Utag2 = 0b1100_0000
- Utag3 = 0b1110_0000
- Utag4 = 0b1111_0000
- Utag5 = 0b1111_1000
- Umaskx = 0b0011_1111
- Umask2 = 0b0001_1111
- Umask3 = 0b0000_1111
- Umask4 = 0b0000_0111
- Uchar1max = (1<<7) - 1
- Uchar2max = (1<<11) - 1
- Uchar3max = (1<<16) - 1
- Ucharerr = 0xFFFD # unicode "replacement char"
- Ustrerr = "\xef\xbf\xbd" # unicode "replacement char"
- Usurrself = 0x10000
- Usurr1 = 0xd800
- Usurr2 = 0xdc00
- Usurr3 = 0xe000
-
- Spc = ' '[0]
- Unesc = {?b=>?\b, ?f=>?\f, ?n=>?\n, ?r=>?\r, ?t=>?\t}
- end
-end | true |
Other | Homebrew | brew | 0a7307de6412ddc566cdcb5ab343a9bb16bb2b88.json | tests: ignore test files in test/vendor/bundle | Library/Homebrew/dev-cmd/tests.rb | @@ -46,6 +46,7 @@ def tests
files = Dir.glob("test/**/*_test.rb")
.reject { |p| !OS.mac? && p.start_with?("test/os/mac/") }
+ .reject { |p| p.start_with?("test/vendor/bundle/") }
opts = []
opts << "--serialize-stdout" if ENV["CI"] | false |
Other | Homebrew | brew | 5baf16f50e71cd8224dad58350e67fceb56942a1.json | Revert "uninstall: skip some flaky tests for now."
This reverts commit 50c964df2ebda125366a94f0e8701eaeb0d98fa7. | Library/Homebrew/test/uninstall_test.rb | @@ -34,13 +34,11 @@ def handle_unsatisfied_dependents
end
def test_check_for_testball_f2s_when_developer
- skip "Flaky test"
assert_match "Warning", handle_unsatisfied_dependents
refute_predicate Homebrew, :failed?
end
def test_check_for_dependents_when_not_developer
- skip "Flaky test"
run_as_not_developer do
assert_match "Error", handle_unsatisfied_dependents
assert_predicate Homebrew, :failed? | false |
Other | Homebrew | brew | d7e72899e6f24dca5e02a734d5a4e64e39fc680e.json | uninstall: remove nil requireds/dependents
These shouldn’t get here in the first place so this is a bit of a hack
pending a better fix. | Library/Homebrew/cmd/uninstall.rb | @@ -99,8 +99,8 @@ class DependentsMessage
attr_reader :reqs, :deps
def initialize(requireds, dependents)
- @reqs = requireds
- @deps = dependents
+ @reqs = requireds.compact
+ @deps = dependents.compact
end
protected | false |
Other | Homebrew | brew | 50c964df2ebda125366a94f0e8701eaeb0d98fa7.json | uninstall: skip some flaky tests for now.
These will be fixed properly later but this will avoid causing
unnecessary CI failures. | Library/Homebrew/test/test_uninstall.rb | @@ -35,11 +35,13 @@ def handle_unsatisfied_dependents
end
def test_check_for_testball_f2s_when_developer
+ skip "Flaky test"
assert_match "Warning", handle_unsatisfied_dependents
refute_predicate Homebrew, :failed?
end
def test_check_for_dependents_when_not_developer
+ skip "Flaky test"
run_as_not_developer do
assert_match "Error", handle_unsatisfied_dependents
assert_predicate Homebrew, :failed? | false |
Other | Homebrew | brew | 14099ffaf3016f126ad95c869ac5dbecf5837eee.json | utils: fix capture_stderr style | Library/Homebrew/utils.rb | @@ -377,7 +377,8 @@ def ignore_interrupts(opt = nil)
end
def capture_stderr
- old, $stderr = $stderr, StringIO.new
+ old = $stderr
+ $stderr = StringIO.new
yield
$stderr.string
ensure | false |
Other | Homebrew | brew | 3c310b2e3dd7805b04f48507c65c2c0a856c2aa2.json | Warn developers when uninstalling a dependency
Suggested in #1084.
Made the existing warning output entirely to STDERR, because
previously the first line went to STDERR and subsequent ones went
to STDOUT. | Library/Homebrew/cmd/uninstall.rb | @@ -28,10 +28,8 @@ def uninstall
ARGV.kegs.group_by(&:rack)
end
- if should_check_for_dependents?
- all_kegs = kegs_by_rack.values.flatten(1)
- return if check_for_dependents all_kegs
- end
+ handle_unsatisfied_dependents(kegs_by_rack)
+ return if Homebrew.failed?
kegs_by_rack.each do |rack, kegs|
if ARGV.force?
@@ -78,28 +76,47 @@ def uninstall
end
end
- def should_check_for_dependents?
- # --ignore-dependencies, to be consistent with install
- return false if ARGV.include?("--ignore-dependencies")
- return false if ARGV.homebrew_developer?
- true
+ def handle_unsatisfied_dependents(kegs_by_rack)
+ return if ARGV.include?("--ignore-dependencies")
+
+ all_kegs = kegs_by_rack.values.flatten(1)
+ check_for_dependents all_kegs
end
def check_for_dependents(kegs)
return false unless result = Keg.find_some_installed_dependents(kegs)
- requireds, dependents = result
+ if ARGV.homebrew_developer?
+ dependents_output_for_developers(*result)
+ else
+ dependents_output_for_nondevelopers(*result)
+ end
+
+ true
+ end
+ def dependents_output_for_developers(requireds, dependents)
+ msg = requireds.join(", ")
+ msg << (requireds.count == 1 ? " is" : " are")
+ msg << " required by #{dependents.join(", ")}, which "
+ msg << (dependents.count == 1 ? "is" : "are")
+ msg << " currently installed."
+ msg << "\nYou can silence this warning with "
+ msg << "`brew uninstall --ignore-dependencies "
+ msg << "#{requireds.map(&:name).join(" ")}`."
+ opoo msg
+ end
+
+ def dependents_output_for_nondevelopers(requireds, dependents)
msg = "Refusing to uninstall #{requireds.join(", ")} because "
msg << (requireds.count == 1 ? "it is" : "they are")
msg << " required by #{dependents.join(", ")}, which "
msg << (dependents.count == 1 ? "is" : "are")
msg << " currently installed."
+ msg << "\nYou can override this and force removal with "
+ msg << "`brew uninstall --ignore-dependencies "
+ msg << "#{requireds.map(&:name).join(" ")}`."
ofail msg
- print "You can override this and force removal with "
- puts "`brew uninstall --ignore-dependencies #{requireds.map(&:name).join(" ")}`."
-
- true
end
def rm_pin(rack) | true |
Other | Homebrew | brew | 3c310b2e3dd7805b04f48507c65c2c0a856c2aa2.json | Warn developers when uninstalling a dependency
Suggested in #1084.
Made the existing warning output entirely to STDERR, because
previously the first line went to STDERR and subsequent ones went
to STDOUT. | Library/Homebrew/test/test_uninstall.rb | @@ -2,20 +2,55 @@
require "cmd/uninstall"
class UninstallTests < Homebrew::TestCase
+ def setup
+ @dependency = formula("dependency") { url "f-1" }
+ @dependent = formula("dependent") do
+ url "f-1"
+ depends_on "dependency"
+ end
+
+ [@dependency, @dependent].each { |f| f.installed_prefix.mkpath }
+
+ tab = Tab.empty
+ tab.tabfile = @dependent.installed_prefix/Tab::FILENAME
+ tab.runtime_dependencies = [
+ { "full_name" => "dependency", "version" => "1" },
+ ]
+ tab.write
+
+ stub_formula_loader @dependency
+ stub_formula_loader @dependent
+ end
+
+ def teardown
+ Homebrew.failed = false
+ [@dependency, @dependent].each { |f| f.rack.rmtree }
+ end
+
+ def handle_unsatisfied_dependents
+ capture_stderr do
+ opts = { @dependency.rack => [Keg.new(@dependency.installed_prefix)] }
+ Homebrew.handle_unsatisfied_dependents(opts)
+ end
+ end
+
def test_check_for_testball_f2s_when_developer
- refute_predicate Homebrew, :should_check_for_dependents?
+ assert_match "Warning", handle_unsatisfied_dependents
+ refute_predicate Homebrew, :failed?
end
def test_check_for_dependents_when_not_developer
run_as_not_developer do
- assert_predicate Homebrew, :should_check_for_dependents?
+ assert_match "Error", handle_unsatisfied_dependents
+ assert_predicate Homebrew, :failed?
end
end
def test_check_for_dependents_when_ignore_dependencies
ARGV << "--ignore-dependencies"
run_as_not_developer do
- refute_predicate Homebrew, :should_check_for_dependents?
+ assert_empty handle_unsatisfied_dependents
+ refute_predicate Homebrew, :failed?
end
ensure
ARGV.delete("--ignore-dependencies") | true |
Other | Homebrew | brew | 3c310b2e3dd7805b04f48507c65c2c0a856c2aa2.json | Warn developers when uninstalling a dependency
Suggested in #1084.
Made the existing warning output entirely to STDERR, because
previously the first line went to STDERR and subsequent ones went
to STDOUT. | Library/Homebrew/test/test_utils.rb | @@ -174,6 +174,10 @@ def test_gzip
end
end
+ def test_capture_stderr
+ assert_equal "test\n", capture_stderr { $stderr.puts "test" }
+ end
+
def test_shell_profile
ENV["SHELL"] = "/bin/sh"
assert_equal "~/.bash_profile", Utils::Shell.shell_profile | true |
Other | Homebrew | brew | 3c310b2e3dd7805b04f48507c65c2c0a856c2aa2.json | Warn developers when uninstalling a dependency
Suggested in #1084.
Made the existing warning output entirely to STDERR, because
previously the first line went to STDERR and subsequent ones went
to STDOUT. | Library/Homebrew/utils.rb | @@ -376,6 +376,14 @@ def ignore_interrupts(opt = nil)
trap("INT", std_trap)
end
+def capture_stderr
+ old, $stderr = $stderr, StringIO.new
+ yield
+ $stderr.string
+ensure
+ $stderr = old
+end
+
def nostdout
if ARGV.verbose?
yield | true |
Other | Homebrew | brew | e9391481a8fa6037e9fe70a3050a5a2226e3954e.json | Update RuboCop to 0.45.0. | Library/.rubocop.yml | @@ -6,6 +6,9 @@ AllCops:
Metrics/AbcSize:
Enabled: false
+Metrics/BlockLength:
+ Enabled: false
+
Metrics/ClassLength:
Enabled: false
| true |
Other | Homebrew | brew | e9391481a8fa6037e9fe70a3050a5a2226e3954e.json | Update RuboCop to 0.45.0. | Library/Homebrew/.rubocop_todo.yml | @@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --exclude-limit 100`
-# on 2016-09-28 22:26:33 +0200 using RuboCop version 0.43.0.
+# on 2016-10-24 17:14:14 +0200 using RuboCop version 0.44.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -66,7 +66,7 @@ Metrics/BlockNesting:
# Offense count: 19
# Configuration parameters: CountComments.
Metrics/ModuleLength:
- Max: 400
+ Max: 367
# Offense count: 2
# Configuration parameters: CountKeywordArgs.
@@ -85,89 +85,12 @@ Style/BarePercentLiterals:
- 'test/test_patch.rb'
- 'test/test_string.rb'
-# Offense count: 134
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
-# SupportedStyles: line_count_based, semantic, braces_for_chaining
-# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
-# FunctionalMethods: let, let!, subject, watch
-# IgnoredMethods: lambda, proc, it
-Style/BlockDelimiters:
- Exclude:
- - 'caveats.rb'
- - 'cleaner.rb'
- - 'cleanup.rb'
- - 'cmd/deps.rb'
- - 'cmd/desc.rb'
- - 'cmd/fetch.rb'
- - 'cmd/help.rb'
- - 'cmd/info.rb'
- - 'cmd/linkapps.rb'
- - 'cmd/list.rb'
- - 'cmd/outdated.rb'
- - 'cmd/reinstall.rb'
- - 'cmd/search.rb'
- - 'cmd/tap-info.rb'
- - 'cmd/unlinkapps.rb'
- - 'cmd/update-report.rb'
- - 'cmd/upgrade.rb'
- - 'cmd/uses.rb'
- - 'compilers.rb'
- - 'debrew.rb'
- - 'descriptions.rb'
- - 'dev-cmd/aspell-dictionaries.rb'
- - 'dev-cmd/audit.rb'
- - 'dev-cmd/bottle.rb'
- - 'dev-cmd/edit.rb'
- - 'dev-cmd/man.rb'
- - 'diagnostic.rb'
- - 'exceptions.rb'
- - 'extend/ARGV.rb'
- - 'extend/ENV/shared.rb'
- - 'extend/ENV/std.rb'
- - 'extend/fileutils.rb'
- - 'extend/os/mac/formula_cellar_checks.rb'
- - 'extend/pathname.rb'
- - 'formula.rb'
- - 'formula_assertions.rb'
- - 'formula_cellar_checks.rb'
- - 'formula_installer.rb'
- - 'formulary.rb'
- - 'global.rb'
- - 'keg.rb'
- - 'language/haskell.rb'
- - 'language/node.rb'
- - 'language/python.rb'
- - 'migrator.rb'
- - 'os/mac/linkage_checker.rb'
- - 'os/mac/xquartz.rb'
- - 'patch.rb'
- - 'readall.rb'
- - 'software_spec.rb'
- - 'tap.rb'
- - 'test/lib/config.rb'
- - 'test/test_ARGV.rb'
- - 'test/test_cleanup.rb'
- - 'test/test_dependency_collector.rb'
- - 'test/test_formula_installer.rb'
- - 'test/test_formula_installer_bottle.rb'
- - 'test/test_formulary.rb'
- - 'test/test_gpg.rb'
- - 'test/test_migrator.rb'
- - 'test/test_pathname.rb'
- - 'test/test_tap.rb'
- - 'test/test_utils.rb'
- - 'test/testing_env.rb'
- - 'utils.rb'
- - 'utils/github.rb'
-
-# Offense count: 7
+# Offense count: 6
Style/ClassVars:
Exclude:
- 'dev-cmd/audit.rb'
- 'formula_installer.rb'
- 'test/testing_env.rb'
- - 'utils.rb'
# Offense count: 13
# Configuration parameters: AllowedVariables.
@@ -176,12 +99,11 @@ Style/GlobalVars:
- 'diagnostic.rb'
- 'utils.rb'
-# Offense count: 2
+# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: module_function, extend_self
Style/ModuleFunction:
Exclude:
- - 'global.rb'
- 'os/mac/xcode.rb'
# Offense count: 8 | true |
Other | Homebrew | brew | e9391481a8fa6037e9fe70a3050a5a2226e3954e.json | Update RuboCop to 0.45.0. | Library/Homebrew/cask/lib/hbc/cli/style.rb | @@ -23,7 +23,7 @@ def run
$CHILD_STATUS.success?
end
- RUBOCOP_CASK_VERSION = "~> 0.10.4".freeze
+ RUBOCOP_CASK_VERSION = "~> 0.10.5".freeze
def install_rubocop
Utils.capture_stderr do | true |
Other | Homebrew | brew | e9391481a8fa6037e9fe70a3050a5a2226e3954e.json | Update RuboCop to 0.45.0. | Library/Homebrew/cmd/style.rb | @@ -47,7 +47,7 @@ def check_style_json(files, options = {})
def check_style_impl(files, output_type, options = {})
fix = options[:fix]
- Homebrew.install_gem_setup_path! "rubocop", "0.43.0"
+ Homebrew.install_gem_setup_path! "rubocop", "0.45.0"
args = %w[
--force-exclusion | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.