69 Commits

Author SHA1 Message Date
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Rylan Polster
acd60181c2
Add cask install receipts 2024-07-04 01:47:13 -04:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Markus Reiter
c76170a456
Hide #to_s in docs. 2024-04-26 14:04:55 +02:00
Markus Reiter
4b432c7ea4
Explicitly mark non-private APIs. 2024-04-22 21:16:49 +02:00
Bo Anderson
bb0252875e
utils/bottles: fix outdated bottle check 2024-03-30 03:29:51 +00:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Mike McQuaid
176095a826
utils/bottles: tweak syntax. 2024-01-30 17:15:13 +00:00
Arian Faurtosh
9088cf9be0 Fixes openjdk_dep_name_if_applicable when not using CurlGitHubPackagesDownloadStrategy
When installing a formula, `FormulaInstaller` calls `#pour`, which in turn calls:

6f20c0300a/Library/Homebrew/formula_installer.rb (L1260)

This `tab` is expected to have `#runtime_dependencies`, and it typically will because most packages come from http://ghcr.io

6f20c0300a/Library/Homebrew/utils/bottles.rb (L111)

Any `DownloadStrategy` that does not match `CurlGitHubPackagesDownloadStrategy` will lead here:
6f20c0300a/Library/Homebrew/software_spec.rb (L463)

Causing this branch to be executed for creating the `tab`:
6f20c0300a/Library/Homebrew/utils/bottles.rb (L119)

This causes a slight issue because `openjdk_dep_name_if_applicable` calls `keg.runtime_dependencies` when it's still `nil`.

6f20c0300a/Library/Homebrew/keg_relocate.rb (L134-L140)

And if it's blank, it won't do the regex replacement on `@@HOMEBREW_JAVA@@`, resulting in the following error when running `Kafka`:

```console
$ tail -f /opt/homebrew/var/log/kafka/kafka_output.log
/opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: No such file or directory
/opt/homebrew/Cellar/kafka/3.6.0/libexec/bin/kafka-run-class.sh: line 346: exec: /opt/homebrew/@@HOMEBREW_JAVA@@/bin/java: cannot execute: No such file or directory
```

As mentioned by: https://github.com/orgs/Homebrew/discussions/2530#discussioncomment-2002374

> Installing Java-dependent formulae from bottle mirrors doesn't work properly at the moment. The issue is that brew needs the manifest in order to correctly replace @@HOMEBREW_JAVA@@ but brew only knows how to fetch manifests from ghcr.io.
> Pull requests to fix this welcome.

This should fix this issue, by getting the `runtime_dependencies` directly from the formula for those cases that it can't get it from https://ghcr.io or tabfile

```ruby
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
tab.runtime_dependencies = Tab.runtime_deps_hash(formula, f_runtime_deps)
```
2024-01-29 15:57:55 -08:00
Douglas Eichelberger
3abbf4447e Some minor regexp match perf improvements 2023-12-27 13:16:36 -08:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Douglas Eichelberger
75179e9239 brew style --fix 2023-11-05 12:18:31 -08:00
Douglas Eichelberger
0191af7899 resolve typecheck errors 2023-11-05 08:55:58 -08:00
Bo Anderson
de83bc69e0
Implement equality functions for BottleSpecification 2023-10-23 16:17:31 +01:00
Bo Anderson
0c08a3cccb
Improve performance of Formula#to_hash 2023-09-28 14:07:25 +01:00
Markus Reiter
486c3765ce
Add --os=all and --arch=all options. 2023-05-17 15:26:46 +02:00
Markus Reiter
4c3e8255cf
Compare Tag using standardized_arch. 2023-05-13 22:19:35 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Carlo Cabrera
9b369871e6
Revert "utils/bottles: fix typechecking error"
This reverts commit 071f6069d2cff272eaa9404f836cb1254c4fb588.
2023-05-08 21:43:12 +08:00
Carlo Cabrera
071f6069d2
utils/bottles: fix typechecking error
https://github.com/Homebrew/homebrew-core/actions/runs/4915420737/jobs/8777887066?pr=130438#step:5:27
2023-05-08 21:07:58 +08:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Issy Long
e9d994622e
rubocop: Drop "f" from Naming/MethodParameterName allowlist
- This either stands for "file" but more often than not "formula".
2023-03-11 00:17:27 +00:00
Rylan Polster
f3e34230ad
Add --variations option to brew info 2022-07-21 16:41:15 +02:00
Rylan Polster
eab3d077bc
Improvements 2022-07-21 15:32:51 +02:00
Bo Anderson
cd73e6bac5
Introduce more Ruby constants for values set by brew.sh 2022-06-17 19:47:57 +01:00
Bo Anderson
eb360dbbb0
utils/bottle: fix local JSON handling for bottle rebuilds 2021-09-27 03:44:33 +01:00
Bo Anderson
b55498269f
Revamp APIs around bottle specifications 2021-09-20 15:02:05 +01:00
FnControlOption
b9fc4e36f0 fetch: fix --bottle-tag when unbottled on host system 2021-08-26 14:44:53 -07:00
Mike McQuaid
b914411ac8
Delete Bintray code
Remove all code related to Bintray. It no longer works so there's no
point keeping it around.

Some of this could arguably be deprecated/disabled first/instead but:
I'm not sure I see the sense in keeping stuff around that's known to be
broken.
2021-05-12 13:37:18 +01:00
Bo Anderson
33e1255f65
formula_installer: write tab when pouring local --only-json-tab bottles 2021-05-11 14:28:12 +01:00
Mike McQuaid
b57fe84f81
Use long/readable tar flags.
Also, use `--no-same-permissions` instead of `-o` (which does nothing
without `-p` being passed and run as `root`) for the more explicit
description of the behaviour we want.
2021-04-16 14:05:06 +01:00
Mike McQuaid
96cd1c058e
utils/bottles: tweak/improve some of the API. 2021-04-16 14:05:05 +01:00
Bo Anderson
635e58e9aa
software_spec: fix bottle domain fallback handling 2021-04-15 19:24:25 +01:00
Mike McQuaid
75592cbebc
Better handle brew bottle --only-json-tab bottles
- test them in `brew test-bot` (before we do so in homebrew/core)
- don't fail if we cannot find the tab/install receipt in a bottle
- cache listing the files in a bottle so we don't do it more times than
  necessary
- fix resolution of version and formula names from a bottle if we're
  getting them from a bottle without a tab/install receipt

This will need to be in a tagged release before we can ship tab-less
bottles to users.
2021-04-13 14:26:31 +01:00
Mike McQuaid
0cb1645d25
bottles: support :all tag.
This allows the creation of bottles which will be used by any macOS
version, architecture or OS (i.e. macOS or Linux).

Add `TODO` stubs for where the bottle generation logic should be
implemented.
2021-04-09 09:50:16 +01:00
Mike McQuaid
6b5213286c
Rename "exact" tag match to "no_older_versions"
This is more specific about the behaviour we want to have in future.
2021-04-09 09:36:18 +01:00
Bo Anderson
20d86c0185
Refactor some tag handling into a Utils::Bottles::Tag class 2021-04-08 17:23:57 +01:00
Mike McQuaid
c8aea8653a
utils/bottles: remove unused method. 2021-04-01 17:37:15 +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
fb8b247db3
dev-cmd/unbottled: various improvements
* Ignore bottles for older macOS versions
* Ignore disabled formulae
* Ignore formulae which can't build on the chosen macOS
* Improve/fix sort description
2021-02-23 16:27:58 +00:00
Michka Popoff
3eea1434cc bottle: tag specific cellars 2021-01-19 10:14:25 +01:00
Seeker
b9854bd4cf rubocops: add unless_multiple_conditions 2021-01-08 10:33:54 -08:00
Seeker
24636d8bea utils/ast: cleanup
- move `add_bottle_stanza!` from `Utils::Bottles` to `Utils::AST`
- add `replace_bottle_stanza!`
- simplify parameters
2020-12-29 03:40:39 -08:00
Seeker
aaf7bc2bc5 utils: add AST helper functions for editing formulae 2020-12-22 22:05:23 -08:00
Mike McQuaid
323fec5032
utils/bottles: install bundler gems if necessary. 2020-12-11 12:26:45 +00:00
Seeker
b8aa67be5b bottle: add bottle stanza by traversing AST 2020-12-10 13:38:57 -08: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
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00