740 Commits

Author SHA1 Message Date
Patrick Linnane
cb15b67b8e
various: correct Style/CollectionQuerying
Signed-off-by: Patrick Linnane <patrick@linnane.io>
2025-07-11 10:43:00 -07:00
Eric Knibbe
0f2131484d
download_strategy: only require content-disposition header 2025-07-07 13:16:33 -04:00
Eric Knibbe
eff4523074
download_strategy: preserve cache upon text response 2025-07-03 22:05:49 -04:00
Bob Lail
048f58123f
download_strategy: Add logging when a cached download is being ignored 2025-06-25 08:32:02 +01:00
Eric Knibbe
8a4cac0238
download_strategy: fix cvs checkouts 2025-06-22 14:38:19 -04:00
Eric Knibbe
7e79232512
download_strategy: fossil now outputs hash: 2025-06-22 14:38:19 -04:00
Eric Knibbe
5ff58d2df0
download_strategy: fix caching of :latest downloads 2025-06-17 14:51:11 -04:00
Carlo Cabrera
713289e2eb
Merge pull request #19885 from fidelity-contributions/github-16669
Anonymous OCI registry mirror support
2025-05-20 13:35:11 +00:00
Justin Rackliffe
f051510e67
Update Library/Homebrew/download_strategy.rb
Co-authored-by: Eric Knibbe <enk3@outlook.com>
2025-05-20 09:25:30 -04:00
Bo Anderson
923be69785
Phase out using cgi library 2025-05-13 01:33:14 +01:00
Justin Rackliffe
efa2786732 Resolving CI style errors with whitespace that are not flagged using stle locally 2025-05-02 15:00:22 -04:00
Justin Rackliffe
3761d70785 Revised conditional logic to match CONTRIBUTING.md recommendations on adhering to brew style findings. 2025-05-02 11:33:48 -04:00
Justin Rackliffe
d73b0079e9 Resolve the corner case of anonymous OCI registry access (#16669). 2025-05-02 08:22:01 -04:00
Bob Lail
a6a8306c46 fix: Don't invalidate the cached location if the response is a redirect
A bug introduced with #19460 is that if a redirection has a file size (for example, if it is a 302 that also has HTML content), Homebrew will invalidate the cached location.
2025-04-08 11:14:56 -07:00
Eric Knibbe
a82a8efce9
download_strategy: ignore Content-Length value if zero 2025-03-20 15:38:06 -04:00
Eric Knibbe
d8230eb740
download_strategy: compare cached size to Content-Length 2025-03-14 23:48:25 -04:00
Douglas Eichelberger
b131f47d75
fix: DownloadStrategy meta params should be untyped 2025-03-14 18:18:58 -07:00
Douglas Eichelberger
c48870080e
Incorporate feedback 2025-03-13 11:59:31 -07:00
Douglas Eichelberger
1ca5299f40
refactor: Enable strict typing in download_strategy 2025-03-12 15:15:20 -07:00
Kristján Oddsson
3b0794a884 implement fixes and comments for DisableComment rubocop 2025-01-29 09:17:11 +00:00
Mike McQuaid
cf75c48951
Merge pull request #18809 from reitermarkus/download-lock-interrupt
Fix incorrect download locking.
2024-11-25 08:36:58 +00:00
Eric Knibbe
51be1d9652
revert setting --insecure to download ca-certificates 2024-11-24 14:57:32 -05:00
Markus Reiter
4bd75d4235
Fix incorrect download locking. 2024-11-24 00:03:31 +01:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07:00
Douglas Eichelberger
d3d25beb35 Use requires_ancestor consistently 2024-10-06 09:25:57 -07: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
Markus Reiter
60cb8101f5
Readd Pourable to LocalBottleDownloadStrategy. 2024-09-05 17:21:41 +02:00
Markus Reiter
fb0bf3b7a2
Fix wrong stage method being called. 2024-09-05 00:21:33 +02:00
Markus Reiter
404176af1d
Implement Downloadable for more types. 2024-09-04 22:54:28 +02:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Mike McQuaid
e3a1a9dccf
Improve locking UX
My experience recently playing around with our locking behaviour is
that, while mostly seamless and not seen by users, it's leaks
implementation details a bit too heavily.

As a result, the following improvements are in this commit:
- Ensure that, whenever possible, we tell the user the actual command
  that is holding a given lock instead of the lock name (an internal
  implementation detail)
- Make the locking error output a little more consistent and user
  friendly
- Add a `DownloadLock` class to simplify locking downloads
- Add a `HOMEBREW_LOCK_CONTEXT` variable to allow adding additional
  context for logging error messages
- Lock paths and leave deciding how this translates to lock names up
  to the locking code itself
- Lock the Cellar/Caskroom paths explicitly rather than implicitly

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-07-30 17:51:02 +01:00
Bo Anderson
577f99baac
download_strategy: fix handling of Apache projects moved to Attic 2024-07-23 15:27:37 +01:00
Carlo Cabrera
49b27767aa
download_strategy: fix UID handling for Git submodules
Source builds that use Git checkouts with submodules can choke when the
process UID does not match its EUID.

We can fix this by using the `reset_uid` option added in #17782.
2024-07-17 18:59:02 +02:00
Markus Reiter
1b79e01c5b
Remove useless ignore_interrupts. 2024-07-14 11:43:20 -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
Issy Long
8c9a6e3379
Add a comment for what and why we're rescuing 2024-06-27 12:27:30 +01:00
Issy Long
c8504427cb
CurlDownloadStrategy: Ignore invalid last-modified header values
- Some download locations return a non-standard formatting of date string for the `Last-Modified` header.
  This causes `Time.parse` to blow up. The user sees `error: argument out of range`.
- In this commit we handle the error and return nil, which `filter_map` (equivalent to `.map.compact`) gets rid of and then `time.last` is as normal.
- Fixes https://github.com/Homebrew/brew/issues/ 17556.
2024-06-26 20:00:45 +01:00
Mike McQuaid
6e9288470e
brew style --fix 2024-05-23 17:15:43 +01:00
Mike McQuaid
a37864da0f
Add HOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK
This fits the use-case I've heard multiple times where people want to
rely exclusively on their artifact provider.

Co-authored-by: Carlo Cabrera <30379873+carlocab@users.noreply.github.com>
2024-05-14 21:45:37 +09:00
Mike McQuaid
222fe8ef0b
Homebrew 4.3.0 deprecation/disable/removals.
The usual pass of deprecating/disabling/removing code for the next
minor Homebrew release.
2024-05-07 12:18:04 +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
0f0055ede4
Make documentation @api private by default. 2024-04-26 19:04:20 +02:00
Daeho Ro
5680ffe2e6 add ssh://git scheme for git download strategy 2024-04-21 18:57:04 +09:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Issy Long
f4218a6316
Fix RuboCop Performance/MapCompact offenses
- Rename an iterator variable since it would make the line too long.
2024-02-25 22:59:59 +00:00
Douglas Eichelberger
eb7c3e52a0 Require SystemInclude only where needed 2024-01-31 11:42:01 -08:00
Douglas Eichelberger
e00d066d87 Replace Time refinement with Timer Util 2024-01-29 18:50:12 -08:00
Douglas Eichelberger
2e21efff46 Add ActiveSupport String#exclude? to extend/ 2024-01-19 13:35:34 -08:00
Douglas Eichelberger
08e12b2383 Remove ActiveSupport Array access core extensions 2024-01-19 13:34:52 -08:00