@@ -505,6 +505,8 @@ def audit_signing
505
505
extract_artifacts do |artifacts , tmpdir |
506
506
is_container = artifacts . any? { |a | a . is_a? ( Artifact ::App ) || a . is_a? ( Artifact ::Pkg ) }
507
507
508
+ any_signing_failure = T . let ( false , T ::Boolean )
509
+
508
510
artifacts . each do |artifact |
509
511
next if artifact . is_a? ( Artifact ::Binary ) && is_container == true
510
512
@@ -529,13 +531,11 @@ def audit_signing
529
531
add_error "Unknown artifact type: #{ artifact . class } " , location : url . location
530
532
end
531
533
532
- if result . success? && cask . deprecated? && cask . deprecation_reason == :unsigned
533
- add_error "Cask is deprecated as unsigned but artifacts are signed!"
534
- end
534
+ next if result . success?
535
535
536
- next if cask . deprecated? && cask . deprecation_reason == :unsigned
536
+ any_signing_failure = true
537
537
538
- next if result . success?
538
+ next if cask . deprecated? && cask . deprecation_reason == :unsigned
539
539
540
540
add_error <<~EOS , location : url . location
541
541
Signature verification failed:
@@ -544,6 +544,10 @@ def audit_signing
544
544
Please contact the upstream developer to let them know they should sign and notarize their software.
545
545
EOS
546
546
end
547
+
548
+ if cask . deprecated? && cask . deprecation_reason == :unsigned && !any_signing_failure
549
+ add_error "Cask is deprecated as unsigned but all artifacts are signed!"
550
+ end
547
551
end
548
552
end
549
553
@@ -640,6 +644,12 @@ def audit_rosetta
640
644
extract_artifacts do |artifacts , tmpdir |
641
645
is_container = artifacts . any? { |a | a . is_a? ( Artifact ::App ) || a . is_a? ( Artifact ::Pkg ) }
642
646
647
+ # Aggregate results across artifacts to decide on Rosetta caveat once.
648
+ any_requires_rosetta = T . let ( false , T ::Boolean )
649
+
650
+ mentions_rosetta = cask . caveats . include? ( "requires Rosetta 2" )
651
+ requires_intel = cask . depends_on . arch &.any? { |arch | arch [ :type ] == :intel }
652
+
643
653
artifacts . each do |artifact |
644
654
next if !artifact . is_a? ( Artifact ::App ) && !artifact . is_a? ( Artifact ::Binary )
645
655
next if artifact . is_a? ( Artifact ::Binary ) && is_container
@@ -675,17 +685,19 @@ def audit_rosetta
675
685
next
676
686
end
677
687
678
- supports_arm = result . merged_output . include? ( "arm64" )
679
- mentions_rosetta = cask . caveats . include? ( "requires Rosetta 2" )
680
- requires_intel = cask . depends_on . arch &.any? { |arch | arch [ :type ] == :intel }
688
+ supports_arm = T . cast ( result . merged_output . include? ( "arm64" ) , T ::Boolean )
689
+ requires_rosetta_for_artifact = T . cast ( !supports_arm && result . merged_output . include? ( "x86_64" ) , T ::Boolean )
690
+ any_requires_rosetta ||= requires_rosetta_for_artifact
691
+ end
681
692
682
- if supports_arm && mentions_rosetta
683
- add_error "Artifacts do not require Rosetta 2 but the caveats say otherwise!" ,
684
- location : url . location
685
- elsif !supports_arm && !mentions_rosetta && !requires_intel
686
- add_error "Artifacts require Rosetta 2 but this is not indicated by the caveats!" ,
693
+ if any_requires_rosetta
694
+ if !mentions_rosetta && !requires_intel
695
+ add_error "At least one artifact requires Rosetta 2 but this is not indicated by the caveats!" ,
687
696
location : url . location
688
697
end
698
+ elsif mentions_rosetta
699
+ add_error "No artifacts require Rosetta 2 but the caveats say otherwise!" ,
700
+ location : url . location
689
701
end
690
702
end
691
703
end
0 commit comments