mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 15:28:58 +01:00
pkggraph: merge _devel packages with their main package
Makes the graph a bit more reasonable. Change-Id: Ib1ef182fb0c6c0c88fafe2dd194cae72200d7826
This commit is contained in:
parent
dad66ad308
commit
909af08f43
25
3rdparty/pulkomandy/pkggraph.py
vendored
25
3rdparty/pulkomandy/pkggraph.py
vendored
@ -36,14 +36,17 @@ rendering as a PNG, for example:
|
|||||||
ShowImage /tmp/packages.png
|
ShowImage /tmp/packages.png
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# Collect the list of packages to be analyzed
|
||||||
path = "/system/packages"
|
path = "/system/packages"
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
packages = sys.argv[1:]
|
packages = sys.argv[1:]
|
||||||
else:
|
else:
|
||||||
packages = [join(path, f) for f in listdir(path) if(isfile(join(path, f)))]
|
packages = [join(path, f) for f in listdir(path) if(isfile(join(path, f)))]
|
||||||
|
|
||||||
print('strict digraph {\nrankdir="LR"\nsplines=ortho\nnode [ fontname="Noto", fontsize=10];')
|
|
||||||
|
|
||||||
|
# List the provides and requires for each package
|
||||||
|
# pmap maps any provides to the corresponding packagename
|
||||||
|
# rmap maps a packagename to the corresponding requires
|
||||||
pmap = {}
|
pmap = {}
|
||||||
rmap = {}
|
rmap = {}
|
||||||
|
|
||||||
@ -66,17 +69,27 @@ for p in packages:
|
|||||||
if line != b'haiku' and line != b'haiku_x86':
|
if line != b'haiku' and line != b'haiku_x86':
|
||||||
requires.append(line)
|
requires.append(line)
|
||||||
|
|
||||||
|
basename = provides[0]
|
||||||
|
# Merge devel packages with the parent package
|
||||||
|
basename = basename.decode("utf-8").removesuffix("_devel")
|
||||||
for pro in provides:
|
for pro in provides:
|
||||||
pmap[pro] = provides[0]
|
pmap[pro] = basename
|
||||||
if len(requires) > 0:
|
if len(requires) > 0:
|
||||||
rmap[provides[0]] = requires
|
if basename not in rmap:
|
||||||
|
rmap[basename] = requires
|
||||||
|
else:
|
||||||
|
rmap[basename].extend(requires)
|
||||||
|
|
||||||
for k,v in rmap.items():
|
# Generate the graph in dot/graphviz format
|
||||||
for dep in v:
|
# For each package, there is an edge to each dependency package
|
||||||
|
print('strict digraph {\nrankdir="LR"\nsplines=ortho\nnode [ fontname="Noto", fontsize=10];')
|
||||||
|
|
||||||
|
for name, dependencies in rmap.items():
|
||||||
|
for dep in dependencies:
|
||||||
color = "red"
|
color = "red"
|
||||||
if dep in pmap:
|
if dep in pmap:
|
||||||
dep = pmap[dep]
|
dep = pmap[dep]
|
||||||
color = "blue"
|
color = "blue"
|
||||||
print('"%s" -> "%s" [color=%s]' % (k.decode('utf-8'), dep.decode('utf-8'), color))
|
print(f'"{name}" -> "{dep}" [color={color}]')
|
||||||
|
|
||||||
print("}")
|
print("}")
|
||||||
|
Loading…
Reference in New Issue
Block a user