329 Commits

Author SHA1 Message Date
Carlo Cabrera
10edae9b94
Merge pull request #11644 from carlocab/cpuid-check
formula_cellar_checks: check for `cpuid` instruction when needed
2021-07-06 06:29:27 -07:00
Carlo Cabrera
c59a42b24e
formula_cellar_checks: check for cpuid instruction when needed
This implements the second audit discussed in #11608.
2021-07-04 00:31:31 +01:00
Carlo Cabrera
d88576a89b
keg, cmd/--prefix: handle python3.10 2021-07-03 23:33:09 +01:00
nandahkrishna
f7f9433443
Keg.find_some_installed_dependents: move to installed_dependents.rb 2021-02-12 01:42:17 +05:30
nandahkrishna
56ebffff7a
Refactor code to find dependents of kegs 2021-02-10 11:41:48 +05:30
nandahkrishna
7965ad6160
cmd/uninstall: check for dependent casks 2021-02-09 08:47:11 +05:30
EricFromCanada
6fc116318e fixes for grammar and wording 2021-01-26 16:19:47 -05:00
Mike McQuaid
15761a283d
cleanup: raise failures and handle later.
These are already handled and outputted as a group in `cmd/cleanup.rb`.

Fixes https://github.com/Homebrew/brew/issues/10379
2021-01-21 13:03:52 +00:00
hyuraku
beccc857e1 cmd/keg: refactor to use keyword arguments 2021-01-15 20:15:40 +09:00
Mike McQuaid
1857dfcd2e
keg: check that alias path exists before checking realpath.
Otherwise this can be a broken symlink which will raise an exception:
https://github.com/Homebrew/homebrew-core/runs/1704569542?check_suite_focus=true#step:6:47
2021-01-15 08:58:06 +00:00
Mike McQuaid
128aeba3a4
Keg: fix alias and versioned symlink handling.
Previously, `brew upgrade gcc@10` could get overzealous and remove the
`LinkedKeg` record for `gcc@9`. This is bad because we then think
`gcc@9` is unlinked when it is not and it causes a tonne of conflicts
when trying to link `gcc@9` again.

Instead, fix up the alias and versioned alias cleanup to be more
precise and only delete the symlinks that point to the current `rack`,
`opt_record` or `linked_keg_record` and unify the logic so it's
performed consistently.

While we're here:
- don't `remove_old_aliases` every time we try to unlink a directory
  but just perform it once per `unlink` operation
- remove the linked keg record on `uninstall`
2021-01-14 16:02:06 +00:00
Mike McQuaid
17a073b6cc
Revert "Keg: allow overwriting same-formula conflicts" 2021-01-14 12:04:59 +00:00
Misty De Meo
a2e0da89e4 Keg: only instantiate Keg.for if target exists 2021-01-13 12:18:49 -08:00
Mike McQuaid
66f0a35587 keg: remove trailing whitespace. 2021-01-13 12:18:49 -08:00
Mike McQuaid
e01fa7d2ae keg: tweak retry comment. 2021-01-13 12:18:49 -08:00
Misty De Meo
53fe6b518f Keg: allow overwriting same-formula conflicts
This is weird. We're seeing some installs where formulae
have no opt prefix and no linked keg record, *but* still
ended up linked into the prefix. Upgrades will blow up in
this case because the old symlinks won't get deleted and
Homebrew will report a nonsensical error message about
not being able to link over another link from the same
formula!

Since the optpath is either missing or pointing to the
wrong destination at this point, the checks for conflict
linking above will have failed. We should instead be safe
to simply blow away these conflicting symlinks and replace
them with the new targets.

Fixes https://github.com/Homebrew/homebrew-core/issues/68866.
2021-01-13 12:18:49 -08:00
Mike McQuaid
7c56fa9caf
linkage: correctly detect missing kegs.
- manually `raise Errno::ENOENT` to ensure that a keg that doesn't exist
  isn't flagged as a system dependency.
- remove the inconsistent and incorrect summary messaging.
2020-11-27 13:12:09 +00: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
EricFromCanada
3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
EricFromCanada
dddfbf80fc apidoc: add/update yard tags 2020-11-06 00:16:35 -05:00
EricFromCanada
d293431b87 apidoc: update URLs 2020-11-05 23:50:55 -05:00
Mike McQuaid
488a43ecd7
Merge pull request #9027 from Homebrew/revert-9016-revert-9009-improve-versioned-linking
Improve @-versioned formulae linking.
2020-11-02 14:33:32 +00:00
Mike McQuaid
b54b022f73
Keg.for: handle non-existent path.
Otherwise `path.realpath` will raise `Errno::ENOENT` rather than the
expected `NotAKegError`.

Fixes https://github.com/Homebrew/brew/issues/9015
2020-11-02 12:56:59 +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
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Mike McQuaid
fb4d08a49a Fix brew style 2020-09-11 10:29:22 +01:00
Mike McQuaid
8b97c27c21 brew style manual fixes 2020-09-01 14:26:45 +01:00
Markus Reiter
6a364c9e1f Document Keg. 2020-08-26 03:13:58 +02:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
Markus Reiter
6c964d4a78 Pass verbose? to Keg#link, Keg#unlink and Keg#optlink. 2020-08-06 16:12:52 +02:00
William Ma
3bbffdd1d7 commands: Print cask commands 2020-07-20 13:18:09 -04:00
Mike McQuaid
cae099bb2c
Merge pull request #7957 from MikeMcQuaid/keg-refactoring
keg: general cleanup.
2020-07-10 12:57:35 +01:00
Mike McQuaid
66230fa842
keg: delete more alias LinkedKegs symlinks.
We don't actually care what it points to because we shouldn't have
LinkedKegs around for aliases at all (unlike `opt` links).
2020-07-09 16:37:23 +01:00
Mike McQuaid
dfbc09c12f
keg: general cleanup.
Some refactoring while doing #7956.
2020-07-09 14:21:14 +01:00
Mike McQuaid
386747c733
keg: unlink alias linkedkegs.
We did these for opt symlinks already but not linkedkegs.
2020-07-09 14:17:27 +01:00
Mike McQuaid
ac0665daff
Refer to default branch in links with HEAD
Anywhere we can use `blob/master` we can use `blob/HEAD` instead. This
will make life easier if we ever rename our default branch in future
(once/if Git and GitHub provides the necessary tooling to do so).
2020-06-25 11:38:40 +01:00
Mike McQuaid
12bdb38663
rubocop: brew style --fix autocorrections. 2020-05-12 08:32:27 +01:00
Mike McQuaid
b4b17fa892
keg: handle more exceptions on uninstall.
Fixes https://github.com/Homebrew/brew/issues/7110
2020-03-04 14:17:08 +00:00
Gautham Goli
acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
Mike McQuaid
eeb9ac36a2
keg: cache runtime_dependencies. 2019-11-06 10:04:13 +00:00
Steven Peters
20e85acec4 keg: uniq.sort -> sort.uniq 2019-10-21 12:29:37 -07:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
7193229b42
Auto-fix Layout/CommentIndentation offenses 2019-10-13 16:04:33 +01:00
Issy Long
341ea60807
Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
Mike McQuaid
4759ffb88f
reinstall: handle remove/rename permission errors. 2019-05-24 16:46:54 +01:00