diff options
| author | Markus Reiter | 2017-01-23 17:17:50 +0100 |
|---|---|---|
| committer | GitHub | 2017-01-23 17:17:50 +0100 |
| commit | e59ada508727f11464595893783beb914c26f60b (patch) | |
| tree | 795520e45d29052df65c56503c4a6d2983334ef1 /Library/Homebrew/cask/lib/hbc/audit.rb | |
| parent | 44596696175bef38f3cde07e4f45285c322996b8 (diff) | |
| parent | 2076b494a6233630025acd45d9a5766bd6bb785d (diff) | |
| download | brew-1.1.8.tar.bz2 | |
Merge pull request #1894 from reitermarkus/appcast-checkpoint1.1.8
Add internal command to calculate appcast checkpoint.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/audit.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/audit.rb | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/audit.rb b/Library/Homebrew/cask/lib/hbc/audit.rb index 955ecdbb0..12cefb939 100644 --- a/Library/Homebrew/cask/lib/hbc/audit.rb +++ b/Library/Homebrew/cask/lib/hbc/audit.rb @@ -133,20 +133,19 @@ module Hbc def check_appcast_checkpoint_accuracy odebug "Verifying appcast checkpoint is accurate" - result = @command.run("/usr/bin/curl", args: ["--compressed", "--location", "--user-agent", URL::FAKE_USER_AGENT, cask.appcast], print_stderr: false) - if result.success? - processed_appcast_text = result.stdout.gsub(%r{<pubDate>[^<]*</pubDate>}, "") - # This step is necessary to replicate running `sed` from the command line - processed_appcast_text << "\n" unless processed_appcast_text.end_with?("\n") + result = cask.appcast.calculate_checkpoint + + actual_checkpoint = result[:checkpoint] + + if actual_checkpoint.nil? + add_warning "error retrieving appcast: #{result[:command_result].stderr}" + else expected = cask.appcast.checkpoint - actual = Digest::SHA2.hexdigest(processed_appcast_text) - add_warning <<-EOS.undent unless expected == actual + add_warning <<-EOS.undent unless expected == actual_checkpoint appcast checkpoint mismatch Expected: #{expected} - Actual: #{actual} + Actual: #{actual_checkpoint} EOS - else - add_warning "error retrieving appcast: #{result.stderr}" end end |
