985 Commits

Author SHA1 Message Date
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
Mike McQuaid
746e7000e3
Improve --force-bottle behaviour.
- set `Formula#force_bottle` from `FormulaInstaller`
- refuse to install non-bottled formulae with `--force-bottle`
- raise exceptions on fetch/pour failures if `--force-bottle is passed.

While we're here:
- use `CannotInstallFormulaError` for some `RuntimeError`/`odie`

Fixes https://github.com/Homebrew/brew/issues/8866.
2020-11-06 11:25:31 +00:00
Mike McQuaid
dcba99c7d1
Revert "Revert "Improve @-versioned formulae linking."" 2020-11-02 11:20:09 +00:00
Shaun Jackman
099af8cf9c
Revert "Improve @-versioned formulae linking." 2020-10-30 10:40:10 -07:00
Mike McQuaid
849034c368
Improve @-versioned formulae linking.
The way we currently handle @-versioned formulae linking is pretty
labourius:
- it requires extensive use of `link_overwrite` to avoid the `link`
  stage failing on certain install/upgrade scenarios
- we teach people to use `brew link --force` whenever they wish to
  link a versioned formulae when it's pretty obvious what's expected
  in that situation

Instead, let's:
- automatically unlink other versioned formulae when linking a
  versioned formula (either through `brew link` or `install`/`upgrade`
  /`reinstall`)
- notify the user what we've done (with the same messaging as if
  they had run `brew link` manually)
2020-10-29 13:35:03 +00: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
Rylan Polster
42d75c2787 formula_installer: fix forbidden license check
Convert forbidden licenses to a string before duplicating to have empty
strings instead of `nil`.
2020-10-22 15:15:56 -04:00
Rylan Polster
b06bcf3db1 formula_installer: unfreeze forbidden licenses string 2020-10-22 11:22:06 -04:00
Rylan Polster
24523f8225 utils/spdx: allow other license symbols 2020-10-22 10:01:40 -04:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Rylan Polster
a8bcd92628 deprecate_disable: refactor and add to info 2020-09-07 13:00:02 -04: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
Rylan Polster
e7cf1f4497 fix deprecate! and disable! message 2020-08-31 12:45:55 -04:00
Rylan Polster
4d0a1ff775 deprecate!, disable!: allow symbols for reason 2020-08-31 10:11:08 -04:00
Rylan Polster
689d7eb8f0 disable!, deprecate!: add reason 2020-08-27 10:42:57 -04:00
Markus Reiter
528122638c Document FormulaInstaller. 2020-08-26 03:13:58 +02:00
Mike McQuaid
dbe427073d
Merge pull request #8399 from MLH-Fellowship/migrate-to-args-named
args: Migrate usage of args loading methods to args.named
2020-08-25 10:07:27 +01:00
William Ma
fa7bd3bff6 args: Migrate usage of args loading methods to args.named 2020-08-23 09:02:20 -04:00
Markus Reiter
3118fedab9 Refactor and document Git. 2020-08-23 06:40:07 +02:00
Dawid Dziurla
c8c2e38bcb
Consistently use HOMEBREW_RUBY_WARNINGS when calling ruby
Adding this in `dev-cmd/ruby.rb` allows us to suppress warnings like:
```
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/language/python.rb:8: warning: Insecure world writable dir /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/scm in PATH, mode 040777
```
2020-08-20 14:59:58 +02:00
Rylan Polster
60ec30d41e formula: update license specification 2020-08-19 12:48:50 -04:00
Markus Reiter
7fce76d176 Refactor and document Install. 2020-08-17 19:17:18 +02:00
Markus Reiter
490e503b1b Replace Homebrew.args with Context. 2020-08-06 16:13:14 +02:00
Markus Reiter
bace9ecc34 Pass verbose? to Formula#verify_download_integrity. 2020-08-06 16:13:14 +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
Markus Reiter
75a692d08b Make ohai, oh1 and odebug use #debug? and verbose? of the current object when possible. 2020-08-06 16:12:52 +02:00
Markus Reiter
add10377b8 Pass debug? and verbose? to Cleaner. 2020-08-06 16:12:52 +02:00
Mike McQuaid
fb0268da7e
license: handle "Public Domain".
Allow `:public_domain` to be used as a `license` value and ensure that
it's handled correctly by `brew info`, `brew audit` and `brew install`.
2020-08-04 10:47:41 +01: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