11import json
2+ import arch as archAlt
3+ archAltName = archAlt .ReverseTranslate ()
4+
5+ def add_suite (JsonFile : dict , suite : str ) -> None :
6+ """ Add suite to the JsonFile
7+
8+ Args:
9+ JsonFile (dict): The JsonFile
10+ suite (str): The suite to add
11+ """
12+
13+ JsonFile ["suites" ].append (suite )
14+ JsonFile [suite ] = {
15+ "varients" : []
16+ }
17+
18+
19+ def add_varient (JsonFile : dict , suite : str , varient : str , Name : str , FirendlyName : str ) -> None :
20+ """ Add varient to the JsonFile"""
21+
22+ JsonFile [suite ]["varients" ].append (varient )
23+ JsonFile [suite ][varient ] = {
24+ # adding default arch to the varients
25+ "arch" : [],
26+ "Name" : Name ,
27+ "FirendlyName" : FirendlyName
28+ }
29+
30+ def add_arch (JsonFile : dict , suite : str , varient : str , arch :list [str ]) -> None :
31+ """ Add arch to the JsonFile
32+
33+ Args:
34+ JsonFile (dict): The JsonFile
35+ suite (str): The suite to add archs
36+ varient (str): The varient to archs
37+ arch (list[str]): The arch to add
38+ """
39+
40+ #revArchLst = {'armhf': ['armhf', 'arm'], 'aarch64': ['arm64', 'aarch64'], 'amd64': ['amd64', 'x86_64']}
41+ revArchLst = archAltName [arch ]
42+ for revArch in revArchLst :
43+ JsonFile [suite ][varient ]["arch" ].append (revArch )
44+ JsonFile [suite ][varient ][f"{ arch } url" ] = ""
45+ JsonFile [suite ][varient ][f"{ arch } sha" ] = ""
46+
247
348def resolv_data (
449 json_data : dict ,
550 suite : str ,
651 variant : str ,
7- arch : list = ... ,
52+ arch : list [ str ] ,
853 Name : str = ...,
954 FriendlyName : str = ...,
1055 ) -> dict :
11- # TODO yet to be implemented
12- pass
13-
56+ if suite not in json_data ["suites" ]:
57+ add_suite (json_data ,suite )
58+
59+ if variant not in json_data [suite ]["varients" ]:
60+ add_varient (json_data , suite , variant , Name , FriendlyName )
61+
62+ for arc in arch :
63+ if arch not in json_data [suite ][variant ]["arch" ]:
64+ add_arch (json_data , suite , variant , arc )
65+
66+ return json_data
0 commit comments