mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Don't fail if allegedly missing uninstall entries already exist in casks. (#89490)
This commit is contained in:
@@ -199,27 +199,22 @@ jobs:
|
||||
- name: Compare installed and running apps and services with snapshot
|
||||
run: |
|
||||
brew ruby -r "$(brew --repository homebrew/cask)/cmd/lib/check.rb" <<'EOF'
|
||||
require "cask/cask_loader"
|
||||
require "utils/github/actions"
|
||||
|
||||
before = JSON.parse(<<~'EOS').transform_keys(&:to_sym)
|
||||
${{ steps.snapshot.outputs.before }}
|
||||
EOS
|
||||
after = Check.all
|
||||
|
||||
errors = Check.errors(before, after)
|
||||
cask = Cask::CaskLoader.load('${{ matrix.cask.path }}')
|
||||
errors = Check.errors(before, after, cask: cask)
|
||||
|
||||
errors.each do |error|
|
||||
onoe error
|
||||
puts GitHub::Actions::Annotation.new(:error, error, file: '${{ matrix.cask.path }}')
|
||||
end
|
||||
|
||||
error = errors.map { |e|
|
||||
Tty.strip_ansi(e)
|
||||
.gsub(/\r/, '%0D')
|
||||
.gsub(/\n/, '%0A')
|
||||
.gsub(/]/, '%5D')
|
||||
.gsub(/;/, '%3B')
|
||||
}.join("\n\n")
|
||||
|
||||
puts "::error file=${{ matrix.cask.path }}::#{error}"
|
||||
|
||||
exit 1 if errors.any?
|
||||
EOF
|
||||
if: always() && steps.snapshot.outcome == 'success'
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ module Cask
|
||||
|
||||
after = Check.all
|
||||
|
||||
errors = Check.errors(before, after)
|
||||
errors = Check.errors(before, after, cask: cask)
|
||||
|
||||
next success if errors.empty?
|
||||
|
||||
|
||||
+5
-3
@@ -76,7 +76,9 @@ module Check
|
||||
CHECKS.transform_values(&:call)
|
||||
end
|
||||
|
||||
def self.errors(before, after)
|
||||
def self.errors(before, after, cask:)
|
||||
uninstall_directives = cask.artifacts.select { |a| a.class == Cask::Artifact::Uninstall }.first&.directives || {}
|
||||
|
||||
diff = {}
|
||||
|
||||
CHECKS.each_key do |name|
|
||||
@@ -125,13 +127,13 @@ module Check
|
||||
.added
|
||||
.reject { |id| id.match?(/\.\d+\Z/) }
|
||||
|
||||
if running_apps.any?
|
||||
if (running_apps - uninstall_directives.fetch(:quit, [])).any?
|
||||
message = "Some applications are still running, add them to #{Formatter.identifier("uninstall quit:")}\n"
|
||||
message += running_apps.join("\n")
|
||||
errors << message
|
||||
end
|
||||
|
||||
if loaded_launchjobs.any?
|
||||
if (loaded_launchjobs - uninstall_directives.fetch(:launchctl, [])).any?
|
||||
message = "Some launch jobs were not unloaded, add them to #{Formatter.identifier("uninstall launchctl:")}\n"
|
||||
message += loaded_launchjobs.join("\n")
|
||||
errors << message
|
||||
|
||||
Reference in New Issue
Block a user