Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cask: audit for minimal OS version in sparkle feeds #14060

Merged
merged 3 commits into from Nov 1, 2022

Conversation

SMillerDev
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This should prevent situations where we forget to update the macOS dependency if there is a new version required upstream

@BrewTestBot
Copy link
Member

Review period will end on 2022-11-01 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Oct 30, 2022
Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea

Library/Homebrew/cask/audit.rb Outdated Show resolved Hide resolved
Library/Homebrew/cask/audit.rb Outdated Show resolved Hide resolved
Co-authored-by: Bo Anderson <mail@boanderson.me>
@p-linnane
Copy link
Member

Love this because it is often forgotten until something breaks.

@SMillerDev
Copy link
Member Author

The recent iTerm update is exactly what motivated me here. If you have other things people forget, don't hesitate to ask me or make your own audit for it.

@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Nov 1, 2022
@BrewTestBot
Copy link
Member

Review period ended.

@SMillerDev SMillerDev requested a review from Bo98 November 1, 2022 09:05
@MikeMcQuaid MikeMcQuaid merged commit 29e3e59 into Homebrew:master Nov 1, 2022
@MikeMcQuaid
Copy link
Member

Thanks @SMillerDev!

Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return unless cask.livecheckable?
return unless cask.livecheck.strategy == :sparkle

out, _, status = curl_output(cask.livecheck.url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out, _, status = curl_output(cask.livecheck.url)
out, _, status = curl_output("--fail", "--silent", "--location", cask.livecheck.url)

So that it will detect non-200 codes, follow redirects etc.


return if xml.blank?

item = xml.get_elements("//rss//channel//item").first
Copy link
Member

@Bo98 Bo98 Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
item = xml.get_elements("//rss//channel//item").first
item = xml.elements["//rss//channel//item"]

Just for consistent code style with below. elements[...] should be the same as get_elements(...).first.

Doesn't really matter though.

item = xml.get_elements("//rss//channel//item").first
return if item.blank?

min_os = item.elements["sparkle:minimumSystemVersion"].text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
min_os = item.elements["sparkle:minimumSystemVersion"].text
min_os = item.elements["sparkle:minimumSystemVersion"]&.text

If there's no minimum version, then this will be nil.

min_os = item.elements["sparkle:minimumSystemVersion"].text
return if min_os.blank?

min_os_string = OS::Mac::Version.new(min_os).strip_patch
Copy link
Member

@Bo98 Bo98 Nov 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
min_os_string = OS::Mac::Version.new(min_os).strip_patch
begin
min_os_string = OS::Mac::Version.new(min_os).strip_patch
rescue MacOSVersionError
return
end

In case the source returns an invalid macOS version, or one we don't support (e.g. Yosemite and earlier).

@MikeMcQuaid
Copy link
Member

Oops sorry @Bo98!

@github-actions github-actions bot added the outdated PR was locked due to age label Dec 2, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants