The device repos with 'atv' in their name are just common repos for atv devices. It's not an actual device named 'atv' that we build, so it needs to be added to the blacklist so that the script doesn't treat it as one. Change-Id: I2afd840677ef38f510b85d13a93a0ff4c628fa61
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import json
|
|
|
|
with open('out.json') as f:
|
|
mapping = json.load(f)
|
|
|
|
devices = {}
|
|
suffixes = {}
|
|
blacklist = ['sepolicy', 'devicesettings', 'common', 'atv']
|
|
|
|
def simplify_reverse_deps(repo, device):
|
|
# repo['branch'] = cm-14.1 or cm-14.1-caf or cm-14.1-sony
|
|
if 'branch' in repo and repo['branch'].count('-') > 1: # get suffix
|
|
if repo['repo'] not in suffixes:
|
|
suffixes[repo['repo']] = {}
|
|
suffixes[repo['repo']][device] = '-' + repo['branch'].split('-', 2)[2]
|
|
|
|
if repo['repo'] not in mapping or len(mapping[repo['repo']]) == 0:
|
|
return [repo['repo']]
|
|
res = []
|
|
for i in mapping[repo['repo']]:
|
|
res += (simplify_reverse_deps(i, device))
|
|
res.append(repo['repo'])
|
|
return res
|
|
|
|
for repo in mapping:
|
|
if 'device' not in repo or any(x in repo for x in blacklist):
|
|
continue
|
|
codename = repo.split('_', maxsplit=3)[-1]
|
|
if codename in devices:
|
|
print("warning: dupe: %s"%codename)
|
|
devices[codename] = sorted(list(set(simplify_reverse_deps({'repo': repo}, codename))))
|
|
|
|
with open('device_deps.json', 'w') as f:
|
|
out = {'devices': devices, 'suffixes': suffixes}
|
|
out = devices
|
|
json.dump(out, f, indent=4, sort_keys=True)
|