574 Commits

Author SHA1 Message Date
Mike McQuaid
f951a22bea Install etc/var files on postinstall.
Also, don't delete them after that. This means that `brew postinstall`
becomes a way to easily reinstall configuration files for any formula
without needing any changes to any bottles or requiring a reinstall.
2017-05-03 09:00:17 +01:00
Mike McQuaid
18c2713df4 formula_installer: improve install/upgrade message
If you `brew install` a formula that's already installed you get:
  Warning: ripgrep-0.5.1 already installed

If you `brew install` an outdated formula that's installed you get:
  Error: ripgrep-0.5.1 already installed. To install this version, first
  `brew unlink ripgrep`

Instead, suggest that the user should `brew upgrade` in this case. If
the formula isn't outdated use the previous message.
2017-04-25 12:45:39 +01:00
Mike McQuaid
45a7730f61 Fix and remove various TODOs.
Fix those that can be done so without tearing Homebrew to pieces and
remove the comments for those that can never be done.
2017-04-23 15:10:18 +01:00
Mike McQuaid
e41f0bf8c8 formula_installer: remove feature flags.
We've been testing the recursive dependency check and allowing unlinked
dependencies in CI for a while with no adverse consequences so enable
them globally now for all users.
2017-04-21 18:27:44 +01:00
Mike McQuaid
3f8722c971 audit: allow skipping audit methods.
Add `--only` and `--except` methods which can be used to selectively
enable or disable audit groups.
2017-04-18 08:17:26 +01:00
Mike McQuaid
0cc9d93885 formula_installer: tweak req formula additions.
Rather than just checking if a requirement's dependency is installed or
not check if the requirement was actually satisfied by a particular
formula rather than e.g. just having a `default_formula` defined.
2017-03-25 10:59:54 +00:00
Mike McQuaid
60f96df44d formula_installer: need up to date req formulae.
This makes them behave consistently to other dependencies. Otherwise
other checks for them being `installed?` will fail.

Fixes #2333
Closes #2302
Fixes https://github.com/Homebrew/homebrew-science/issues/5247
2017-03-15 19:29:16 +01:00
Mike McQuaid
42bb19a631 formula_installer: detect recursive dependencies.
Detect recursive dependencies and refuse to install them providing
instruction on exactly what is depending on what.

Fixes #1933.
2017-02-21 21:29:32 +00:00
Mike McQuaid
08c7561639 Merge pull request #1992 from MikeMcQuaid/no-check-unlinked-dependencies
formula_installer: add env to allow unlinked deps.
2017-02-12 16:21:39 +00:00
Alyssa Ross
9e97eadccb rubocop: trailing comma in multiline method calls
Discussed in
https://github.com/Homebrew/brew/pull/1987/files#r100693581.

This was originally ommitted because it wasn't compatible with Ruby 1.8.
(See https://github.com/Homebrew/legacy-homebrew/pull/48144#r49928971).
2017-02-12 15:11:38 +00:00
Mike McQuaid
efc1f1c7da formula_installer: add env to allow unlinked deps.
We can enable this locally and/or in `brew test-bot` to see if this
code is needed any more. If we can remove it we can start doing much
more interesting things with linking keg-only, versioned formulae and
system dupe formulae.
2017-02-12 14:45:34 +00:00
Mike McQuaid
f0249643d4 formula_installer: use attr_accessor for installed_* 2017-01-18 16:10:28 +00:00
Mike McQuaid
16293c0a68 formula_installer: use installed_* variables.
Also, report formulae installed on request. This is useful in
differentiating between those formulae that are popular because they
are widely requested and those that are popular because they are widely
depended on.
2017-01-18 11:23:21 +00:00
Mike McQuaid
eece7706d1 Merge pull request #1815 from MikeMcQuaid/dependency_to_formula
requirement: get formula from satisfy.
2017-01-17 10:09:05 +00:00
Mike McQuaid
feddacf829 formula_installer: set specified_path on pour.
This means that a `brew install $ALIAS` records the path accordingly
so  e.g. `Formula#full_installed_specified_name` returns the correct
path.
2017-01-15 14:26:07 +00:00
Mike McQuaid
5821572b9b formula_installer: don't assume requirement dependency is default formula. 2017-01-11 12:01:08 -08:00
Mike McQuaid
a571965df9 formula: make prefix usually return opt_prefix.
Return `opt_prefix` if it exists and `prefix` is not called from within
the same formula's `install` or `post_install` methods. Otherwise, fall
back to the existing functionality.

This avoids the need to use `opt_prefix` etc. everywhere and generally
means we don't expose an implementation detail (i.e. the full Cellar
path) to dependents that have a habit of hard-coding it.
2016-12-31 16:38:05 +00:00
Mike McQuaid
7f75b02133 formula_installer: optional deps version check.
Require `HOMEBREW_CHECK_RECURSIVE_VERSION_DEPENDENCIES` to be specified
(which will be by `brew test-bot`) to avoid this being inflicted on
end-users unnecessarily.
2016-12-30 14:36:53 +00:00
Mike McQuaid
961b5fff9d formula_installer: prevent version mismatched deps
Don't allow e.g. the use of `openssl` and `openssl@1.1` in the same
dependency tree to avoid runtime failures and general weirdness.
2016-12-13 00:37:40 +00:00
Mike McQuaid
bf9da2532e formula_installer: remove dependency_installer.
This is no longer needed as the reason it was added (argument
sanitisation) is now done properly.

Also, remove `skip_deps_check?` in favour of `ignore_deps?` as it too is
no longer needed.
2016-12-10 19:21:17 +00:00
Mike McQuaid
7258557aea Merge pull request #1647 from MikeMcQuaid/fix-dependency-option-handling
Fix dependency option handling.
2016-12-10 18:20:59 +00:00
Mike McQuaid
51c31f4d51 Merge pull request #1642 from MikeMcQuaid/always-output-options
reinstall/upgrade/install: always output options.
2016-12-10 18:12:36 +00:00
Mike McQuaid
f7f15673a8 Fix dependency option handling.
- formula_installer: only recompute dependencies when necessary i.e.
when a bottle pour fails.
- formula_installer: re-add accidentally remove dependency options
- dependency: missing options are only those that actually exist on a
formula
2016-12-10 17:58:41 +00: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
8e2f0ccdc3 formulary: remap deprecated options from keg.
When reading a building a formula from a keg (rather than e.g. from
name) then the deprecation options were not remapped correctly as they
are only done in `Tab.for_formula` and not `Tab.for_keg`. Ensure that
after we’ve created the formula that the `used_options` are remapped
correctly.
2016-12-09 17:59:08 +00:00
Kaito Udagawa
bcc9002214 install: print nothing if @requirement_messages is a String or nil 2016-11-20 19:49:58 +09:00
Kaito Udagawa
61c8fff0ee install: suppress redundunt warnings with depends_on requirement
When a formula depends on any requirements, they evaluated at most three times:
before locking, before installing dependent, before building formula.
When a non-fatal requirement is specified and thus evaluated three times,
mostly the same warning message is also emitted three times.

This change restricts printing the warning messages only when a bottle is
successfully installed or before building.
Since this timing is after the final dependency computation for each cases,
the warnings will be most useful to check what is not yet satisfied.
2016-11-19 04:14:26 +09:00
Markus Reiter
59e2d67721 No if/unless-modifier on multiline blocks. 2016-11-13 23:37:40 +01:00
Mike McQuaid
2a53d14b51 Merge pull request #1217 from MatzFan/invalid_build_option_warnings
Invalid build option warnings - supersedes #1088
2016-11-13 10:50:51 +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
Bruce Steedman
098974b2a1 @MikeMcQuaid requested changes 2016-11-12 12:03:04 +00:00
Josh Hagins
652c5bc865 formula_installer: fix regression in #1253
Apparently `cellar :any_skip_relocation` doesn't actually mean we
can skip relocation, at least for text files.
2016-10-25 03:41:37 -04:00
Josh Hagins
9c519bbdbc keg_relocate: refactor relocate_text_files
Replace relocate_text_files with three methods that clarify intent:
replace_locations_with_placeholders, replace_placeholders_with_locations
and replace_text_in_files, the first two calling the third.
2016-10-24 16:21:08 -04:00
Josh Hagins
c46155aba4 keg_relocate: cache files rewritten during brew bottle
`brew bottle` replaces instances of the Homebrew prefix, cellar, and
repository with placeholders in all text files. Cache these files in
INSTALL_RECEIPT.json so that we don't have to check every single text
file for placeholders on install.
2016-10-24 16:21:08 -04:00
Andrew Janke
802402ee34 install: prune build-only deps of deps
This avoids needlessly installing build-time dependencies of dependencies
which are not themselves being built from source.
2016-10-17 04:45:49 -04:00
William Woodruff
5163aa5d21
formula_installer: Remove obsolete hard dependency on cctools.
ruby-macho now performs all relocations in Homebrew.

Additionally, delete the defunct CctoolsRequirement.
2016-10-12 15:00:40 -04:00
Bruce Steedman
62e14ea673 invalid build options - fixed conflicts; rename 2016-10-03 09:42:53 +01:00
Markus Reiter
75e8b59aad Add Formatter module. 2016-10-01 20:00:49 +02:00
Mike McQuaid
98e7fb6b60 Merge pull request #1052 from sjackman/store-formula
Store the formula used to build the keg in the keg
2016-10-01 12:24:19 +01:00
Markus Reiter
58e36c7319 Fix Style/GuardClause. 2016-09-24 12:24:35 +02:00
Shaun Jackman
25df0c03d6 Store the formula used to build the keg in the keg
Store the formula used to build the keg inside the keg in a
file named NAME/VERSION/.brew/NAME.rb after removing the
bottle do ... end block.

See https://github.com/Homebrew/brew-evolution/pull/6.
Closes https://github.com/Homebrew/brew/issues/931.
2016-09-23 17:11:24 -07:00
Markus Reiter
fe2d51e0b9 Fix Style/IfUnlessModifier. 2016-09-23 15:30:07 +02:00
Markus Reiter
4064084c58 Fix Style/MethodName. 2016-09-23 15:30:06 +02:00
Markus Reiter
23eac7ab89 Fix DoubleNegation. 2016-09-23 15:30:06 +02:00
Mike McQuaid
997ccb044d 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).
2016-09-18 16:31:58 +01:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Alex Wang
71063aa2e3 Make scons use stdenv only if immediate build dep
formula_installer will use stdenv if scons is anywhere in the formula's
recursive dependency list:

    https://github.com/Homebrew/legacy-homebrew/issues/40401#issuecomment-110066355

Having scons as a dependency should only require stdenv if it is an
immediate build dependency, as otherwise scons shouldn't be invoked.
2016-09-13 12:36:56 -04:00
Mike McQuaid
1d66cdd3ad Merge pull request #863 from penman/preserve_alias
Save aliases in INSTALL_RECEIPT
2016-09-09 07:47:05 +01:00
Vlad Shablinsky
a04030a6f7 formula_installer: don't allow pinned dependencies
Prompt user to unpin pinned dependencies of the formula
2016-09-07 20:58:09 +03:00