add removedeps option to remove_cube to control wether a cube's dependencies should be removed as well or not
--- a/common/migration.py Fri Jun 19 08:28:19 2009 +0200
+++ b/common/migration.py Fri Jun 19 08:29:22 2009 +0200
@@ -328,14 +328,13 @@
self.config.add_cubes(newcubes)
return newcubes
- def cmd_remove_cube(self, cube):
+ def cmd_remove_cube(self, cube, removedeps=True):
+ if removedeps:
+ toremove = self.config.expand_cubes([cube])
+ else:
+ toremove = (cube,)
origcubes = self.config._cubes
- basecubes = list(origcubes)
- for pkg in self.config.expand_cubes([cube]):
- try:
- basecubes.remove(pkg)
- except ValueError:
- continue
+ basecubes = [c for c in origcubes if not c in toremove]
self.config._cubes = tuple(self.config.expand_cubes(basecubes))
removed = [p for p in origcubes if not p in self.config._cubes]
assert cube in removed, \
--- a/server/migractions.py Fri Jun 19 08:28:19 2009 +0200
+++ b/server/migractions.py Fri Jun 19 08:29:22 2009 +0200
@@ -523,8 +523,9 @@
self.exec_event_script('postcreate', self.config.cube_dir(pack))
self.commit()
- def cmd_remove_cube(self, cube):
- removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube(cube)
+ def cmd_remove_cube(self, cube, removedeps=True):
+ removedcubes = super(ServerMigrationHelper, self).cmd_remove_cube(
+ cube, removedeps)
if not removedcubes:
return
fsschema = self.fs_schema