122 Commits

Author SHA1 Message Date
apainintheneck
3c503cdf56
Normalize service serialization method names 2024-02-04 13:50:57 +01:00
Bo Anderson
5692c8ecbf
Fix style violations under newer RuboCop 2023-12-14 05:47:12 +00:00
apainintheneck
5760ae4fb2 cmd/readall: Cleanup todos
- keep running the command against all os/arch combinations
  as the default
- remove todos and deprecations related to changing the behavior
- create constants for os/arch combinations
2023-09-19 21:33:13 -07:00
Douglas Eichelberger
5d5c22e104 Replace integration test with unit test 2023-08-07 18:32:08 -07:00
Mike McQuaid
b3c33d34ab
Various sharding fixes
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
  `Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
  efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions

Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-08-04 16:43:13 +01:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Mike McQuaid
229a1f6c1e
Remove Tap#versioned_formula_files
This doesn't work with the API and the single caller can be
refactored to not need it instead.
2023-07-05 16:28:44 +01:00
Mike McQuaid
b3015701f6
dependency: use formula name.
This allows renamed or aliased formulae dependencies to be resolved to
specific formulae correctly and deduplicated.

Fixes #15488
2023-06-29 14:30:43 +01:00
Bo Anderson
8dc2e80a98
Significantly improve install speeds with smarter postinstall detection 2023-06-22 03:06:45 +01:00
Kevin
946478aed4
Merge pull request #15396 from apainintheneck/custom-service-name
Custom service name
2023-05-17 22:09:31 -07:00
apainintheneck
f2adbf6613 service: change custom name DSL
After some discussion, we decided to change the DSL to get rid of
the `plist_name` and `service_name` methods which aren't meaningful
for most users.

The new DSL looks like this:

```rb
service do
  name macos: "name", linux: "name"
end
```

I also updated some specs here to reflect these changes.

There was some talk about maybe deprecating `plist_name` and `service_name`
but I think that's outside of the scope of this PR so I'm leaving
them as is for now. One benefit of this is that everything here is backwards
compatible.
2023-05-17 21:54:32 -07:00
Markus Reiter
0d56b97b07
Add SimulateSystem::with. 2023-05-14 01:45:04 +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
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Bo Anderson
44f058edb5
Refactor formula, cask and Ruby source downloads to use shared code 2023-04-27 23:23:07 +01:00
Bo Anderson
a696bd8203
Support multiple oldnames for formulae 2023-04-27 05:15:43 +01:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Issy Long
3a83b5492c
rubocop: Clean up Style/BlockDelimiters excludes and autofix offenses
- The defaults of using "do ... end" for multi-line blocks everywhere is
  good, better than switching everything to braces everywhere.
2023-03-08 23:54:22 +00:00
Alexander Bayandin
9b4f29e47c
formula: fix alias loading 2023-03-01 09:44:57 +00:00
Rylan Polster
f7fa5937d8
Allow brew info --json=v2 without taps with JSON API 2023-02-12 12:03:40 +00: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
Mike McQuaid
3c7adc91ac
Merge branch 'deprecate-ignore_missing_libraries' into deprecate-disable-remove 2023-02-03 10:49:54 +00:00
Douglas Eichelberger
dead4de3fc Resolve Lint/EmptyBlock todos 2023-01-26 21:18:24 -08:00
Carlo Cabrera
4b318f738b
Remove tests for ignore_missing_libraries
The deprecation is causing these tests to fail.
2023-01-26 13:46:48 +08:00
Douglas Eichelberger
06d037eadf Resolve formula_spec violation 2023-01-22 17:26:44 -08:00
Mike McQuaid
59f4b5226a
tests: test on Ubuntu 18.04. 2022-11-09 14:45:43 +00:00
Sean Molenaar
d477d1663a
Service: add method to define a root requirement 2022-11-06 13:52:53 +01:00
Bo Anderson
af234779af
test: support non-master init.defaultbranch 2022-10-07 18:44:03 +01:00
Mike McQuaid
1b3f5980be
Merge pull request #13839 from apainintheneck/no-autoremove-build-deps-when-built-from-src
autoremove: ignore build deps when built from src
2022-09-14 13:10:14 +01:00
apainintheneck
f068f74f55 Move autoremove code to util and add tests 2022-09-13 23:23:48 -07:00
Mike McQuaid
7349c2b996
brew style --fix 2022-09-13 09:43:09 +01:00
Bo Anderson
15280ba107
test: avoid improper, late usage of formula DSL 2022-08-31 20:40:39 +01:00
Bo Anderson
768eb1d51a
test/formula_spec: stub Tap#versioned_formulae_names 2022-08-25 16:13:24 +01:00
Mike McQuaid
c294dcc616
glibc related cleanup
Extracted from https://github.com/Homebrew/brew/pull/13577
2022-08-23 12:42:02 +01:00
Max Eisner
a666b1bce8
fix style 2022-08-10 22:31:43 +02:00
Max Eisner
d819c949b4
fix test 2022-08-10 20:21:05 +02:00
Max Eisner
e091d62aa3
Merge branch 'master' into generate-completions-dsl 2022-08-10 19:10:44 +02:00
Max Eisner
00471be514
add test 2022-08-10 19:07:19 +02:00
Sean Molenaar
8e49be58b3
Merge pull request #13623 from SMillerDev/fix/exceptions/report_issues_inreplace_head
brew.rb: tell users to fix head issues with inreplace
2022-08-08 16:48:24 +02:00
Sean Molenaar
03a489bf78
brew.rb: tell users to fix head issues with inreplace 2022-08-07 13:34:56 +02:00
Kevin
93bf9e5ba2
Merge pull request #13532 from apainintheneck/add-uninstall-autoremove
cmd/uninstall: Add env variable that runs autoremove after uninstalls
2022-08-03 18:10:32 -07:00
Rylan Polster
34a1bc6618
Use SimulateSystem for ignore_missing_libraries 2022-07-23 03:09:29 +02:00
Rylan Polster
7255df1ec2
Only run to_hash_with_variations test on macOS 2022-07-21 17:33:19 +02:00
Rylan Polster
6c35317732
Add and update tests 2022-07-21 16:41:23 +02:00
apainintheneck
cb91f8b665 Add tests for retrieving formula based on dependents
Also, made sure to clear formula cache before
and after autoremoving packages.
2022-07-17 00:39:23 -07:00
apainintheneck
fe83500617 Moved autoremove logic into cleanup.rb and formula.rb
Cleanup.rb:
- Added #autoremove method
- #autoremove is called in clean when HOMEBREW_AUTOREMOVE is set

Formula.rb:
- Added #unused_formulae_with_no_dependents and helpers

Removed old autoremove.rb module.
2022-07-14 13:16:26 -07:00
Rylan Polster
5e5c78ebef
Fix tests and improve style 2022-07-11 04:03:37 -04:00
Rylan Polster
57417dd016
Add on_system :linux, macos: wrapper to OnSystem 2022-07-11 02:19:24 -04:00