@@ -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,21 +521,16 @@ 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:
@@ -544,6 +539,13 @@ def audit_signing
544
539
Please contact the upstream developer to let them know they should sign and notarize their software.
545
540
EOS
546
541
end
542
+
543
+ if cask . deprecated? && cask . deprecation_reason == :unsigned && !any_signing_failure
544
+ add_error <<~EOS
545
+ Cask is deprecated as unsigned but all artifacts are signed!
546
+ Remove the deprecate/disable stanza or update the deprecate/disable reason.
547
+ EOS
548
+ end
547
549
end
548
550
end
549
551
@@ -640,9 +642,12 @@ def audit_rosetta
640
642
extract_artifacts do |artifacts , tmpdir |
641
643
is_container = artifacts . any? { |a | a . is_a? ( Artifact ::App ) || a . is_a? ( Artifact ::Pkg ) }
642
644
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
645
+ mentions_rosetta = cask . caveats . include? ( "requires Rosetta 2" )
646
+ requires_intel = cask . depends_on . arch &.any? { |arch | arch [ :type ] == :intel }
647
+
648
+ any_requires_rosetta = artifacts . any? do |artifact |
649
+ next false if !artifact . is_a? ( Artifact ::App ) && !artifact . is_a? ( Artifact ::Binary )
650
+ next false if artifact . is_a? ( Artifact ::Binary ) && is_container
646
651
647
652
path = tmpdir /artifact . source . relative_path_from ( cask . staged_path )
648
653
@@ -665,7 +670,7 @@ def audit_rosetta
665
670
end
666
671
667
672
# binary stanza can contain shell scripts, so we just continue if lipo fails.
668
- next unless result . success?
673
+ next false unless result . success?
669
674
670
675
odebug "Architectures: #{ result . merged_output } "
671
676
@@ -676,16 +681,17 @@ def audit_rosetta
676
681
end
677
682
678
683
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 }
684
+ next true if ! supports_arm && result . merged_output . include? ( "x86_64 " )
685
+ end
681
686
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!" ,
687
+ if any_requires_rosetta
688
+ if !mentions_rosetta && !requires_intel
689
+ add_error "At least one artifact requires Rosetta 2 but this is not indicated by the caveats!" ,
687
690
location : url . location
688
691
end
692
+ elsif mentions_rosetta
693
+ add_error "No artifacts require Rosetta 2 but the caveats say otherwise!" ,
694
+ location : url . location
689
695
end
690
696
end
691
697
end
0 commit comments