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
ad17bbff9c59ef5d0490e6af317f7ce2d3069f69.json
cask-tests: fix loading simplecov
Library/Homebrew/cask/cmd/brew-cask-tests.rb
@@ -38,10 +38,7 @@ def run_tests(executable, files, args = []) end if ENV["CODECOV_TOKEN"] - require "simplecov" - require "codecov" - formatter = SimpleCov::Formatter::Codecov.new - formatter.format(SimpleCov::ResultMerger.merged_result) + system "bundle", "exec", "rake", "test:coverage:upload" end Homebrew.failed = !$CHILD_STATUS.success?
true
Other
Homebrew
brew
869fb0214971f3dbcccbe1915702ffc7e7d69d16.json
tests, cask-tests: serialize stdout on CI
Library/Homebrew/cask/cmd/brew-cask-tests.rb
@@ -1,7 +1,10 @@ require "English" def run_tests(executable, files, args = []) - system "bundle", "exec", executable, "--", *args, "--", *files + opts = [] + opts << "--serialize-stdout" if ENV["CI"] + + system "bundle", "exec", executable, *opts, "--", *args, "--", *files end repo_root = Pathname(__FILE__).realpath.parent.parent
true
Other
Homebrew
brew
869fb0214971f3dbcccbe1915702ffc7e7d69d16.json
tests, cask-tests: serialize stdout on CI
Library/Homebrew/dev-cmd/tests.rb
@@ -41,16 +41,24 @@ def tests files = Dir["test/test_*.rb"] files -= Dir["test/test_os_mac_*.rb"] unless OS.mac? + + opts = [] + opts << "--serialize-stdout" if ENV["CI"] + args = [] args << "--trace" if ARGV.include? "--trace" + if ARGV.value("only") ENV["HOMEBREW_TESTS_ONLY"] = "1" test_name, test_method = ARGV.value("only").split("/", 2) files = ["test/test_#{test_name}.rb"] args << "--name=test_#{test_method}" if test_method end + args += ARGV.named.select { |v| v[/^TEST(OPTS)?=/] } - system "bundle", "exec", "parallel_test", "--", *args, "--", *files + + system "bundle", "exec", "parallel_test", *opts, + "--", *args, "--", *files Homebrew.failed = !$?.success?
true
Other
Homebrew
brew
0d76dfadcc11a2131917a4a677cc82bc16710b7c.json
utils: fix completions/manpages/docs linking.
Library/Homebrew/utils.rb
@@ -605,8 +605,11 @@ def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false) src_paths = link_dir ? [src_dir] : src_dir.find src_paths.each do |src| next if src.directory? && !link_dir - dst = dst_dir.parent/src.relative_path_from(src_dir.parent) - next if dst.symlink? && src == dst.resolved_path + dst = dst_dir/src.relative_path_from(src_dir) + if dst.symlink? + next if src == dst.resolved_path + dst.unlink + end if dst.exist? conflicts << dst next
false
Other
Homebrew
brew
4e6990ed8168b74f14b51f389ae89db5abc026f6.json
list: use new exclude paths.
Library/Homebrew/cmd/list.rb
@@ -64,6 +64,8 @@ def list UNBREWED_EXCLUDE_PATHS = %w[ .github/* bin/brew + completions/zsh/_brew + docs/* lib/gdk-pixbuf-2.0/* lib/gio/* lib/node_modules/* @@ -73,13 +75,11 @@ def list lib/ruby/gems/[12].* lib/ruby/site_ruby/[12].* lib/ruby/vendor_ruby/[12].* + manpages/brew.1 share/pypy/* share/pypy3/* - share/doc/homebrew/* share/info/dir - share/man/man1/brew.1 share/man/whatis - share/zsh/site-functions/_brew ].freeze def list_unbrewed
false
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
CONTRIBUTING.md
@@ -5,7 +5,7 @@ First time contributing to Homebrew? Read our [Code of Conduct](https://github.c * run `brew update` (twice) * run and read `brew doctor` -* read [the Troubleshooting Checklist](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting) +* read [the Troubleshooting Checklist](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting) * open an issue on the formula's repository ### Propose a feature
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/README.md
@@ -3,6 +3,6 @@ This is the (partially) documented public API for Homebrew. The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private. -You may also find the [Formula Cookbook](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae. +You may also find the [Formula Cookbook](https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae. Good luck!
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/cask/README.md
@@ -6,7 +6,7 @@ Homebrew-Cask extends [Homebrew](http://brew.sh) and brings its elegance, simpli We do this by providing a friendly Homebrew-style CLI workflow for the administration of macOS applications distributed as binaries. -It’s implemented as a `homebrew` [external command](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/External-Commands.md) called `cask`. +It’s implemented as a `homebrew` [external command](https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md) called `cask`. [![Join the chat at https://gitter.im/caskroom/homebrew-cask](https://img.shields.io/badge/gitter-join%20chat-blue.svg)](https://gitter.im/caskroom/homebrew-cask)
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/cmd/help.rb
@@ -16,7 +16,7 @@ Developers: brew create [URL [--no-fetch]] brew edit [FORMULA...] - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md + https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md Further help: man brew
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/cmd/info.rb
@@ -14,7 +14,7 @@ #: information on all installed formulae. #: #: See the docs for examples of using the JSON: -#: <https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Querying-Brew.md> +#: <https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md> require "blacklist" require "caveats"
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/cmd/tap-info.rb
@@ -13,7 +13,7 @@ #: Pass `--installed` to get information on installed taps. #: #: See the docs for examples of using the JSON: -#: <https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Querying-Brew.md> +#: <https://github.com/Homebrew/brew/blob/master/docs/Querying-Brew.md> require "tap"
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/dev-cmd/create.rb
@@ -154,7 +154,7 @@ def generate! end def template; <<-EOS.undent - # Documentation: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md + # Documentation: https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md # http://www.rubydoc.info/github/Homebrew/brew/master/Formula # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/dev-cmd/tap-readme.rb
@@ -24,7 +24,7 @@ def tap_readme ``` ## Documentation - `brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/brew/tree/master/share/doc/homebrew#readme). + `brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/brew/tree/master/docs#readme). EOS puts template if ARGV.verbose?
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/formula.rb
@@ -26,7 +26,7 @@ # @see SharedEnvExtension # @see FileUtils # @see Pathname -# @see http://www.rubydoc.info/github/Homebrew/brew/file/share/doc/homebrew/Formula-Cookbook.md Formula Cookbook +# @see http://www.rubydoc.info/github/Homebrew/brew/file/docs/Formula-Cookbook.md Formula Cookbook # @see https://github.com/styleguide/ruby Ruby Style Guide # # <pre>class Wget < Formula @@ -1973,7 +1973,7 @@ def mirror(val) # and you haven't passed or previously used any options on this formula. # # If you maintain your own repository, you can add your own bottle links. - # https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Bottles.md + # https://github.com/Homebrew/brew/blob/master/docs/Bottles.md # You can ignore this block entirely if submitting to Homebrew/Homebrew, It'll be # handled for you by the Brew Test Bot. #
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/manpages/brew.1.md.erb
@@ -62,7 +62,7 @@ scripts that reside somewhere in the `PATH`, named `brew-`<cmdname> or to create your own commands without modifying Homebrew's internals. Instructions for creating your own commands can be found in the docs: -<https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/External-Commands.md> +<https://github.com/Homebrew/brew/blob/master/docs/External-Commands.md> ## SPECIFYING FORMULAE @@ -183,7 +183,7 @@ can take several different forms: *Default:* the number of available CPU cores. * `HOMEBREW_NO_ANALYTICS`: - If set, Homebrew will not send analytics. See: <https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md#analytics> + If set, Homebrew will not send analytics. See: <https://github.com/Homebrew/brew/blob/master/docs/Analytics.md#analytics> * `HOMEBREW_NO_AUTO_UPDATE`: If set, Homebrew will not auto-update before running `brew install`, @@ -249,7 +249,7 @@ If your proxy requires authentication: ## SEE ALSO -Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/> +Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/docs/> `git`(1), `git-log`(1)
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation 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/share/doc/homebrew/Analytics.md + # https://github.com/Homebrew/brew/blob/master/docs/Analytics.md # 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
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
Library/Homebrew/utils/analytics.sh
@@ -104,7 +104,7 @@ report-analytics-screenview-command() { ) # Send analytics. Don't send or store any personally identifiable information. - # https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md + # https://github.com/Homebrew/brew/blob/master/docs/Analytics.md # 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
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
README.md
@@ -13,12 +13,12 @@ cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew updat 3. Or use `brew search --desc <keyword>` to browse packages from the command line. ## More Documentation -`brew help`, `man brew` or check [our documentation](https://github.com/Homebrew/brew/tree/master/share/doc/homebrew#readme). +`brew help`, `man brew` or check [our documentation](https://github.com/Homebrew/brew/tree/master/docs#readme). ## Troubleshooting First, please run `brew update` and `brew doctor`. -Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Troubleshooting.md#troubleshooting). +Second, read the [Troubleshooting Checklist](https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md#troubleshooting). **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/share/doc/homebrew/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](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! ## Security Please report security issues to security@brew.sh. @@ -63,7 +63,7 @@ Homebrew is a member of the [Software Freedom Conservancy](http://sfconservancy. - Donate with Flattr or PayPal Giving Fund: coming soon. ## Sponsors -Our CI infrastructure was paid for by [our Kickstarter supporters](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Kickstarter-Supporters.md). +Our CI infrastructure was paid for by [our Kickstarter supporters](https://github.com/Homebrew/brew/blob/master/docs/Kickstarter-Supporters.md). Our CI infrastructure is hosted by [The Positive Internet Company](http://www.positive-internet.com).
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/Common-Issues.md
@@ -76,7 +76,7 @@ When running `brew upgrade`, you see something like this: $ brew upgrade Error: undefined method `include?' for nil:NilClass Please report this bug: - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Troubleshooting.md + https://github.com/Homebrew/brew/blob/master/docs/Troubleshooting.md /usr/local/Library/Homebrew/formula.rb:393:in `canonical_name' /usr/local/Library/Homebrew/formula.rb:425:in `factory' /usr/local/Library/Contributions/examples/brew-upgrade.rb:7
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/External-Commands.md
@@ -81,4 +81,4 @@ These commands have been contributed by Homebrew users but are not included in t > ``` ## SEE ALSO -Homebrew Docs: <https://github.com/Homebrew/brew/tree/master/share/doc/homebrew> +Homebrew Docs: <https://github.com/Homebrew/brew/tree/master/docs>
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/Formula-Cookbook.md
@@ -350,7 +350,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/share/doc/homebrew/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](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. * One formula per commit; one commit per formula * Keep merge commits out of the pull request
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/New-Maintainer-Checklist.md
@@ -25,8 +25,8 @@ A few requests: - still create your branches on your fork rather than in the main repository - if still in doubt please ask for help and we'll help you out - these are probably worth a read: - - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Brew-Test-Bot-For-Core-Contributors.md - - https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Maintainer-Guidelines.md + - https://github.com/Homebrew/brew/blob/master/docs/Brew-Test-Bot-For-Core-Contributors.md + - https://github.com/Homebrew/brew/blob/master/docs/Maintainer-Guidelines.md - possibly everything else in the documentation How does that sound?
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/Node-for-Formula-Authors.md
@@ -82,7 +82,7 @@ In your formula's `install` method, do any installation steps which need to be d system "npm", "install", *Language::Node.local_npm_install_args ``` -This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` by your own, following the [general Homebrew formula instructions](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md). +This will install all of your Node modules dependencies to your local build path. You can now continue with your build steps and take care of the installation into the Homebrew `prefix` by your own, following the [general Homebrew formula instructions](https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md). # Example
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/Prose-Style-Guidelines.md
@@ -1,6 +1,6 @@ # Prose Style Guidelines -This is a set of style and usage guidelines for Homebrew's prose documentation aimed at users, contributors, and maintainers (as opposed to executable computer code). It applies to documents like those in `share/doc/homebrew` in the `Homebrew/brew` repo, announcement emails, and other communications with the Homebrew community. +This is a set of style and usage guidelines for Homebrew's prose documentation aimed at users, contributors, and maintainers (as opposed to executable computer code). It applies to documents like those in `docs` in the `Homebrew/brew` repo, announcement emails, and other communications with the Homebrew community. This does not apply to any Ruby or other computer code. You can use it to inform technical documentation extracted from computer code, like embedded man pages, but it's just a suggestion there.
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/Tips-N'-Tricks.md
@@ -6,7 +6,7 @@ The preferred and supported method of installing specific versions of formulae is to use the [homebrew/versions](https://github.com/Homebrew/homebrew-versions) tap. If the version you’re looking for isn’t available, consider [opening a -pull request](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md)! +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
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
docs/brew.1.html
@@ -151,7 +151,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/share/doc/homebrew/Querying-Brew.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Querying-Brew.md</a></p></dd> +<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> <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 @@ -344,7 +344,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/share/doc/homebrew/Querying-Brew.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Querying-Brew.md</a></p></dd> +<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> <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> @@ -590,7 +590,7 @@ <h2 id="EXTERNAL-COMMANDS">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/share/doc/homebrew/External-Commands.md" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/External-Commands.md</a></p> +<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> <h2 id="SPECIFYING-FORMULAE">SPECIFYING FORMULAE</h2> @@ -669,7 +669,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/share/doc/homebrew/Analytics.md#analytics" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/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="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_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 @@ -721,7 +721,7 @@ <h2 id="USING-HOMEBREW-BEHIND-A-PROXY">USING HOMEBREW BEHIND A PROXY</h2> <h2 id="SEE-ALSO">SEE ALSO</h2> -<p>Homebrew Documentation: <a href="https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/</a></p> +<p>Homebrew Documentation: <a href="https://github.com/Homebrew/brew/blob/master/docs/" data-bare-link="true">https://github.com/Homebrew/brew/blob/master/docs/</a></p> <p><code>git</code>(1), <code>git-log</code>(1)</p>
true
Other
Homebrew
brew
b85ee1cb8ffef36503f46685609442f79660737a.json
Update documentation links.
manpages/brew.1
@@ -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/share/doc/homebrew/Querying\-Brew\.md\fR +See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Querying\-Brew\.md\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 @@ -473,7 +473,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/share/doc/homebrew/Querying\-Brew\.md\fR +See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Querying\-Brew\.md\fR . .TP \fBtap\-pin\fR \fItap\fR @@ -790,7 +790,7 @@ If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the 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/share/doc/homebrew/External\-Commands\.md\fR +Instructions for creating your own commands can be found in the docs: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/External\-Commands\.md\fR . .SH "SPECIFYING FORMULAE" Many Homebrew commands accept one or more \fIformula\fR arguments\. These arguments can take several different forms: @@ -909,7 +909,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/share/doc/homebrew/Analytics\.md#analytics\fR +If set, Homebrew will not send analytics\. See: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/Analytics\.md#analytics\fR . .TP \fBHOMEBREW_NO_AUTO_UPDATE\fR @@ -989,7 +989,7 @@ http_proxy=http://<user>:<password>@<host>:<port> brew install foo .IP "" 0 . .SH "SEE ALSO" -Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/share/doc/homebrew/\fR +Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/docs/\fR . .P \fBgit\fR(1), \fBgit\-log\fR(1)
true
Other
Homebrew
brew
9067cc39b8d6943b585cc34c7b91994cb6a6810b.json
gitignore: rearrange repository, simplify rules.
.gitignore
@@ -33,30 +33,19 @@ # Unignore our `brew` script. !/bin/brew -# Ignore `share` contents (again). -/share -/share/doc -/share/zsh -/share/zsh/site-functions - # Unignore our documentation. !/.github -!/share/doc/homebrew -!/share/man/man1/brew.1 -!/share/man/man1/brew-cask.1 - -# Ignore `etc` contents (again) -/etc -/etc/bash_completion.d +!/docs +!/manpages # Unignore our shell completion -!/etc/bash_completion.d/brew -!/share/zsh/site-functions/_brew +!/completions # Unignore our root-level metadata files. !/.gitignore !/.travis.yml !/.yardopts !/CODEOFCONDUCT.md +!/CONTRIBUTING.md !/LICENSE.txt !/README.md
false
Other
Homebrew
brew
51ed08d733de8560048807c06eac63067f42788b.json
man: read lead, former maintainers, creator.
Library/Homebrew/dev-cmd/man.rb
@@ -51,9 +51,18 @@ def build_man_page variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") - variables[:maintainers] = (HOMEBREW_REPOSITORY/"README.md") + readme = HOMEBREW_REPOSITORY/"README.md" + variables[:lead_maintainer] = readme + .read[/Homebrew's lead maintainer is (.*)\./, 1] + .scan(/\[([^\]]*)\]/).flatten.first + variables[:maintainers] = readme .read[/Homebrew's current maintainers are (.*)\./, 1] .scan(/\[([^\]]*)\]/).flatten + former_maintainers = readme + .read[/Former maintainers with significant contributions include (.*)\./, 1] + .scan(/\[([^\]]*)\]/).flatten + variables[:former_maintainers] = former_maintainers[0...-1] + variables[:creator] = former_maintainers.last ERB.new(template, nil, ">").result(variables.instance_eval { binding }) end
true
Other
Homebrew
brew
51ed08d733de8560048807c06eac63067f42788b.json
man: read lead, former maintainers, creator.
Library/Homebrew/manpages/brew.1.md.erb
@@ -255,9 +255,11 @@ Homebrew Documentation: <https://github.com/Homebrew/brew/blob/master/share/doc/ ## AUTHORS +Homebrew's lead maintainer is <%= lead_maintainer %>. + Homebrew's current maintainers are <%= maintainers[0...-1].join(", ") %> and <%= maintainers[-1] %>. -Former maintainers with significant contributions include Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell. +Former maintainers with significant contributions include <%= former_maintainers.join(", ") %> and Homebrew's creator: <%= creator %>. ## BUGS
true
Other
Homebrew
brew
51ed08d733de8560048807c06eac63067f42788b.json
man: read lead, former maintainers, creator.
share/doc/homebrew/brew.1.html
@@ -297,18 +297,14 @@ <h2 id="COMMANDS">COMMANDS</h2> or even your <code>gem install</code> succeed. Especially handy if you run Homebrew in an Xcode-only configuration since it adds tools like <code>make</code> to your <code>PATH</code> which otherwise build-systems would not find.</p></dd> -<dt><code>style</code> [<code>--fix</code>] [<code>--display-cop-names</code>] [<var>formulae</var>|<var>files</var>]</dt><dd><p>Check formulae or files for conformance to Homebrew style guidelines.</p> - -<p><var>formulae</var> is a list of formula names.</p> - -<p><var>files</var> is a list of file names.</p> +<dt><code>style</code> [<code>--fix</code>] [<code>--display-cop-names</code>] [<var>files</var>|<var>taps</var>|<var>formulae</var>]</dt><dd><p>Check formulae or files for conformance to Homebrew style guidelines.</p> <p><var>formulae</var> and <var>files</var> may not be combined. If both are omitted, style will run style checks on the whole Homebrew <code>Library</code>, including core code and all formulae.</p> -<p>If <code>--fix</code> is passed and <code>HOMEBREW_DEVELOPER</code> is set, style violations -will be automatically fixed using RuboCop's <code>--auto-correct</code> feature.</p> +<p>If <code>--fix</code> is passed, style violations will be automatically fixed using +RuboCop's <code>--auto-correct</code> feature.</p> <p>If <code>--display-cop-names</code> is passed, the RuboCop cop name for each violation is included in the output.</p> @@ -731,9 +727,11 @@ <h2 id="SEE-ALSO">SEE ALSO</h2> <h2 id="AUTHORS">AUTHORS</h2> -<p>Homebrew's current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Mike McQuaid, Baptiste Fontaine, Brett Koonce, ilovezfs, Martin Afanasjew, Dominyk Tiller, Tim Smith and Alex Dunn.</p> +<p>Homebrew's lead maintainer is Mike McQuaid.</p> + +<p>Homebrew's current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Baptiste Fontaine, Zhiming Wang, Brett Koonce, ilovezfs, Martin Afanasjew, Uladzislau Shablinski, Dominyk Tiller, Tim Smith and Alex Dunn.</p> -<p>Former maintainers with significant contributions include Jack Nagel, Adam Vandenberg and Homebrew's creator: Max Howell.</p> +<p>Former maintainers with significant contributions include Jack Nagel, Adam Vandenberg, Max Howell and Homebrew's creator: Max Howell.</p> <h2 id="BUGS">BUGS</h2>
true
Other
Homebrew
brew
51ed08d733de8560048807c06eac63067f42788b.json
man: read lead, former maintainers, creator.
share/man/man1/brew.1
@@ -403,20 +403,14 @@ Search for \fItext\fR in the given package manager\'s list\. Instantiate a Homebrew build environment\. Uses our years\-battle\-hardened Homebrew build logic to help your \fB\./configure && make && make install\fR or even your \fBgem install\fR succeed\. Especially handy if you run Homebrew in an Xcode\-only configuration since it adds tools like \fBmake\fR to your \fBPATH\fR which otherwise build\-systems would not find\. . .TP -\fBstyle\fR [\fB\-\-fix\fR] [\fB\-\-display\-cop\-names\fR] [\fIformulae\fR|\fIfiles\fR] +\fBstyle\fR [\fB\-\-fix\fR] [\fB\-\-display\-cop\-names\fR] [\fIfiles\fR|\fItaps\fR|\fIformulae\fR] Check formulae or files for conformance to Homebrew style guidelines\. . .IP -\fIformulae\fR is a list of formula names\. -. -.IP -\fIfiles\fR is a list of file names\. -. -.IP \fIformulae\fR and \fIfiles\fR may not be combined\. If both are omitted, style will run style checks on the whole Homebrew \fBLibrary\fR, including core code and all formulae\. . .IP -If \fB\-\-fix\fR is passed and \fBHOMEBREW_DEVELOPER\fR is set, style violations will be automatically fixed using RuboCop\'s \fB\-\-auto\-correct\fR feature\. +If \fB\-\-fix\fR is passed, style violations will be automatically fixed using RuboCop\'s \fB\-\-auto\-correct\fR feature\. . .IP If \fB\-\-display\-cop\-names\fR is passed, the RuboCop cop name for each violation is included in the output\. @@ -1001,10 +995,13 @@ Homebrew Documentation: \fIhttps://github\.com/Homebrew/brew/blob/master/share/d \fBgit\fR(1), \fBgit\-log\fR(1) . .SH "AUTHORS" -Homebrew\'s current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Mike McQuaid, Baptiste Fontaine, Brett Koonce, ilovezfs, Martin Afanasjew, Dominyk Tiller, Tim Smith and Alex Dunn\. +Homebrew\'s lead maintainer is Mike McQuaid\. +. +.P +Homebrew\'s current maintainers are Misty De Meo, Andrew Janke, Xu Cheng, Tomasz Pajor, Baptiste Fontaine, Zhiming Wang, Brett Koonce, ilovezfs, Martin Afanasjew, Uladzislau Shablinski, Dominyk Tiller, Tim Smith and Alex Dunn\. . .P -Former maintainers with significant contributions include Jack Nagel, Adam Vandenberg and Homebrew\'s creator: Max Howell\. +Former maintainers with significant contributions include Jack Nagel, Adam Vandenberg, Max Howell and Homebrew\'s creator: Max Howell\. . .SH "BUGS" See our issues on GitHub:
true
Other
Homebrew
brew
d6aa0aa8d35c76cc9865035e8570e9ee44600031.json
README: add lead, new maintainers.
README.md
@@ -38,7 +38,9 @@ This is our PGP key which is valid until May 24, 2017. * Full key: https://keybase.io/homebrew/key.asc ## Who Are You? -Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Mike McQuaid](https://github.com/mikemcquaid), [Baptiste Fontaine](https://github.com/bfontaine), [Brett Koonce](https://github.com/asparagui), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn). +Homebrew's lead maintainer is [Mike McQuaid](https://github.com/mikemcquaid). + +Homebrew's current maintainers are [Misty De Meo](https://github.com/mistydemeo), [Andrew Janke](https://github.com/apjanke), [Xu Cheng](https://github.com/xu-cheng), [Tomasz Pajor](https://github.com/nijikon), [Baptiste Fontaine](https://github.com/bfontaine), [Zhiming Wang](https://github.com/zmwangx), [Brett Koonce](https://github.com/asparagui), [ilovezfs](https://github.com/ilovezfs), [Martin Afanasjew](https://github.com/UniqMartin), [Uladzislau Shablinski](https://github.com/orgs/Homebrew/people/vladshablinsky), [Dominyk Tiller](https://github.com/DomT4), [Tim Smith](https://github.com/tdsmith) and [Alex Dunn](https://github.com/dunn). Former maintainers with significant contributions include [Jack Nagel](https://github.com/jacknagel), [Adam Vandenberg](https://github.com/adamv) and Homebrew's creator: [Max Howell](https://github.com/mxcl).
false
Other
Homebrew
brew
41e25209f7486676f633ae05d7fc61e05af07b90.json
Save runtime dependencies in INSTALL_RECEIPT.json Fixes #930
Library/Homebrew/formula.rb
@@ -1450,6 +1450,12 @@ def recursive_requirements(&block) Requirement.expand(self, &block) end + # Returns a list of Dependency objects that are required at runtime. + # @private + def runtime_dependencies + recursive_dependencies.reject(&:build?) + end + # @private def to_hash hsh = {
true
Other
Homebrew
brew
41e25209f7486676f633ae05d7fc61e05af07b90.json
Save runtime dependencies in INSTALL_RECEIPT.json Fixes #930
Library/Homebrew/tab.rb
@@ -30,6 +30,10 @@ def self.create(formula, compiler, stdlib) "HEAD" => HOMEBREW_REPOSITORY.git_head, "compiler" => compiler, "stdlib" => stdlib, + "runtime_dependencies" => formula.runtime_dependencies.map do |dep| + f = dep.to_formula + { "full_name" => f.full_name, "version" => f.version.to_s } + end, "source" => { "path" => formula.specified_path.to_s, "tap" => formula.tap ? formula.tap.name : nil, @@ -56,6 +60,7 @@ def self.from_file(path) def self.from_file_content(content, path) attributes = Utils::JSON.load(content) attributes["tabfile"] = path + attributes["runtime_dependencies"] ||= [] attributes["source_modified_time"] ||= 0 attributes["source"] ||= {} @@ -172,6 +177,7 @@ def self.empty "HEAD" => nil, "stdlib" => nil, "compiler" => DevelopmentTools.default_compiler, + "runtime_dependencies" => [], "source" => { "path" => nil, "tap" => nil, @@ -303,6 +309,7 @@ def to_json "HEAD" => self.HEAD, "stdlib" => (stdlib.to_s if stdlib), "compiler" => (compiler.to_s if compiler), + "runtime_dependencies" => runtime_dependencies, "source" => source, }
true
Other
Homebrew
brew
41e25209f7486676f633ae05d7fc61e05af07b90.json
Save runtime dependencies in INSTALL_RECEIPT.json Fixes #930
Library/Homebrew/test/fixtures/receipt.json
@@ -14,6 +14,12 @@ "alias_path": "/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula", "stdlib": "libcxx", "compiler": "clang", + "runtime_dependencies": [ + { + "full_name": "foo", + "version": "1.0" + } + ], "source": { "path": "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb", "tap": "homebrew/core",
true
Other
Homebrew
brew
41e25209f7486676f633ae05d7fc61e05af07b90.json
Save runtime dependencies in INSTALL_RECEIPT.json Fixes #930
Library/Homebrew/test/test_formula.rb
@@ -638,6 +638,27 @@ def test_test_fixtures f1.test_fixtures("foo") end + def test_dependencies + stub_formula_loader formula("f1") { url "f1-1.0" } + stub_formula_loader formula("f2") { url "f2-1.0" } + + f3 = formula("f3") do + url "f3-1.0" + depends_on "f1" => :build + depends_on "f2" + end + stub_formula_loader f3 + + f4 = formula("f4") do + url "f4-1.0" + depends_on "f3" + end + + assert_equal %w[f3], f4.deps.map(&:name) + assert_equal %w[f1 f2 f3], f4.recursive_dependencies.map(&:name) + assert_equal %w[f2 f3], f4.runtime_dependencies.map(&:name) + end + def test_to_hash f1 = formula("foo") do url "foo-1.0"
true
Other
Homebrew
brew
41e25209f7486676f633ae05d7fc61e05af07b90.json
Save runtime dependencies in INSTALL_RECEIPT.json Fixes #930
Library/Homebrew/test/test_tab.rb
@@ -16,6 +16,7 @@ def setup "HEAD" => TEST_SHA1, "compiler" => "clang", "stdlib" => "libcxx", + "runtime_dependencies" => [], "source" => { "tap" => "homebrew/core", "path" => nil, @@ -40,6 +41,7 @@ def test_defaults assert_nil tab.tap assert_nil tab.time assert_nil tab.HEAD + assert_empty tab.runtime_dependencies assert_nil tab.stable_version assert_nil tab.devel_version assert_nil tab.head_version @@ -95,12 +97,14 @@ def test_from_old_version_file assert_equal TEST_SHA1, tab.HEAD assert_equal :clang, tab.cxxstdlib.compiler assert_equal :libcxx, tab.cxxstdlib.type + assert_empty tab.runtime_dependencies end def test_from_file path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json") tab = Tab.from_file(path) source_path = "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb" + runtime_dependencies = [{ "full_name" => "foo", "version" => "1.0" }] assert_equal @used.sort, tab.used_options.sort assert_equal @unused.sort, tab.unused_options.sort @@ -115,18 +119,30 @@ def test_from_file assert_equal TEST_SHA1, tab.HEAD assert_equal :clang, tab.cxxstdlib.compiler assert_equal :libcxx, tab.cxxstdlib.type + assert_equal runtime_dependencies, tab.runtime_dependencies assert_equal "2.14", tab.stable_version.to_s assert_equal "2.15", tab.devel_version.to_s assert_equal "HEAD-0000000", tab.head_version.to_s assert_equal source_path, tab.source["path"] end def test_create - f = formula { url "foo-1.0" } + f = formula do + url "foo-1.0" + depends_on "bar" + depends_on "baz" => :build + end + + stub_formula_loader formula("bar") { url "bar-2.0" } + stub_formula_loader formula("baz") { url "baz-3.0" } + compiler = DevelopmentTools.default_compiler stdlib = :libcxx tab = Tab.create(f, compiler, stdlib) + runtime_dependencies = [{ "full_name" => "bar", "version" => "2.0" }] + + assert_equal runtime_dependencies, tab.runtime_dependencies assert_equal f.path.to_s, tab.source["path"] end @@ -167,6 +183,7 @@ def test_to_json assert_equal @tab.HEAD, tab.HEAD assert_equal @tab.compiler, tab.compiler assert_equal @tab.stdlib, tab.stdlib + assert_equal @tab.runtime_dependencies, tab.runtime_dependencies assert_equal @tab.stable_version, tab.stable_version assert_equal @tab.devel_version, tab.devel_version assert_equal @tab.head_version, tab.head_version
true
Other
Homebrew
brew
15f3f2065625b05496632c1f5cf61fd150afef3c.json
Prevent Accessibility access for macOS >= 10.12 See https://github.com/caskroom/homebrew-cask/issues/24519 Feel free to suggest alternative wording and such.
Library/Homebrew/cask/lib/hbc/installer.rb
@@ -225,7 +225,12 @@ def print_caveats def enable_accessibility_access return unless @cask.accessibility_access ohai "Enabling accessibility access" - if MacOS.version <= :mountain_lion + if MacOS.version >= :sierra + opoo <<-EOS.undent + Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. + If needed, enable manually via the app or System Preferences. + EOS + elsif MacOS.version <= :mountain_lion @command.run!("/usr/bin/touch", args: [Hbc.pre_mavericks_accessibility_dotfile], sudo: true) @@ -248,7 +253,12 @@ def enable_accessibility_access def disable_accessibility_access return unless @cask.accessibility_access - if MacOS.version >= :mavericks + if MacOS.version >= :sierra + opoo <<-EOS.undent + Access denied to accessibility DB (TCC.db) by SIP on this version of macOS. + If needed, disable manually via the app or System Preferences. + EOS + elsif MacOS.version >= :mavericks ohai "Disabling accessibility access" @command.run!("/usr/bin/sqlite3", args: [
false
Other
Homebrew
brew
4c773725c7683ec624863459ac3b4a3237a7382f.json
Use user GEM_HOME for installing gems Save the value of GEM_HOME before unsetting it, and resetting it when setting up a gem environment. Fixes #944.
Library/Homebrew/brew.sh
@@ -59,6 +59,10 @@ then odie "Cowardly refusing to continue at this prefix: $HOMEBREW_PREFIX" fi +# Save value to use for installing gems +export GEM_OLD_HOME="$GEM_HOME" +export GEM_OLD_PATH="$GEM_PATH" + # Users may have these set, pointing the system Ruby # at non-system gem paths unset GEM_HOME
true
Other
Homebrew
brew
4c773725c7683ec624863459ac3b4a3237a7382f.json
Use user GEM_HOME for installing gems Save the value of GEM_HOME before unsetting it, and resetting it when setting up a gem environment. Fixes #944.
Library/Homebrew/utils.rb
@@ -270,17 +270,24 @@ def self.core_tap_version_string end def self.install_gem_setup_path!(name, version = nil, executable = name) - require "rubygems" + # Respect user's preferences for where gems should be installed. + ENV["GEM_HOME"] = ENV["GEM_OLD_HOME"].to_s + ENV["GEM_HOME"] = Gem.user_dir if ENV["GEM_HOME"].empty? + ENV["GEM_PATH"] = ENV["GEM_OLD_PATH"] unless ENV["GEM_OLD_PATH"].to_s.empty? + + # Make rubygems notice env changes. + Gem.clear_paths + Gem::Specification.reset # Add Gem binary directory and (if missing) Ruby binary directory to PATH. path = ENV["PATH"].split(File::PATH_SEPARATOR) path.unshift(RUBY_BIN) if which("ruby") != RUBY_PATH - path.unshift("#{Gem.user_dir}/bin") + path.unshift("#{Gem.dir}/bin") ENV["PATH"] = path.join(File::PATH_SEPARATOR) if Gem::Specification.find_all_by_name(name, version).empty? ohai "Installing or updating '#{name}' gem" - install_args = %W[--no-ri --no-rdoc --user-install #{name}] + install_args = %W[--no-ri --no-rdoc #{name}] install_args << "--version" << version if version # Do `gem install [...]` without having to spawn a separate process or
true
Other
Homebrew
brew
6fe70190204807a893419e5c510cb3e961e35c35.json
Make `HOMEBREW_PREFIX/Caskroom` the default.
Library/Homebrew/cask/lib/hbc.rb
@@ -49,6 +49,7 @@ def self.init Hbc::Cache.ensure_cache_exists Hbc::Cache.migrate_legacy_cache + Hbc::Caskroom.migrate_caskroom_from_repo_to_prefix Hbc::Caskroom.ensure_caskroom_exists end
true
Other
Homebrew
brew
6fe70190204807a893419e5c510cb3e961e35c35.json
Make `HOMEBREW_PREFIX/Caskroom` the default.
Library/Homebrew/cask/lib/hbc/caskroom.rb
@@ -1,6 +1,14 @@ module Hbc::Caskroom module_function + def migrate_caskroom_from_repo_to_prefix + repo_caskroom = Hbc.homebrew_repository.join("Caskroom") + if !Hbc.caskroom.exist? && repo_caskroom.directory? + ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX" + FileUtils.mv repo_caskroom, Hbc.caskroom + end + end + def ensure_caskroom_exists unless Hbc.caskroom.exist? ohai "Creating Caskroom at #{Hbc.caskroom}"
true
Other
Homebrew
brew
6fe70190204807a893419e5c510cb3e961e35c35.json
Make `HOMEBREW_PREFIX/Caskroom` the default.
Library/Homebrew/cask/lib/hbc/cli/list.rb
@@ -79,4 +79,8 @@ def self.format_versioned(cask) def self.help "with no args, lists installed Casks; given installed Casks, lists staged files" end + + def self.needs_init? + true + end end
true
Other
Homebrew
brew
6fe70190204807a893419e5c510cb3e961e35c35.json
Make `HOMEBREW_PREFIX/Caskroom` the default.
Library/Homebrew/cask/lib/hbc/locations.rb
@@ -9,7 +9,7 @@ def legacy_caskroom end def default_caskroom - @default_caskroom ||= homebrew_repository.join("Caskroom") + @default_caskroom ||= homebrew_prefix.join("Caskroom") end def caskroom
true
Other
Homebrew
brew
3ffb9a2f7cda6652f75cb0c59c6d079ab1039e94.json
Fix another `brew style` from #971.
Library/Homebrew/formulary.rb
@@ -190,7 +190,7 @@ def initialize(name) super name, Formulary.core_path(name) end - def get_formula(_spec, alias_path: nil) + def get_formula(*) raise FormulaUnavailableError, name end end
false
Other
Homebrew
brew
13f08a2bd4ff3aec13423fa5bb62b6ef08ffa0c4.json
update-report: add missing comma.
Library/Homebrew/cmd/update-report.rb
@@ -236,7 +236,7 @@ def migrate_legacy_repository_if_necessary end unremovable_paths = [] - extra_remove_paths = [".git", "Library/Locks", "Library/Taps", "Caskroom" + extra_remove_paths = [".git", "Library/Locks", "Library/Taps", "Caskroom", "Library/Homebrew/cask", "Library/Homebrew/test"] (repo_files + extra_remove_paths).each do |file| path = Pathname.new "#{HOMEBREW_REPOSITORY}/#{file}"
false
Other
Homebrew
brew
8a4f26f9522522ea938e79cb9e4651968f50045f.json
test-bot: run `brew style`.
Library/Homebrew/dev-cmd/test-bot.rb
@@ -719,6 +719,7 @@ def homebrew test "brew", "update-test", "--commit=HEAD" end + test "brew", "style" test "brew", "readall", "--syntax" coverage_args = [] @@ -741,6 +742,9 @@ def homebrew test "brew", "cask-tests", *coverage_args end elsif @tap + if @tap.name == "homebrew/core" + test "brew", "style", @tap.name + end test "brew", "readall", "--aliases", @tap.name end end
false
Other
Homebrew
brew
e79f62b2ead91decb3a255167d6a87020a0ad7ab.json
style: allow passing taps as arguments.
Library/Homebrew/cmd/style.rb
@@ -1,10 +1,6 @@ -#: * `style` [`--fix`] [`--display-cop-names`] [<formulae>|<files>]: +#: * `style` [`--fix`] [`--display-cop-names`] [<files>|<taps>|<formulae>]: #: Check formulae or files for conformance to Homebrew style guidelines. #: -#: <formulae> is a list of formula names. -#: -#: <files> is a list of file names. -#: #: <formulae> and <files> may not be combined. If both are omitted, style will run #: style checks on the whole Homebrew `Library`, including core code and all #: formulae. @@ -26,6 +22,8 @@ def style [HOMEBREW_LIBRARY] elsif ARGV.named.any? { |file| File.exist? file } ARGV.named + elsif ARGV.named.any? { |tap| tap.count("/") == 1 } + ARGV.named.map { |tap| Tap.fetch(tap).path } else ARGV.formulae.map(&:path) end
false
Other
Homebrew
brew
515f7b52553b7f5f10904f2b3972260ae223c6e8.json
Unify .rubocopy.yml files.
Library/.rubocop.yml
@@ -1,134 +1,10 @@ -inherit_from: .rubocop_todo.yml +inherit_from: + - .rubocop_rules.yml + - .rubocop_todo.yml AllCops: TargetRubyVersion: 2.0 Exclude: - 'Homebrew/cask/**/*' - 'Homebrew/vendor/**/*' - 'Homebrew/test/vendor/**/*' - -# ruby style guide favorite -Style/StringLiterals: - EnforcedStyle: double_quotes - -# consistency with above -Style/StringLiteralsInInterpolation: - EnforcedStyle: double_quotes - -# percent-x is allowed for multiline -Style/CommandLiteral: - EnforcedStyle: mixed - -# paths abound, easy escape -Style/RegexpLiteral: - EnforcedStyle: slashes - -# too prevalent to change this now, but might be discussed/changed later -Style/Alias: - EnforcedStyle: prefer_alias_method - -# our current conditional style is established, clear and -# requiring users to change that now would be confusing. -Style/ConditionalAssignment: - Enabled: false - -# no metrics for formulas -Metrics/AbcSize: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false - -# we often need very long lines -Metrics/LineLength: - Enabled: false - -# formulas have no mandatory doc -Style/Documentation: - Enabled: false - -# favor parens-less DSL-style arguments -Lint/AmbiguousOperator: - Enabled: false -Lint/AmbiguousRegexpLiteral: - Enabled: false -Lint/AssignmentInCondition: - Enabled: false -Lint/ParenthesesAsGroupedExpression: - Enabled: false - -# compact style -Style/EmptyLineBetweenDefs: - AllowAdjacentOneLineDefs: true - -# port numbers and such tech stuff -Style/NumericLiterals: - Enabled: false - -# zero-prefixed octal literals are just too widely used (and mostly understood) -Style/NumericLiteralPrefix: - EnforcedOctalStyle: zero_only - -# consistency and readability when faced with string interpolation -Style/PercentLiteralDelimiters: - PreferredDelimiters: - '%': '()' - '%i': '()' - '%q': '()' - '%Q': '()' - '%r': '{}' - '%s': '()' - '%w': '[]' - '%W': '[]' - '%x': '()' - -# conflicts with DSL-style path concatenation with `/` -Style/SpaceAroundOperators: - Enabled: false - -# not a problem for typical shell users -Style/SpecialGlobalVars: - Enabled: false - -# `system` is a special case and aligns on second argument -Style/AlignParameters: - Enabled: false - -# counterproductive in formulas, notably within the install method -Style/GuardClause: - Enabled: false -Style/IfUnlessModifier: - Enabled: false - -# dashes in filenames are typical -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1545 -Style/FileName: - Enabled: false - -# no percent word array, being friendly to non-ruby users -# TODO: enforce when rubocop has fixed this -# https://github.com/bbatsov/rubocop/issues/1543 -Style/WordArray: - Enabled: false -Style/UnneededCapitalW: - Enabled: false - -# we prefer compact if-else-end/case-when-end alignment -Lint/EndAlignment: - AlignWith: variable -Style/CaseIndentation: - IndentWhenRelativeTo: end - -# we prefer Perl-style regex back references -Style/PerlBackrefs: - Enabled: false - -# makes diffs nicer -Style/TrailingCommaInLiteral: - EnforcedStyleForMultiline: comma
true
Other
Homebrew
brew
515f7b52553b7f5f10904f2b3972260ae223c6e8.json
Unify .rubocopy.yml files.
Library/.rubocop_rules.yml
@@ -0,0 +1,141 @@ + +# ruby style guide favorite +Style/StringLiterals: + EnforcedStyle: double_quotes + +# consistency with above +Style/StringLiteralsInInterpolation: + EnforcedStyle: double_quotes + +# percent-x is allowed for multiline +Style/CommandLiteral: + EnforcedStyle: mixed + +# paths abound, easy escape +Style/RegexpLiteral: + EnforcedStyle: slashes + +# too prevalent to change this now, but might be discussed/changed later +Style/Alias: + EnforcedStyle: prefer_alias_method + +# our current conditional style is established, clear and +# requiring users to change that now would be confusing. +Style/ConditionalAssignment: + Enabled: false + +# no metrics for formulas +Metrics/AbcSize: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false + +# we often need very long lines +Metrics/LineLength: + Enabled: false + +# formulas have no mandatory doc +Style/Documentation: + Enabled: false + +# favor parens-less DSL-style arguments +Lint/AmbiguousOperator: + Enabled: false +Lint/AmbiguousRegexpLiteral: + Enabled: false +Lint/AssignmentInCondition: + Enabled: false +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +# compact style +Style/EmptyLineBetweenDefs: + AllowAdjacentOneLineDefs: true + +# port numbers and such tech stuff +Style/NumericLiterals: + Enabled: false + +# zero-prefixed octal literals are just too widely used (and mostly understood) +Style/NumericLiteralPrefix: + EnforcedOctalStyle: zero_only + +# consistency and readability when faced with string interpolation +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%': '()' + '%i': '()' + '%q': '()' + '%Q': '()' + '%r': '{}' + '%s': '()' + '%w': '[]' + '%W': '[]' + '%x': '()' + +# conflicts with DSL-style path concatenation with `/` +Style/SpaceAroundOperators: + Enabled: false + +# not a problem for typical shell users +Style/SpecialGlobalVars: + Enabled: false + +# `system` is a special case and aligns on second argument +Style/AlignParameters: + Enabled: false + +# counterproductive in formulas, notably within the install method +Style/GuardClause: + Enabled: false +Style/IfUnlessModifier: + Enabled: false + +# dashes in filenames are typical +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1545 +Style/FileName: + Enabled: false + +# no percent word array, being friendly to non-ruby users +# TODO: enforce when rubocop has fixed this +# https://github.com/bbatsov/rubocop/issues/1543 +Style/WordArray: + Enabled: false +Style/UnneededCapitalW: + Enabled: false + +# we prefer compact if-else-end/case-when-end alignment +Lint/EndAlignment: + AlignWith: variable +Style/CaseIndentation: + IndentWhenRelativeTo: end + +# we prefer Perl-style regex back references +Style/PerlBackrefs: + Enabled: false + +# makes diffs nicer +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma + +# we won't change backward compatible method names +Style/MethodName: + Exclude: + - 'Homebrew/compat/**/*' + +# we won't change backward compatible predicate names +Style/PredicateName: + Exclude: + - 'Homebrew/compat/**/*' + +# `formula do` uses nested method definitions +Lint/NestedMethodDefinition: + Exclude: + - 'Homebrew/test/**/*'
true
Other
Homebrew
brew
515f7b52553b7f5f10904f2b3972260ae223c6e8.json
Unify .rubocopy.yml files.
Library/.rubocop_todo.yml
@@ -1,6 +1,6 @@ # This configuration was generated by -# `rubocop --auto-gen-config` -# on 2016-09-17 15:44:31 +0100 using RuboCop version 0.42.0. +# `rubocop --auto-gen-config --exclude-limit 30` +# on 2016-09-18 15:15:22 +0100 using RuboCop version 0.41.2. # 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 @@ -48,6 +48,7 @@ Lint/Loop: # Offense count: 6 Lint/NestedMethodDefinition: Exclude: + - 'Homebrew/test/**/*' - 'Homebrew/dev-cmd/bottle.rb' - 'Homebrew/dev-cmd/test-bot.rb' @@ -58,7 +59,23 @@ Lint/NonLocalExitFromIterator: # Offense count: 28 Lint/RescueException: - Enabled: false + Exclude: + - 'Homebrew/brew.rb' + - 'Homebrew/build.rb' + - 'Homebrew/cmd/fetch.rb' + - 'Homebrew/cmd/reinstall.rb' + - 'Homebrew/cmd/update-report.rb' + - 'Homebrew/debrew.rb' + - 'Homebrew/dev-cmd/pull.rb' + - 'Homebrew/dev-cmd/test.rb' + - 'Homebrew/formula.rb' + - 'Homebrew/formula_installer.rb' + - 'Homebrew/migrator.rb' + - 'Homebrew/postinstall.rb' + - 'Homebrew/readall.rb' + - 'Homebrew/test.rb' + - 'Homebrew/test/test_ENV.rb' + - 'Homebrew/utils/fork.rb' # Offense count: 1 Lint/ShadowedException: @@ -77,7 +94,7 @@ Metrics/BlockNesting: # Offense count: 20 # Configuration parameters: CountComments. Metrics/ModuleLength: - Max: 369 + Max: 400 # Offense count: 1 # Configuration parameters: CountKeywordArgs. @@ -110,7 +127,23 @@ Style/Alias: # Offense count: 26 Style/CaseEquality: - Enabled: false + Exclude: + - 'Homebrew/cleanup.rb' + - 'Homebrew/cmd/search.rb' + - 'Homebrew/compilers.rb' + - 'Homebrew/cxxstdlib.rb' + - 'Homebrew/debrew.rb' + - 'Homebrew/dependencies.rb' + - 'Homebrew/dependency_collector.rb' + - 'Homebrew/download_strategy.rb' + - 'Homebrew/formula.rb' + - 'Homebrew/options.rb' + - 'Homebrew/patch.rb' + - 'Homebrew/pkg_version.rb' + - 'Homebrew/requirement.rb' + - 'Homebrew/requirements.rb' + - 'Homebrew/software_spec.rb' + - 'Homebrew/version.rb' # Offense count: 1 # Cop supports --auto-correct. @@ -170,6 +203,7 @@ Style/IdenticalConditionalBranches: # SupportedStyles: snake_case, camelCase Style/MethodName: Exclude: + - 'Homebrew/compat/**/*' - 'Homebrew/cleanup.rb' - 'Homebrew/diagnostic.rb' - 'Homebrew/formula_cellar_checks.rb' @@ -230,7 +264,7 @@ Style/OpMethod: # NameWhitelist: is_a? Style/PredicateName: Exclude: - - 'spec/**/*' + - 'Homebrew/compat/**/*' - 'Homebrew/download_strategy.rb' - 'Homebrew/hardware.rb'
true
Other
Homebrew
brew
515f7b52553b7f5f10904f2b3972260ae223c6e8.json
Unify .rubocopy.yml files.
Library/Homebrew/compat/.rubocop.yml
@@ -1,7 +0,0 @@ -inherit_from: ../../.rubocop.yml - -# We won't change method or predicate names because of backward compatibility. -Style/MethodName: - Enabled: false -Style/PredicateName: - Enabled: false
true
Other
Homebrew
brew
515f7b52553b7f5f10904f2b3972260ae223c6e8.json
Unify .rubocopy.yml files.
Library/Homebrew/test/.rubocop.yml
@@ -1,5 +0,0 @@ -inherit_from: ../../.rubocop.yml - -# `formula do` uses nested method definitions -Lint/NestedMethodDefinition: - Enabled: false
true
Other
Homebrew
brew
d89a696d83cd325656e30a99cb4ba8342ffb39c9.json
Remove unused variable This will make brew readall --syntax pass
Library/Homebrew/test/test_formula.rb
@@ -126,7 +126,6 @@ def test_installed_alias_with_core def test_installed_alias_with_tap tap = Tap.new("user", "repo") name = "foo" - full_name = "#{tap.user}/#{tap.repo}/#{name}" path = "#{tap.path}/Formula/#{name}.rb" f = formula(name, path) { url "foo-1.0" }
false
Other
Homebrew
brew
4abd48812bb544426442749266acb13a20ce434c.json
alias tracking: add formula tests
Library/Homebrew/test/test_formula.rb
@@ -8,15 +8,154 @@ def test_formula_instantiation name = "formula_name" path = Formulary.core_path(name) spec = :stable - alias_path = CoreTap.instance.alias_dir/"formula_alias" + + f = klass.new(name, path, spec) + assert_equal name, f.name + assert_equal name, f.specified_name + assert_equal name, f.full_name + assert_equal name, f.full_specified_name + assert_equal path, f.path + assert_nil f.alias_path + assert_nil f.alias_name + assert_nil f.full_alias_name + assert_raises(ArgumentError) { klass.new } + end + + def test_formula_instantiation_with_alias + klass = Class.new(Formula) { url "http://example.com/foo-1.0.tar.gz" } + name = "formula_name" + path = Formulary.core_path(name) + spec = :stable + alias_name = "baz@1" + alias_path = CoreTap.instance.alias_dir/alias_name f = klass.new(name, path, spec, alias_path: alias_path) assert_equal name, f.name + assert_equal name, f.full_name assert_equal path, f.path assert_equal alias_path, f.alias_path + assert_equal alias_name, f.alias_name + assert_equal alias_name, f.specified_name + assert_equal alias_name, f.full_alias_name + assert_equal alias_name, f.full_specified_name + assert_raises(ArgumentError) { klass.new } + end + + def test_tap_formula_instantiation + tap = Tap.new("foo", "bar") + klass = Class.new(Formula) { url "baz-1.0" } + name = "baz" + full_name = "#{tap.user}/#{tap.repo}/#{name}" + path = tap.path/"Formula/#{name}.rb" + spec = :stable + + f = klass.new(name, path, spec) + assert_equal name, f.name + assert_equal name, f.specified_name + assert_equal full_name, f.full_name + assert_equal full_name, f.full_specified_name + assert_equal path, f.path + assert_nil f.alias_path + assert_nil f.alias_name + assert_nil f.full_alias_name assert_raises(ArgumentError) { klass.new } end + def test_tap_formula_instantiation_with_alias + tap = Tap.new("foo", "bar") + klass = Class.new(Formula) { url "baz-1.0" } + name = "baz" + full_name = "#{tap.user}/#{tap.repo}/#{name}" + path = tap.path/"Formula/#{name}.rb" + spec = :stable + alias_name = "baz@1" + full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}" + alias_path = CoreTap.instance.alias_dir/alias_name + + f = klass.new(name, path, spec, alias_path: alias_path) + assert_equal name, f.name + assert_equal full_name, f.full_name + assert_equal path, f.path + assert_equal alias_path, f.alias_path + assert_equal alias_name, f.alias_name + assert_equal alias_name, f.specified_name + assert_equal full_alias_name, f.full_alias_name + assert_equal full_alias_name, f.full_specified_name + assert_raises(ArgumentError) { klass.new } + end + + def test_follow_installed_alias + f = formula { url "foo-1.0" } + assert_predicate f, :follow_installed_alias? + + f.follow_installed_alias = true + assert_predicate f, :follow_installed_alias? + + f.follow_installed_alias = false + refute_predicate f, :follow_installed_alias? + end + + def test_installed_alias_with_core + f = formula { url "foo-1.0" } + + build_values_with_no_installed_alias = [ + nil, + BuildOptions.new({}, {}), + Tab.new(source: { "path" => f.path.to_s }), + ] + + build_values_with_no_installed_alias.each do |build| + f.build = build + assert_nil f.installed_alias_path + assert_nil f.installed_alias_name + assert_nil f.full_installed_alias_name + assert_equal f.name, f.installed_specified_name + assert_equal f.name, f.full_installed_specified_name + end + + alias_name = "bar" + alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}" + f.build = Tab.new(source: { "path" => alias_path }) + assert_equal alias_path, f.installed_alias_path + assert_equal alias_name, f.installed_alias_name + assert_equal alias_name, f.full_installed_alias_name + assert_equal alias_name, f.installed_specified_name + assert_equal alias_name, f.full_installed_specified_name + end + + def test_installed_alias_with_tap + tap = Tap.new("user", "repo") + name = "foo" + full_name = "#{tap.user}/#{tap.repo}/#{name}" + path = "#{tap.path}/Formula/#{name}.rb" + f = formula(name, path) { url "foo-1.0" } + + build_values_with_no_installed_alias = [ + nil, + BuildOptions.new({}, {}), + Tab.new(source: { "path" => f.path }), + ] + + build_values_with_no_installed_alias.each do |build| + f.build = build + assert_nil f.installed_alias_path + assert_nil f.installed_alias_name + assert_nil f.full_installed_alias_name + assert_equal f.name, f.installed_specified_name + assert_equal f.full_name, f.full_installed_specified_name + end + + alias_name = "bar" + full_alias_name = "#{tap.user}/#{tap.repo}/#{alias_name}" + alias_path = "#{tap.alias_dir}/#{alias_name}" + f.build = Tab.new(source: { "path" => alias_path }) + assert_equal alias_path, f.installed_alias_path + assert_equal alias_name, f.installed_alias_name + assert_equal full_alias_name, f.full_installed_alias_name + assert_equal alias_name, f.installed_specified_name + assert_equal full_alias_name, f.full_installed_specified_name + end + def test_prefix f = Testball.new assert_equal HOMEBREW_CELLAR/f.name/"0.1", f.prefix @@ -274,6 +413,36 @@ def test_alias_paths_with_tab_with_alias_source_path assert_equal source_path.to_s, f.installed_alias_path end + def test_installed_with_alias_path_with_nil + assert_predicate Formula.installed_with_alias_path(nil), :empty? + end + + def test_installed_with_alias_path_with_a_path + alias_path = "#{CoreTap.instance.alias_dir}/alias" + different_alias_path = "#{CoreTap.instance.alias_dir}/another_alias" + + formula_with_alias = formula("foo") { url "foo-1.0" } + formula_with_alias.build = Tab.empty + formula_with_alias.build.source["path"] = alias_path + + formula_without_alias = formula("bar") { url "bar-1.0" } + formula_without_alias.build = Tab.empty + formula_without_alias.build.source["path"] = formula_without_alias.path.to_s + + formula_with_different_alias = formula("baz") { url "baz-1.0" } + formula_with_different_alias.build = Tab.empty + formula_with_different_alias.build.source["path"] = different_alias_path + + formulae = [ + formula_with_alias, + formula_without_alias, + formula_with_different_alias, + ] + + Formula.stubs(:installed).returns(formulae) + assert_equal [formula_with_alias], Formula.installed_with_alias_path(alias_path) + end + def test_formula_spec_integration f = formula do homepage "http://example.com" @@ -607,29 +776,111 @@ def test_pour_bottle_dsl end end +class AliasChangeTests < Homebrew::TestCase + attr_reader :f, :new_formula, :tab, :alias_path + + def make_formula(version) + f = formula(alias_path: alias_path) { url "foo-#{version}" } + f.build = tab + f + end + + def setup + alias_name = "bar" + @alias_path = "#{CoreTap.instance.alias_dir}/#{alias_name}" + + @tab = Tab.empty + + @f = make_formula("1.0") + @new_formula = make_formula("1.1") + + Formula.stubs(:installed).returns([f]) + end + + def test_alias_changes_when_not_installed_with_alias + tab.source["path"] = Formulary.core_path(f.name).to_s + + assert_nil f.current_installed_alias_target + assert_equal f, f.latest_formula + refute_predicate f, :installed_alias_target_changed? + refute_predicate f, :supersedes_an_installed_formula? + refute_predicate f, :alias_changed? + assert_predicate f.old_installed_formulae, :empty? + end + + def test_alias_changes_when_not_changed + tab.source["path"] = alias_path + stub_formula_loader(f, alias_path) + + assert_equal f, f.current_installed_alias_target + assert_equal f, f.latest_formula + refute_predicate f, :installed_alias_target_changed? + refute_predicate f, :supersedes_an_installed_formula? + refute_predicate f, :alias_changed? + assert_predicate f.old_installed_formulae, :empty? + end + + def test_alias_changes_when_new_alias_target + tab.source["path"] = alias_path + stub_formula_loader(new_formula, alias_path) + + assert_equal new_formula, f.current_installed_alias_target + assert_equal new_formula, f.latest_formula + assert_predicate f, :installed_alias_target_changed? + refute_predicate f, :supersedes_an_installed_formula? + assert_predicate f, :alias_changed? + assert_predicate f.old_installed_formulae, :empty? + end + + def test_alias_changes_when_old_formulae_installed + tab.source["path"] = alias_path + stub_formula_loader(new_formula, alias_path) + + assert_equal new_formula, new_formula.current_installed_alias_target + assert_equal new_formula, new_formula.latest_formula + refute_predicate new_formula, :installed_alias_target_changed? + assert_predicate new_formula, :supersedes_an_installed_formula? + assert_predicate new_formula, :alias_changed? + assert_equal [f], new_formula.old_installed_formulae + end +end + class OutdatedVersionsTests < Homebrew::TestCase - attr_reader :outdated_prefix, :same_prefix, :greater_prefix, :head_prefix - attr_reader :f + attr_reader :outdated_prefix, + :same_prefix, + :greater_prefix, + :head_prefix, + :old_alias_target_prefix + attr_reader :f, :old_formula def setup @f = formula do url "foo" version "1.20" end + + @old_formula = formula("foo@1") { url "foo-1.0" } + @outdated_prefix = HOMEBREW_CELLAR/"#{f.name}/1.11" @same_prefix = HOMEBREW_CELLAR/"#{f.name}/1.20" @greater_prefix = HOMEBREW_CELLAR/"#{f.name}/1.21" @head_prefix = HOMEBREW_CELLAR/"#{f.name}/HEAD" + @old_alias_target_prefix = HOMEBREW_CELLAR/"#{old_formula.name}/1.0" end def teardown - @f.rack.rmtree if @f.rack.exist? + [@f.rack, @old_formula.rack].select(&:exist?).each(&:rmtree) + end + + def alias_path + "#{@f.tap.alias_dir}/bar" end def setup_tab_for_prefix(prefix, options = {}) prefix.mkpath tab = Tab.empty tab.tabfile = prefix.join("INSTALL_RECEIPT.json") + tab.source["path"] = options[:path].to_s if options[:path] tab.source["tap"] = options[:tap] if options[:tap] tab.source["versions"] = options[:versions] if options[:versions] tab.source_modified_time = options[:source_modified_time].to_i @@ -663,6 +914,50 @@ def test_outdated_same_tap_installed refute_predicate f.outdated_kegs, :empty? end + def test_outdated_follow_alias_and_alias_unchanged + f.follow_installed_alias = true + f.build = setup_tab_for_prefix(same_prefix, path: alias_path) + stub_formula_loader(f, alias_path) + assert_predicate f.outdated_kegs, :empty? + end + + def test_outdated_follow_alias_and_alias_changed + f.follow_installed_alias = true + f.build = setup_tab_for_prefix(same_prefix, path: alias_path) + stub_formula_loader(formula("foo@2") { url "foo-2.0" }, alias_path) + refute_predicate f.outdated_kegs, :empty? + end + + def test_outdated_no_follow_alias_and_alias_unchanged + f.follow_installed_alias = false + f.build = setup_tab_for_prefix(same_prefix, path: alias_path) + stub_formula_loader(f, alias_path) + assert_predicate f.outdated_kegs, :empty? + end + + def test_outdated_no_follow_alias_and_alias_changed + f.follow_installed_alias = false + f.build = setup_tab_for_prefix(same_prefix, path: alias_path) + stub_formula_loader(formula("foo@2") { url "foo-2.0" }, alias_path) + assert_predicate f.outdated_kegs, :empty? + end + + def test_outdated_old_alias_targets_installed + @f = formula(alias_path: alias_path) { url "foo-1.0" } + tab = setup_tab_for_prefix(old_alias_target_prefix, path: alias_path) + old_formula.build = tab + Formula.stubs(:installed).returns([old_formula]) + refute_predicate f.outdated_kegs, :empty? + end + + def test_outdated_old_alias_targets_not_installed + @f = formula(alias_path: alias_path) { url "foo-1.0" } + tab = setup_tab_for_prefix(old_alias_target_prefix, path: old_formula.path) + old_formula.build = tab + Formula.stubs(:installed).returns([old_formula]) + assert_predicate f.outdated_kegs, :empty? + end + def test_outdated_same_head_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(head_prefix, tap: "homebrew/core")
true
Other
Homebrew
brew
4abd48812bb544426442749266acb13a20ce434c.json
alias tracking: add formula tests
Library/Homebrew/test/testing_env.rb
@@ -121,5 +121,13 @@ def with_environment(partial_env) ENV.replace old end end + + # Use a stubbed {Formulary::FormulaLoader} to make a given formula be found + # when loading from {Formulary} with `ref`. + def stub_formula_loader(formula, ref = formula.name) + loader = mock + loader.stubs(:get_formula).returns(formula) + Formulary.stubs(:loader_for).with(ref).returns(loader) + end end end
true
Other
Homebrew
brew
e12c23faa87aa9c6f493dcd4aa47d1124c41a418.json
Formula#old_installed_formula?: fix some bugs Previously, this method would: - Include the current formula - Include the current target of the installed alias, which by definition is not "old" This commit fixes both of these issues. Only formulae that are the current target of the alias they were installed with are now considered to have old installed formulae.
Library/Homebrew/formula.rb
@@ -1186,7 +1186,11 @@ def latest_formula end def old_installed_formulae - alias_path ? self.class.installed_with_alias_path(alias_path) : [] + # If this formula isn't the current target of the alias, + # it doesn't make sense to say that other formulae are older versions of it + # because we don't know which came first. + return [] if alias_path.nil? || installed_alias_target_changed? + self.class.installed_with_alias_path(alias_path) - [self] end # @private
false
Other
Homebrew
brew
d0204207edd6a8044b8bd1f01df1b3637dab5475.json
update-report: remove cask dir after migration. This will hang around otherwise due to e.g. running `bundle install` in here once.
Library/Homebrew/cmd/update-report.rb
@@ -234,7 +234,7 @@ def migrate_legacy_repository_if_necessary unremovable_paths = [] extra_remove_paths = [".git", "Library/Locks", "Library/Taps", - "Library/Homebrew/test"] + "Library/Homebrew/cask", "Library/Homebrew/test"] (repo_files + extra_remove_paths).each do |file| path = Pathname.new "#{HOMEBREW_REPOSITORY}/#{file}" begin
false
Other
Homebrew
brew
7b85934f502cd6adf4696cf63cd3cd0c4449d40f.json
Update formula tests for #outdated_kegs
Library/Homebrew/test/test_formula.rb
@@ -637,55 +637,55 @@ def setup_tab_for_prefix(prefix, options = {}) tab end - def reset_outdated_versions - f.instance_variable_set(:@outdated_versions, nil) + def reset_outdated_kegs + f.instance_variable_set(:@outdated_kegs, nil) end def test_greater_different_tap_installed setup_tab_for_prefix(greater_prefix, tap: "user/repo") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_greater_same_tap_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(greater_prefix, tap: "homebrew/core") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_outdated_different_tap_installed setup_tab_for_prefix(outdated_prefix, tap: "user/repo") - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? end def test_outdated_same_tap_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core") - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? end def test_same_head_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(head_prefix, tap: "homebrew/core") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_different_head_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(head_prefix, tap: "user/repo") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_mixed_taps_greater_version_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(outdated_prefix, tap: "homebrew/core") setup_tab_for_prefix(greater_prefix, tap: "user/repo") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? setup_tab_for_prefix(greater_prefix, tap: "homebrew/core") - reset_outdated_versions + reset_outdated_kegs - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_mixed_taps_outdated_version_installed @@ -695,38 +695,38 @@ def test_mixed_taps_outdated_version_installed setup_tab_for_prefix(outdated_prefix) setup_tab_for_prefix(extra_outdated_prefix, tap: "homebrew/core") - reset_outdated_versions + reset_outdated_kegs - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? setup_tab_for_prefix(outdated_prefix, tap: "user/repo") - reset_outdated_versions + reset_outdated_kegs - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? end def test_same_version_tap_installed f.instance_variable_set(:@tap, CoreTap.instance) setup_tab_for_prefix(same_prefix, tap: "homebrew/core") - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? setup_tab_for_prefix(same_prefix, tap: "user/repo") - reset_outdated_versions + reset_outdated_kegs - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_outdated_installed_head_less_than_stable tab = setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0" }) - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? # Tab.for_keg(head_prefix) will be fetched from CACHE but we write it anyway tab.source["versions"] = { "stable" => f.version.to_s } tab.write - reset_outdated_versions + reset_outdated_kegs - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? end def test_outdated_fetch_head @@ -764,20 +764,20 @@ def test_outdated_fetch_head end end - refute_predicate f.outdated_versions(fetch_head: true), :empty? + refute_predicate f.outdated_kegs(fetch_head: true), :empty? tab_a.source["versions"] = { "stable" => f.version.to_s } tab_a.write - reset_outdated_versions - refute_predicate f.outdated_versions(fetch_head: true), :empty? + reset_outdated_kegs + refute_predicate f.outdated_kegs(fetch_head: true), :empty? head_prefix_a.rmtree - reset_outdated_versions - refute_predicate f.outdated_versions(fetch_head: true), :empty? + reset_outdated_kegs + refute_predicate f.outdated_kegs(fetch_head: true), :empty? setup_tab_for_prefix(head_prefix_c, source_modified_time: 1) - reset_outdated_versions - assert_predicate f.outdated_versions(fetch_head: true), :empty? + reset_outdated_kegs + assert_predicate f.outdated_kegs(fetch_head: true), :empty? ensure ENV.replace(initial_env) testball_repo.rmtree if testball_repo.exist? @@ -788,7 +788,7 @@ def test_outdated_fetch_head FileUtils.rm_rf HOMEBREW_CELLAR/"testball" end - def test_outdated_versions_version_scheme_changed + def test_outdated_kegs_version_scheme_changed @f = formula("testball") do url "foo" version "20141010" @@ -798,12 +798,12 @@ def test_outdated_versions_version_scheme_changed prefix = HOMEBREW_CELLAR.join("testball/0.1") setup_tab_for_prefix(prefix, versions: { "stable" => "0.1" }) - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? ensure prefix.rmtree end - def test_outdated_versions_mixed_version_schemes + def test_outdated_kegs_mixed_version_schemes @f = formula("testball") do url "foo" version "20141010" @@ -816,23 +816,23 @@ def test_outdated_versions_mixed_version_schemes prefix_b = HOMEBREW_CELLAR.join("testball/2.14") setup_tab_for_prefix(prefix_b, versions: { "stable" => "2.14", "version_scheme" => 2 }) - refute_predicate f.outdated_versions, :empty? - reset_outdated_versions + refute_predicate f.outdated_kegs, :empty? + reset_outdated_kegs prefix_c = HOMEBREW_CELLAR.join("testball/20141009") setup_tab_for_prefix(prefix_c, versions: { "stable" => "20141009", "version_scheme" => 3 }) - refute_predicate f.outdated_versions, :empty? - reset_outdated_versions + refute_predicate f.outdated_kegs, :empty? + reset_outdated_kegs prefix_d = HOMEBREW_CELLAR.join("testball/20141011") setup_tab_for_prefix(prefix_d, versions: { "stable" => "20141009", "version_scheme" => 3 }) - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? ensure f.rack.rmtree end - def test_outdated_versions_head_with_version_scheme + def test_outdated_kegs_head_with_version_scheme @f = formula("testball") do url "foo" version "1.0" @@ -842,13 +842,13 @@ def test_outdated_versions_head_with_version_scheme head_prefix = HOMEBREW_CELLAR.join("testball/HEAD") setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 1 }) - refute_predicate f.outdated_versions, :empty? + refute_predicate f.outdated_kegs, :empty? - reset_outdated_versions + reset_outdated_kegs head_prefix.rmtree setup_tab_for_prefix(head_prefix, versions: { "stable" => "1.0", "version_scheme" => 2 }) - assert_predicate f.outdated_versions, :empty? + assert_predicate f.outdated_kegs, :empty? ensure head_prefix.rmtree end
false
Other
Homebrew
brew
d3788c58efbae7c841faeb89a3eea539862245f7.json
brew outdated: use full name in verbose
Library/Homebrew/cmd/outdated.rb
@@ -56,9 +56,11 @@ def print_outdated(formulae) end outdated_versions = outdated_kegs. - group_by(&:name). - sort_by(&:first). - map { |name, kegs| "#{name} (#{kegs.map(&:version) * ", "})" } * ", " + group_by { |keg| Formulary.from_keg(keg) }. + sort_by { |formula, kegs| formula.full_name }. + map do |formula, kegs| + "#{formula.full_name} (#{kegs.map(&:version) * ", "})" + end * ", " puts "#{outdated_versions} < #{current_version}" else
false
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/cmd/outdated.rb
@@ -43,15 +43,26 @@ def print_outdated(formulae) outdated_formulae.each do |f| if verbose - outdated_versions = f.outdated_versions(fetch_head: fetch_head) - current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s } + outdated_kegs = f.outdated_kegs(fetch_head: fetch_head) + + current_version = if f.alias_changed? + latest = f.latest_formula + "#{latest.name} (#{latest.pkg_version})" + elsif f.head? && outdated_kegs.any? { |k| k.version.to_s == f.pkg_version.to_s } + # There is a newer HEAD but the version number has not changed. "latest HEAD" else f.pkg_version.to_s end - puts "#{f.full_name} (#{outdated_versions.join(", ")}) < #{current_version}" + + outdated_versions = outdated_kegs. + group_by(&:name). + sort_by(&:first). + map { |name, kegs| "#{name} (#{kegs.map(&:version) * ", "})" } * ", " + + puts "#{outdated_versions} < #{current_version}" else - puts f.full_name + puts f.full_installed_specified_name end end end @@ -62,7 +73,7 @@ def print_outdated_json(formulae) outdated_formulae = formulae.select { |f| f.outdated?(fetch_head: fetch_head) } outdated = outdated_formulae.each do |f| - outdated_versions = f.outdated_versions(fetch_head: fetch_head) + outdated_versions = f.outdated_kegs(fetch_head: fetch_head).map(&:version) current_version = if f.head? && outdated_versions.any? { |v| v.to_s == f.pkg_version.to_s } "HEAD" else
true
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/cmd/upgrade.rb
@@ -37,10 +37,10 @@ def upgrade (ARGV.resolved_formulae - outdated).each do |f| versions = f.installed_kegs.map(&:version) if versions.empty? - onoe "#{f.full_name} not installed" + onoe "#{f.full_specified_name} not installed" else version = versions.max - onoe "#{f.full_name} #{version} already installed" + onoe "#{f.full_specified_name} #{version} already installed" end end exit 1 if outdated.empty? @@ -51,19 +51,21 @@ def upgrade outdated -= pinned end - if outdated.empty? + formulae_to_install = outdated.map(&:latest_formula) + + if formulae_to_install.empty? oh1 "No packages to upgrade" else - oh1 "Upgrading #{outdated.length} outdated package#{plural(outdated.length)}, with result:" - puts outdated.map { |f| "#{f.full_name} #{f.pkg_version}" } * ", " + oh1 "Upgrading #{formulae_to_install.length} outdated package#{plural(formulae_to_install.length)}, with result:" + puts formulae_to_install.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end unless upgrade_pinned? || pinned.empty? oh1 "Not upgrading #{pinned.length} pinned package#{plural(pinned.length)}:" - puts pinned.map { |f| "#{f.full_name} #{f.pkg_version}" } * ", " + puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end - outdated.each do |f| + formulae_to_install.each do |f| upgrade_formula(f) next unless ARGV.include?("--cleanup") next unless f.installed? @@ -76,7 +78,11 @@ def upgrade_pinned? end def upgrade_formula(f) - outdated_keg = Keg.new(f.linked_keg.resolved_path) if f.linked_keg.directory? + formulae_maybe_with_kegs = [f] + f.old_installed_formulae + outdated_kegs = formulae_maybe_with_kegs. + map(&:linked_keg). + select(&:directory?). + map { |k| Keg.new(k.resolved_path) } fi = FormulaInstaller.new(f) fi.options = f.build.used_options @@ -87,12 +93,12 @@ def upgrade_formula(f) fi.debug = ARGV.debug? fi.prelude - oh1 "Upgrading #{f.full_name}" + oh1 "Upgrading #{f.full_specified_name}" # first we unlink the currently active keg for this formula otherwise it is # possible for the existing build to interfere with the build we are about to # do! Seriously, it happens! - outdated_keg.unlink if outdated_keg + outdated_kegs.each(&:unlink) fi.install fi.finish @@ -117,7 +123,7 @@ def upgrade_formula(f) ensure # restore previous installation state if build failed begin - outdated_keg.link if outdated_keg && !f.installed? + outdated_kegs.each(&:link) if !f.installed? rescue nil end
true
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/extend/ARGV.rb
@@ -37,11 +37,23 @@ def resolved_formulae f.version.update_commit(k.version.version.commit) if k.version.head? end end - f else rack = Formulary.to_rack(name) - Formulary.from_rack(rack, spec(nil)) + alias_path = Formulary.factory(name).alias_path + f = Formulary.from_rack(rack, spec(nil), alias_path: alias_path) end + + # If this formula was installed with an alias that has since changed, + # then it was specified explicitly in ARGV. (Using the alias would + # instead have found the new formula.) + # + # Because of this, the user is referring to this specific formula, + # not any formula targetted by the same alias, so in this context + # the formula shouldn't be considered outdated if the alias used to + # install it has changed. + f.follow_installed_alias = false + + f end end
true
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/formula.rb
@@ -60,16 +60,24 @@ class Formula # e.g. `this-formula` attr_reader :name - # The name that was used to identify this {Formula}. - # Could be the name of the {Formula}, or an alias. - # e.g. `another-name-for-this-formula` + # The path to the alias that was used to identify this {Formula}. + # e.g. `/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/another-name-for-this-formula` attr_reader :alias_path + # The name of the alias that was used to identify this {Formula}. + # e.g. `another-name-for-this-formula` + attr_reader :alias_name + # The fully-qualified name of this {Formula}. # For core formula it's the same as {#name}. # e.g. `homebrew/tap-name/this-formula` attr_reader :full_name + # The fully-qualified alias referring to this {Formula}. + # For core formula it's the same as {#alias_name}. + # e.g. `homebrew/tap-name/another-name-for-this-formula` + attr_reader :full_alias_name + # The full path to this {Formula}. # e.g. `/usr/local/Library/Taps/homebrew/homebrew-core/Formula/this-formula.rb` attr_reader :path @@ -149,25 +157,31 @@ class Formula # @return [BuildOptions] attr_accessor :build + # A {Boolean} indicating whether this formula should be considered outdated + # if the target of the alias it was installed with has since changed. + # Defaults to true. + # @return [Boolean] + attr_accessor :follow_installed_alias + alias follow_installed_alias? follow_installed_alias + # @private def initialize(name, path, spec, alias_path: nil) @name = name @path = path @alias_path = alias_path + @alias_name = File.basename(alias_path) if alias_path @revision = self.class.revision || 0 @version_scheme = self.class.version_scheme || 0 - if path == Formulary.core_path(name) - @tap = CoreTap.instance - @full_name = name + @tap = if path == Formulary.core_path(name) + CoreTap.instance elsif path.to_s =~ HOMEBREW_TAP_PATH_REGEX - @tap = Tap.fetch($1, $2) - @full_name = "#{@tap}/#{name}" - else - @tap = nil - @full_name = name + Tap.fetch($1, $2) end + @full_name = get_full_name(name) + @full_alias_name = get_full_name(@alias_name) + set_spec :stable set_spec :devel set_spec :head @@ -183,6 +197,7 @@ def initialize(name, path, spec, alias_path: nil) validate_attributes! @build = active_spec.build @pin = FormulaPin.new(self) + @follow_installed_alias = true end # @private @@ -197,6 +212,16 @@ def set_active_spec(spec_sym) private + # Allow full name logic to be re-used between names, aliases, + # and installed aliases. + def get_full_name(name) + if name.nil? || @tap.nil? || @tap.core_tap? + name + else + "#{@tap}/#{name}" + end + end + def set_spec(name) spec = self.class.send(name) if spec.url @@ -236,11 +261,39 @@ def installed_alias_path path if path =~ %r{#{HOMEBREW_TAP_DIR_REGEX}/Aliases} end + def installed_alias_name + File.basename(installed_alias_path) if installed_alias_path + end + + def full_installed_alias_name + get_full_name(installed_alias_name) + end + # The path that was specified to find this formula. def specified_path alias_path || path end + # The name specified to find this formula. + def specified_name + alias_name || name + end + + # The name (including tap) specified to find this formula. + def full_specified_name + full_alias_name || full_name + end + + # The name specified to install this formula. + def installed_specified_name + installed_alias_name || name + end + + # The name (including tap) specified to install this formula. + def full_installed_specified_name + full_installed_alias_name || full_name + end + # Is the currently active {SoftwareSpec} a {#stable} build? # @private def stable? @@ -1067,39 +1120,77 @@ def migration_needed? end # @private - def outdated_versions(options = {}) - @outdated_versions ||= Hash.new do |cache, key| + def outdated_kegs(options = {}) + @outdated_kegs ||= Hash.new do |cache, key| raise Migrator::MigrationNeededError, self if migration_needed? - cache[key] = _outdated_versions(key) + cache[key] = _outdated_kegs(key) end - @outdated_versions[options] + @outdated_kegs[options] end - def _outdated_versions(options = {}) - all_versions = [] + def _outdated_kegs(options = {}) + all_kegs = [] installed_kegs.each do |keg| + all_kegs << keg version = keg.version - all_versions << version next if version.head? tab = Tab.for_keg(keg) next if version_scheme > tab.version_scheme next if version_scheme == tab.version_scheme && pkg_version > version - return [] + next if follow_installed_alias? && installed_alias_target_changed? + + return [] # this keg is the current version of the formula, so it's not outdated end + # Even if this formula hasn't been installed, there may be installations + # of other formulae which used to be targets of the alias currently + # targetting this formula. These should be counted as outdated versions. + all_kegs.concat old_installed_formulae.flat_map(&:installed_kegs) + head_version = latest_head_version if head_version && !head_version_outdated?(head_version, options) [] else - all_versions.sort + all_kegs.sort_by(&:version) end end + def current_installed_alias_target + Formulary.factory(installed_alias_path) if installed_alias_path + end + + # Has the target of the alias used to install this formula changed? + # Returns false if the formula wasn't installed with an alias. + def installed_alias_target_changed? + ![self, nil].include?(current_installed_alias_target) + end + + # Is this formula the target of an alias used to install an old formula? + def supersedes_an_installed_formula? + old_installed_formulae.any? + end + + # Has the alias used to install the formula changed, or are different + # formulae already installed with this alias? + def alias_changed? + installed_alias_target_changed? || supersedes_an_installed_formula? + end + + # If the alias has changed value, return the new formula. + # Otherwise, return self. + def latest_formula + installed_alias_target_changed? ? current_installed_alias_target : self + end + + def old_installed_formulae + alias_path ? self.class.installed_with_alias_path(alias_path) : [] + end + # @private def outdated?(options = {}) - !outdated_versions(options).empty? + !outdated_kegs(options).empty? rescue Migrator::MigrationNeededError true end @@ -1254,6 +1345,11 @@ def self.installed end.compact end + def self.installed_with_alias_path(alias_path) + return [] if alias_path.nil? + installed.select { |f| f.installed_alias_path == alias_path } + end + # an array of all alias files of core {Formula} # @private def self.core_alias_files
true
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/formulary.rb
@@ -77,8 +77,11 @@ def initialize(name, path) end # Gets the formula instance. - def get_formula(spec) - klass.new(name, path, spec, alias_path: alias_path) + # + # `alias_path` can be overridden here in case an alias was used to refer to + # a formula that was loaded in another way. + def get_formula(spec, alias_path: nil) + klass.new(name, path, spec, alias_path: alias_path || self.alias_path) end def klass @@ -103,7 +106,7 @@ def initialize(bottle_name) super name, Formulary.path(full_name) end - def get_formula(spec) + def get_formula(spec, alias_path: nil) formula = super formula.local_bottle_path = @bottle_filename formula_version = formula.pkg_version @@ -120,7 +123,7 @@ def initialize(alias_path) path = alias_path.resolved_path name = path.basename(".rb").to_s super name, path - @alias_path = alias_path + @alias_path = alias_path.to_s end end @@ -175,7 +178,7 @@ def initialize(tapped_name) super name, path end - def get_formula(spec) + def get_formula(spec, alias_path: nil) super rescue FormulaUnavailableError => e raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace @@ -187,7 +190,7 @@ def initialize(name) super name, Formulary.core_path(name) end - def get_formula(_spec) + def get_formula(_spec, alias_path: nil) raise FormulaUnavailableError, name end end @@ -215,38 +218,42 @@ def klass # * a formula pathname # * a formula URL # * a local bottle reference - def self.factory(ref, spec = :stable) - loader_for(ref).get_formula(spec) + def self.factory(ref, spec = :stable, alias_path: nil) + loader_for(ref).get_formula(spec, alias_path: alias_path) end # Return a Formula instance for the given rack. # It will auto resolve formula's spec when requested spec is nil - def self.from_rack(rack, spec = nil) + # + # The :alias_path option will be used if the formula is found not to be + # installed, and discarded if it is installed because the alias_path used + # to install the formula will be set instead. + def self.from_rack(rack, spec = nil, alias_path: nil) kegs = rack.directory? ? rack.subdirs.map { |d| Keg.new(d) } : [] keg = kegs.detect(&:linked?) || kegs.detect(&:optlinked?) || kegs.max_by(&:version) if keg - from_keg(keg, spec) + from_keg(keg, spec, :alias_path => alias_path) else - factory(rack.basename.to_s, spec || :stable) + factory(rack.basename.to_s, spec || :stable, :alias_path => alias_path) end end # Return a Formula instance for the given keg. # It will auto resolve formula's spec when requested spec is nil - def self.from_keg(keg, spec = nil) + def self.from_keg(keg, spec = nil, alias_path: nil) tab = Tab.for_keg(keg) tap = tab.tap spec ||= tab.spec f = if tap.nil? - factory(keg.rack.basename.to_s, spec) + factory(keg.rack.basename.to_s, spec, :alias_path => alias_path) else begin - factory("#{tap}/#{keg.rack.basename}", spec) + factory("#{tap}/#{keg.rack.basename}", spec, :alias_path => alias_path) rescue FormulaUnavailableError # formula may be migrated to different tap. Try to search in core and all taps. - factory(keg.rack.basename.to_s, spec) + factory(keg.rack.basename.to_s, spec, :alias_path => alias_path) end end f.build = tab @@ -346,7 +353,7 @@ def self.loader_for(ref) end def self.core_path(name) - CoreTap.instance.formula_dir/"#{name.downcase}.rb" + CoreTap.instance.formula_dir/"#{name.to_s.downcase}.rb" end def self.tap_paths(name, taps = Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/"])
true
Other
Homebrew
brew
2a683f2569614850f79534a8547fd96cc52c7850.json
upgrade, outdated: follow alias changes
Library/Homebrew/test/test_formulary.rb
@@ -89,7 +89,7 @@ def test_factory_from_alias FileUtils.ln_s @path, alias_path result = Formulary.factory("foo") assert_kind_of Formula, result - assert_equal alias_path, result.alias_path + assert_equal alias_path.to_s, result.alias_path ensure alias_dir.rmtree end
true
Other
Homebrew
brew
ee0fb3e999197b866d727a9c63ab3dda31603639.json
update-report: handle directory not existing. This shouldn't be possible to occur after #1013 but it makes sense to add it anyway.
Library/Homebrew/cmd/update-report.rb
@@ -258,7 +258,7 @@ def migrate_legacy_repository_if_necessary dst = Pathname.new("#{HOMEBREW_PREFIX}/bin/brew") begin FileUtils.ln_s(src.relative_path_from(dst.parent), dst) - rescue Errno::EACCES + rescue Errno::EACCES, Errno::ENOENT ofail <<-EOS.undent Could not create symlink at #{dst}! Please do this manually with:
false
Other
Homebrew
brew
997ccb044d21fccb1a95ef4eefad0fa892289e02.json
Relocate HOMEBREW_REPOSITORY when necessary. Now that the default from the installer, our CI and soon all users is `/usr/local/Homebrew` it's a lot easier to check if there's references to it (as we cannot look for `/usr/local` as it's a too commonly hardcoded path).
Library/Homebrew/dev-cmd/bottle.rb
@@ -177,6 +177,7 @@ def bottle_formula(f) tar_path = Pathname.pwd/tar_filename prefix = HOMEBREW_PREFIX.to_s + repository = HOMEBREW_REPOSITORY.to_s cellar = HOMEBREW_CELLAR.to_s ohai "Bottling #{filename}..." @@ -193,7 +194,8 @@ def bottle_formula(f) keg.relocate_dynamic_linkage prefix, Keg::PREFIX_PLACEHOLDER, cellar, Keg::CELLAR_PLACEHOLDER keg.relocate_text_files prefix, Keg::PREFIX_PLACEHOLDER, - cellar, Keg::CELLAR_PLACEHOLDER + cellar, Keg::CELLAR_PLACEHOLDER, + repository, Keg::REPOSITORY_PLACEHOLDER end keg.delete_pyc_files! @@ -248,6 +250,7 @@ def bottle_formula(f) skip_relocation = true else relocatable = false if keg_contain?(prefix_check, keg, ignores) + relocatable = false if keg_contain?(repository, keg, ignores) relocatable = false if keg_contain?(cellar, keg, ignores) if prefix != prefix_check relocatable = false if keg_contain_absolute_symlink_starting_with?(prefix, keg) @@ -265,7 +268,8 @@ def bottle_formula(f) keg.relocate_dynamic_linkage Keg::PREFIX_PLACEHOLDER, prefix, Keg::CELLAR_PLACEHOLDER, cellar keg.relocate_text_files Keg::PREFIX_PLACEHOLDER, prefix, - Keg::CELLAR_PLACEHOLDER, cellar + Keg::CELLAR_PLACEHOLDER, cellar, + Keg::REPOSITORY_PLACEHOLDER, repository end end end
true
Other
Homebrew
brew
997ccb044d21fccb1a95ef4eefad0fa892289e02.json
Relocate HOMEBREW_REPOSITORY when necessary. Now that the default from the installer, our CI and soon all users is `/usr/local/Homebrew` it's a lot easier to check if there's references to it (as we cannot look for `/usr/local` as it's a too commonly hardcoded path).
Library/Homebrew/formula_installer.rb
@@ -779,7 +779,8 @@ def pour Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s end keg.relocate_text_files Keg::PREFIX_PLACEHOLDER, HOMEBREW_PREFIX.to_s, - Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s + Keg::CELLAR_PLACEHOLDER, HOMEBREW_CELLAR.to_s, + Keg::REPOSITORY_PLACEHOLDER, HOMEBREW_REPOSITORY.to_s Pathname.glob("#{formula.bottle_prefix}/{etc,var}/**/*") do |path| path.extend(InstallRenamed)
true
Other
Homebrew
brew
997ccb044d21fccb1a95ef4eefad0fa892289e02.json
Relocate HOMEBREW_REPOSITORY when necessary. Now that the default from the installer, our CI and soon all users is `/usr/local/Homebrew` it's a lot easier to check if there's references to it (as we cannot look for `/usr/local` as it's a too commonly hardcoded path).
Library/Homebrew/keg_relocate.rb
@@ -1,6 +1,7 @@ class Keg PREFIX_PLACEHOLDER = "@@HOMEBREW_PREFIX@@".freeze CELLAR_PLACEHOLDER = "@@HOMEBREW_CELLAR@@".freeze + REPOSITORY_PLACEHOLDER = "@@HOMEBREW_REPOSITORY@@".freeze def fix_dynamic_linkage symlink_files.each do |file| @@ -18,13 +19,15 @@ def relocate_dynamic_linkage(_old_prefix, _new_prefix, _old_cellar, _new_cellar) [] end - def relocate_text_files(old_prefix, new_prefix, old_cellar, new_cellar) + def relocate_text_files(old_prefix, new_prefix, old_cellar, new_cellar, + old_repository, new_repository) files = text_files | libtool_files files.group_by { |f| f.stat.ino }.each_value do |first, *rest| s = first.open("rb", &:read) changed = s.gsub!(old_cellar, new_cellar) changed = s.gsub!(old_prefix, new_prefix) || changed + changed = s.gsub!(old_repository, new_repository) || changed next unless changed
true
Other
Homebrew
brew
72d0154454a1d4fe4dd94d4a3abf94ad65d2b77b.json
update-report: migrate everyone to new repository. Also migrate people without `HOMEBREW_DEVELOPER` set to the new location.
Library/Homebrew/cmd/update-report.rb
@@ -175,7 +175,6 @@ def migrate_legacy_cache_if_necessary def migrate_legacy_repository_if_necessary return unless HOMEBREW_PREFIX.to_s == "/usr/local" return unless HOMEBREW_REPOSITORY.to_s == "/usr/local" - return unless ARGV.homebrew_developer? ohai "Migrating HOMEBREW_REPOSITORY (please wait)..."
false
Other
Homebrew
brew
d70841db2bcccb089382ffb940ce8a8bc3de22d4.json
update.sh: turn origin/branch into a variable. Rather than repeating origin multiple times.
Library/Homebrew/cmd/update.sh
@@ -215,6 +215,8 @@ merge_or_rebase() { trap reset_on_interrupt SIGINT + REMOTE_REF="origin/$UPSTREAM_BRANCH" + if [[ -n "$(git status --untracked-files=all --porcelain 2>/dev/null)" ]] then if [[ -n "$HOMEBREW_VERBOSE" ]] @@ -252,11 +254,11 @@ EOS # Recreate and check out `#{upstream_branch}` if unable to fast-forward # it to `origin/#{@upstream_branch}`. Otherwise, just check it out. - if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" &>/dev/null + if git merge-base --is-ancestor "$UPSTREAM_BRANCH" "$REMOTE_REF" &>/dev/null then git checkout --force "$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}" else - git checkout --force -B "$UPSTREAM_BRANCH" "origin/$UPSTREAM_BRANCH" "${QUIET_ARGS[@]}" + git checkout --force -B "$UPSTREAM_BRANCH" "$REMOTE_REF" "${QUIET_ARGS[@]}" fi fi @@ -268,9 +270,9 @@ EOS if [[ -z "$HOMEBREW_MERGE" ]] then - git rebase "${QUIET_ARGS[@]}" "origin/$UPSTREAM_BRANCH" + git rebase "${QUIET_ARGS[@]}" "$REMOTE_REF" else - git merge --no-edit --ff "${QUIET_ARGS[@]}" "origin/$UPSTREAM_BRANCH" \ + git merge --no-edit --ff "${QUIET_ARGS[@]}" "$REMOTE_REF" \ --strategy=recursive \ --strategy-option=ours \ --strategy-option=ignore-all-space
false
Other
Homebrew
brew
58b17a0cfc34adf2213e18b1f277c52a89407e64.json
utils: convert formula name from pathname to string `name` is passed as argument to Formulary.factory which could later be downcased at formulary.rb:349, but Pathname doesn't have a downcase method. Converting `name` to String as it should be fixes the problem. Fixes #1000.
Library/Homebrew/utils.rb
@@ -627,7 +627,7 @@ def migrate_legacy_keg_symlinks_if_necessary HOMEBREW_LINKED_KEGS.mkpath unless legacy_linked_kegs.children.empty? legacy_linked_kegs.children.each do |link| - name = link.basename + name = link.basename.to_s src = begin link.realpath rescue Errno::ENOENT @@ -648,7 +648,7 @@ def migrate_legacy_keg_symlinks_if_necessary HOMEBREW_PINNED_KEGS.mkpath unless legacy_pinned_kegs.children.empty? legacy_pinned_kegs.children.each do |link| - name = link.basename + name = link.basename.to_s src = link.realpath dst = HOMEBREW_PINNED_KEGS/name FileUtils.ln_sf(src.relative_path_from(dst.parent), dst)
false
Other
Homebrew
brew
eb23a397013622025dc3b64dda782a9a9cdea4cf.json
utils: remove bad symlink if it already exists.
Library/Homebrew/utils.rb
@@ -637,6 +637,7 @@ def migrate_legacy_keg_symlinks_if_necessary end end dst = HOMEBREW_LINKED_KEGS/name + dst.unlink if dst.exist? FileUtils.ln_sf(src.relative_path_from(dst.parent), dst) end FileUtils.rm_rf legacy_linked_kegs
false
Other
Homebrew
brew
1bdbb0f462e4c3557bbcba0b203696bdcf025bb4.json
Improve rescue nesting.
Library/Homebrew/diagnostic.rb
@@ -516,10 +516,10 @@ def check_for_gettext # Our gettext formula will be caught by check_linked_keg_only_brews gettext = begin - Formulary.factory("gettext") - rescue - nil - end + Formulary.factory("gettext") + rescue + nil + end homebrew_owned = @found.all? do |path| Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext" end @@ -537,10 +537,10 @@ def check_for_iconv return if @found.empty? libiconv = begin - Formulary.factory("libiconv") - rescue - nil - end + Formulary.factory("libiconv") + rescue + nil + end if libiconv && libiconv.linked_keg.directory? unless libiconv.keg_only? <<-EOS.undent
true
Other
Homebrew
brew
1bdbb0f462e4c3557bbcba0b203696bdcf025bb4.json
Improve rescue nesting.
Library/Homebrew/download_strategy.rb
@@ -269,10 +269,10 @@ def chdir case entries.length when 0 then raise "Empty archive" when 1 then begin - Dir.chdir entries.first - rescue - nil - end + Dir.chdir entries.first + rescue + nil + end end end
true
Other
Homebrew
brew
1bdbb0f462e4c3557bbcba0b203696bdcf025bb4.json
Improve rescue nesting.
Library/Homebrew/global.rb
@@ -56,10 +56,10 @@ module Homebrew ORIGINAL_PATHS = ENV["PATH"].split(File::PATH_SEPARATOR).map do |p| begin - Pathname.new(p).expand_path - rescue - nil - end + Pathname.new(p).expand_path + rescue + nil + end end.compact.freeze # TODO: remove this as soon as it's removed from commands.rb.
true
Other
Homebrew
brew
1bdbb0f462e4c3557bbcba0b203696bdcf025bb4.json
Improve rescue nesting.
Library/Homebrew/software_spec.rb
@@ -339,10 +339,10 @@ def checksums os_versions = collector.keys os_versions.map! do |osx| begin - MacOS::Version.from_symbol osx - rescue - nil - end + MacOS::Version.from_symbol osx + rescue + nil + end end.compact! os_versions.sort.reverse_each do |os_version| osx = os_version.to_sym
true
Other
Homebrew
brew
8f1ae3b28b0a12fe4a9d905dd4c41873d1674377.json
Move LinkedKegs migration. Move the `LinkedKegs` migration into `utils.rb` so it can also be called from `brew.rb` on startup.
Library/Homebrew/brew.rb
@@ -87,6 +87,9 @@ def require?(path) # `Homebrew.help` never returns, except for external/unknown commands. end + # Migrate LinkedKegs/PinnedKegs if update didn't already do so + migrate_legacy_keg_symlinks_if_necessary + # Uninstall old brew-cask if it's still around; we just use the tap now. if cmd == "cask" && (HOMEBREW_CELLAR/"brew-cask").exist? system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
true
Other
Homebrew
brew
8f1ae3b28b0a12fe4a9d905dd4c41873d1674377.json
Move LinkedKegs migration. Move the `LinkedKegs` migration into `utils.rb` so it can also be called from `brew.rb` on startup.
Library/Homebrew/cmd/update-report.rb
@@ -7,6 +7,7 @@ require "formulary" require "descriptions" require "cleanup" +require "utils" module Homebrew def update_preinstall_header @@ -168,30 +169,6 @@ def migrate_legacy_cache_if_necessary end end - def migrate_legacy_keg_symlinks_if_necessary - legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs" - return unless legacy_linked_kegs.directory? - - legacy_linked_kegs.children.each do |f| - keg = Keg.new(f.realpath) - keg.unlink - keg.link - end - FileUtils.rm_rf legacy_linked_kegs - - legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs" - return unless legacy_pinned_kegs.directory? - - legacy_pinned_kegs.children.each do |f| - pin_version = Keg.new(f.realpath).version - formula = Formulary.factory(f.basename.to_s) - pin = FormulaPin.new(formula) - pin.unpin - pin.pin_at(pin_version) - end - FileUtils.rm_rf legacy_pinned_kegs - end - def link_completions_and_docs return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s command = "brew update"
true
Other
Homebrew
brew
8f1ae3b28b0a12fe4a9d905dd4c41873d1674377.json
Move LinkedKegs migration. Move the `LinkedKegs` migration into `utils.rb` so it can also be called from `brew.rb` on startup.
Library/Homebrew/config.rb
@@ -18,18 +18,10 @@ HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims" # Where we store symlinks to currently linked kegs -HOMEBREW_LINKED_KEGS = if (HOMEBREW_LIBRARY/"LinkedKegs").exist? - HOMEBREW_LIBRARY/"LinkedKegs" -else - HOMEBREW_PREFIX/"var/homebrew/linked" -end +HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked" # Where we store symlinks to currently version-pinned kegs -HOMEBREW_PINNED_KEGS = if (HOMEBREW_LIBRARY/"PinnedKegs").exist? - HOMEBREW_LIBRARY/"PinnedKegs" -else - HOMEBREW_PREFIX/"var/homebrew/pinned" -end +HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned" # Where we store lock files HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX/"var/homebrew/locks"
true
Other
Homebrew
brew
8f1ae3b28b0a12fe4a9d905dd4c41873d1674377.json
Move LinkedKegs migration. Move the `LinkedKegs` migration into `utils.rb` so it can also be called from `brew.rb` on startup.
Library/Homebrew/utils.rb
@@ -620,3 +620,27 @@ def link_src_dst_dirs(src_dir, dst_dir, command, link_dir: false) def link_path_manpages(path, command) link_src_dst_dirs(path/"man", HOMEBREW_PREFIX/"share/man", command) end + +def migrate_legacy_keg_symlinks_if_necessary + legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs" + return unless legacy_linked_kegs.directory? + + legacy_linked_kegs.children.each do |f| + keg = Keg.new(f.realpath) + keg.unlink + keg.link + end + FileUtils.rm_rf legacy_linked_kegs + + legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs" + return unless legacy_pinned_kegs.directory? + + legacy_pinned_kegs.children.each do |f| + pin_version = Keg.new(f.realpath).version + formula = Formulary.factory(f.basename.to_s) + pin = FormulaPin.new(formula) + pin.unpin + pin.pin_at(pin_version) + end + FileUtils.rm_rf legacy_pinned_kegs +end
true
Other
Homebrew
brew
b1903c1a4a2639bf9730f1035abfe6172c3b5957.json
test-bot: generate coverage reports on Sierra. We may have two Sierra nodes available which could speed up this relatively slow operation.
Library/Homebrew/dev-cmd/test-bot.rb
@@ -724,7 +724,7 @@ def homebrew coverage_args = [] if ARGV.include?("--coverage") if ENV["JENKINS_HOME"] - if OS.mac? && MacOS.version == :el_capitan + if OS.mac? && MacOS.version == :sierra coverage_args << "--coverage" end else
false
Other
Homebrew
brew
24aa6a53caab86ec3c90d1c729a18cf65da3ba08.json
.codecov.yml: Redirect root to Library/Homebrew.
Library/Homebrew/test/.codecov.yml
@@ -1 +1,4 @@ comment: false +coverage: + fixes: + - "::Library/Homebrew/"
false
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/cmd/update-report.rb
@@ -75,6 +75,7 @@ def update_report end migrate_legacy_cache_if_necessary + migrate_legacy_keg_symlinks_if_necessary if !updated if !ARGV.include?("--preinstall") && !ENV["HOMEBREW_UPDATE_FAILED"] @@ -167,6 +168,24 @@ def migrate_legacy_cache_if_necessary end end + def migrate_legacy_keg_symlinks_if_necessary + legacy_linked_kegs = HOMEBREW_LIBRARY/"LinkedKegs" + return unless legacy_linked_kegs.directory? + + legacy_linked_kegs.children.each {|f| Keg.new(f.realpath).link } + FileUtils.rm_rf legacy_linked_kegs + + legacy_pinned_kegs = HOMEBREW_LIBRARY/"PinnedKegs" + return unless legacy_pinned_kegs.directory? + + legacy_pinned_kegs.children.each do |f| + pin_version = Keg.new(f.realpath).version + formula = Formulary.factory(f.basename.to_s) + FormulaPin.new(formula).pin_at(pin_version) + end + FileUtils.rm_rf legacy_pinned_kegs + end + def link_completions_and_docs return if HOMEBREW_PREFIX.to_s == HOMEBREW_REPOSITORY.to_s command = "brew update"
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/config.rb
@@ -17,8 +17,14 @@ # Where shim scripts for various build and SCM tools are stored HOMEBREW_SHIMS_PATH = HOMEBREW_LIBRARY/"Homebrew/shims" +# Where we store symlinks to currently linked kegs +HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX/"var/homebrew/linked" + +# Wehere we store symlinks to currently version-pinned kegs +HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX/"var/homebrew/pinned" + # Where we store lock files -HOMEBREW_LOCK_DIR = HOMEBREW_LIBRARY/"Locks" +HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX/"var/homebrew/locks" # Where we store built products HOMEBREW_CELLAR = Pathname.new(ENV["HOMEBREW_CELLAR"])
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/global.rb
@@ -22,9 +22,6 @@ HOMEBREW_REPOSITORY.extend(GitRepositoryExtension) -HOMEBREW_LINKED_KEGS = HOMEBREW_LIBRARY/"LinkedKegs" -HOMEBREW_PINNED_KEGS = HOMEBREW_LIBRARY/"PinnedKegs" - RUBY_PATH = Pathname.new(RbConfig.ruby) RUBY_BIN = RUBY_PATH.dirname
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/keg.rb
@@ -66,7 +66,7 @@ def to_s; <<-EOS.undent INFOFILE_RX = %r{info/([^.].*?\.info|dir)$} TOP_LEVEL_DIRECTORIES = %w[bin etc include lib sbin share var Frameworks] ALL_TOP_LEVEL_DIRECTORIES = (TOP_LEVEL_DIRECTORIES + %w[lib/pkgconfig share/locale share/man opt]).freeze - PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs].map do |d| + PRUNEABLE_DIRECTORIES = %w[bin etc include lib sbin share Frameworks LinkedKegs var/homebrew].map do |d| case d when "LinkedKegs" then HOMEBREW_LIBRARY/d else HOMEBREW_PREFIX/d end end
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/test/lib/config.rb
@@ -24,6 +24,8 @@ HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+"Library" HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+"cache" HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+"formula_cache" +HOMEBREW_LINKED_KEGS = HOMEBREW_PREFIX.parent+"linked" +HOMEBREW_PINNED_KEGS = HOMEBREW_PREFIX.parent+"pinned" HOMEBREW_LOCK_DIR = HOMEBREW_PREFIX.parent+"locks" HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+"cellar" HOMEBREW_LOGS = HOMEBREW_PREFIX.parent+"logs"
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/test/test_integration_cmds.rb
@@ -14,6 +14,8 @@ def setup def teardown coretap = CoreTap.new paths_to_delete = [ + HOMEBREW_LINKED_KEGS, + HOMEBREW_PINNED_KEGS, HOMEBREW_CELLAR.children, HOMEBREW_CACHE.children, HOMEBREW_LOCK_DIR.children, @@ -22,7 +24,6 @@ def teardown HOMEBREW_PREFIX/"bin", HOMEBREW_PREFIX/"share", HOMEBREW_PREFIX/"opt", - HOMEBREW_LINKED_KEGS, HOMEBREW_LIBRARY/"Taps/caskroom", HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bundle", HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-foo",
true
Other
Homebrew
brew
e3609b6fd4001523679562c33064e17d03e1534f.json
Move LinkedKegs/PinnedKegs/Locks from Library. These don't make sense to be tied to the `HOMEBREW_REPOSITORY` but instead should live in the `HOMEBREW_PREFIX` as they all relate to its state.
Library/Homebrew/utils/lock.sh
@@ -3,7 +3,7 @@ # Noted due to the fixed FD, a shell process can only create one lock. lock() { local name="$1" - local lock_dir="$HOMEBREW_LIBRARY/Locks" + local lock_dir="$HOMEBREW_PREFIX/var/homebrew/locks" local lock_file="$lock_dir/$name" [[ -d "$lock_dir" ]] || mkdir -p "$lock_dir" # 200 is the file descriptor used in the lock.
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
.travis.yml
@@ -2,13 +2,6 @@ language: ruby rvm: 2.0.0 os: linux -matrix: - include: - - os: osx - env: OSX=10.11 - osx_image: xcode7.3 - rvm: system - before_install: - export HOMEBREW_DEVELOPER=1 - export PATH="bin:$PATH"
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/cask/Gemfile
@@ -12,7 +12,7 @@ group :development do end group :test do - gem "coveralls", require: false + gem "codecov", require: false gem "minitest", "5.4.1" gem "minitest-reporters" gem "mocha", "1.1.0", require: false
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/cask/Gemfile.lock
@@ -5,13 +5,11 @@ GEM ast (2.3.0) builder (3.2.2) byebug (9.0.5) + codecov (0.1.5) + json + simplecov + url coderay (1.1.1) - coveralls (0.8.15) - json (>= 1.8, < 3) - simplecov (~> 0.12.0) - term-ansicolor (~> 1.3) - thor (~> 0.19.1) - tins (>= 1.6.0, < 2) diff-lcs (1.2.5) docile (1.1.5) json (2.0.2) @@ -71,17 +69,14 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - term-ansicolor (1.3.2) - tins (~> 1.0) - thor (0.19.1) - tins (1.12.0) unicode-display_width (1.1.0) + url (0.3.2) PLATFORMS ruby DEPENDENCIES - coveralls + codecov minitest (= 5.4.1) minitest-reporters mocha (= 1.1.0)
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/cask/README.md
@@ -8,9 +8,6 @@ We do this by providing a friendly Homebrew-style CLI workflow for the administr It’s implemented as a `homebrew` [external command](https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/External-Commands.md) called `cask`. -[![Build Status](https://img.shields.io/travis/caskroom/homebrew-cask/master.svg)](https://travis-ci.org/caskroom/homebrew-cask) -[![Code Climate](https://img.shields.io/codeclimate/github/caskroom/homebrew-cask.svg)](https://codeclimate.com/github/caskroom/homebrew-cask) -[![Coverage Status](https://img.shields.io/coveralls/caskroom/homebrew-cask.svg)](https://coveralls.io/r/caskroom/homebrew-cask) [![Join the chat at https://gitter.im/caskroom/homebrew-cask](https://img.shields.io/badge/gitter-join%20chat-blue.svg)](https://gitter.im/caskroom/homebrew-cask) ## Let’s try it!
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/cask/Rakefile
@@ -23,10 +23,11 @@ namespace :test do Rake::Task[:test].invoke - if ENV["TRAVIS"] - require "coveralls/rake/task" - Coveralls::RakeTask.new - Rake::Task['coveralls:push'].invoke + if ENV["CODECOV_TOKEN"] + require "simplecov" + require "codecov" + formatter = SimpleCov::Formatter::Codecov.new + formatter.format(SimpleCov::ResultMerger.merged_result) end end end
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/dev-cmd/test-bot.rb
@@ -59,8 +59,7 @@ #: #: If `--no-pull` is passed, don't use `brew pull` when possible. #: -#: If `--coverage` is passed, generate coverage report and send it to -#: Coveralls. +#: If `--coverage` is passed, generate and uplaod a coverage report. #: #: If `--test-default-formula` is passed, use a default testing formula #: when not building a tap and no other formulae are specified. @@ -72,6 +71,9 @@ #: #: If `--ci-testing` is passed, use the Homebrew testing CI options. #: +#: If `--ci-auto` is passed, automatically pick one of the Homebrew CI +#: options based on the environment. +#: #: If `--ci-upload` is passed, use the Homebrew CI bottle upload #: options. #: @@ -709,18 +711,24 @@ def homebrew return if @skip_homebrew if !@tap && (@formulae.empty? || @test_default_formula) - tests_args = ["--official-cmd-taps"] - tests_args_no_compat = [] - tests_args_no_compat << "--coverage" if ARGV.include?("--coverage") - test "brew", "tests", *tests_args - test "brew", "tests", "--generic", *tests_args - test "brew", "tests", "--no-compat", *tests_args_no_compat + coverage_args = [] + if ARGV.include?("--coverage") + if ENV["JENKINS_HOME"] + if OS.mac? && MacOS.version == :el_capitan + coverage_args << "--coverage" + end + else + coverage_args << "--coverage" + end + end + + test "brew", "tests", "--no-compat" + test "brew", "tests", "--generic" + test "brew", "tests", "--official-cmd-taps", *coverage_args test "brew", "readall", "--syntax" if OS.mac? run_as_not_developer { test "brew", "tap", "caskroom/cask" } - tests_args_cask = [] - tests_args_cask << "--coverage" if ARGV.include?("--coverage") - test "brew", "cask-tests", *tests_args_cask + test "brew", "cask-tests", *coverage_args end # TODO: try to fix this on Linux at some stage. @@ -1003,16 +1011,29 @@ def sanitize_argv_and_env ENV["HOMEBREW_FAIL_LOG_LINES"] = "150" ENV["HOMEBREW_EXPERIMENTAL_FILTER_FLAGS_ON_DEPS"] = "1" - if ENV["TRAVIS"] + travis = !ENV["TRAVIS"].nil? + if travis ARGV << "--verbose" - ARGV << "--ci-master" if ENV["TRAVIS_PULL_REQUEST"] == "false" ENV["HOMEBREW_VERBOSE_USING_DOTS"] = "1" + end + + # Only report coverage if build runs on macOS and this is indeed Homebrew, + # as we don't want this to be averaged with inferior Linux test coverage. + if OS.mac? && (ENV["COVERALLS_REPO_TOKEN"] || ENV["CODECOV_TOKEN"]) + ARGV << "--coverage" + end - # Only report coverage if build runs on macOS and this is indeed Homebrew, - # as we don't want this to be averaged with inferior Linux test coverage. - repo = ENV["TRAVIS_REPO_SLUG"] - if repo && repo.start_with?("Homebrew/") && ENV["OSX"] - ARGV << "--coverage" + travis_pr = ENV["TRAVIS_PULL_REQUEST"] && ENV["TRAVIS_PULL_REQUEST"] != "false" + jenkins_pr = !ENV["ghprbPullLink"].nil? + jenkins_branch = !ENV["GIT_COMMIT"].nil? + + if ARGV.include?("--ci-auto") + if travis_pr || jenkins_pr + ARGV << "--ci-pr" + elsif travis || jenkins_branch + ARGV << "--ci-master" + else + ARGV << "--ci-testing" end end
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/test/Gemfile
@@ -13,5 +13,5 @@ group :coverage do :git => "https://github.com/colszowka/simplecov.git", :branch => "master", # commit 257e26394c464c4ab388631b4eff1aa98c37d3f1 :require => false - gem "coveralls", "0.8.14", :require => false + gem "codecov", require: false end
true
Other
Homebrew
brew
b1fba6ed54997bd0a2ce29fdd523f40fecada0c3.json
Send coverage from Jenkins, don't run OS X Travis. OS X Travis CI is particularly error-prone, slow and unnecessary for us when we're already running (fast) OS X builds on Jenkins so use it just for Linux testing.
Library/Homebrew/test/Gemfile.lock
@@ -11,12 +11,10 @@ GIT GEM remote: https://rubygems.org/ specs: - coveralls (0.8.14) - json (>= 1.8, < 3) - simplecov (~> 0.12.0) - term-ansicolor (~> 1.3) - thor (~> 0.19.1) - tins (~> 1.6.0) + codecov (0.1.5) + json + simplecov + url docile (1.1.5) json (1.8.3) metaclass (0.0.4) @@ -25,16 +23,13 @@ GEM metaclass (~> 0.0.1) rake (10.5.0) simplecov-html (0.10.0) - term-ansicolor (1.3.2) - tins (~> 1.0) - thor (0.19.1) - tins (1.6.0) + url (0.3.2) PLATFORMS ruby DEPENDENCIES - coveralls (= 0.8.14) + codecov minitest (~> 5.3) mocha (~> 1.1) rake (~> 10.3)
true