1739 Commits

Author SHA1 Message Date
Rylan Polster
9538f424b5
Merge pull request #17762 from samford/formula-require-utils-backtrace 2024-07-16 12:41:19 -04:00
Bo Anderson
af429d4f1a
utils/analytics: fix handling of newlines 2024-07-16 17:06:38 +01:00
Sam Ford
11d6785bea
Add utils/backtrace requires
This is primarily intended to resolve the `uninitialized constant
Utils::Backtrace` error in `formula_versions.rb:60` but I expanded it
to try to cover all existing usage of `Utils::Backtrace`.

I've followed the existing pattern, where `utils/backtrace` is
required in the context of where it's used. Many of these cases use
`Backtrace` in a conditional manner, so I've tried to ensure that the
`require` follows suit.
2024-07-15 17:48:47 -04:00
William Woodruff
79dabc918b
utils/pypi: add missing import
This was transitively imported before.

Signed-off-by: William Woodruff <william@yossarian.net>
2024-07-15 09:34:15 -04:00
Markus Reiter
988c44ce20
Merge pull request #17722 from reitermarkus/ignore-interrupts
Make `ignore_interrupts` thread-safe.
2024-07-14 15:25:34 -04:00
Markus Reiter
447216a960
Avoid ignore_interrupts in safe_fork. 2024-07-14 14:32:49 -04:00
Mike McQuaid
55c0a9d3b4
Merge pull request #17729 from Homebrew/utils_analytics_strip 2024-07-14 14:11:19 -04:00
Markus Reiter
6f58bffc5c
Remove useless ignore_interrupts. 2024-07-14 13:48:23 -04:00
William Woodruff
a6e6837077
Merge pull request #17724 from Homebrew/ww/fix-local-bottles 2024-07-14 13:32:36 -04:00
Markus Reiter
3c8497647e
Fix unused argument. 2024-07-14 13:18:33 -04:00
Mike McQuaid
2d345d89eb
utils/analytics: strip out more data.
We've filter this out in `brew formula-analytics` too but let's avoid
sending it here in the first place so we can delete the
formula-analytics filtering later.
2024-07-14 13:15:09 -04:00
William Woodruff
e8ce1841d5
pypi: source wheel -> universal wheel
Signed-off-by: William Woodruff <william@yossarian.net>
2024-07-14 12:51:41 -04:00
William Woodruff
547e33ccb7
pypi: allow source wheels as resources
Signed-off-by: William Woodruff <william@yossarian.net>
2024-07-14 11:58:36 -04:00
Mike McQuaid
b8ff4b3d23
Widen attestation verification rollout
Take 2 of https://github.com/Homebrew/brew/pull/17692 but with:

- provide and document `HOMEBREW_NO_VERIFY_ATTESTATIONS`
- don't try to run unless there's GitHub credentials
- don't try to run unless `gh` is installed
- don't try to run in CI

While we're here:
- split out a `Homebrew::EnvConfig.devcmdrun?` helper method
- add some missing `Homebrew::EnvConfig.github_api_token` presence
  checks
2024-07-14 11:50:57 -04:00
Mike McQuaid
c5dbd3ca24
Rearrange requires
This improves the load time of most brew commands. For an example of
one of the simplest commands this speeds up:

Without Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     525.0 ms ±  35.8 ms    [User: 229.9 ms, System: 113.1 ms]
  Range (min … max):   465.3 ms … 576.6 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     383.3 ms ±  25.1 ms    [User: 133.0 ms, System: 72.1 ms]
  Range (min … max):   353.0 ms … 443.6 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.37 ± 0.13 times faster than git checkout master; brew help
```

With Bootsnap:
```
$ hyperfine 'git checkout master; brew help' 'git checkout optimise_requires; brew help'
Benchmark 1: git checkout master; brew help
  Time (mean ± σ):     386.0 ms ±  30.9 ms    [User: 130.2 ms, System: 93.8 ms]
  Range (min … max):   359.5 ms … 469.3 ms    10 runs

Benchmark 2: git checkout optimise_requires; brew help
  Time (mean ± σ):     330.2 ms ±  32.4 ms    [User: 93.4 ms, System: 73.0 ms]
  Range (min … max):   302.9 ms … 413.9 ms    10 runs

Summary
  git checkout optimise_requires; brew help ran
    1.17 ± 0.15 times faster than git checkout master; brew help
```
2024-07-14 08:49:39 -04:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Issy Long
bd9c7777e8
utils/shebang: Convert to Sorbet typed: strict 2024-07-05 15:37:59 +01:00
Rylan Polster
acd60181c2
Add cask install receipts 2024-07-04 01:47:13 -04:00
Rylan Polster
e28d455154
autoremove: skip formulae where installed_on_request is nil 2024-06-28 21:57:47 -04:00
Bo Anderson
2b454328ca
Remove non-Portable Ruby bootsnap support 2024-06-19 16:08:05 +01:00
Bo Anderson
1e7cf514eb
utils/gems: handle mismatching EUID and UID for bundle installs 2024-06-18 14:42:45 +01:00
Kevin
c3c1528611
Revert "Use cp -c when copying files" 2024-06-17 21:17:10 -07:00
Mike McQuaid
a883f14b72
autoremove: don't remove formulae that were built from source
When a formula was built from source, it should not be removed by
`brew autoremove` as it will take a while to be installed again.

Fixes https://github.com/Homebrew/brew/issues/17433
2024-06-14 17:26:28 +01:00
Mike McQuaid
b38e14bce7
Further Portable Ruby cleanup
- Use the `HOMEBREW_PORTABLE_RUBY_VERSION` environment variable to
  determine the version of the Portable Ruby to use in
  `vendor-install.sh` and `ruby.sh`.
- Replace the `docs/.ruby-version` file with a symlink to
 `Library/Homebrew/.ruby-version`.
- Fix an incorrect `HOMEBREW_LIBRARY` comment.
- Use a simpler `HOMEBREW_USING_PORTABLE_RUBY` definition.
2024-06-14 12:22:02 +01:00
Mike McQuaid
9e0cbe0fd7
Rename variable to HOMEBREW_USING_PORTABLE_RUBY 2024-06-14 12:06:06 +01:00
Bo Anderson
24f74c0528
Merge pull request #17501 from Homebrew/portable-ruby-3.3.3
Portable Ruby 3.3.3
2024-06-14 04:34:01 +01:00
Bo Anderson
fa91edadfd
Portable Ruby 3.3.3 2024-06-14 03:32:38 +01:00
Bo Anderson
fa2731d0c7
cmd/setup-ruby: fix Portable Ruby install failing 2024-06-14 02:26:16 +01:00
Mike McQuaid
1e0add6d66
Merge pull request #17373 from tesaguri/cp-reflink 2024-06-13 08:57:20 +01:00
Leo Heitmann Ruiz
4ac57d85b2 Read ZDOTDIR environment variable 2024-06-12 16:53:43 +02:00
Daiki Mizukami
028cfe1ea6
Utils::Cp: Rename to Utils::Copy
As per review feedback:

https://github.com/Homebrew/brew/pull/17373#discussion_r1633217748
2024-06-11 20:31:34 +09:00
Mike McQuaid
c13700af00
Use repository consistently instead of repo
The documentation linting job doesn't like `repo` so let's fix this
globally rather than naming it differently in documentation and code.
2024-06-10 09:31:53 +01:00
Daiki Mizukami
eab1e87726
Utils::Cp: Deduplicate SystemCommand invocations 2024-06-09 22:59:24 +09:00
Daiki Mizukami
67f280eb53
Utils::Cp: Add force_system keyword argument
This fixes the test for `UnpackStrategy::Directory`, which needs the
`cp` command.
2024-06-09 07:57:56 +09:00
Daiki Mizukami
9156891c99
Utils::Cp: Use FileUtils.cp on Linux
`FileUtils.cp` is implemented with the lightweight `copy_file_range(2)`
syscall on Linux, so it's more performant than the plain `cp` command on
that platform.

cf. https://github.com/Homebrew/brew/pull/17373#pullrequestreview-2105629022
2024-06-08 20:25:19 +09:00
Daiki Mizukami
a4271fdad1
Apply suggestions from code review
https://github.com/Homebrew/brew/pull/17373#pullrequestreview-2104523770

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-08 07:58:57 +09:00
Daiki Mizukami
b2ddeecdd9
Utils::Cp: Remove copy prefix from method name
As per review feedback:

https://github.com/Homebrew/brew/pull/17373#pullrequestreview-2104523770

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-08 07:58:20 +09:00
Daiki Mizukami
7cfcc596b9
Utils::Cp: Move macOS-specific code to extend/os/mac 2024-06-07 19:03:48 +09:00
Daiki Mizukami
58852106c1
Utils::Cp: Rename copy* methods to copy*_with_attributes
As per review feedback:

https://github.com/Homebrew/brew/pull/17373#pullrequestreview-2103870774
2024-06-07 19:03:33 +09:00
Daiki Mizukami
a5500aa7f2
Utils::Cp: Fix Linux tests 2024-06-06 21:45:28 +09:00
Sam Ford
8236a70771
Curl: Add constants for used curl errors
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-04 11:58:02 -04:00
Sam Ford
d3eac3848e
Curl#curl_headers: Work with 8 exit_status
I recently noticed that ~23 `livecheck` blocks using the `HeaderMatch`
strategy were failing. Looking into it, these fail when using a `HEAD`
request and retry with `GET` but the resulting response with the
headers we want is simply discarded because the `exit_status` from
curl is 8 ("weird server reply").

This resolves the issue by adding a special case for this exit status,
so `#curl_headers` will return the headers in this scenario.
2024-06-04 11:48:41 -04:00
Issy Long
a23dad737f
Fix constructing search query strings with date ranges
- Both `from` and `to` are now separate keyword arguments
  in a bunch of places, not part of `args`.
- When we switched this around, we didn't realize this
  method needed updating to correctly construct the time
  range query.
- This led to further inaccurate counts in `brew contributions`
  for reviews, since `from` and `to` are not valid search qualifiers
  for the GitHub PR search APIs.
2024-06-02 14:31:18 +01:00
Mike McQuaid
e573a53868
Output GitHub warning/error annotations to stderr
This will mean e.g. `opoo` etc. will output to stdout and not end up
being in the stdout of `brew deps` etc.

While we're here, remove a duplicate annotation output I noticed in
`extend/kernel.rb`.

Inspired by conversation in:
https://github.com/Homebrew/homebrew-test-bot/issues/1082
2024-05-31 09:31:44 +01:00
Issy Long
808cfda92d
dev-cmd/contributions: Fix the date range behaviour
- This was broken (I did have a commit SHA for the breakage but I can't find it now) since `from` and `args.from` are different variables (one can be nil, the other has a default value).
- So it was reporting very high counts because, despite the message, the `from` restriction was not being passed to `count_repo_commits`.
2024-05-28 13:58:41 +01:00
Daiki Mizukami
b4dcb94ad6
Utils::Cp: Drop special case for coreutils cp
As per review feedback:

https://github.com/Homebrew/brew/pull/17373#issuecomment-2132673915
2024-05-28 12:34:30 +09:00
Daiki Mizukami
942906b74a
Utils::Cp: Use cp from macOS 2024-05-27 18:10:46 +09:00
Daiki Mizukami
b905959a99
Add Utils::Cp for interacting with cp command
This module determines the `cp` command to use based on availability of
the `coreutils` formula and optimizes the command invocation to prefer a
lightweight copy-on-write clone, which is significantly faster than a
full file copy and helps to reduce the risk of exhausting the storage
during the operation.
2024-05-27 12:11:38 +09:00
Eric Knibbe
07e69b0ff2
livecheck/strategy: verify fail-with-body support 2024-05-23 13:08:25 -04:00
Carlo Cabrera
6b59c032a7
utils/shell: add + to safe shell characters
`+` does not require escaping in the shell. (Not for Bash and Zsh, at
least.)
2024-05-18 16:01:07 +08:00