954 Commits

Author SHA1 Message Date
Douglas Eichelberger
e574904cb7 Use each_with_object 2024-01-22 10:52:43 -08:00
Douglas Eichelberger
2f8ad2f5e6 Inline index_by 2024-01-22 10:52:43 -08:00
Douglas Eichelberger
ffd761d2e9 Create dedicated Attrable mixin for attr_ methods 2023-12-28 11:46:27 -08:00
Rylan Polster
6431822e7b
Apply feedback 2023-12-16 20:18:35 -05:00
Rylan Polster
641a80475e
Update cask logic to handle deprecations and disables 2023-12-16 20:01:47 -05:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
Bo Anderson
19f27f9a20
Store and use revision, where possible, in tab runtime dependencies.
Let's start storing `revision` and `pkg_version` for tab runtime
dependencies and use them when available.

When the `revision` is not available, use a conservative approach to
deciding whether dependencies need to be upgrade.

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-11-10 18:24:43 +00:00
Douglas Eichelberger
ca90f9866a Resolve type error 2023-11-05 12:18:31 -08:00
Eric Knibbe
0f76ade06b
formula_installer: pre-install implicit dependencies 2023-10-18 10:29:41 -04:00
apainintheneck
85bd4c7e1f utils/backtrace: scrub sorbet-runtime from backtrace
Ever since we started using this at runtime it's been polluting
the backtrace output. This makes it harder to debug errors and
increases the amount of info users have to paste into the box
when filing an issue.

This is a very direct approach. Essentially, we strip out
everything related to the `sorbet-runtime` gem whenever the top
line in the backtrace is unrelated to sorbet-runtime.

The hope is that this will allow errors related to sorbet to
be diagnosed easily while also reducing the backtrace size
for all other types of errors.

Sometimes it is useful to see the full backtrace though.
For those cases, we include the full backtrace when
`--verbose` is passed in and print a warning that the
Sorbet lines have been removed from the backtrace the
first time they are removed.

Note: This requires gems to be set up so that the call to
`Gem.paths.home` works correctly. For that reason, it must
be included after `utils/gems` which is included in
`standalone/load_path` already.
2023-09-21 21:07:22 -07:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
Mike McQuaid
8b6e1f33da
formula_installer: don't ignore deps when fetching and pouring bottles.
Otherwise, we can try to pour bottles that haven't been downloaded yet.

Possible fix for #15957.
2023-09-05 08:24:50 -04:00
Mike McQuaid
72ded32393
upgrade: more liberal formula upgrade changes.
Download the bottle manifests for the potential formulae we are going to
upgrade and, if they are have all their `runtime_dependencies` versions
currently met, don't try to download the bottle or upgrade the formula.
2023-09-04 22:18:55 -04:00
Mike McQuaid
3aba32a68b
formula_installer: handle another exception in fetch_bottle_tab.
Fix another way that fetching a bottle tab can fail. This pretty much
only happens in CI.

Addresses https://github.com/Homebrew/homebrew-core/pull/141362#issuecomment-1705327027
2023-09-04 12:33:21 -04:00
Mike McQuaid
9fcdaa2b85
Make formula upgrades more liberal based on bottle
When we're installing a formula from a bottle, we currently always
upgrade all dependencies in the dependency tree to be safe.

However, if we're installing a bottle and the `runtime_dependencies`
within that bottle's tab all have older or equal versions to those
already installed: we do not need to upgrade these dependencies.

This should help a lot of upgrading a lot of the time, at least for
users using bottles (which is the huge majority).

The only downside or other noticeable change is that this requires us
to download or attempt to download the bottle tab before we compute
the dependencies at installation time.

Co-authored-by: Kevin <apainintheneck@gmail.com>
2023-09-03 15:07:48 -04:00
Mike McQuaid
8430acf7ba
formula_installer: improve a comment.
Based on:
https://github.com/Homebrew/brew/pull/15778#discussion_r1294477218
2023-08-15 14:44:35 +01:00
Mike McQuaid
d7268aeb18
Merge pull request #15778 from Bo98/dep-source-fix
formula_installer: use cached fetched formula instance when available
2023-08-15 11:37:26 +01:00
Mike McQuaid
7801878c74
post_install: improvements and fixes.
- warn if running `brew postinstall` explicitly and there's no
  `post_install` defined in the formula
- add a `post_install` alias for `brew postinstall` to make life
  easier for those jumping between `postinstall` and `post_install` in
  e.g. Homebrew development
- refactor `post_install` formula path logic into a new method for
  improved readability
- handle the JSON API `post_install` formula path case
2023-07-28 11:26:09 +01:00
Bo Anderson
dcbdc73c45
formula_installer: use cached fetched formula instance when available 2023-07-28 02:12:09 +01:00
Bo Anderson
beaa6c32a0
Fix cases of core taps being unnecessarily installed 2023-07-13 20:33:31 +01:00
Bo Anderson
8dc2e80a98
Significantly improve install speeds with smarter postinstall detection 2023-06-22 03:06:45 +01:00
Bo Anderson
f1d3700744
formula_installer: fix postinstall using incorrect formula file 2023-06-19 03:43:26 +01:00
Markus Reiter
e9bfcb9296
Merge pull request #15225 from reitermarkus/audit-os-arch
Add `--os=all` and `--arch=all` options for `brew audit`.
2023-05-19 15:03:32 +02:00
Kevin
946478aed4
Merge pull request #15396 from apainintheneck/custom-service-name
Custom service name
2023-05-17 22:09:31 -07:00
Markus Reiter
486c3765ce
Add --os=all and --arch=all options. 2023-05-17 15:26:46 +02:00
Markus Reiter
f60612e6b2
Add Formula#loaded_from_api?. 2023-05-15 13:58:33 +02:00
apainintheneck
1111706378 service: add custom service name DSL
The main thing is that this DSL allows us to provide an
interface that can be serialized to the JSON API.

Changes:
- Homebrew::Service
  - Adds `#service_name` and `#plist_name` methods
    - Each is now included in the `#serialize` method as well
  - Eval block on instantiation
    - Before we lazy evaluated this but the cost is not significant
      and it complicated the code a bunch. This only gets called
      during install, when evaluating caveats and in the `brew service`
      command. It skips this evaluation if the service block isn't there.
  - Add `#command?` helper to avoid `#command.blank?` and `#command.present?`
- Formula
  - `#service` now returns a service whenever it's called. This call is
    hidden behind a call to `#service?` most of the time anyway so this
    should be fine.
  - `#plist_name` and `#service_name` now call the methods of the same name
    on the service class. This should have already been in the service object
    to begin with and keeping these methods here helps preserve backwards
    compatibility with people who were overwriting these methods before.
- Caveats
  - Prefer `service#command?`
  - Add helpers for checking on service commands
    - This duplicates some of the work in `brew services`. Maybe we should
      merge that repo in at some point.
  - Check for installed service at `#plist_name` or `#service_name`. I think
    this should be used instead of `Keg#plist_installed?` which checked for any plist file.
    We should think about deprecating `#plist_installed?` in the future.
  - Stop using `ps aux | grep #{formula.plist_name}` to check for service files
    because it was inaccurate (it always returns true on my machine) because the grep
    process is started before the ps process.
  - Note: The behavior is the same as it was before. This means that caveats
    only show up for custom service files on install or if they're already installed.
    Otherwise it won't show up in `brew info`. This is because it has to check
    first if the service file has been installed.
- Utils::Service
  - Add utils for evaluating if a service is installed and running. This duplicates
    some of the work already found in `brew services`. We should seriously consider
    merging `brew services` with the main brew repo in the future since it's already
    tightly coupled to the code in the main repo.
- Formulary.load_formula_from_api
  - Be more explicit about which types can be deserialized into run params since
    it is now possible for run params to be nil.
- Update and add tests
2023-05-13 14:53:01 -07:00
Bo Anderson
289fb5b393
tab: fix typing of versions 2023-05-11 12:33:27 +01:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Douglas Eichelberger
1c411f6086 Code review changes 2023-03-26 08:57:39 -07:00
Douglas Eichelberger
7720485f40 Enable types in Formula files 2023-03-25 08:50:06 -07:00
Mike McQuaid
95a8c3f638
Add brew install --skip-post-install
Will be needed by `brew test-bot`.
2023-03-23 15:22:27 +00:00
Mike McQuaid
4d8445e29d
analytics: improve InfluxDB cardinality
- roll InfluxDB token (we need to report to a new bucket to fix implicit schema)
- adjust various parameters
- separate default tags and fields
- send more fields and fewer tags (tags should have low cardinality)
- use `--data-binary` to match InfluxDB documentation
- document second precision for greater InfluxDB performance
- pass through tap name, formula/cask name, options separately
- pass `devcmdrun` as a tag
- avoid sending very high-cardinality `OS_VERSION` values
2023-03-20 15:26:47 +00:00
Bo Anderson
e663f532a6
Checksum Ruby source file downloads 2023-02-22 22:50:24 +00:00
Issy Long
298bb65dfb
rubocop: Entirely disable Metrics cops
- These are arbitrary length limits that had a load of disables in code.
- The limits were only increasing over time rather than decreasing.
- Fixing the problematic code to be shorter would take a long time for
  questionable gain since the problem has been around so long.
2023-02-21 00:34:17 +00:00
Mike McQuaid
aaec4014fd
Merge pull request #14710 from issyl0/rubocop-excludes
rubocop: Clean up some `Exclude`s
2023-02-20 09:51:11 +00:00
Issy Long
f8654bd363
rubocop: In-line disables of Metrics/{Module,Block,Class}Length
- We're not going to make the really long things be any shorter any time soon.
- The instructions in issue 14685 say, pragmatically, "disable all the rubocop
  rules we're never going to realistically fix e.g. Metrics/ClassLength". But
  that felt like a slippery slope to more _really_ long modules/classes/blocks,
  and the limits are here for a reason.
2023-02-19 16:33:23 +00:00
Mike McQuaid
fbdec8738d
Warn more when building from source
We warn sometimes when we tell people to build from source and it's
not supported but we don't actually warn non-developers when invoking
the various install commands so: let's start doing so.

While we're here, also update the existing messaging to reflect the fact
we're on Mastodon now too and we don't want maintainers being
individually bothered about errors either.

I've tried to balance having messages here vs. having them be so long
at the beginning of installation that they will be missed or be overly
obnoxious.
2023-02-17 16:10:38 +00:00
Bo Anderson
433631ad60
formula_installer: fix resource fetching for source builds under API 2023-02-17 04:26:45 +00:00
Sean Molenaar
50e9247da4
fix: add better keys and fuller values to influxDB analytics 2023-02-15 14:12:05 +01:00
Bo Anderson
7ef0c48362
Fix analytics handling when core/cask taps are untapped 2023-02-15 05:31:08 +00:00
EricFromCanada
dfc9906184
internal messaging fixes 2023-02-10 23:17:16 -05:00
Mike McQuaid
6b4363092d
Revert "Merge pull request #14548 from Homebrew/revert-14382-deprecate-disable-remove"
This reverts commit 932d2cf3b77c9439a57b6a43577fc8d3b6399a62, reversing
changes made to f4e60482791d2ff628efadfdbf0d14d9237d2d29.
2023-02-07 19:25:51 +01:00
Mike McQuaid
6882ac17e7
Revert "Add deprecations and disables" 2023-02-07 15:13:19 +01:00
Bo Anderson
2055792791
Better support source builds under API mode 2023-02-06 13:27:36 +00:00
Mike McQuaid
a086fcd293
Merge branch 'chore/formula/deprecate_plist_options' into deprecate-disable-remove 2023-02-03 10:51:06 +00:00
Sean Molenaar
f67d4c4ed6
chore: deprecate plist_options in formula 2023-02-01 17:44:36 +01:00
Mike McQuaid
97def3c104
install: better error when using API and --HEAD.
- Tell people what to do to resolve this
- Tweak the instruction ordering to be consistent elsewhere
2023-01-26 11:08:56 +00:00