File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 1010:rhel-short: RHEL
1111:ocp-y: 4.18
1212:product-rosa: Red{nbsp}Hat OpenShift Service on AWS
13+ :cso: Container Security Operator
1314
1415ifeval::["{productname} " == "Project Quay"]
1516:upstream:
@@ -36,7 +37,6 @@ ifeval::["{productname}" == "Red Hat Quay"]
3637:productmin: 3.15.1
3738:productminv: v3.15.1
3839:productrepo: registry.redhat.io/quay
39- :clairnewver: v3.14
4040:quayimage: quay-rhel8
4141:clairimage: clair-rhel8
4242:clairproductminv: 4.8
Original file line number Diff line number Diff line change 1+ import os
2+ import re
3+ from collections import defaultdict
4+ import sys
5+
6+ BASE_DIR = sys .argv [1 ] if len (sys .argv ) > 1 else "."
7+
8+ # Regex to match include lines for modules (allowing ../, attributes, etc.)
9+ INCLUDE_PATTERN = re .compile (r'include::(?:\.\./)*modules/([^[]+)\.adoc' )
10+
11+ # Dictionary: module -> set of assemblies where it's included
12+ module_usage = defaultdict (set )
13+
14+ for root , _ , files in os .walk (BASE_DIR ):
15+ for file in files :
16+ if file .endswith (".adoc" ):
17+ file_path = os .path .join (root , file )
18+ with open (file_path , "r" , encoding = "utf-8" ) as f :
19+ for line in f :
20+ match = INCLUDE_PATTERN .search (line )
21+ if match :
22+ module_name = match .group (1 )
23+ # Treat any .adoc outside of modules/ as an assembly
24+ if "modules" not in file_path :
25+ module_usage [module_name ].add (file_path )
26+
27+ # Print results
28+ print ("Modules included in more than one assembly:\n " )
29+ for module , assemblies in sorted (module_usage .items ()):
30+ if len (assemblies ) > 1 :
31+ print (f"{ module } .adoc" )
32+ for asm in sorted (assemblies ):
33+ print (f" - { asm } " )
34+ print ()
You can’t perform that action at this time.
0 commit comments