775 Commits

Author SHA1 Message Date
Bo Anderson
16049840dc formula_installer: mv rather than rename on link_overwrite
Fixes a cross-device link error if the two locations are on separate partitions.
2020-07-09 15:06:44 +01:00
lionellloh
c1bdbc53ea include logic for ignore-deps and only-deps 2020-07-09 17:45:04 +08:00
Lionell Loh Jian An
bdb64aa178
Apply suggestions from code review
Code review changes

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-09 16:28:00 +08:00
lionellloh
22ef3d5294 brew style --fix 2020-07-09 11:48:09 +08:00
lionellloh
4de020ec6c adapt to forbidden_license_check method signature 2020-07-09 11:38:23 +08:00
Lionell Loh Jian An
5e99ecfbdb
Apply suggestions from code review
Code review changes

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-07-08 23:55:48 +08:00
lionellloh
f0222c3eb7 Moved code from install -> formula_installer 2020-07-07 21:51:15 +08:00
lionellloh
5449904dde small refactor to check env variable within function 2020-07-07 21:42:22 +08:00
lionellloh
fdc9dc4333 require cmd/install to include methods methods in scope 2020-07-07 21:34:48 +08:00
lionellloh
a161829927 forbidden-license: include method in module scope for module-wide access 2020-07-07 21:34:48 +08:00
Mike McQuaid
f951ea83d4
Fix brew style. 2020-07-07 12:23:29 +01:00
Mike McQuaid
9fc0799d5e
Merge pull request #7880 from MikeMcQuaid/check_dependents_install_reinstall
Check installed dependents on install and reinstall
2020-07-02 13:30:29 +01:00
Mike McQuaid
2c133a3d45
Check installed dependents on install and reinstall
It's not sufficient to do this merely on `brew upgrade` because
`brew install` and `brew reinstall` can also result in formulae being
upgraded.

This requires moving logic from `cmd/upgrade.rb` to `upgrade.rb`. To
save you searching the diff the changes that resulted from doing that:

- Query the installed formulae from class state in `FormulaInstaller`
  rather than the (incomplete) list that we passed into it.
- Don't output the "Checking dependents" message. It was there for
  systems and configurations where this is slow but for most users
  and most installations this will be a (annoying, noisy) no-op.

Fixes https://github.com/Homebrew/brew/issues/7860
2020-07-02 12:53:52 +01:00
Mike McQuaid
7596108bd2
Bottle extract and fetch fixes
- Make `brew extract` strip out bottle blocks
- Make `brew extract` output the path in a readable fashion
- Warn about building from source before fetching (not installing)
- If fetching a bottle fails, refetch and build from source.
2020-07-02 11:57:11 +01:00
Issy Long
ad3acf800b
formula_installer: Fix .installed? method deprecation
- Trying to test out a user-submitted `brew bump-formula-pr` for
  `app-engine-java` gave an error locally that [hasn't shown up on
  CI](https://github.com/Homebrew/homebrew-core/pull/55798/checks?check_run_id=740165542),
  oddly.

```
➜ brew install app-engine-java -s && brew test app-engine-java
Error: Calling Formula#installed? is deprecated! Use Formula#latest_version_installed? (or Formula#any_version_installed? ) instead.
/usr/local/Homebrew/Library/Homebrew/compat/formula.rb:6:in `installed?'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:421:in `block (2 levels) in check_requirements'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:420:in `each'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:420:in `block in check_requirements'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:419:in `each_pair'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:419:in `check_requirements'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:392:in `compute_dependencies'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:149:in `verify_deps_exist'
/usr/local/Homebrew/Library/Homebrew/formula_installer.rb:143:in `prelude'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:328:in `install_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:261:in `block in install'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:259:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/install.rb:259:in `install'
/usr/local/Homebrew/Library/Homebrew/brew.rb:110:in `<main>'
```
2020-06-04 22:54:07 +01:00
Mike McQuaid
ef95b59ed4
Remove HomebrewArgvExtension
Fixes #5730
2020-05-23 19:39:11 +01:00
Mike McQuaid
bc27e38f18
Remove ARGV.debug?
Replace with `Homebrew.args.debug?`.

Part of #5730.
2020-05-23 14:38:58 +01:00
Mike McQuaid
e1f3c8d2b3
Merge pull request #7579 from MikeMcQuaid/deprecations
Update deprecations
2020-05-23 14:38:10 +01:00
Mike McQuaid
64602bc8ef
Merge branch 'master' into argv-env 2020-05-23 14:10:44 +01:00
Mike McQuaid
183670296f
Merge pull request #7493 from GauthamGoli/argv-cleanup-26
ARGV: Deprecate ARGV.cc and replace with Homebrew.args.cc
2020-05-23 14:10:20 +01:00
Mike McQuaid
d5ff4f5327
Remove ARGV.env
Replace with `Homebrew.args.env`.

Part of #5730.
2020-05-23 13:49:38 +01:00
Mike McQuaid
e5d15c8b19
Merge branch 'master' into argv-cleanup-26 2020-05-23 13:44:42 +01:00
Mike McQuaid
11cf77be17
formula_installer: prelude before fetch.
This ensures that dependencies are verified and tapped before they are
fetched. `FormulaInstaller#lock` has been moved into
`FormulaInstaller#install` to avoid locking until necessary.

While we're here, don't compute dependencies before fetching if we're
not going to use them.
2020-05-23 13:40:13 +01:00
Bo Anderson
6b06043289 formula_installer: fix pruning of test deps also marked as build 2020-05-23 00:05:20 +01:00
Bo Anderson
a3f589801f formula_installer: fix build/test reqs not being pruned correctly
Fixes #7618.
2020-05-20 23:39:30 +01:00
Bo Anderson
6ac9d43599 formula_installer: fix already-satisfied test deps not being pruned 2020-05-20 13:28:10 +01:00
Mike McQuaid
89a0984d42
formula_installer: fix :test requirement expansion. 2020-05-20 12:24:54 +01:00
Bo Anderson
a2939be08a formula_installer: don't propagate --include-test unless requested 2020-05-19 19:12:47 +01:00
Mike McQuaid
8b98ed1f47
Further tweak :test dependency handling
- ensure that cases where `:build` and `:test` both apply to a
  dependency that we handle it appropriately
- fix reintroduced regression
  (https://github.com/Homebrew/brew/pull/6471#issuecomment-533414923).
  Fixes #6470.
2020-05-19 14:25:10 +01:00
Mike McQuaid
2fc643421f
formula_installer: fix test dependencies.
Only prune test dependencies from the tree when they aren't also build
dependencies (and vice-versa with build dependencies) and the include
test argument hasn't been passed.
2020-05-19 09:34:50 +01:00
Mike McQuaid
3588e6a5c6
bottle_arch: ensure a symbol is used when needed.
Fixes #7597.
2020-05-19 08:47:59 +01:00
Mike McQuaid
4f75a77b08
Update deprecations
Add more deprecations, disable deprecations and remove disabled code.
2020-05-18 13:50:46 +01:00
Mike McQuaid
b9f493a7f6
Pass FormulaInstaller#display_options to BuildError.
This should improve the output in analytics.
2020-05-18 12:46:25 +01:00
Mike McQuaid
10c9d96566
Merge pull request #7552 from MikeMcQuaid/fetch-resources-from-source
Fetch (all) resources when building from source
2020-05-12 14:27:52 +01:00
Mike McQuaid
6ed1ccd8e8
Fetch (all) resources when building from source
Also:
- when `brew test` or `brew postinstall` is run allow `Resource#stage`
  to fetch the resource.
- make `Formula#fetch` and `Resource#fetch` fetch external patches too.

Follow-up from #7549 and #7546.
2020-05-12 12:37:54 +01:00
Mike McQuaid
a333014c55
formula_installer: ignore dependencies when fetching.
Whenever you are fetching a dependency you only care about fetching that
specific dependency and not all the dependencies of that dependency.

Unlike installing, dependencies can be fetched in any order and have no
"chains" between them.
2020-05-12 10:45:10 +01:00
Mike McQuaid
12bdb38663
rubocop: brew style --fix autocorrections. 2020-05-12 08:32:27 +01:00
Mike McQuaid
48918bb5e3
formula_installer: add fetch_dependency method.
This uses `FormulaInstaller#fetch` to recursively fetch dependencies
through the dependency tree and allows `install_dependency` to not
do any fetching.
2020-05-11 09:38:26 +01:00
Michelle Nguyen
2264c08cee
Fetch formula resources before unlinking during upgrade.
Fixes #6374.
2020-05-11 09:37:56 +01:00
Mike McQuaid
1c656fb584
Merge pull request #7538 from MikeMcQuaid/bottle_arch
Replace ARGV#bottle_arch with Homebrew.args.bottle_arch
2020-05-11 08:46:57 +01:00
Mike McQuaid
5f721c6986
Cleanup ARGV.include? usage
Remove usage where `Homebrew.args` could be used instead or, due to the
`Homebrew.args` parsing, there was dead code that was never executed
(and no-one complained about not working).
2020-05-10 15:28:31 +01:00
Mike McQuaid
07b19cba09
Replace ARGV#bottle_arch with Homebrew.args.bottle_arch
Part of https://github.com/Homebrew/brew/issues/5730
2020-05-10 15:15:41 +01:00
Mike McQuaid
20a1199375
Refactor CLI to remove unless args_parsed
Refactor the CLI::Args module so it doesn't have different paths to
check arguments depending on whether the arguments have been parsed or
not. Instead, set the values we need from the global ARGV at
first, global initialisation time where they will be thrown away when
the actual arguments are parsed.

To do this some other general refactoring was needed:
- more methods made private when possible
- e.g. `HEAD?` used consistently instead of `head` before arguments
  are parsed.
- formula options are only parsed after named arguments are extracted
2020-05-05 17:47:51 +01:00
Gautham G
b40e33aeb8 ARGV: Deprecate ARGV.cc and replace with Homebrew.args.cc 2020-05-04 11:14:55 +05:30
Mike McQuaid
b2571d42eb
Merge pull request #7484 from MikeMcQuaid/cleanup-sandbox
Cleanup Sandbox code
2020-05-02 14:16:09 +01:00
Mike McQuaid
40ec8e69cc
Cleanup Sandbox code
Remove unused code and methods.
2020-05-02 13:45:04 +01:00
Gautham G
f6abc6fe19 ARGV: Deprecate ARGV.formulae, replace with Homebrew.args.formulae 2020-05-01 22:50:59 +05:30
Mike McQuaid
b3a7ad7ca6
formula_installer: fix build_from_source? call.
This should check the local instance variable rather than the global
value as it varies for dependencies and requested formulae.
2020-04-21 13:26:37 +01:00
Gautham G
676ebf7419
ARGV: Deprecate ARGV.force_bottle? 2020-04-20 16:45:43 +01:00
Gautham G
2bdbca1280 Revert "Merge pull request #7289 from Homebrew/revert-7279-argv-cleanup-18"
This reverts commit 64fd839c955b3c32855067d26fed7daf65183877, reversing
changes made to 6f50801b37b7d829afc37da76d2ef0a1ac1c9f5f.
2020-04-11 18:50:24 +05:30