29 Commits

Author SHA1 Message Date
Mike McQuaid
e09147fe75 brew style --fix 2020-09-01 14:26:45 +01:00
Bo Anderson
03c83749c5 reinstall: fix error when building from source
Fixes Homebrew/homebrew-core#59437.
2020-08-11 02:31:56 +01:00
Claudia
8864287cf2
Fix “wrong number of arguments” error
This commit fixes an error introduced in 6c964d4a78, which would
surface on certain install/reinstall/upgrade failures.

Example:

```
==> Patching
patching file default_out.txt
Hunk #2 FAILED at 11.
1 out of 2 hunks FAILED -- saving rejects to file default_out.txt.rej
Error: wrong number of arguments (given 3, expected 2)
/usr/local/Homebrew/Library/Homebrew/reinstall.rb:77:in `restore_backup'
/usr/local/Homebrew/Library/Homebrew/reinstall.rb:52:in `block in reinstall_formula'
/usr/local/Homebrew/Library/Homebrew/utils.rb:377:in `ignore_interrupts'
/usr/local/Homebrew/Library/Homebrew/reinstall.rb:52:in `rescue in reinstall_formula'
/usr/local/Homebrew/Library/Homebrew/reinstall.rb:10:in `reinstall_formula'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:71:in `block in reinstall'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:65:in `each'
/usr/local/Homebrew/Library/Homebrew/cmd/reinstall.rb:65:in `reinstall'
/usr/local/Homebrew/Library/Homebrew/brew.rb:112:in `<main>'
```
2020-08-07 08:57:54 +02:00
Markus Reiter
6c964d4a78 Pass verbose? to Keg#link, Keg#unlink and Keg#optlink. 2020-08-06 16:12:52 +02:00
Markus Reiter
e9d8f09da1 Pass debug?, quiet? and verbose? to FormulaInstaller. 2020-08-06 16:12:52 +02:00
Bo Anderson
ab15c97c61 Fix dependents building from source when not requested 2020-08-02 00:46:17 +01:00
Markus Reiter
6b0678e8ed Remove args from FormulaInstaller. 2020-07-30 03:21:12 +02:00
Markus Reiter
05365b5542 Pass args more explicitly in FormulaInstaller. 2020-07-30 03:21:12 +02:00
Markus Reiter
620ca4177e Pass args to FormulaInstaller instead of using global args. 2020-07-30 03:21:12 +02:00
Markus Reiter
3a60d50bd3 Pass args in reinstall instead of using global args. 2020-07-30 03:21:12 +02:00
Dustin Rodrigues
e02d08f020 re-enable build from source for install, reinstall, upgrade 2020-07-25 22:27:54 -04:00
Markus Reiter
8a1f8ab858 Pass args to FormulaInstaller instead of using global args. 2020-07-25 04:21:21 +02: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
Mike McQuaid
08a9f0e1c0
Use FormulaInstaller#fetch before #prelude. 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
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
b0ac5bab31
ARGV: Deprecate ARGV.build_bottle? and replace with Homebrew.args.build_bottle 2020-04-26 13:28:44 +01:00
Gautham G
fde11efdf3 ARGV: Deprecate ARGV.git? 2020-03-15 18:32:21 +05:30
Gautham G
1292c4559c ARGV: Deprecate ARGV.interactive? 2020-03-15 16:28:04 +05:30
Mike McQuaid
ac97c8545a
cmd/upgrade, reinstall: don't install on dry-run.
Fixes #7033.
2020-02-14 12:18:55 +00:00
Gautham Goli
393c8dfbf1 ARGV: Replace options_only and flags_only with Homebrew.args counterparts 2019-09-23 12:39:22 +05:30
Mike McQuaid
7df0292f9b
Revert "argv: move flags_only to cli/args" 2019-09-13 09:12:26 +01:00
Gautham Goli
c7681c4287 argv: move flags_only to cli/args 2019-09-09 14:51:36 +05:30
Mike McQuaid
4759ffb88f
reinstall: handle remove/rename permission errors. 2019-05-24 16:46:54 +01:00
Xu Cheng
1dfdc5c2ec
reinstall: don't build bottles unnecessarily.
Apply the same changes from #6066.

Also apply the same logics from `brew upgrade` to preserve
`installed_as_dependency`/`installed_on_request` settings
when reinstalling formulae.
2019-04-26 15:28:57 +08:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
24eb8e8e54
Remove (now) unused invalid_option_names.
This is handled by `OptionParser` now instead in `cmd/install`.
2019-01-29 08:31:45 +00:00
Mike McQuaid
a24197bcc9
Fix some bottling logic
- We've never supported `devel` bottles so don't bother outputting their
  status to `brew info`
- Don't `brew upgrade` or `brew reinstall` bottles if they were
  previously built as a bottle unless there's no bottles defined at all
  (rather than there was no compatible bottles). Fixes #5532.
2019-01-14 16:47:07 +00:00
L. E. Segovia
d442905719
Upgrade: implement linkage repair
After upgrading existing kegs, we now search and upgrade their
dependents as well. If any are detected that have broken linkage, they
are reinstalled from source.

If there are any formulae in the dependents tree that are pinned, they
are only reinstalled if they're not outdated; in all cases, a suitable
message is printed detailing the kegs that will be acted upon.
2018-09-12 19:28:02 +00:00