234 Commits

Author SHA1 Message Date
Mike McQuaid
77c0d38c35
brew style --fix 2022-12-13 11:37:06 +00:00
Frederick Zhang
c27eed4606
Curl: Fix following redirections when base changes
Update base URL when there is an absolute location, so that following
relative locations are considered relative to the new base.

Consider below cURL output for https://example_one.com:

    HTTP/1.1 302 Moved Temporarily
    Location: https://example_two.com

    HTTP/1.1 302 Moved Temporarily
    Location: /foo/

    HTTP/1.1 200 OK

The final URL should be https://example_two.com/foo/ rather than
https://example_one.com/foo/.
2022-11-30 01:32:24 +11:00
Bo Anderson
e7b47bc34e
test: sort metadata alphabetically 2022-11-05 16:51:33 +00:00
Bo Anderson
eac32f0b20
Additional fixes for Ruby 3 compatibility 2022-10-18 01:54:59 +01:00
Bo Anderson
9b99594753
Preliminary compatibility fixes for Ruby 3 2022-10-11 02:53:27 +01:00
Mike McQuaid
1b3f5980be
Merge pull request #13839 from apainintheneck/no-autoremove-build-deps-when-built-from-src
autoremove: ignore build deps when built from src
2022-09-14 13:10:14 +01:00
apainintheneck
f068f74f55 Move autoremove code to util and add tests 2022-09-13 23:23:48 -07:00
Mike McQuaid
7349c2b996
brew style --fix 2022-09-13 09:43:09 +01:00
Mike McQuaid
bc295f7947
update-sponsors: don't require admin token.
Instead, use a different API to query these with a lower scope.

This should be usable by GitHub Actions.
2022-09-07 16:49:41 +01:00
Bo Anderson
04f6f53b58
dev-cmd/pr-pull: avoid expensive search API calls 2022-09-03 21:19:37 +01:00
Rylan Polster
6c35317732
Add and update tests 2022-07-21 16:41:23 +02:00
Rylan Polster
eab3d077bc
Improvements 2022-07-21 15:32:51 +02:00
Bo Anderson
6eb2d6df9a
utils/ruby_check_version_script: fix invalid shebang 2022-07-16 02:49:33 +01:00
Mike McQuaid
217bfb7dad
utils/ruby_check_version_script: fix and test.
Don't use ActiveSupport methods and add a test to make sure this doesn't regress.

Fixes #13559
2022-07-16 02:47:33 +01:00
Mike McQuaid
22d6af1258
Manual brew style fixes. 2022-06-30 08:56:21 +01:00
Mike McQuaid
2d5eab2e1c
brew style --fix 2022-06-30 08:56:21 +01:00
Bo Anderson
40bbdc659e
Fix some Style/FetchEnvVar offences 2022-06-17 19:47:57 +01:00
Sam Ford
7b23bc64e5
Curl: Rename :status to :status_code
The return hash from `#curl_http_content_headers_and_checksum`
contains a `:status`, which is the status code of the last response.
This string value comes from `#parse_curl_response`, where the key is
`:status_code` instead.

Aligning these keys technically allows us to pass either of these
hashes to the `#url_protected_by_*` methods, as both contain
`:status_code` and `:headers` in the expected format.
2022-05-25 16:50:02 -04: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
Sam Ford
9171eb2e16
Curl: Add methods to parse response 2022-04-20 23:47:51 -04: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
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
Niklas Higi
00f209e16e
Recommend interactive usage of fish_add_path
Since the `fish_add_path` command modifies a universal Fish variable
(which is automatically persisted to a file) it's unnecessary to run it
again every time a new shell is opened.
2022-02-05 16:29:09 +01:00
Carlo Cabrera
2b60a99d4a
Revert "shebang: raise error if no rewriting"
This is causing failures when attempting to rewrite shebangs during the
cleanup stage of `brew install`.

See, for example, Homebrew/homebrew-core#94323,
Homebrew/homebrew-core#94321.

This reverts commit 7e6be5eb4474ed9eaa4b8e9a5a45e3340186840c.
2022-02-02 20:44:03 +08:00
Branch Vincent
7e6be5eb44
shebang: raise error if no rewriting 2022-02-01 00:17:50 -05:00
Mike McQuaid
b09f421027
repology: always use Homebrew curl.
This seems to be required even with TLSv1.3 support now.

Also, while we're here, improve the error handling/output.
2022-01-03 13:17:12 +00:00
Steve Peters
d53dab62c9
bump-revision: add --remove-bottle-block option
This removes a bottle block for the specified formulae
while bumping the revision.
2021-12-26 03:42:39 -08:00
Rylan Polster
2e6b6ab3a2
Fix style 2021-12-24 21:15:21 -05:00
Rylan Polster
7656c09184
Only check for Rosetta on macOS 2021-12-05 13:03:38 -05:00
Nipunn Koorapati
30c4663066 Fix analytics string to test for CI 2021-12-04 12:29:31 -05:00
Rylan Polster
b58551cd67
Control for CPU type and Rosetta in os_arch_prefix_ci tests 2021-12-03 22:29:10 -05:00
Nipunn Koorapati
e2fc14b0b7 Fix analytics_spec.rb test to pass when run from M1 2021-12-03 20:14:17 -05:00
XuehaiPan
d1aac8857a tests/utils/git_spec: update tests for ensure_formula_installed! 2021-11-24 00:30:26 +08:00
Carlo Cabrera
105d1f9cfc
utils/github/actions: make file a mandatory argument
An annotation is pretty useless if you don't specify a file to place the
annotation on, so let's just require it.
2021-11-16 23:42:03 +08:00
EricFromCanada
c952ea7358
bump: fix tests 2021-10-25 15:55:11 -04:00
EricFromCanada
811d0fa0bd
bump: add option to retrieve a subset of results
Plus a few fixes for output.
2021-10-19 20:14:39 -04:00
Bo Anderson
30b24cf4ad
Use HOMEBREW_CURL universally, including formulae 2021-10-04 02:03:04 +01:00
Bo Anderson
b55498269f
Revamp APIs around bottle specifications 2021-09-20 15:02:05 +01:00
fn ⌃ ⌥
0c3e49092c upgrade: use topological sort to upgrade formulae 2021-09-09 13:41:50 -07:00
Sam Ford
d44979fa67
Curl#curl_args: Fix and refactor options 2021-09-07 14:13:17 -04:00
Nanda H Krishna
5ccfbcd1d2
Autocorrect style issues with brew style --fix 2021-07-08 12:36:39 +05:30
Mike McQuaid
1680ddb267
utils/repology: temporarily disable functionality.
Doesn't work with system `curl` currently.
2021-06-30 09:20:56 +01:00
Michael Cho
d304c84f2a
test/utils/github_spec: fix artifact number 2021-06-25 11:36:13 -07:00
Alexander Bayandin
d55cbeac78
github_spec: Update PR number with unexpired artifacts 2021-06-24 13:29:44 +01:00
Sam Ford
0752d25125
OS::Mac: Move version methods into ::Version 2021-06-23 09:03:46 -04:00
Misty De Meo
c0a02442d9
Revert "language/java: use shortened brew paths"
This reverts commits 318175cfe2b23328f1b5f13812fd59cfd45fe1dc,
e7ab760392b9691a6c730b7e0d660b7874969e70 and
3b35af63f608438b1882756feca94a6ebdd0d6a3 (PR #11537).
2021-06-17 20:29:43 -07:00