4620 Commits

Author SHA1 Message Date
Mike McQuaid
00c5960a6a
Merge pull request #13299 from MikeMcQuaid/update_improvements
Improve updating behaviour
2022-05-24 13:05:24 +01:00
Mike McQuaid
7a79da2668
Merge pull request #13227 from UiP9AV6Y/bugfix_artifact_domain_manpage
docs: clarify application of HOMEBREW_ARTIFACT_DOMAIN
2022-05-23 07:47:41 -04:00
Gordon Bleux
9cbaf97069 decouple authentication information from HOMEBREW_ARTIFACT_DOMAIN
add support for credentials usage in combination with other mirroring
features. previously `HOMEBREW_DOCKER_REGISTRY_TOKEN` and
`HOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN` where only used in combination
with `HOMEBREW_ARTIFACT_DOMAIN` which affects *all* curl download strategies.
`HOMEBREW_BOTTLE_DOMAIN` is only used for bottle artifacts, whose mirror might
also require credentials.
this change removes the requirement of using `HOMEBREW_ARTIFACT_DOMAIN`.

related to #13226
2022-05-23 10:38:52 +02:00
Gordon Bleux
b2796ec7fb docs: clarify application of HOMEBREW_ARTIFACT_DOMAIN
bottle URLs are treated differently than any other URL.
this change clarifies the resulting URLs in the manpage.

closes #13222
2022-05-23 09:20:16 +02:00
Bo Anderson
d0e4af8fb5
test/rubocops/patches: silence CodeQL alert 2022-05-20 01:44:05 +01:00
Mike McQuaid
fb4c9353bb
Improve updating behaviour
- Rename use of "preinstall" to "auto update". The original "preinstall"
  naming came from the fact that we used to only auto-update before
  `brew install` but now that it's many commands: this is more confusing
  than useful.
- Add `HOMEBREW_NO_UPDATE_REPORT_ONLY_INSTALLED` and remove
  `HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED`; the latter is now the default
  and the prior provides an opt-out for better output, performance and
  avoiding reading potentially untrusted formulae.
- Add `HOMEBREW_UPDATE_FORMULA_VERSION_CHECKS` and don't check formula
  versions by default for better performance by default.

Co-authored-by: Eric Knibbe <3324775+EricFromCanada@users.noreply.github.com>
Co-authored-by: Sam Ford <1584702+samford@users.noreply.github.com>
2022-05-19 11:04:20 -04:00
Sam Ford
2f0a53c0da
Livecheck: Use Homebrew curl based on root domain
At the moment, `#use_homebrew_curl?` can only be true for a
`homepage` or `stable`/cask `url` with `using: :homebrew_curl`. If
the checked URL differs from these URLs, livecheck won't use brewed
curl. This limitation prevents livecheck from using brewed curl for a
`livecheck` block URL that's a string literal (not a symbol for a
`#checkable_url` like `:stable`, `:head`, `:url`). `libzip` was the
original formula referenced in the related brew issue and it meets
this criterion, so it doesn't appear to be handled by the existing
`#use_homebrew_curl?` implementation.

Additionally, the existing behavior can cause livecheck to
unnecessarily use brewed curl for a completely different website
(e.g., `cubelib`, `otf2`). For example, if the `stable` URL has
`using: :homebrew_curl` and the `livecheck` block has `url
:homepage`, livecheck will use brewed curl when checking the
`homepage`. If these are completely different domains/servers, it's
unlikely that we would need to use brewed curl when checking the
`homepage`, so this particular behavior may not be beneficial.

This commit reimplements `use_homebrew_curl?` to apply brewed curl
when the checked URL's root domain is the same as the root domain of
an aforementioned formula/cask URL with `using: :homebrew_curl`. For
example, this looser approach would allow a `livecheck` block
checking `https://www.example.com/downloads/` to use brewed curl if
the `stable` URL was `https://downloads.example.com/example.zip` with
`using: :homebrew_curl`. These could be different servers but, based
on related formulae, this looseness is necessary for the moment.

This approach aims to resolve both issues, allowing brewed curl to be
applied to a slightly broader range of URLs (i.e., not limited to
just the `#checkable_urls`) while also helping to avoid unnecessarily
applying brewed curl when it's less likely to be useful (completely
different domains). Neither approach is perfect but this one may be
more useful in the interim time.

Depending on how this looser approach works in practice, we may want
to consider returning to a stricter approach once we have something
like `using: :homebrew_curl` in `livecheck` blocks (this is
forthcoming). Being explicit in a `livecheck` block is the most
reliable approach (i.e., only use brewed curl when needed), so we
could favor that and pare down the automated approach to only what's
needed to support implicit checks (i.e., with no `livecheck` block).
Of course, it's also possible to drop the automated approach entirely
and simply require a `livecheck` block in this scenario but we can
decide on how to handle this when the time comes.
2022-05-18 18:48:17 -04:00
Mike McQuaid
f56cd09c91
Merge pull request #13295 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.11.0
build(deps): bump rubocop-rspec from 2.10.0 to 2.11.0 in /Library/Homebrew
2022-05-18 15:58:05 -04:00
Mike McQuaid
7321388287
brew style --fix 2022-05-18 15:37:23 -04:00
Mike McQuaid
95213893a6
Revert "Livecheck: Use Homebrew curl based on root domain" 2022-05-18 15:36:12 -04:00
apainintheneck
b85f407e95 Only upgrade :latest casks when --greedy and the cask has been updated
A sha256 hash of the previous download is stored and compared with
new downloads before updating :latest casks. This prevents unnecessary
reinstalls when the cask hasn't been updated.

Move download path to cask from installer to prevent unnecessary
redownloads of casks.
2022-05-17 16:15:05 -07:00
Sam Ford
fb8a4e5658
Livecheck: Use Homebrew curl based on root domain
At the moment, `#use_homebrew_curl?` can only be true for a
`homepage` or `stable`/cask `url` with `using: :homebrew_curl`. If
the checked URL differs from these URLs, livecheck won't use brewed
curl. This limitation prevents livecheck from using brewed curl for a
`livecheck` block URL that's a string literal (not a symbol for a
`#checkable_url` like `:stable`, `:head`, `:url`). `libzip` was the
original formula referenced in the related brew issue and it meets
this criterion, so it doesn't appear to be handled by the existing
`#use_homebrew_curl?` implementation.

Additionally, the existing behavior can cause livecheck to
unnecessarily use brewed curl for a completely different website
(e.g., `cubelib`, `otf2`). For example, if the `stable` URL has
`using: :homebrew_curl` and the `livecheck` block has `url
:homepage`, livecheck will use brewed curl when checking the
`homepage`. If these are completely different domains/servers, it's
unlikely that we would need to use brewed curl when checking the
`homepage`, so this particular behavior may not be beneficial.

This commit reimplements `use_homebrew_curl?` to apply brewed curl
when the checked URL's root domain is the same as the root domain of
an aforementioned formula/cask URL with `using: :homebrew_curl`. For
example, this looser approach would allow a `livecheck` block
checking `https://www.example.com/downloads/` to use brewed curl if
the `stable` URL was `https://downloads.example.com/example.zip` with
`using: :homebrew_curl`. These could be different servers but, based
on related formulae, this looseness is necessary for the moment.

This approach aims to resolve both issues, allowing brewed curl to be
applied to a slightly broader range of URLs (i.e., not limited to
just the `#checkable_urls`) while also helping to avoid unnecessarily
applying brewed curl when it's less likely to be useful (completely
different domains). Neither approach is perfect but this one may be
more useful in the interim time.

Depending on how this looser approach works in practice, we may want
to consider returning to a stricter approach once we have something
like `using: :homebrew_curl` in `livecheck` blocks (this is
forthcoming). Being explicit in a `livecheck` block is the most
reliable approach (i.e., only use brewed curl when needed), so we
could favor that and pare down the automated approach to only what's
needed to support implicit checks (i.e., with no `livecheck` block).
Of course, it's also possible to drop the automated approach entirely
and simply require a `livecheck` block in this scenario but we can
decide on how to handle this when the time comes.
2022-05-17 00:34:32 -04:00
Bo Anderson
4f5f981436
Merge pull request #13266 from xxyzz/quiet-install
Don't print Cask installed error message when `--quiet` is used
2022-05-11 05:05:25 +01:00
xxyzz
1b877273d8
Don't print Cask installed error message when --quiet is used 2022-05-11 11:03:20 +08:00
Bo Anderson
14870406e0
Merge pull request #13253 from xxyzz/delete-force-update
Add `--no-force-auto-update` option to `brew tap`
2022-05-11 03:23:17 +01:00
xxyzz
2e899da7c7
Add --no-force-auto-update option to brew tap
Enable this option to delete `homebrew.forceautoupdate` git config option
2022-05-11 07:17:17 +08:00
Sam Ford
40b8fd3406
url_protected_by_*: Check multiple headers
Before `#parse_curl_output` was introduced and related methods were
updated to use it, `#url_protected_by_cloudflare?` and
`#url_protected_by_incapsula?` were checking a string of all the
headers from a response and using a regex to check related header
values.

However, when `#curl_http_content_headers_and_checksum` was updated
to use `#parse_curl_output` internally, the `:headers` value became
a hash generated by `#parse_curl_response`. The `#url_protected_by_*`
methods were updated to work with the hash value but this wasn't able
to fully replicate the previous behavior because
`#parse_curl_response` was only keeping the last instance of a given
header (maintaining pre-existing behavior). This is an issue for
these methods because they check `Set-Cookie` headers and there can
be multiple instances of this header in a response.

This commit updates these methods to handle an array of strings in
addition to the existing string support. This change ensures that
these methods properly check all `Set-Cookie` headers, effectively
reinstating the previous behavior.

Past that, this updates one of the early return values in
`#url_protected_by_cloudflare?` to be `false` instead of an implicit
`nil`. After adding a type signature to this method, it became clear
that it wasn't always returning a boolean value and this fixes it.
2022-05-06 10:51:26 -04:00
Sam Ford
94449d07c0
parse_curl_response: Handle duplicate headers
`Curl#parse_curl_response` only includes the last instance of a given
header in its `:headers` hash (replicating pre-existing behavior).
This is a problem for headers like `Set-Cookie`, which can appear more
than once in a response.

This commit addresses the issue by collecting duplicate headers into
an array instead. Headers that only appear once in the response will
still have a string value but headers that appear more than once will
be an array of strings. Whenever headers from `#parse_curl_response`
are used (directly or indirectly), it's important to conditionally
handle the expected types.
2022-05-06 10:51:22 -04:00
Bob Lail
c715ea7fd1 Document the --quiet flag on brew update 2022-05-04 10:52:19 -05:00
apainintheneck
0dd3764041 Allow casks with outdated caskfiles to be reinstalled
The problem occurred when calling `brew reinstall` on a cask
with an out of date caskfile.

To solve the problem Cask::Installer#uninstall_existing_cask has been changed to
catch a possible CaskInvalidError when trying to load outdated
caskfiles using Cask::CaskLoader#load.
2022-05-02 23:39:18 -07:00
Tim Visher
0d81864597 Use file.dirname in most cleaner tests 2022-04-28 10:40:16 -04:00
Tim Visher
8852208758 feedback 2022-04-28 10:40:16 -04:00
Tim Visher
48db5eff25 lint 2022-04-28 10:40:16 -04:00
Tim Visher
fbb3ccbfd6 Keep info/#{f.name}/dir files in cleaner
Still cleans `info/dir` and `info/<arch>/dir` files.

Fixes https://github.com/Homebrew/homebrew-core/issues/100190
2022-04-28 10:40:16 -04:00
Mike McQuaid
e381843215
Merge pull request #13201 from mhmdanas/remove-space-before-colon-in-livecheck-output
Remove space before colon in `livecheck` output
2022-04-27 14:52:30 +01:00
Sean Molenaar
506337e76d
Merge pull request #13196 from SMillerDev/feature/pr-pull/casks_checksum 2022-04-27 12:30:32 +02:00
Bo Anderson
b3da8dbd24
test/os/mac/pkgconfig_spec: fix libffi detection on 12.3+ SDK 2022-04-27 00:59:15 +01:00
mhmdanas
37c46e1acd Remove space before colon in livecheck output 2022-04-27 01:09:16 +03:00
Sean Molenaar
9a25a1d5e1
pr-pull: add checksum update clause 2022-04-26 08:57:29 +02:00
Sam Ford
9171eb2e16
Curl: Add methods to parse response 2022-04-20 23:47:51 -04:00
Sean Molenaar
624ea2a98b
Merge pull request #12790 from SMillerDev/feature/service/socket_and_keepalive
service: add sockets and keepalive variants
2022-04-14 14:20:01 +02:00
Daniel Nachun
97b0162541
Merge pull request #13138 from danielnachun/patch_prefix3
Binary patching of build prefixes
2022-04-13 13:32:01 -07:00
danielnachun
26791734c1
test/keg_relocate/binary_relocation_spec.rb: add new unit test 2022-04-12 15:53:04 -07:00
Sean Molenaar
3d5d12e8b9
service: add sockets and keepalive variants 2022-04-12 12:17:27 +02:00
Issy Long
a8ce086844
Merge pull request #13116 from issyl0/reinstall-cask-zap
cask/reinstall: Support `--zap` for entirely purging cask files
2022-04-12 10:37:58 +01:00
Michka Popoff
a5c29fff2d
utils/github.rb: convert pr to integer
Follow up adter #13124

I made the choice to convert the pr variable to an integer
at the very end and adjust the tests.

It would be maybe more consistent to work with an integer
everywhere, but this needs a more careful analysis and we
are in a hurry to fix the homberew-core upload CI

Fixes:
2022-04-11T20:19:34.1395885Z [31mError:[0m : Variable $pr of type Int! was provided invalid value
2022-04-11T20:19:34.1398279Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/github/api.rb:261:in `open_graphql'
2022-04-11T20:19:34.1399774Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/utils/github.rb:310:in `get_workflow_run'
2022-04-11T20:19:34.1403699Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:418:in `block (4 levels) in pr_pull'
2022-04-11T20:19:34.1405233Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:417:in `each'
2022-04-11T20:19:34.1406723Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:417:in `block (3 levels) in pr_pull'
2022-04-11T20:19:34.1408112Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:128:in `chdir'
2022-04-11T20:19:34.1408986Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/fileutils.rb:128:in `cd'
2022-04-11T20:19:34.1409813Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:400:in `block (2 levels) in pr_pull'
2022-04-11T20:19:34.1410671Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
2022-04-11T20:19:34.1411495Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:399:in `block in pr_pull'
2022-04-11T20:19:34.1412250Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:388:in `each'
2022-04-11T20:19:34.1413056Z /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/pr-pull.rb:388:in `pr_pull'
2022-04-11 22:38:42 +02:00
Bo Anderson
3e75b165ae
utils/github: rewrite get_workflow_run using GraphQL 2022-04-11 20:35:03 +01:00
Issy Long
0b6b2f04da
cask/reinstall: Support --zap for entirely purging cask files
- The `brew uninstall` command has `--zap`, so let's make `brew
  reinstall` have parity here for a better user experience. (Requested
  in issue 12983.)
- It feels weird that to get my new reinstall test to pass I had to add
  `--zap` to `cask/cmd/install.rb`, not `cask/cmd/reinstall.rb` to get
  the tests to pass. But the `brew reinstall --cask caffeine --zap`
  command worked fine all the time. The CLI argument parser from the
  test run was complaining about not knowing what `zap` was. As a
  result, `--zap` now shows up as a switch in `brew install --help`
  which I'm not 100% convinced is the desired UX. But I've edited the
  description accordingly to specify that it will only work on
  `reinstall` operations (and `--zap` on `install` is a no-op).

```
issyl0 at pictor in /opt/homebrew on reinstall-cask-zap
❯ brew reinstall --cask caffeine --zap
==> Downloading https://github.com/IntelliScape/caffeine/releases/download/1.1.3/Caffeine.dmg
Already downloaded: /Users/issyl0/Library/Caches/Homebrew/downloads/3d6ccfdd3b8d0ab37d1c2468d6e69078c2d31d3b12bf51947c4db21e5f376af2--Caffeine.dmg
==> Implied `brew uninstall --cask caffeine`
==> Backing App 'Caffeine.app' up to '/opt/homebrew/Caskroom/caffeine/1.1.3/Caffeine.app'
==> Removing App '/Applications/Caffeine.app'
==> Dispatching zap stanza
==> Trashing files:
~/Library/Application Support/com.intelliscapesolutions.caffeine
~/Library/Preferences/com.intelliscapesolutions.caffeine.plist
~/Library/Caches/com.intelliscapesolutions.caffeine
~/Library/HTTPStoages/com.intelliscapesolutions.caffeine.binarycookies
==> Removing all staged versions of Cask 'caffeine'
==> Installing Cask caffeine
==> Moving App 'Caffeine.app' to '/Applications/Caffeine.app'
🍺  caffeine was successfully installed!
```
2022-04-09 16:37:23 +01:00
Sean Molenaar
d62558aa68
Merge pull request #12692 from SMillerDev/feature/pr-pull/casks
pr-pull: allow casks to be pulled
2022-04-04 16:02:51 +02:00
EricFromCanada
2fdc70c3bf
desc, search: also search cask descriptions 2022-03-30 11:23:55 -04:00
Sean Molenaar
54e15cf361
pr-pull: allow pulling casks 2022-03-30 10:27:17 +02:00
Bo Anderson
ebda92f908
Revert "Binary patching of build prefixes " 2022-03-21 18:22:36 +00:00
Daniel Nachun
058be73b72
Merge pull request #12940 from danielnachun/patch_prefix2
Binary patching of build prefixes
2022-03-21 10:44:22 -07:00
Bo Anderson
fbc5b11a2d
Merge pull request #12988 from apainintheneck/add_keep_alive
Added Service#keep_alive? method
2022-03-14 04:20:41 +00:00
danielnachun
843a189d40
test/keg_relocate/binary_relocation_spec.rb: add new unit test 2022-03-12 17:46:09 -08:00
apainintheneck
62de156c40 Added Service#keep_alive? method 2022-03-11 12:42:41 -08:00
danielnachun
2c4ad58d16
test/software_spec/bottle_spec.rb: add unit tests 2022-03-10 11:32:32 -08:00
Daniel Nachun
d2857e0dd8
Merge pull request #12964 from danielnachun/new_binary_grep
Use simpler method to detect binaries
2022-03-09 16:39:21 -08:00
danielnachun
1faa4448bd
test/keg_relocate/grep_spec.rb: update unit test 2022-03-09 13:33:50 -08:00
Mike McQuaid
0bd1e6a24d
Merge pull request #12966 from Bo98/svn-test-fix
test/os/mac/dependency_collector_spec: fix svn test on older macOS
2022-03-07 08:54:33 +00:00