52 Commits

Author SHA1 Message Date
Mike McQuaid
e03f07f302 Rubocop 0.53.0 automatic fixes. 2018-03-08 14:10:02 +00:00
Chayoung You
b05d69f600
Format identifiers in oh1 2018-02-09 18:00:29 +09:00
Mike McQuaid
838a3f1996 reinstall/upgrade: stop unlinked kegs being sticky
It's not possible to determine the difference between a non-keg-only
keg that failed to link and one that wasn't linked by us intentionally.

To avoid additional complexity of storing this logic in another place
let's back out this relatively new functionality; sticky keg-only links
is a better and more desirable behaviour anyway.
2018-01-10 16:43:21 +00:00
Mike McQuaid
7eb1fd6671 reinstall/upgrade: document use of options.
To avoid user confusion e.g. #3606.
2017-12-30 21:23:33 +00:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
044f4d947b Tweak preserve link status on reinstall/upgrade.
Treat a `brew install` command as normal i.e. link by default unless
keg-only and only specify whether a keg should be linked when upgrading
or reinstalling. Also, adjust the naming accordingly so it's more
obvious that this is the case.
2017-07-30 21:44:43 +01:00
Mike McQuaid
7ec0505200 Preserve link status on reinstall/upgrade.
This means if a user has manually `brew unlink` or `brew link --force`d
something then that status will be preserved after they `brew upgrade`
or `brew reinstall` that formula.

This generally should make things that are keg-only by default easier
to swallow.
2017-07-30 16:20:32 +01:00
Mike McQuaid
b8611bd988 formula_installer: simplify callers.
There's a bunch of duplication going on that's not really necessary.
2017-07-28 15:27:47 +01:00
Mike McQuaid
18fb81906e reinstall: keg.rmtree isn't a method. 2017-06-08 16:24:55 +03:00
Mike McQuaid
838bb38b3e reinstall: remove partially installed keg.
Previously if a `brew reinstall` was Ctrl-Cd after some files had been
installed it wouldn't try to remove the partially installed keg and the
renaming of the backed-up keg would fail. Alternatively, remove the
partially installed keg as if it has been Ctrl-Cd or otherwise failed
then it's not desirable to keep it.
2017-06-07 15:58:13 +01:00
Bob W. Hogg
51e83cdf91 cmd/reinstall: Fix reinstallation of formulae without bottles
Reinstallation of non-bottled formulae was failing because it
used a deprecated method.

Signed-off-by: Bob W. Hogg <rwhogg@linux.com>
2017-06-05 18:35:43 -07:00
Mike McQuaid
61ebc128af reinstall: perform rename migrations when needed. 2017-03-31 10:01:46 +01:00
Thomas Maurer
6594650eb1
Pass invalid option names to formula installer
This is the same that happens in the command 'install'. By passing
the invalid option names, we enable the formula installer to output
warnings if necessary.
2017-02-04 18:10:37 +01:00
Mike McQuaid
e347f7ade3 reinstall/upgrade/install: always output options.
This is both easier for debugging and to communicate with users what is
being done.
2016-12-10 13:07:03 +00:00
Mike McQuaid
56124f5963 Filter formula build options based on those that exist.
If `--with-foo` is provided to a formula through a tab or through
another formula depending on it and this option does not exist it
should be filtered. If it is not (the prior behaviour) then this can
prevent bottles being used unnecessarily.

Fixes #1399.
2016-11-12 12:11:55 +00:00
Markus Reiter
0ab750bf24 Use module_function for commands. 2016-10-02 00:24:47 +02:00
Markus Reiter
a5b11a6a5c Fix Style/GuardClause. 2016-09-23 15:30:07 +02:00
Vlad Shablinsky
f8ea7a4a0c reinstall: fail if pinned 2016-09-07 20:58:13 +03:00
Martin Afanasjew
823505a058 Fix minor issues in command help text formatting
- Inconsistent or unneeded indentation
- Missing or superfluous empty lines
- Missing or wrongly formatted arguments in command summary
- Missing punctuation
2016-08-17 01:25:51 +02:00
Mike McQuaid
164e46a729 Add missing development_tools requires. 2016-07-29 21:21:02 -06:00
Xu Cheng
d7ee541293
reinstall: handle new options
Since we are loading options as Formula#build from tab, we will have to explicitly read
options from ARGV as well.

Fixes #3066.

Closes #537.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-07-18 18:11:54 +08:00
Xu Cheng
820b6347b8
remove unnecessary Tab.for_formula
We already loaded tab in ARGV.resolved_formulae or Formulary.from_rack
2016-07-18 18:11:53 +08:00
Mike McQuaid
3a127e405e development_tools: add installed? method. (#455) 2016-07-06 11:07:24 +01:00
Andrew Janke
d887dd39ec brew install: make -s apply only to given formula, not deps (#205) 2016-05-06 12:02:13 -07:00
Max Nordlund
fa1fd70a37 Add all the top level comments 2016-04-10 22:59:25 +02:00
Zhiming Wang
81dc194ebf reinstall: add --interactive and --git options
Closes Homebrew/homebrew#47622.

Closes Homebrew/homebrew#47647.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-09 10:33:19 +00:00
Misty De Meo
727239e12f Merge bottle install without Xcode branch
Merge branch 'bottle_hooks'
2015-08-21 11:04:22 -07:00
William Woodruff
1face808f5 Add guards to calls that would trigger Xcode install requests
add guard in Formula#file_modified? to prevent git popup

add guard in Superenv.bin before calling MacOS::Xcode.version

add guard against missing Xcode/CLT in Xcode.uncached_version

return nil instread of 0 in uncached_version when Xcode/CLT are not present, to distinguish from linuxbrew behavior

checks against pour_bottle? and needs_relocation?, add guard around keg.relocate_install_names to check pour_bottle?/needs_relocation? as well

needs_relocation? becomes skip_relocation?, use cellar attr to indicate relocation instead of does_not_need_relocation

MacOS.can_build? becomes MacOS.has_apple_developer_tools?
2015-08-21 11:02:33 -07:00
William Woodruff
f58506ea6f FormulaInstaller: add prevent_build_flags to eliminate code repetition
remove unneeded definition

change variable in FormulaInstaller.check_build_flags from bf to build_flags
2015-08-21 10:59:35 -07:00
William Woodruff
91e598cf3f Install: add BuildToolsError and BuildFlagsError
Add these new errors, and guards in formula installation and
cmd/{,un,re}install to match, move can_build? to the MacOS module,
flatten conditions, remove redundant can_build? check

reinstate removed (doctor) check
2015-08-21 10:59:09 -07:00
Rafael Kitover
74b18bfe12 put caveats in finish after post_install Homebrew/homebrew#42565
When running brew -v install, long post_install output from the formula,
presumably from upstream, may hide the important instructions in the
caveats and confuse the user. For example, postgresql runs initdb which
prints its own instructions for running the database, making the caveats
scroll off screen.

Per xu-cheng's instructions in Homebrew/homebrew#42565 :

Remove the explicit call to caveats from the install, reinstall, and
upgrade commands, as well as the dependency installer code in
FormulaInstaller#install_dependency , and call caveats right before the
summary code in FormulaInstaller#finish .

Closes Homebrew/homebrew#42565.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-09 20:08:42 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
3da315167c reinstall: use Formula#full_name 2015-05-29 17:02:22 +08:00
Xu Cheng
d338f291df reinstall: use ARGV.resolved_formulae 2015-05-27 13:53:42 +08:00
Mike McQuaid
28f26e0c9f reinstall, upgrade: tweak use of tab build_bottle.
In the case where a bottle wasn't around before and is now it probably
doesn't make sense to use `build-bottle` to build something that will
be identical to the binary bottle package anyway. After all, when you
use the bottle you will end up with something that has been built with
`build-bottle` anyway (just not by you).
2015-03-24 12:11:40 +00:00
Jack Nagel
73cc58641b More specific require 2014-10-31 20:10:49 -05:00
Jack Nagel
9a356fc609 Remove FormulaAlreadyInstalledError
install is the only command that can trigger this warning, so it should
be handled before instantiating the installer.
2014-10-31 18:33:39 -05:00
Jack Nagel
7266ecd4e3 Hide install receipt key names 2014-10-15 01:30:56 -05:00
Jack Nagel
10a1952d2c Only "extend self" once on the Homebrew module 2014-06-19 13:10:36 -05:00
Jack Nagel
ce1f598e98 Avoid realpath where it is not necessary
Symlinks in opt and LinkedKegs point directly at a keg in the cellar, so
only resolving one symlink should suffice, and make it clear what path
we are actually interested in.
2014-04-05 12:17:19 -05:00
Jack Nagel
eab90dcb56 Rewrite brew reinstall
Fixes Homebrew/homebrew#23928.
2014-03-15 10:53:03 -05:00
Jack Nagel
7966b29ac6 reinstall: re-raise original exception after cleaning up 2014-03-01 18:27:30 -06:00
Jack Nagel
cf4e7e5954 reinstall: fix incorrect use of Formula.canonical_name
Fixes Homebrew/homebrew#27117.
2014-03-01 18:22:35 -06:00
Samuel John
6ae2e872d3 reinstall cleanup 2013-09-05 14:59:33 +02:00
Xiyue Deng
8aae1dac7b Make reinstall transaction safe.
* Aborting during reinstall will now restore the originally installed
  keg.
  - Change install code to pass on CannotInstallFormulaError exception
    to caller so it can be reused in reinstall.
* Add "--force-new-install" flag to force installing a new formula.

Closes Homebrew/homebrew#22190.

Signed-off-by: Samuel John <github@SamuelJohn.de>
2013-09-05 14:02:29 +02:00
Mike McQuaid
0c5d928cad brew-reinstall: don't list --force in args. 2013-09-01 13:57:40 +01:00
Mike McQuaid
22da8eb633 brew-reinstall: don't try and rebuild bottles. 2013-09-01 13:57:40 +01:00
Samuel John
43fc7423d7 brew reinstall: Is able to work for all formulae
... and not just installed ones. Of course, strictly speaking,
reinstalling not-yet-installed formulae makes semantically little
sense, but the big win is that we can tell people (after we have
resolved an issue) to `brew reinstall <formula>` and even if a user
has removed that formula in the meantime, reinstall will do the right
thing. Basically adding --force to uninstall. I think this makes
reinstall more robust.
2013-08-21 20:18:55 +02:00
Samuel John
5a0bad6b42 Revert "brew reinstall: Is able to work for all formulae"
This reverts commit 865f763ae59fdf32f496ca416fd98117f3370f86.
2013-08-21 20:17:38 +02:00
Samuel John
4bb49a6439 brew reinstall: Is able to work for all formulae
... and not just installed ones. Of course, strictly speaking,
reinstalling not-yet-installed formulae makes semantically little
sense, but the big win is that we can tell people (after we have
resolved an issue) to `brew reinstall <formula>` and even if a user
has removed that formula in the meantime, reinstall will do the right
thing. Basically adding --force to uninstall. I think this makes
reinstall more robust.
2013-08-21 19:20:41 +02:00