66from argparse import ArgumentParser
77from pathlib import Path
88from typing import Any
9+ import _colorize
910import gzip
1011import json
1112
@@ -14,6 +15,7 @@ def compare_install_manifests(base: Path) -> bool:
1415 """Compare all json manifests inside the directory at base."""
1516 hashes_seen : dict [str , tuple [str , str ]] = {}
1617 tags_seen_by_platform : dict [str , set [frozenset [str ]]] = {}
18+ colors = _colorize .get_colors ()
1719
1820 success : bool = True
1921 for tree in base .iterdir ():
@@ -37,20 +39,26 @@ def compare_install_manifests(base: Path) -> bool:
3739 continue
3840 expected , source_name = hashes_seen [path ]
3941 if digest != expected :
40- print (f"Mismatch found: { path } " )
42+ print (f"{ colors . RED } Mismatch found{ colors . RESET } : { path } " )
4143 print (f"{ digest } ({ tree .name } ) != { expected } ({ source_name } )" )
4244 success = False
4345
4446 # Did we see enough builds to make a useful comparison?
4547 if len (tags_seen_by_platform ) < 2 :
46- print ("Insufficient platforms (architectures) to compare. Expected >= 2" )
48+ print (
49+ f"{ colors .RED } ERROR{ colors .RESET } : Insufficient platforms "
50+ "(architectures) to compare. Expected >= 2."
51+ )
4752 success = False
4853
4954 for tagsets in tags_seen_by_platform .values ():
5055 if len (tagsets ) >= 2 :
5156 break
5257 else :
53- print ("Insufficient configuration variants tested. Expected >= 2" )
58+ print (
59+ f"{ colors .RED } ERROR{ colors .RESET } : Insufficient configuration "
60+ f"variants tested. Expected >= 2."
61+ )
5462 success = False
5563
5664 return success
@@ -112,6 +120,9 @@ def main() -> None:
112120 if not compare_install_manifests (args .base_directory ):
113121 raise SystemExit (1 )
114122
123+ colors = _colorize .get_colors ()
124+ print (f"{ args .base_directory } { colors .GREEN } OK{ colors .RESET } " )
125+
115126
116127if __name__ == "__main__" :
117128 main ()
0 commit comments