Skip to content

Commit

Permalink
[pipeline/kexts] Re-add duplicate cfbundleidentifiers
Browse files Browse the repository at this point in the history
Ensures that any colliding kexts get re-added to the list
  • Loading branch information
Qonfused committed Oct 29, 2024
1 parent 702d0ab commit 6876435
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ocebuild/pipeline/kexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,19 @@ def num_dependents(kext: dict) -> int:
(ordered if num_dependents(k) else unordered).append(k)
nodes[-1] = ordered + sorted(unordered, key=lambda k: k['name'])

# Handle colliding cfbundleidentifiers (or unmapped kexts)
for kext in sorted_dependencies:
if not any(kext in node for node in nodes):
for node in nodes:
for i,k in enumerate(node):
# If the kext has a duplicate cfbundleidentifier, upsert it before the
# colliding kext in the node list. Here, we assume that the kexts are
# never loaded at the same time (i.e. they have exclusive MinKernel
# and MaxKernel versions).
if kext['identifier'] == k['identifier']:
node.insert(i if kext['__path'] < k['__path'] else i + 1, kext)
break

# Apply new node sorting scheme to sorted kexts list
sorted_dependencies = []
sorting_scheme = lambda n: (n[0]['name'][:3], -len(n))
Expand Down

0 comments on commit 6876435

Please sign in to comment.