Skip to content

Commit 26c1273

Browse files
move arch translator and better names for variables
Co-Authored-By: AYON 80549753+Ayon-SSP@users.noreply.github.com
1 parent 693e147 commit 26c1273

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

gen_data/arch.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
def translated_arch() -> dict:
3+
"""System architectures translated to deb package architecture names
4+
5+
Returns:
6+
dict: dictionary of arch names
7+
"""
8+
# TODO Need improve above docstring
9+
10+
# SystemArchitecture:PackageArchitecture
11+
return dict(
12+
{
13+
"armhf": "armhf",
14+
"arm": "armhf",
15+
"arm64": "aarch64",
16+
"aarch64": "aarch64",
17+
"amd64": "amd64",
18+
"x86_64": "amd64"
19+
}
20+
)
21+
22+
23+
24+
def ReverseTranslate() -> dict:
25+
StoPdict = translated_arch();
26+
PtoSdict = {}
27+
28+
for SysArch,PakArch in zip(StoPdict.keys(),StoPdict.values()):
29+
if PakArch in PtoSdict:
30+
PtoSdict[PakArch] = [PtoSdict[PakArch]]
31+
PtoSdict[PakArch].append(SysArch)
32+
else:
33+
PtoSdict[PakArch] = SysArch
34+
35+
return PtoSdict

gen_data/gen-update-json.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import optparse
44
import utils
5+
import arch
56

67
GIT_ROOT = os.popen("git rev-parse --show-toplevel").read().strip()
78
DIR = "fs-cook/out"
@@ -29,21 +30,14 @@ def strip_info(file):
2930
name = os.path.splitext(basename)[0]
3031
name = os.path.splitext(name)[0]
3132

32-
sp = name.split("-")
33-
ar = {
34-
"armhf": "armhf",
35-
"arm": "armhf",
36-
"arm64": "aarch64",
37-
"aarch64": "aarch64",
38-
"amd64": "amd64",
39-
"x86_64": "amd64"
40-
}
33+
sp = name.split("-")
34+
StoPdict = arch.translate()
4135

4236
suite = sp[0]
4337
variant = sp[1]
44-
arch = ar[sp[2]]
45-
46-
return [suite, variant, arch, basename]
38+
packageArchitecture = StoPdict[sp[2]]
39+
40+
return [suite, variant, packageArchitecture, basename]
4741

4842
def get_release_url(release_tag, file) -> str:
4943
repo="https://github.com/RandomCoderOrg/udroid-download"

0 commit comments

Comments
 (0)