4561 Commits

Author SHA1 Message Date
Mohammad Zain Abbas
ed37ee55a9 brew style fixes for livecheck tests in resource 2022-06-30 17:27:48 +02:00
Mohammad Zain Abbas
b3b17ee7bf Updated tests for livecheck block in resources 2022-06-30 17:06:32 +02:00
Mohammad Zain Abbas
ff63136c6f Added tests for livecheck in resource_spec.rb 2022-06-30 16:06:36 +02: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
Rylan Polster
ac067eedb2
Create MacOSVersions module 2022-06-29 11:34:49 -04:00
Rylan Polster
5ec19adf58
Rename Override module to SimulateSystem 2022-06-28 15:35:20 -04:00
Rylan Polster
d96a8fd35e
Fix tests 2022-06-24 17:20:03 -04:00
Rylan Polster
6ebd5174d6
Update tests for on_* methods in formulae and casks 2022-06-24 14:39:17 -04:00
Bo Anderson
02164a35db
Use ORIGINAL_PATHS over envs; reject nil PATH 2022-06-17 19:47:57 +01:00
Bo Anderson
e78665f4f7
Replace ENV["HOME"] with Dir.home 2022-06-17 19:47:57 +01:00
Bo Anderson
40bbdc659e
Fix some Style/FetchEnvVar offences 2022-06-17 19:47:57 +01:00
Bo Anderson
cd73e6bac5
Introduce more Ruby constants for values set by brew.sh 2022-06-17 19:47:57 +01:00
Bo Anderson
50437ca07e
Clear cached curl path where HOMEBREW_CURL changes 2022-06-17 19:47:55 +01:00
Rylan Polster
15cf890ed7
Fix caveats when loading from the API 2022-06-16 20:24:22 -04:00
Rylan Polster
0ea9f5ec80
Add tests for convert_to_string_or_symbol 2022-06-16 16:45:38 -04:00
Rylan Polster
3cf86dad30
Handle deprecate/disable symbols when loading from the API 2022-06-16 16:22:59 -04:00
Rylan Polster
78aa927ba8
Fix dependency check test again 2022-06-16 15:27:19 -04:00
Rylan Polster
2adfdae482
Fix dependency check test 2022-06-16 14:52:21 -04:00
Rylan Polster
8c8c6964c8
Add more API test coverage 2022-06-16 14:27:39 -04:00
Rylan Polster
dd516e4355
Expand Formulary test coverage 2022-06-16 13:58:23 -04:00
Rylan Polster
0113774e90
Add test 2022-06-15 18:09:51 -04:00
Rylan Polster
ccd46af7c6
Cleanup 2022-06-14 16:42:10 -04:00
Rylan Polster
89483abda9
Remove Bottle API 2022-06-14 16:06:05 -04:00
Mike McQuaid
0a053d091e
Merge pull request #13258 from UiP9AV6Y/bugfix_artifact_domain_bottles
change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
2022-06-14 09:01:51 +01:00
Sam Ford
5930880920
Gnome: Update default regex and version filtering
The `Gnome` strategy's default regex uses the `+` form of the standard
regex for matching versions like 1.2.3. However, with the switch to
the new version scheme, some packages had a release that omits a
minor and patch (i.e., `40` instead of `40.0`). The default regex
fails to match versions like this but the looser `*` form will match
both. [When creating regexes, we generally start with the `+` form
and only switch to the looser `*` form when it's necessary and
contextually-appropriate.]

This also updates the default version filtering logic that's applied
to versions using the old GNOME version scheme (below version 40).
Outside of the refactoring changes, this also filters out versions
where the patch number is 90+, as these are also unstable.
2022-06-13 18:17:56 -04:00
Gordon Bleux
bcfd20e1b9 change cURL download behaviour for HOMEBREW_ARTIFACT_DOMAIN.
instead of prefixing and/or replacing data in URLs, the
*HOMEBREW_ARTIFACT_DOMAIN* environment variable only replaces
the bottle base URL. this causes URLs from Casks and other assets
to be no longer affected by this feature.

closes #13226
closes #13222
closes #13227
2022-06-11 08:24:50 +02:00
apainintheneck
1d5c668110 Remove unused parser option required_for 2022-06-08 15:23:58 -07:00
Bo Anderson
75e76361ac
Preliminary macOS 13 support 2022-06-07 02:39:36 +01:00
Mike McQuaid
845925bf56
Merge pull request #13311 from bevanjkay/fix-outdated-greedy
cask: fix greedy outdated command
2022-06-06 10:05:24 +01:00
Sam Ford
ca9932fdd9
Merge pull request #13368 from samford/livecheck/sparkle-provide-channel-info-in-item
Sparkle: Provide channel information in Item
2022-06-03 16:16:20 -04:00
Mike McQuaid
04c8e02418
cmd/update-report: use better wording where appropriate.
From reading https://github.com/orgs/Homebrew/discussions/3328: I
initially thought we should just change "Updated" to "Modified" when
appropriate. After conversation with Bo98, though, I thought more and
saw that we're already checking for outdated formulae here so, rather
than ever traverse through the formula history, look at the outdated
formula and list them unless we've set
`HOMEBREW_UPDATE_REPORT_ALL_FORMULAE` in which case we show the
modifications.

While we're here, also do a bit of reformatting and renaming to better
clarify intent.
2022-06-03 19:23:38 +01:00
Sam Ford
71906c7f89
Tidy up Sparkle tests a bit 2022-06-02 10:36:33 -04:00
Sam Ford
c6907f911f
Sparkle: Provide channel information in Item
Making `channel` information available in the `Item` is necessary
to be able to filter out unstable items using a `strategy` block. If
an item doesn't specify a channel, then it uses the default channel
(this is what Sparkle itself uses for updates). Channels like `beta`
are something we want to avoid for stable casks and this allows for
that type of [cask-specific] filtering.

It's technically possible to automatically filter out items that
aren't using the default channel (i.e., `channel != nil`) in
`#items_from_content` but some casks use an unstable version, so we
can't do this internally. That is to say, we wouldn't be able to
override internal filtering in a `strategy` block, as any omitted
items wouldn't be provided to the block. Conversely, if we pass all
items to a `strategy` block, we can easily filter by channel there.
We haven't been filtering by channel internally and we've only found
one cask where this has been a problem, so it seems fine for now.
2022-06-02 10:35:00 -04:00
Sam Ford
b4cb47815f
Sparkle: Pass all items into strategy block
It's sometimes necessary to work with all the items in a Sparkle feed
to be able to correctly identify the newest version but livecheck's
`Sparkle` strategy only passes the `item` it views as newest into a
`strategy` block.

This updates the `Sparkle` strategy to optionally pass all items into
a `strategy` block, so we can manipulate them (e.g., filtering,
sorting). This is enabled by naming the first argument of the
strategy block `items` instead of `item`. `Sparkle` `strategy` blocks
where the first argument is `item` will continue to work as expected.

This necessarily updates `#item_from_content` (now
`items_from_content`) to return all items. I've decided to move the
sorting out of `#items_from_content`, so it simply returns the items
in the order they appear. If there is ever an exceptional situation
where we need the original order, this will technically allow for it.

The sorting has instead been moved into the `#versions_from_content`
method, to maintain the existing behavior. I thought about passing
the items into the `strategy` block in their original order but it
feels like sorting by default is the better approach for now (partly
from the perspective of maintaining existing behavior) and we can
always revisit this in the future if a cask ever requires the
original order.

Lastly, this expands the `Sparkle` tests to increase coverage. The
only untested parts are `#find_versions` (which currently
requires a network request) and a couple safeguard `raise` calls
when there's a `REXML::UndefinedNamespaceException` (which shouldn't
be encountered unless something is broken).
2022-06-01 18:29:37 -04:00
Mike McQuaid
9a48d24545
Merge pull request #13347 from MikeMcQuaid/3.5.0-deprecation-disable-delete
Disable and delete code for 3.5.0
2022-05-31 13:03:03 +01:00
Bo Anderson
b63595a627
test/cask/quarantine: improve audit test output 2022-05-31 03:29:42 +01:00
Mike McQuaid
1bb44979ee
Disable and delete code for 3.5.0
The next planned release will be 3.5.0 so let's fix things up for there.
2022-05-30 14:59:14 +01:00
Bevan Kay
e64ab4c0f7
Fix test 2022-05-30 18:30:18 +10: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
Bo Anderson
5e6d5f68ca
test/download_strategies/curl_github_packages: fix bad const override 2022-05-24 22:50:22 +01:00
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