5284 Commits

Author SHA1 Message Date
Mike McQuaid
41d67bb28d
Merge pull request #16196 from samford/cask/rework-livecheck_min_os-audit
Use Sparkle sorting/filtering in #livecheck_min_os
2023-11-17 11:41:21 +00:00
Bo Anderson
ca549fa10d
dev-cmd/determine-test-runner: add --all-supported 2023-11-17 02:11:01 +00:00
Sam Ford
bc2ce97e5d
Sparkle: Move sorting/filtering into methods
We need to be able to replicate the `Sparkle` strategy's sorting
and filtering behavior in a related cask audit, so this extracts
the logic into reusable methods.

This also stores `item.minimum_system_version` as a `MacOSVersion`
object (instead of a string), so we can do proper version comparison
(instead of naive string comparison) wherever needed.
2023-11-16 12:05:24 -05:00
Rylan Polster
aa316109d9
Pass new tap to TapLoader
Co-authored-by: Alexander Mancevice <alexander.mancevice@hey.com>
2023-11-13 14:02:50 -05:00
Rylan Polster
237a42974b
Pass original tap to formula when loaded from the API via TapLoader 2023-11-13 13:40:44 -05:00
Bo Anderson
fb21d59b5a
Improve coverage tracking 2023-11-11 05:36:40 +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
Mike McQuaid
54012f14ce
cask: add installed_time to JSON output.
This is provided for formulae in `installed.time` and is useful to have
for casks as well as formulae so let's output it here too.
2023-11-03 11:37:01 +00:00
Sam Ford
86c702abcd
Sparkle: Surface more Item values
Historically, the `Sparkle` strategy's `Item` struct has only
included basic values from the appcast that are commonly useful.
Over time we've selectively added/surfaced more values as we've
encountered outliers that require use of different values in a
`strategy` block.

We now need to use `minimumSystemValue`, so this expands the `Item`
struct to include any appcast value that we could conceivably want
to use in the future. This will hopefully save us from having to make
more modifications to the struct (and related tests) before we can
use a previously-unused value in a `strategy` block.
2023-10-28 14:55:47 -04:00
Bo Anderson
14c1dce38b
Allow HOMEBREW_RUBY3 in tests 2023-10-27 15:58:43 +01:00
Mike McQuaid
4436a663f2
download_strategies/curl_spec: fix test. 2023-10-21 09:41:35 +01:00
Rui Chen
4232cb6c90
curl_spec: update test
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-10-20 20:46:22 -04:00
Markus Reiter
00c976ce38
Fix test. 2023-10-11 09:42:22 +02:00
Markus Reiter
4b7aed84fa
Add test for print_stdout: :debug. 2023-10-10 03:42:22 +02:00
Kevin
1c9caf96b7
Merge pull request #16063 from Homebrew/revert-16054-revert-16026-support-multiple-sockets-in-service-dsl
service: support multiple sockets in DSL
2023-10-07 14:42:26 -07:00
apainintheneck
215419daa5 service: provide backwards compatibility for socket strings
The previous PR changed how sockets were represented in the JSON
API for formulae and that would cause problems when trying to install
packages with service sockets. This provides backwards compatibility
until all users have upgraded to versions of homebrew that can deserialize
sockets hashes (maybe a couple weeks). Essentially, we store the
socket string when serializing sockets that were originally defined with
only the string parameter otherwise we serialize it to a hash.
2023-10-07 14:22:38 -07:00
Issy Long
5ddebe1640
rubocops/text: Declare "revision 0" in formulae as unnecessary
- This came up in a user contribution recently so here's a RuboCop for it.
2023-10-04 23:28:30 +01:00
Kevin
043aca2df4
Revert "Revert "service: support multiple sockets in DSL"" 2023-09-29 19:10:13 -07:00
Bo Anderson
af7d744af0
Fixes for Ruby 3 2023-09-29 05:25:48 +01:00
Bo Anderson
71f558229a
Test on Ruby 3.1 2023-09-29 04:46:16 +01:00
Kevin
653f333d73
Revert "service: support multiple sockets in DSL" 2023-09-28 09:58:03 -07:00
Bo Anderson
e4623cc8f4
Improve performance of brew readall 2023-09-28 14:05:09 +01:00
apainintheneck
5fb9f90457 service: prefer symbols over strings in DSL
This is more in keeping with the other DSL methods and Ruby
convention along with the fact that these socket names are
just used internally by launchd.
2023-09-27 22:30:30 -07:00
apainintheneck
afeef33bc1 Add tests for multiple service sockets 2023-09-24 11:58:11 -07:00
apainintheneck
ae5e9387b9 service: support multiple sockets in DSL
This adds support for multiple named sockets to the service DSL.
It also retains backwards compatibility with the previous DSL
where you can declare one socket and it is always just named
Listener by default.
2023-09-23 19:29:21 -07:00
Mike McQuaid
073a4bb925
Merge pull request #16014 from apainintheneck/scrub-sorbet-runtime-from-backtrace
utils/backtrace: scrub sorbet-runtime from backtrace
2023-09-22 09:53:10 +01: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
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
Sam Ford
578c935bcf
Formula, BuildError: Update type signatures
We're seeing type errors when building formulae that use something
like `xcodebuild ..., "-arch", Hardware::CPU.arch`, since `CPU.arch`
is a symbol. We've been addressing these issues by calling `#to_s` on
the value but there was some talk about simply expanding the type
signatures to accommodate anything that will be cast to a `String`.

There's maybe still an argument to be made for doing string conversion
in formulae but expanding the type signatures will resolve a number of
existing type errors if we simply want to rely on implicit type
casting.

Past that, this also updates the type signature for `BuildError` to
align with the `#system` signature changes, as we receive a type error
otherwise.
2023-09-13 19:16:04 -04:00
Mike McQuaid
c1f79499af
Merge pull request #15942 from issyl0/audit-pypi-package-names-match-resource-names
Add an audit for mismatched Python resource and PyPi package names
2023-09-13 09:32:09 +01:00
Mike McQuaid
4e0ec2555e
Merge pull request #15986 from EricFromCanada/docs-assorted-improvements
Docs: assorted refinements for output
2023-09-11 13:06:52 +01:00
Mike McQuaid
bd1caa4f87
Merge pull request #15974 from chenrui333/chore-update-safari-ua
chore: update safari UA to the latest
2023-09-11 13:05:40 +01:00
Eric Knibbe
931f762598
docs+rubydoc: various grammar/wording fixes 2023-09-11 02:26:37 -04:00
Rui Chen
d31f4e4697
fix: update UA regex
Signed-off-by: Rui Chen <rui@chenrui.dev>
2023-09-09 22:47:47 -04:00
Caleb Xu
fcb3f8c553
missing_formula: remove sshpass from denylist 2023-09-07 21:51:12 -04:00
Issy Long
94d4061589
Improve PyPI package name audit wording 2023-09-06 23:16:25 +01:00
Mike McQuaid
b7114651ac
utils/curl: include or use explicitly.
Include or use `Utils::Curl` explicitly everywhere it is used.
2023-09-04 22:17:57 -04:00
Issy Long
5d2ae98d0c
Add an audit for mismatched Python resource and PyPi package names
- Issue 14537.
- When people manually add or modify PyPI resources the `Resource#name`
  sometimes ends up out-of-sync with the PyPI package name.
2023-09-03 00:44:24 +01:00
Mike McQuaid
d357607b2c
dev-cmd/contributions: usability/performance improvements.
- more sensible/performant defaults: default to primary repositories
  only for the last year rather than all repositories forever
- allow specifying more than one user at a time
- output the breakdown of contributions without needing `--csv`
- add a space before the `--csv` output
- consolidate some code
- avoid counting authored commits twice, to improve performance
- retry failed GitHub API calls (this happens often when querying all
  maintainers)
- stop counting after we find 1000 commits for a given user to avoid
  excessive API queries/pagination
2023-08-30 15:08:50 +01:00
apainintheneck
5c41e85ae9 update cmd/uses and cmd/deps tests
These tests were very simple before and now this should result
in more code coverage without affecting test performance.

The only tricky thing was testing the `--missing` option without
actually installing a package using `install_test_formula` because
that is very slow (around 10 seconds on my machine). I ended
up just writing the tab to a plausible keg directory for each
package I wanted to "install". This allows us to test the behavior
while also not increasing CI time by ~20 seconds (though it'd
probably be faster on CI than my local machine).
2023-08-28 21:54:32 -07:00
Sam Ford
1d404e437b
dev-cmd/livecheck: avoid watchlist in test
The existing watchlist test in `dev-cmd/livecheck_spec.rb` will only
pass if the testing environment doesn't contain a livecheck watchlist
file. When a watchlist file is present, it ends up being treated as
empty (formulae and casks aren't available in tests) and produces an
`Invalid usage: No formulae or casks to check` error instead. We don't
have to worry about a watchlist file on CI but it's a potential issue
when running `brew test` locally.

This provides a bogus `HOMEBREW_LIVECHECK_WATCHLIST` value to the
`#brew` call, to ensure that any watchlist file in the testing
environment is not used for this test.

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-08-16 15:08:34 -04:00
Mike McQuaid
72d25a21df
Merge pull request #15853 from clint-stripe/clint/pass_through_curl_home
Allow HOMEBREW_CURLRC to specify a path for curl `--config`
2023-08-15 11:42:26 +01:00
Clint Harrison
4ade9351e4
Allow HOMEBREW_CURLRC to provide a path for curl --config
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2023-08-15 11:29:02 +01:00
Sam Ford
4314daa2cf
python: expand and refactor tests
This brings coverage of `Language::Python::Shebang` to 100%.
2023-08-15 00:53:41 -04:00
Sam Ford
87935f8d0f
perl: expand and refactor tests
This brings coverage of `Language::Perl::Shebang` to 100%.
2023-08-15 00:53:41 -04:00
Sam Ford
d1297c0974
node: add shebang rewriting
Formulae that depend on `node` sometimes contain files that use a
shebang like `#!/usr/bin/env node` and this can lead to issues when
the `node` in a user's environment isn't brewed `node`.

For example, some node modules are compiled when the formula is built
but if the user's `node` is a different major version than brew's
`node`, the differing `NODE_MODULE_VERSION` can produce an error when
certain parts of the application are used. The formula may build and
test fine and the issue may only become apparent when more of the
application is exercised.

This adds a `Language::Node::Shebang` module (borrowing from the
existing Perl and Python examples), which allows us to use
`rewrite_shebang detected_node_shebang, ...` in formulae to address
this type of issue.
2023-08-15 00:53:41 -04:00
Douglas Eichelberger
d01cda2815 Turn up the types 2023-08-12 22:01:22 -07:00
Mike McQuaid
22553cd34a
Fix cask sharding issues
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
  shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
  with the same name rather than always using the first
2023-08-10 16:08:47 +01:00
Douglas Eichelberger
5d5c22e104 Replace integration test with unit test 2023-08-07 18:32:08 -07:00
Douglas Eichelberger
880362669b Add tests 2023-08-04 16:21:34 -07:00