162 Commits

Author SHA1 Message Date
Rylan Polster
b44f715f82
Include loaded_from_api key in Tab 2022-09-14 22:23:01 -04:00
Rylan Polster
50fac1737a
install: fix HEAD installations with HOMEBREW_INSTALL_FROM_API 2021-09-17 23:46:28 -04:00
Bo Anderson
a5cb621fb8
tab: add declared_directly field for runtime deps 2021-05-10 05:50:08 +01:00
Mike McQuaid
d8a2cf9efc
Write tabs to bottle JSON, optionally not bottle
- Write a subset of the tab required for bottles as an annotation.
- Add option on new bottle creation to skip writing tab into bottle
  and instead add it (and other useful metadata) to bottle JSON.
- Read formula information and tab from bottle JSON.
- Write prettier JSON to disk.
- Don't write `HEAD` to tab; this duplicates `HOMEBREW_VERSION`.
- Allow `brew bottle` to use `--json` to generate JSON files from a
  local bottle file.
2021-03-31 09:43:37 +01:00
Mike McQuaid
2b1f460289
Fix installed_on_request for dependencies.
Dependencies were using `Tab.for_formula(df)` to get a `Tab` which meant
that they were always ending up with the (default) value of `true` for
`installed_on_request`. Fix this by:
- setting `installed_on_request` to `false` by default in empty `Tab`s;
  we always override it on installation so we'd rather have it default
  to `false`
- only read and use a `Tab` for the existing dependency formula if
  there's an existing `Keg`
2021-02-23 10:19:45 +00:00
Mike McQuaid
eaae52edb8
tab: return default values on existing, blank install receipt contents. 2021-01-14 16:26:58 +00:00
Mike McQuaid
74fb058c7e
More deprecations
More deprecations, disabling and removal for Homebrew 2.7.0.
2020-12-18 14:17:37 +00:00
Mike McQuaid
d496f5c121
Deprecations for Homebrew 2.6.0
Do the usual deprecate/disable dance for the Homebrew 2.6.0 release.

Not to be merged until the next release will definitely be 2.6.0.
2020-11-24 16:44:02 +00:00
Markus Reiter
da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Mike McQuaid
5afff3f3aa
Handle macOS Homebrew on ARM
- Output `brew doctor` and `brew install` messages noting this configuration is (currently) unsupported and encourage use of Rosetta instead
- Output Rosetta 2 usage in `brew config` on ARM (whether in Rosetta 2 or not)
- Check the architecture of (newly installed) dependencies and ensure they are using the correct architecture.
- Don't allow installing macOS Intel Homebrew in macOS ARM Homebrew default prefix (and vice versa
- Actually write out the architecture of dependencies to the tab rather than generating and throwing them away
- Set and document the expected default prefix for macOS Intel Homebrew, macOS ARM Homebrew (`/opt/homebrew`) and Homebrew on Linux

While we're here:
- Don't say Big Sur is a prerelease version but still make it clear we
  don't support it (yet).
- Don't reference non-existent IRC channel
2020-11-12 17:06:47 +00:00
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Mike McQuaid
ffe827ad0e
Fix upgrading dependents on missing keg
Ensure that we don't try to check for broken linkage in a keg that
doesn't exist. Furthermore, fix the reason we checked for the keg that
doesn't exist by `Formula.clear_cache`.

While here, I noticed that there was other methods of caching at use in
`Formula` so consolidate them to be consistent.

Fixes #8997
2020-10-29 08:31:04 +00:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Jonathan Chang
14cba7f648 tab: fix nil modification time 2020-10-05 13:52:50 +11:00
Mike McQuaid
2e5272d04c Deprecate/disable code for Homebrew 2.5.0.
Do the usual "disable deprecations" and "uncomment pending deprecations"
dance and delete/deprecate/disable relevant/related code.
2020-09-03 10:34:22 +01:00
Seeker
5acdcd26d0 formula: rename installed_prefix to latest_installed_prefix 2020-09-01 09:32:32 -07:00
Bo Anderson
b338398a8c tab: add built_on & arch information 2020-08-18 15:58:00 +01:00
Mike McQuaid
1e265247ca
rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Mike McQuaid
766fc4b301
Fix RuboCop 0.77.0 failures. 2019-11-28 15:10:50 +00:00
Mike McQuaid
0b685bb890
upgrade: don't build bottles unnecessarily.
Fixes #6063.
2019-04-25 14:01:50 -07:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
803ea4ed1a
tab#to_json: allow zero parameters. 2019-03-18 15:04:37 +00:00
Mike McQuaid
b23f990175
Rubocop autofixes 2019-03-18 14:30:44 +00:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Markus Reiter
72f350e757 Use ActiveSupport’s #second_to_last. 2018-10-07 23:10:56 +02:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid
ea97da9879 tab: correctly handle options request.
Because a `Tab` is an `OpenStruct` the existing calls to
`any_args_or_options?` would always return `false`. This means that
`Formula#declared_runtime_dependencies` would never call
`Tab#without?` to check whether a dependency has been brought in by an
option.

Fixes #4407
2018-07-23 19:58:39 +01:00
Mike McQuaid
375d401580 Handle missing formulae in runtime_dependencies
Hopefully put this to bed for once and for all. Add a new method
`runtime_formulae_dependencies` which returns the `runtime_dependencies`
which have only the `Formula` objects that exist. I've checked all the
`runtime_dependencies` callers and updated them accordingly.

Also, fix a few cases where runtime dependencies were being read from
the tab when this wasn't desirable.
2018-07-16 16:46:39 +01:00
Mike McQuaid
d49566ba06 tab: if parsing JSON fails output the filename.
This should make it easier to debug and resolve things like #4439.
2018-07-10 09:29:26 +01:00
Mike McQuaid
1cbc78c5dd Further tweak formula installer runtime dep handling
Instead of adding a custom method to `Tab` use `Tab.runtime_deps_hash`
within `FormulaInstaller` to ensure the `runtime_dependencies` are in
the right format.
2018-06-01 20:39:39 +01:00
Mike McQuaid
42e5ef9f89 tab: set runtime_dependencies consistently. 2018-06-01 19:53:26 +01:00
Mike McQuaid
e9a66bff14 Regenerate runtime_dependencies after installation
This ensures the we’re calculating we’ve run `fix_dynamic_linkage` so
that their results are consistent with what we’re actually pouring.

Combined with the linkage cache (which will be enabled by default in
future) this has very little performance overhead for consistently
Correct tab results.

As a result, don’t bother looking at opportunistically linked
dependencies when creating a tab by default but only do so after
installation has completed.

Finally, only output the caveats and summary after all these
operations have completed.
2018-06-01 14:05:16 +01:00
Mike McQuaid
42a39b16bf formula: use runtime_dependencies from tab.
Don't do so in `linkage_checker` or `tab` which to avoid recursive loops
and want the actual values specified in the formula itself.
2018-03-27 14:52:47 +01:00
Mike McQuaid
d8bf3f8d60 tab: default runtime_dependencies to nil. 2018-03-27 14:52:47 +01:00
Mike McQuaid
f3fba8185e tab: cleanup various methods.
Use some newer Ruby syntax and improve readability.
2018-03-21 12:42:48 +00:00
Mike McQuaid
e03f07f302 Rubocop 0.53.0 automatic fixes. 2018-03-08 14:10:02 +00:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
01e9ec9a9f Rubocop: automatic rule fixes. 2017-09-24 21:23:59 +01:00
Mike McQuaid
fe35bb32e8 tab: include aliases.
Including aliases in the tab allows e.g. `brew switch` to correctly
handle switching between different keg’s aliases.
2017-07-21 17:20:54 +01:00
Markus Reiter
2d6ae61314 Re-revert "Fix operator spacing." 2017-06-02 19:22:05 +02:00
Mike McQuaid
879b3360d3 Handle missing receipt on brew install.
For example if this is for a really old keg, keg where a user has
manually removed stuff or used `brew diy`.
2017-04-02 17:02:56 +01:00
Mike McQuaid
b99fb56275 tab: store installed_{as_dependency,on_request}.
These are used to determine whether or not a formula’s install was
specifically requested by a user and/or pulled in as a dependency.
2017-01-18 11:23:21 +00:00
Alyssa Ross
56d6695bf3 tab: set homebrew_version in Tab.empty 2017-01-04 00:56:06 +00:00
Alyssa Ross
d998a3fcce tab: remove #reliable_runtime_dependencies?
See https://github.com/Homebrew/brew/pull/1750#discussion_r94243825 for
discussion.

Removes Tab#reliable_runtime_dependencies? in favour of returning nil
from Tab#runtime_dependencies if the list is unreliable.

Because Homebrew 1.1.6 hasn't been tagged yet, tabs created in tests
aren't created with a homebrew_version that marks the
runtime_dependencies in the Tab as reliable, so there are some tests
that fail. To work around this, I've had to add a line to some tests
that explicitly overrides the homebrew_version in the Tab. This is
really ugly though, so they should be removed as soon as possible after
1.1.6 is released.
2016-12-30 20:34:14 +00:00
Alyssa Ross
c41d1d8148 tab: remove #homebrew_tag
This method isn't used any more
2016-12-30 18:16:49 +00:00
Alyssa Ross
ce454bd141 tab: parse full Homebrew version string
It didn't occur to me that this would work, but it does! Magic.
2016-12-30 18:15:35 +00:00
Alyssa Ross
bdbc19c614 tab: implement #reliable_runtime_dependencies? 2016-12-30 16:16:28 +00:00
Mike McQuaid
f98304026b Deprecate 32-bit options.
These were formerly supported but as it has been a very long time since
32-bit software was necessary on macOS these have been deprecated with
a `brew audit` warning and a future `odeprecated`.
2016-12-20 10:22:30 +00:00
Alyssa Ross
5cf97e5603 tab: remove debugging 2016-12-03 23:26:52 +00:00