4404 Commits
Author SHA1 Message Date
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 McQuaidandGitHub 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 MolenaarandGitHub 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 MolenaarandGitHub 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 NachunandGitHub 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 LongandGitHub 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 MolenaarandGitHub 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 AndersonandGitHub ebda92f908 Revert "Binary patching of build prefixes " 2022-03-21 18:22:36 +00:00
Daniel NachunandGitHub 058be73b72 Merge pull request #12940 from danielnachun/patch_prefix2
Binary patching of build prefixes
2022-03-21 10:44:22 -07:00
Bo AndersonandGitHub 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 NachunandGitHub 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 McQuaidandGitHub 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
Bo Anderson 4db0b9963c test/spec_helper: prevent stdin trashing 2022-03-06 19:06:28 +00:00
Bo Anderson a2f95125f0 test/os/mac/dependency_collector_spec: fix svn test on older macOS 2022-03-06 19:04:04 +00:00
Bo Anderson e4159a7986 dev-cmd/pr-pull: consider alternative tap formula directories
Fixes #12939.
2022-03-01 16:39:09 +00:00
Mike McQuaidandGitHub c84cb39d04 Merge pull request #12937 from Homebrew/dependabot/bundler/Library/Homebrew/rubocop-rspec-2.9.0
build(deps): bump rubocop-rspec from 2.8.0 to 2.9.0 in /Library/Homebrew
2022-03-01 10:03:13 +00:00
Issy Long cb2a09e65e Fix (auto-correct) more RSpec/BeNil offenses
- The `RSpec/BeEq` auto-corrections made more `RSpec/BeNil` offenses, so another go of `brew style --only=RSpec/BeNil --fix\` is needed.
2022-03-01 00:36:37 +00:00
Issy Long 72e48024f0 Fix (auto-correct) RuboCop Rspec/BeEq offenses 2022-03-01 00:10:14 +00:00
Issy Long 6b76fd012a Fix (auto-correct) RuboCop RSpec/BeNil offenses 2022-03-01 00:10:10 +00:00
Daniel NachunandGitHub 76e4f6bc79 Merge pull request #12890 from danielnachun/add_binary_grep
Add binary grep method to keg_relocate
2022-02-28 11:27:09 -08:00
danielnachun dd898e58b8 test/keg_relocate/grep_spec.rb: add new unit tests 2022-02-28 08:59:33 -08:00
Mike McQuaidandGitHub d48a9337e4 Revert "update-report: default HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED to on." 2022-02-28 09:54:12 +00:00
Mike McQuaid 16bdd42308 cask/dsl/version_spec: remove deprecated specs.
No idea why these didn't fail before now?
2022-02-25 15:26:37 +00:00
Mike McQuaidandGitHub 7ec6d41a1d Revert "formula: remove OnOS." 2022-02-24 12:31:32 +00:00
Mike McQuaidandGitHub dd8a245158 Merge pull request #12910 from Homebrew/update_report_only_installed_default
update-report: default HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED to on.
2022-02-24 08:46:08 +00:00
Mike McQuaid 73951a01fc formula: remove OnOS. 2022-02-22 10:19:09 +00:00
Mike McQuaid 10d5266361 update-report: default HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED to on.
This avoids reading formula files that the user hasn't explicitly
installed which both speeds up `brew update` and improves the security.
2022-02-22 10:01:24 +00:00
Mike McQuaidandGitHub 249bc2136a Merge pull request #12837 from NickHackman/service-launch-only-once
service: launch only once
2022-02-14 09:17:44 +00:00