looks good -- Martin Gracik ----- Original Message ----- From: "Hans de Goede" <hdegoede@xxxxxxxxxx> To: "Discussion of Development and Customization of the Red Hat Linux Installer" <anaconda-devel-list@xxxxxxxxxx> Sent: Friday, April 24, 2009 9:13:30 AM GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: [PATCH 2/2] Remove devices in leaves first order (#496630) --- partIntfHelpers.py | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/partIntfHelpers.py b/partIntfHelpers.py index bd1ddbb..6d91bad 100644 --- a/partIntfHelpers.py +++ b/partIntfHelpers.py @@ -133,8 +133,12 @@ def doDeleteDevice(intf, storage, device, confirm=1, quiet=0): if confirm and not confirmDelete(intf, device): return False - for dep in storage.deviceDeps(device): - storage.destroyDevice(dep) + deps = storage.deviceDeps(device) + while deps: + leaves = [d for d in deps if d.isleaf] + for leaf in leaves: + storage.destroyDevice(leaf) + deps.remove(leaf) storage.destroyDevice(device) return True @@ -157,12 +161,14 @@ def doDeleteDependentDevices(intf, storage, device, confirm=1, quiet=0): return False immutable = [] - for dep in deps: - if storage.deviceImmutable(dep): - immutable.append(dep.path) - continue - else: - storage.destroyDevice(dep) + while deps: + leaves = [d for d in deps if d.isleaf] + for leaf in leaves: + if storage.deviceImmutable(leaf): + immutable.append(leaf.path) + else: + storage.destroyDevice(leaf) + deps.remove(leaf) if immutable and not quiet: remaining = "\t" + "\n\t".join(immutable) + "\n" -- 1.6.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list