-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -545,6 +545,38 @@ def check_livecheck_version | |||||||||||||||
false | ||||||||||||||||
end | ||||||||||||||||
|
||||||||||||||||
def check_livecheck_min_os | ||||||||||||||||
return unless online? | ||||||||||||||||
return unless cask.livecheckable? | ||||||||||||||||
return unless cask.livecheck.strategy == :sparkle | ||||||||||||||||
|
||||||||||||||||
out, _, status = curl_output(cask.livecheck.url) | ||||||||||||||||
return unless status.success? | ||||||||||||||||
|
||||||||||||||||
require "rexml/document" | ||||||||||||||||
|
||||||||||||||||
xml = begin | ||||||||||||||||
REXML::Document.new(out) | ||||||||||||||||
rescue REXML::ParseException | ||||||||||||||||
nil | ||||||||||||||||
end | ||||||||||||||||
|
||||||||||||||||
return if xml.blank? | ||||||||||||||||
|
||||||||||||||||
item = xml.get_elements("//rss//channel//item").first | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Just for consistent code style with below. Doesn't really matter though. |
||||||||||||||||
return if item.blank? | ||||||||||||||||
|
||||||||||||||||
min_os = item.elements["sparkle:minimumSystemVersion"].text | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If there's no minimum version, then this will be nil. |
||||||||||||||||
return if min_os.blank? | ||||||||||||||||
|
||||||||||||||||
min_os_string = OS::Mac::Version.new(min_os).strip_patch | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
In case the source returns an invalid macOS version, or one we don't support (e.g. Yosemite and earlier). |
||||||||||||||||
cask_min_os = cask.depends_on.macos.version | ||||||||||||||||
|
||||||||||||||||
return if cask_min_os == min_os_string | ||||||||||||||||
|
||||||||||||||||
add_error "Upstream defined #{min_os_string} as minimal OS version and the cask defined #{cask_min_os}" | ||||||||||||||||
end | ||||||||||||||||
|
||||||||||||||||
sig { void } | ||||||||||||||||
def check_appcast_contains_version | ||||||||||||||||
return unless appcast? | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So that it will detect non-200 codes, follow redirects etc.