mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 21:26:36 +00:00
support/scripts/pkg-stats: add defconfig support
Scan configs directory and create Defconfig objects. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
d31fadfbf5
commit
8d77ecbad0
@ -54,6 +54,34 @@ RM_API_STATUS_NOT_FOUND = 4
|
|||||||
# because it's used by sub-processes.
|
# because it's used by sub-processes.
|
||||||
http_pool = None
|
http_pool = None
|
||||||
|
|
||||||
|
class Defconfig:
|
||||||
|
def __init__(self, name, path):
|
||||||
|
self.name = name
|
||||||
|
self.path = path
|
||||||
|
self.developers = None
|
||||||
|
|
||||||
|
def set_developers(self, developers):
|
||||||
|
"""
|
||||||
|
Fills in the .developers field
|
||||||
|
"""
|
||||||
|
self.developers = [
|
||||||
|
developer.name
|
||||||
|
for developer in developers
|
||||||
|
if developer.hasfile(self.path)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_defconfig_list():
|
||||||
|
"""
|
||||||
|
Builds the list of Buildroot defconfigs, returning a list of Defconfig
|
||||||
|
objects.
|
||||||
|
"""
|
||||||
|
return [
|
||||||
|
Defconfig(name[:-len('_defconfig')], os.path.join('configs', name))
|
||||||
|
for name in os.listdir('configs')
|
||||||
|
if name.endswith('_defconfig')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class Package:
|
class Package:
|
||||||
all_licenses = dict()
|
all_licenses = dict()
|
||||||
@ -889,7 +917,7 @@ def dump_html(packages, stats, date, commit, output):
|
|||||||
f.write(html_footer)
|
f.write(html_footer)
|
||||||
|
|
||||||
|
|
||||||
def dump_json(packages, stats, date, commit, output):
|
def dump_json(packages, defconfigs, stats, date, commit, output):
|
||||||
# Format packages as a dictionnary instead of a list
|
# Format packages as a dictionnary instead of a list
|
||||||
# Exclude local field that does not contains real date
|
# Exclude local field that does not contains real date
|
||||||
excluded_fields = ['url_worker', 'name']
|
excluded_fields = ['url_worker', 'name']
|
||||||
@ -900,6 +928,12 @@ def dump_json(packages, stats, date, commit, output):
|
|||||||
if k not in excluded_fields
|
if k not in excluded_fields
|
||||||
} for pkg in packages
|
} for pkg in packages
|
||||||
}
|
}
|
||||||
|
defconfigs = {
|
||||||
|
d.name: {
|
||||||
|
k: v
|
||||||
|
for k, v in d.__dict__.items()
|
||||||
|
} for d in defconfigs
|
||||||
|
}
|
||||||
# Aggregate infrastructures into a single dict entry
|
# Aggregate infrastructures into a single dict entry
|
||||||
statistics = {
|
statistics = {
|
||||||
k: v
|
k: v
|
||||||
@ -910,6 +944,7 @@ def dump_json(packages, stats, date, commit, output):
|
|||||||
# The actual structure to dump, add commit and date to it
|
# The actual structure to dump, add commit and date to it
|
||||||
final = {'packages': pkgs,
|
final = {'packages': pkgs,
|
||||||
'stats': statistics,
|
'stats': statistics,
|
||||||
|
'defconfigs': defconfigs,
|
||||||
'commit': commit,
|
'commit': commit,
|
||||||
'date': str(date)}
|
'date': str(date)}
|
||||||
|
|
||||||
@ -951,6 +986,10 @@ def __main__():
|
|||||||
packages = get_pkglist(args.npackages, package_list)
|
packages = get_pkglist(args.npackages, package_list)
|
||||||
print("Getting developers ...")
|
print("Getting developers ...")
|
||||||
developers = parse_developers()
|
developers = parse_developers()
|
||||||
|
print("Build defconfig list ...")
|
||||||
|
defconfigs = get_defconfig_list()
|
||||||
|
for d in defconfigs:
|
||||||
|
d.set_developers(developers)
|
||||||
print("Getting package make info ...")
|
print("Getting package make info ...")
|
||||||
package_init_make_info()
|
package_init_make_info()
|
||||||
print("Getting package details ...")
|
print("Getting package details ...")
|
||||||
@ -977,7 +1016,7 @@ def __main__():
|
|||||||
dump_html(packages, stats, date, commit, args.html)
|
dump_html(packages, stats, date, commit, args.html)
|
||||||
if args.json:
|
if args.json:
|
||||||
print("Write JSON")
|
print("Write JSON")
|
||||||
dump_json(packages, stats, date, commit, args.json)
|
dump_json(packages, defconfigs, stats, date, commit, args.json)
|
||||||
|
|
||||||
|
|
||||||
__main__()
|
__main__()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user