@@ -505,8 +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
- artifacts . each do |artifact |
509
- next if artifact . is_a? ( Artifact ::Binary ) && is_container == true
508
+ any_signing_failure = artifacts . any? do |artifact |
509
+ next false if artifact . is_a? ( Artifact ::Binary ) && is_container == true
510
510
511
511
artifact_path = artifact . is_a? ( Artifact ::Pkg ) ? artifact . path : artifact . source
512
512
@@ -521,28 +521,32 @@ def audit_signing
521
521
system_command ( "gktool" , args : [ "scan" , path ] , print_stderr : false )
522
522
when Artifact ::Binary
523
523
# Shell scripts cannot be signed, so we skip them
524
- next if path . text_executable?
524
+ next false if path . text_executable?
525
525
526
526
system_command ( "codesign" , args : [ "--verify" , "-R=notarized" , "--check-notarization" , path ] ,
527
527
print_stderr : false )
528
528
else
529
529
add_error "Unknown artifact type: #{ artifact . class } " , location : url . location
530
530
end
531
531
532
- if result . success? && cask . deprecated? && cask . deprecation_reason == :unsigned
533
- add_error "Cask is deprecated as unsigned but artifacts are signed!"
534
- end
535
-
536
- next if cask . deprecated? && cask . deprecation_reason == :unsigned
537
-
538
- next if result . success?
532
+ next false if result . success?
533
+ next true if cask . deprecated? && cask . deprecation_reason == :unsigned
539
534
540
535
add_error <<~EOS , location : url . location
541
536
Signature verification failed:
542
537
#{ result . merged_output }
543
538
macOS on ARM requires software to be signed.
544
539
Please contact the upstream developer to let them know they should sign and notarize their software.
545
540
EOS
541
+
542
+ true
543
+ end
544
+
545
+ if cask . deprecated? && cask . deprecation_reason == :unsigned && !any_signing_failure
546
+ add_error <<~EOS
547
+ Cask is deprecated as unsigned but all artifacts are signed!
548
+ Remove the deprecate/disable stanza or update the deprecate/disable reason.
549
+ EOS
546
550
end
547
551
end
548
552
end
@@ -640,9 +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
643
- artifacts . each do |artifact |
644
- next if !artifact . is_a? ( Artifact ::App ) && !artifact . is_a? ( Artifact ::Binary )
645
- next if artifact . is_a? ( Artifact ::Binary ) && is_container
647
+ mentions_rosetta = cask . caveats . include? ( "requires Rosetta 2" )
648
+ requires_intel = cask . depends_on . arch &.any? { |arch | arch [ :type ] == :intel }
649
+
650
+ any_requires_rosetta = artifacts . any? do |artifact |
651
+ next false if !artifact . is_a? ( Artifact ::App ) && !artifact . is_a? ( Artifact ::Binary )
652
+ next false if artifact . is_a? ( Artifact ::Binary ) && is_container
646
653
647
654
path = tmpdir /artifact . source . relative_path_from ( cask . staged_path )
648
655
@@ -665,7 +672,7 @@ def audit_rosetta
665
672
end
666
673
667
674
# binary stanza can contain shell scripts, so we just continue if lipo fails.
668
- next unless result . success?
675
+ next false unless result . success?
669
676
670
677
odebug "Architectures: #{ result . merged_output } "
671
678
@@ -675,17 +682,17 @@ def audit_rosetta
675
682
next
676
683
end
677
684
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 }
685
+ next true if result . merged_output . exclude? ( "arm64" ) && result . merged_output . include? ( "x86_64" )
686
+ end
681
687
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!" ,
688
+ if any_requires_rosetta
689
+ if !mentions_rosetta && !requires_intel
690
+ add_error "At least one artifact requires Rosetta 2 but this is not indicated by the caveats!" ,
687
691
location : url . location
688
692
end
693
+ elsif mentions_rosetta
694
+ add_error "No artifacts require Rosetta 2 but the caveats say otherwise!" ,
695
+ location : url . location
689
696
end
690
697
end
691
698
end
0 commit comments