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

Add audit warning if previous Cask version cannot be read. #3248

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions Library/Homebrew/cask/lib/hbc/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,16 @@ def check_version_and_checksum
previous_cask_contents = Git.last_revision_of_file(tap.path, @cask.sourcefile_path, before_commit: commit_range)
return if previous_cask_contents.empty?

previous_cask = CaskLoader.load_from_string(previous_cask_contents)
begin
previous_cask = CaskLoader.load_from_string(previous_cask_contents)

return unless previous_cask.version == cask.version
return if previous_cask.sha256 == cask.sha256
return unless previous_cask.version == cask.version
return if previous_cask.sha256 == cask.sha256

add_error "only sha256 changed (see: https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/sha256.md)"
add_error "only sha256 changed (see: https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/sha256.md)"
rescue CaskError => e
add_warning "Skipped version and checksum comparison. Reading previous version failed: #{e}"
end
end

def check_version
Expand Down