816 Commits

Author SHA1 Message Date
Bo Anderson
627381e949
formula_installer: fix version scheme not being set in the tab 2021-04-12 15:48:13 +01:00
Sean Molenaar
4427fa283f
formula: allow plists to be generated 2021-04-08 10:16:57 +02:00
Bo Anderson
a78051d2e0
debrew: make Debrew::Raise only catch uncaught exceptions 2021-04-07 13:41:41 +01:00
Mike McQuaid
04abc51d1f
Cleanup use of CxxStdlib
- remove usage on macOS as we don't care about it there
- don't error out on incompatibility but still store stdlib on Linux
- remove (now) unused methods
2021-04-02 13:55:29 +01:00
Mike McQuaid
d9032ff01a
Download and use tabs from GitHub Packages 2021-04-01 17:37:16 +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
Bo Anderson
22053ca2c3
formula_installer: pass cache key to Dependency.expand 2021-03-29 13:20:18 +01:00
Bo Anderson
929d2d8caf
formula_installer: move deprecation/disabled checking earlier 2021-03-24 15:46:29 +00:00
Bo Anderson
d14a0bb131
Remove FormulaInstaller.prevent_build_flags 2021-03-22 16:11:27 +00:00
Bo Anderson
e49a338896
Implement caching for dependency expansion 2021-03-20 16:56:00 +00:00
Bo Anderson
248ca231a2
formula_installer: don't warn about bottles when active spec is HEAD 2021-03-16 18:22:05 +00:00
Bo Anderson
acfe9d24d9
Merge pull request #10815 from Bo98/fi-more-perf
formula_installer: further reduce dependency calculations
2021-03-15 18:20:03 +00:00
Carlo Cabrera
de676841f6
formula_installer: skip bottle check on old Macs
Fixes #10832.
2021-03-12 15:38:45 +00:00
Bo Anderson
73d372e951
formula_installer: further reduce dependency calculations 2021-03-10 17:09:14 +00:00
Bo Anderson
31a4989358
Merge pull request #10792 from Bo98/fi-less-dep-comp
formula_installer: reduce dependency expansion computations
2021-03-08 14:03:55 +00:00
Bo Anderson
96670cedb2
formula_installer: reduce dependency expansion computations 2021-03-08 13:12:12 +00:00
Mike McQuaid
761404a2dc
formula_installer: tweak "no bottle available" logic.
- ensure that `HOMEBREW_DEVELOPER` still fails when there's a bottle
  available but the `pour_bottle?` block fails. This is usually due to
  the CLT being missing (and it's removed on even patch macOS upgrades)
  so building from source without prompt is undesirable.
- require `--build-from-source` for dependencies that aren't already
  installed
- do these bottle checks before fetching dependencies (they were already
  done before fetching requested formulae)

Fixes #10729
2021-03-05 12:06:34 +00:00
Steve Peters
e3505247cb
formula_installer: fix typo in install_dependency
The linked_keg variable is referenced outside the block where
it is defined; I think it should be the installed_keg variable.
2021-03-02 01:16:55 -08:00
Bo Anderson
6cd1e5e384
Avoid passing around a massive $LOAD_PATH.
Portable Ruby crashes if the $LOAD_PATH gets too big.
2021-02-26 18:23:48 +00: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
22e591e531
Make HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK default
- Remove `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK` and make the behaviour
  the default. We mostly already do this since we added the need for
  the `--build-from-source` override on macOS. This allows us to
  delete some more code.
- Still fail and require `--build-from-source` when reinstalling or
  upgrading if failing on a formula-specific reason e.g. the CLT is
  not/no longer installed, you're using a non-default prefix.

Fixes #10623
2021-02-17 13:51:53 +00:00
nandahkrishna
8e5451df2f
style: use parentheses for assignment in conditions 2021-02-12 18:33:37 +05:30
EricFromCanada
6fc116318e fixes for grammar and wording 2021-01-26 16:19:47 -05:00
EricFromCanada
99ad3350ee use single quotes around stanza and parameter names 2021-01-26 16:19:47 -05:00
EricFromCanada
cd3cb6928b indent suggested commands on subsequent line
and combine sequential puts calls
2021-01-26 15:36:44 -05:00
EricFromCanada
f5e1557154 use ofail to set Homebrew.failed 2021-01-26 15:36:43 -05:00
hyuraku
e6eeb2cbed delete HOMEBREW_REPOSITORY & some variables 2021-01-27 00:29:43 +09:00
Seeker
b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
carlocab
beeb7faaba
formula_installer: tweak no-bottle error message
Follow up to #10183.

This improves the error message displayed when `formula.pour_bottle?` is
false.

Before:

    ❯ brew install python@3.8
    Error: python@3.8: no bottle available!
    The bottle needs the Apple Command Line Tools to be installed.
      You can install them, if desired, with:
        xcode-select --install
    You can try to install from source with e.g.
      brew install --build-from-source python@3.8
    Please note building from source is unsupported. You will encounter build
    failures with some formulae. If you experience any issues please create pull
    requests instead of asking for help on Homebrew's GitHub, Twitter or any other
    official channels.

After:

    ❯ brew install python@3.8
    Error: python@3.8: the bottle needs the Apple Command Line Tools to be installed.
      You can install them, if desired, with:
        xcode-select --install
    You can try to install from source with e.g.
      brew install --build-from-source python@3.8
    Please note building from source is unsupported. You will encounter build
    failures with some formulae. If you experience any issues please create pull
    requests instead of asking for help on Homebrew's GitHub, Twitter or any other
    official channels.
2021-01-04 15:53:50 +00:00
Mike McQuaid
cc50307aca
formula_installer: use existing no bottle text. 2020-12-31 13:09:35 +00:00
carlocab
2dedca337e
formula_installer: improve no-bottle error message
Closes #10180.
2020-12-31 01:11:44 +00:00
Mike McQuaid
07f9f6c42c
formula_installer: only require --build-from-source on macOS. 2020-12-28 08:47:05 +00:00
Mike McQuaid
2777369da7
formula_installer: exclude more from build-from-source warning.
We should only complain when installing requested formulae that aren't
currently installed.
2020-12-18 14:56:01 +00:00
Mike McQuaid
0bbf965807
More bottling HOMEBREW_LIBRARY changes
- Refuse to create bottles which have non-relocatable references to
  `HOMEBREW_LIBRARY`. This allows us to make all bottles ignore where
  `HOMEBREW_REPOSITORY` is (even those that aren't `cellar :any`).
  I cannot see any circumstances in which any bottle should link to
  anything within `HOMEBREW_REPOSITORY`.
- Remove audit that becomes unnecessary given the above change.
- Relocate references to `@HOMEBREW_LIBRARY@` but don't actually write
  any references yet. This will allow us to move to using
  `@HOMEBREW_LIBRARY` and remove all relocation of `HOMEBREW_REPOSITORY`
  in a future release (2.7.1, most likely).
2020-12-18 13:50:10 +00:00
Mike McQuaid
79eeb00d0c
Merge pull request #10030 from MikeMcQuaid/formula_installer_pour_bottle
formula_installer: refactor pour_bottle?
2020-12-16 15:19:34 +00:00
Mike McQuaid
7fd716ff66
formula_installer: refactor source build messages. 2020-12-16 12:38:52 +00:00
Francois-Xavier Coudert
4db1c1a00f
Do not build from source on ARM unless explicitly requested 2020-12-16 11:45:51 +00:00
Mike McQuaid
fc9ad05ad5
formula_installer: refactor pour_bottle?
Use a better keyword argument rather than passing a hash.
2020-12-16 09:01:06 +00:00
Shaun Jackman
33483e9478 Fix install --force-bottle for non-standard prefix
Fix the error:
Error: undefined method `stage' for nil:NilClass
formula_installer.rb:1132:in `block in pour'
2020-12-15 00:04:36 -08:00
Mike McQuaid
eb74717a9e
Fix unbottled dependency handling
- Rename `BuildToolsError` to `UnbottledError` to better reflect what it
  does (particularly now)
- Improve the `UnbottledError` messaging
- Raise the `UnbottledError` for dependencies also when building bottles
  (so that we don't try and build bottles against things that have been
  built from source).
2020-12-11 16:57:47 +00:00
Mike McQuaid
0f9bad0052
Fix bottle prefix and repository handling
We were previously only looking at the `cellar` value when pouring
bottles and ignoring the `prefix` and (implicit) `repository`.

Actually look at these values and set the defaults for each platform.

Also, when we're relocating to create or pour bottles when `prefix`
and `repository` are equal then skip relocating the `repository` and
always use references to the `prefix` instead.

Fixes #9453
2020-12-09 13:53:10 +00:00
Mike McQuaid
9216d8abe6
rubocop-rails: make fixes. 2020-12-02 10:43:04 +00:00
Markus Reiter
7d9758a05e Fix RuboCop offenses. 2020-11-30 22:50:15 +01:00
Jonathan Chang
ce67dc3e63 formula_installer: fix type for fetch_dependency
This receives a Dependency, not a Formula.
2020-11-20 22:09:59 +11:00
Markus Reiter
7c5d8a5288 Refactor FormulaInstaller. 2020-11-18 09:30:11 +01:00
Markus Reiter
a014f65e41 Fix type checking errors. 2020-11-18 04:21:41 +01:00
Markus Reiter
1b732ec7b2 Fix RuboCop offenses. 2020-11-16 02:05:29 +01:00
Rylan Polster
50890ebd51 fix Lint/DuplicateBranch style 2020-11-16 02:02:52 +01: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