6060 Commits

Author SHA1 Message Date
Mike McQuaid
92fee908ba
spec_helper: improve parallel test handling.
- Clarify the comment of why we have SimpleCov special logic for
  parallel tests
- use a nicer ParallelTests API for checking which process to output
  the coverage format on
2024-10-26 11:20:37 +01:00
Przemysław Kryger
2225af5bef Revert "Disable audit_result in inreplace"
This reverts commit f31e93a73aab025e60a4a798031c73327cef45cb.
2024-10-25 15:26:03 +01:00
Sam Ford
bfdb84f676
Expand #checkable_urls test coverage
This expands tests for `#checkable_urls` to cover everything except
branches that shouldn't ever be reached.
2024-10-25 09:55:22 -04:00
Sam Ford
d7b515bf73
livecheck: error on invalid url symbol
Up to now, we haven't been accounting for `#url` symbol arguments in
`livecheck` blocks that don't reference a checkable URL. This can
either be an invalid symbol (e.g., using the `:stable` formula symbol
in a cask) or a valid symbol where the referenced URL doesn't exist
(e.g., using `:head` when there's no `head` URL). [Almost all of the
valid symbols are required URLs but `head` is optional.]

Over the years, we've had a handful of slips where we've used `:url`
in formulae (when it's only valid in casks) and `:stable` in casks
(when it's only valid in formulae). In this scenario,
`livecheck_url_string` is `nil`, so livecheck falls back to
`#checkable_urls`. In this scenario, `stable` and `url` are the first
checkable URLs for formulae and casks (respectively), so the checks
ended up working as expected merely by chance. This isn't obvious in
the output and even the debug output looks normal. It only becomes
apparent that livecheck isn't working as expected if it iterates
through more than one checkable URL before reaching one that works
(not the case in those instances).

With that in mind, this adds an error when a `#url` symbol is used
but it doesn't correspond to a checkable URL. This will account for
both of the mentioned scenarios (invalid symbols and valid ones
referencing a non-existent URL) and prevent livecheck from quietly
proceeding in an unexpected manner.
2024-10-25 09:54:28 -04:00
Przemysław Kryger
f31e93a73a Disable audit_result in inreplace
This is to allow migration of existing users of @@HOMEBREW_PREFIX@@ tag in external patches. Once the automatic
replacement of the tag is in stable branch and existing users are fixed (inreplace calls removed), this commit can be
reverted.
2024-10-25 13:37:15 +01:00
Przemysław Kryger
ff03947ba0 Use @@HOMEBREW_PREFIX@@ for replacements in external patches 2024-10-23 16:51:01 +01:00
Przemysław Kryger
a03d65b5c9 Allow HOMEBREW_PREFIX replacement in external patches
This fixes #15925
2024-10-23 15:15:17 +01:00
Michael Cho
13be3c3073
unpack_strategy/directory: use mv for nested unpack
`mv` should preserve hardlinks and allow faster unpack on the same
filesystem. A secondary pass is done with `cp` to copy over attributes
onto any existing directories.

We only run this for nested unpacks as most direct Directory strategy
usage is for repositories where moving files breaks existing code.

This uses `cp -pR` for non-move as some potential user reported issues
could be due to Apple's `cp -l` on specific macOS versions. Can
consider re-adding `cp -l` with better handling for older macOS.
2024-10-20 11:29:30 -04:00
apainintheneck
7aee21ca8b Fix RuboCop::Cop::FormulaAudit::ShellVariables autocorrect
It used to leave out the parenthesis which could result in invalid
Ruby syntax. Now it always parenthesis here.
2024-10-17 23:46:40 -07:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07:00
Ruoyu Zhong
5a6203a285
test/utils/github_spec: fix artifact URL test
This does the same as dcba7f356d (#15619) and unblocks CI.
2024-10-15 03:01:45 +08:00
Mike McQuaid
a25a541d26
Merge pull request #18438 from bevanjkay/extract_plist_url_fix
cask/cask: pass args when initalising methods
2024-10-13 17:32:01 +01:00
Michael Cho
252678692f
os/mac/pkgconfig: add bzip2.pc for rust formulae 2024-10-11 14:55:37 -04:00
Bevan Kay
8b33aa048a
test/fixtures: add app binary with valid info.plist file 2024-10-10 10:41:09 +11:00
Bevan Kay
8852f024a6
test/fixtures: add livecheck-extract-plist cask 2024-10-10 10:41:09 +11:00
Bevan Kay
0211a23c1f
test/livecheck: add extract_plist livecheck url test 2024-10-10 10:36:45 +11:00
Michael Cho
a3d8f4e0e4
Merge pull request #18508 from Homebrew/curl-skip-get
utils/curl: workaround curl bug for `--head --request GET`
2024-10-08 08:44:05 -04:00
Douglas Eichelberger
2d16333bbc Replace removable constants with overridable methods 2024-10-07 18:33:03 -07:00
Michael Cho
43ee408793
utils/curl: workaround curl bug for --head --request GET
The `curl --head --request GET` causes a full download to happen on
`curl` from 8.7.0 to 8.9.1[^1] which causes poor UX due to slow
Cask downloads that can take almost twice as long as they should.

[^1]: https://github.com/Homebrew/brew/issues/18213
2024-10-05 14:05:59 -04:00
Carlo Cabrera
4671af4bb9
Merge pull request #18485 from Homebrew/non-fatal-invalid-attestations 2024-10-04 16:09:47 +08:00
Carlo Cabrera
7b74bf07fd
Fix attestation test failures 2024-10-04 16:00:29 +08:00
Michael Cho
cfb8ebb5d8
unpack_strategy/directory: try preserving hardlinks
Try running `cp -al` to preserve hardlinks on both macOS and Linux.

If that fails, fall back on `cp -a` which can preserve hardlinks on
Linux (but not macOS) assuming target filesystem supports them.
2024-10-03 20:30:41 -04:00
Patrick Linnane
c2e2b23c50
brew style --fix
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-10-02 10:03:12 -07:00
Bevan Kay
1c5bfa3d80
test/formula_auditor_spec: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Bevan Kay
5a39e1f238
test/cask/audit_spec: audit deprecate/disable reasons 2024-09-30 23:11:44 +10:00
Mike McQuaid
490a553fec
Merge pull request #18455 from samford/livecheck/move-preprocess-url-into-strategies
livecheck: move `#preprocess_url` into strategies
2024-09-30 08:53:13 +01:00
Sam Ford
9e47fc9f31
livecheck: move #preprocess_url into strategies
`Livecheck#preprocess_url` only contains logic for rewriting Git URLs,
so it makes more sense for this code to be part of the `Git` strategy
instead. Outside of better code organization, this saves us from
having to maintain the list of strategies to skip processing (which
is sometimes forgotten when a new strategy is added) and makes it
easier to do something similar in other strategies as needed.

One thing to note is that `Livecheck#preprocess_url` was previously
called on the URL before each strategy's `#match?` method was called.
To maintain the existing behavior, this calls `Git#preprocess_url` in
`Git#match?`. However, we need the processed URL when we use the `Git`
strategy, so we have to call `Git#preprocess_url` again. To avoid
duplicating effort, I've added a `@processed_urls` hash to the `Git`
strategy and have set up `Git#preprocess_url` to cache processed
URLs, so we only do the work once. There may be a better way of
handling it but this seems to work as expected.
2024-09-28 11:29:07 -04:00
Michael Cho
112c692a53
test/spec_helper: require standalone before warnings 2024-09-27 12:48:27 -04:00
Mike McQuaid
a6954f26a5
Merge pull request #18435 from Homebrew/temp-symlink-test-fix
test/cask/utils_spec: fix test failure when HOMEBREW_TEMP is a symlink
2024-09-27 08:42:11 +01:00
Mike McQuaid
b38cbbc085
Merge pull request #18434 from Homebrew/unix-socket
Allow sockets to use longer paths on macOS
2024-09-27 08:07:58 +01:00
Carlo Cabrera
fe1f330e60
Revert "Deprecate installing casks/formulae from paths." 2024-09-27 10:17:04 +08:00
Bo Anderson
fe0505d492
test/cask/utils_spec: fix test failure when HOMEBREW_TEMP is a symlink 2024-09-27 03:02:26 +01:00
Bo Anderson
326a71712f
Revert "Shorten brew tests temporary paths."
This reverts commit 27fb07c0fc622d3e010a8a9f6e0056fd09dc5b1f.
2024-09-27 01:55:26 +01:00
Mike McQuaid
bbdea29a0f
Deprecate installing casks/formulae from paths.
We've already disabled installing casks/formulae from URLs and we
regularly tell people not to install from paths so let's just deprecate
this behaviour entirely.

Even Homebrew developers do not need to work this way.
2024-09-26 20:25:07 +01:00
Mike McQuaid
f0653348c4
Merge pull request #18407 from Homebrew/deprecate_cask_url_block
cask/url: deprecate `url do` blocks.
2024-09-26 16:16:40 +01:00
Mike McQuaid
5b46ec70e9
cask/url: deprecate url do blocks.
We're removing these in
https://github.com/Homebrew/homebrew-cask/pull/186501
so let's deprecate them too.
2024-09-26 14:05:25 +01:00
Case Taintor
31c560e578 Improve cask --adopt to only care about the installed version if auto_update is false 2024-09-26 11:59:40 +02:00
Patrick Linnane
d7e0c8f0c0
Merge branch 'master' into forbid-url-do-homebrew-cask 2024-09-25 10:35:21 -07:00
Mike McQuaid
2f2ca82035
Merge pull request #18413 from Homebrew/more-random-temp-dir
tests: add an extra byte of randomness
2024-09-25 16:01:49 +01:00
Carlo Cabrera
e03a9fd0be
tests: add an extra byte of randomness
Two bytes should hopefully be plenty.
2024-09-25 22:32:51 +08:00
Carlo Cabrera
7d23111608
Merge pull request #18408 from Homebrew/falsy-env_config 2024-09-25 21:28:11 +08:00
Carlo Cabrera
78065c5781
env_config: deprecate setting boolean vars to falsy values
The way we handle boolean environment variables is a bit unfortunate.
For example, setting `HOMEBREW_EVAL_ALL=false` actually enables
`HOMEBREW_EVAL_ALL`.

Let's fix this by deprecating setting boolean environment variables to
common false-y values (`false`, `0`, `nil`, `no`, and `off`) so that we
can later ignore these false-y values when reading boolean environment
variables.
2024-09-25 21:15:53 +08:00
Mike McQuaid
d3cc0c3f22
Merge pull request #18388 from Homebrew/odeprecated_odisabled_remove
Add new odeprecated, odisabled, remove disabled code.
2024-09-25 09:54:46 +01:00
Rylan Polster
18147a6a1e
style: forbid url do blocks in homebrew/cask 2024-09-24 22:45:00 -04:00
Mike McQuaid
27fb07c0fc
Shorten brew tests temporary paths.
If you have `HOMEBREW_TEMP` set to a longer path (e.g. the user's
private temporary directory rather than `/private/tmp`), Sequoia will
error out on some tests when forking because the path is too long
(> 104 bytes).

To improve this situation let's:
- use a shorter path for `HOMEBREW_TEMP` by appending `/brew-tests` to
  the existing `HOMEBREW_TEMP` used outside of tests rather than
  creating nested temporary directories
- use the minimal amount of randomness to avoid collisions while
  allowing parallel tests
- use `squeeze` to remove any double slashes in the temporary path
2024-09-24 10:28:18 +01:00
Mike McQuaid
94416e82f0
Add new odeprecated, odisabled, remove disabled code.
Prepare the usual deprecation cycle for Homebrew 4.4.0.
2024-09-24 10:15:34 +01:00
Daeho Ro
47e70ab3ea allow @ and + characters for search 2024-09-17 12:43:28 +09:00
Bo Anderson
eb93d844d8
Fix NoSuchKegFromTapError handling 2024-09-16 05:46:14 +01:00
Carlo Cabrera
51c4421409
Change default Homebrew/core CI runners
We will now build on Ventura (macOS 13) to Sequoia (macOS 15).

Runners for macOS 15-x86_64 will not be allocated by default due to a
lack of appropriate hardware.
2024-09-12 22:06:10 +08:00
Mike McQuaid
b29549eaed
Merge pull request #18296 from fxcoudert/sequoia_rc
Make Sequoia supported
2024-09-11 13:31:36 +01:00