709 Commits

Author SHA1 Message Date
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
Bo Anderson
5aebde3ffd Add consistent path validation 2024-01-01 18:37:47 +00:00
Bo Anderson
b42256d286
Deprecate, disable & delete code for Homebrew 4.2.0 2023-12-07 23:42:13 +00:00
Eric Knibbe
4562ab4299
download_strategy: support Mercurial tags/branches 2023-10-17 00:24:40 -04:00
Eric Knibbe
8646b2cf1f
api: ignore HTTPS errors if minimum curl version isn't installed 2023-10-04 22:24:57 -04:00
Bo Anderson
9c16089e95
download_strategy: fix mirrors not working 2023-10-04 14:28:52 +01:00
Mike McQuaid
f73607553c
Cleanup various TODOs
These were also easily fixed, already fixed or incorrect and
non-controversial.

Co-authored-by: Issy Long <issyl0@github.com>
2023-09-03 09:12:41 -04:00
Mike McQuaid
7da934f7e2
Deprecate/disable/delete code.
The next release after this is merged will be 4.1.0.

Co-authored-by: Markus Reiter <me@reitermark.us>
2023-07-06 16:56:20 +01:00
Bo Anderson
c969be340e
download_strategy: move HOMEBREW_ARTIFACT_DOMAIN hack 2023-06-27 14:33:23 +01:00
Bo Anderson
6d8b033eff
Significantly improve fetch speed of bottles 2023-06-22 15:08:16 +01:00
Harry Marr
d2b17e29ef
Check only_path is present before modifying it 2023-06-10 14:31:46 -04:00
Harry Marr
747d3aaaba
Apply review suggestions 2023-06-10 14:08:58 -04:00
Harry Marr
2cd2076186
Use "cone" mode for sparse checkouts 2023-06-09 22:58:00 -04:00
Markus Reiter
b05de929c6
Merge pull request #15351 from reitermarkus/livecheck-head
Use `curl_headers` and `curl_output` for `Livecheck` strategies.
2023-05-09 00:55:34 +02:00
Markus Reiter
498ce8d18f
Merge pull request #15243 from aacerox/hotfix/cask-auth-redirect 2023-05-08 07:56:02 +02:00
alejandro.alvarez.acero
555ce9a5b0
Merge URL :header with :headers. 2023-05-08 07:41:06 +02:00
Markus Reiter
353818f508
Rename curl_head to curl_headers. 2023-05-06 03:41:35 +02:00
Markus Reiter
545a332fef
Use curl_head and curl_output for Livecheck strategies. 2023-05-06 03:40:09 +02:00
Sam Ford
ec2a7121ab
BazaarDownloadStrategy: Replace in-place sub
livecheck's `Git` strategy uses `DownloadStrategyDetector#detect`
in its `#match?` method to check if a URL is a Git repository. This
has historically worked fine but I've recently seen a `can't modify
frozen String` error for a few formulae (percona-toolkit,
schroedinger, squid) in relation to the in-place `sub` call in
`BazaarDownloadStrategy`'s initializer.

Other download strategies use a `@url = @url.sub(...)` pattern to
avoid this issue, so this commit resolves the issue by using the same
approach in `BazaarDownloadStrategy`.
2023-05-01 10:45:13 -04:00
Ilya Kulakov
a63ccfa8ff download_strategy: Fix the timeout value. 2023-04-28 10:11:24 -07:00
Bob Lail
8847719b68 Install cached bottles if curl --head fails
Fixes #15302

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-04-25 07:35:27 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Douglas Eichelberger
f52cbbb9da
Vendor mechanize gem outside Gemfile
We only need a single file and it avoids pulling in e.g. `nokogiri`
which is vulnerable.

Allow updating it using `brew vendor-gems`.
2023-04-24 14:03:55 +01:00
Carlo Cabrera
35a8a5dd3d
download_strategy: disable Git fsmonitor
Enabling the fsmonitor isn't useful for these repositories. Moreover,
disabling them will get rid of the warning shown from trying to copy
sockets from a repo watched by the fsmonitor.
2023-04-23 16:42:58 +08:00
Bo Anderson
6cf18e3810
download_strategy: fix bad unescaping in basename parsing 2023-04-18 13:42:34 +01:00
Markus Reiter
fbf474a3fd
Add curl_head method. 2023-04-06 10:22:24 +02:00
Mike McQuaid
ec15acf7dc
Revert "Remove --request GET workaround for HEAD requests." 2023-03-31 09:07:02 +01:00
Markus Reiter
c876530eff
Remove --request GET workaround for HEAD requests. 2023-03-30 05:02:51 +02:00
Mike McQuaid
d3d372d6f5
download_strategy: use another blank. 2023-03-21 12:19:06 +00:00
Mike McQuaid
fd0b3e8035
download_strategy: use blank. 2023-03-21 12:18:17 +00:00
Bevan Kay
f197f164c8
download_strategy: fix case where filename cannot be parsed 2023-03-21 09:12:07 +11:00
Douglas Eichelberger
b8aa619f2f brew style --fix 2023-03-15 18:21:41 -07:00