1522 Commits

Author SHA1 Message Date
Issy Long
bd9c7777e8
utils/shebang: Convert to Sorbet typed: strict 2024-07-05 15:37:59 +01: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
Mike McQuaid
0c1766510a
env_config: add HOMEBREW_BUNDLE_USER_CACHE.
Used to configure `BUNDLE_USER_CACHE`.
2024-05-18 00:08:42 +09:00
Mike McQuaid
1eb99cdb0e
utils/gems: use BUNDLE_USER_CACHE instead of BUNDLE_CACHE_PATH.
Take two at https://github.com/Homebrew/brew/pull/17304 with the correct
variable name this time.

Fixes #17276.
2024-05-17 23:00:12 +09:00
Mike McQuaid
bde9afa70e
Portable Ruby 3.3.1
Use the latest version of Portable Ruby.
2024-05-17 00:23:36 +01:00
Mike McQuaid
03bf6db08c
utils/gems: handle undefined HOMEBREW_CACHE.
Some call paths can result in this not being defined so let's handle
that better.
2024-05-16 11:08:51 +09:00
Mike McQuaid
cb86847d95
utils/gems: use HOMEBREW_CACHE for bundler cache.
Fixes #17276
2024-05-15 22:17:02 +09:00
Patrick Linnane
8ec44f279b
github.rb: fix grammar
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-05-13 14:57:08 -07:00
Patrick Linnane
992b50a413
various: fix minor typos
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2024-05-13 14:30:06 -07:00
Mike McQuaid
16901a674f
extend/kernel: make opoo/odie/etc. print GitHub Actions notes.
We already do this for deprecations but these may make warnings
and errors from Homebrew easier to spot in GitHub Actions logs.

While we're here, cleanup other cases that should have used
`GitHub::Actions::Annotation` but didn't and provide some helpers and
tweaks there necessary for our use case here.
2024-05-09 14:43:53 +01:00
Bo Anderson
b790c7fe8c
utils/github/api: use real UID for auth fetching 2024-05-09 11:55:14 +01:00
Mike McQuaid
b5b37d8c80
Merge pull request #17204 from Homebrew/ruby_scripts_to_utils_files
Library/Homebrew: move stdin ruby scripts to files under `utils`.
2024-05-02 10:44:00 +01:00
Mike McQuaid
bc0f5ee62a
Library/Homebrew: move stdin ruby scripts to files under utils.
This avoids can avoid UID/EUID related issues with Ruby scripts passed
over `stdin` clashing with Ruby security features.

It's also just a bit nicer to have Ruby scripts in files instead.

While we're here:
- refactor some shared logic into a new `setup-gem-home-bundle-gemfile`
  function in `ruby.sh`
- do some general cleanup of `lock.sh`
- prioritise `flock` over `python` in `lock.sh`
2024-05-02 10:33:42 +01:00
Markus Reiter
480e264d9a
Lint Ruby docs. 2024-05-01 11:35:21 +02:00
Markus Reiter
caf87c0336
Warn about undocumented non-private APIs. 2024-05-01 11:35:20 +02:00
Markus Reiter
0b56d0be4a
Document Tab.for_keg and use Keg#tab where possible. 2024-04-28 20:50:13 +02:00
Markus Reiter
c26d10e4cb
Merge pull request #17170 from alebcay/backtrace-strict-typing 2024-04-28 20:33:54 +02:00
Caleb Xu
985cc83008
utils/gzip: enable strict typing 2024-04-28 02:37:18 -04:00
Caleb Xu
783e72dc59
utils/backtrace: enable strict typing 2024-04-28 02:36:19 -04:00