Avoid endless dependency analysis loop
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
This commit is contained in:
parent
b46b6ca612
commit
2b36325b92
1 changed files with 8 additions and 0 deletions
|
@ -226,16 +226,24 @@ def generate_package_order(packages: list[Package]) -> list[Package]:
|
||||||
If that is true, the package itself is added to the sorted packages
|
If that is true, the package itself is added to the sorted packages
|
||||||
"""
|
"""
|
||||||
while len(unsorted) > 0:
|
while len(unsorted) > 0:
|
||||||
|
changed = False
|
||||||
for package in unsorted.copy():
|
for package in unsorted.copy():
|
||||||
if len(package.local_depends) == 0:
|
if len(package.local_depends) == 0:
|
||||||
sorted.append(package)
|
sorted.append(package)
|
||||||
unsorted.remove(package)
|
unsorted.remove(package)
|
||||||
|
changed = True
|
||||||
for package in sorted:
|
for package in sorted:
|
||||||
for name in package.names:
|
for name in package.names:
|
||||||
for p in unsorted:
|
for p in unsorted:
|
||||||
for dep in p.local_depends.copy():
|
for dep in p.local_depends.copy():
|
||||||
if name == dep:
|
if name == dep:
|
||||||
p.local_depends.remove(name)
|
p.local_depends.remove(name)
|
||||||
|
changed = True
|
||||||
|
if not changed:
|
||||||
|
print('emergency break:', 'sorted:', repr(sorted), 'unsorted:', repr(unsorted))
|
||||||
|
sorted += unsorted
|
||||||
|
print('merged:', repr(sorted))
|
||||||
|
break
|
||||||
|
|
||||||
return sorted
|
return sorted
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue