Author: waldi Date: Sat Mar 8 22:16:30 2008 New Revision: 10754 Log: lib/dkt/hooks/modules/backward_symlinks.py: Fix.
Modified: people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py Modified: people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py ============================================================================== --- people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py (original) +++ people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py Sat Mar 8 22:16:30 2008 @@ -91,17 +91,15 @@ def image_postrm(*args): pass - def _set_config_partition(self, config, dir, image_file, type): - suffix = '' - if type == 1: - suffix = '.old' + def _set_config_partition(self, config, dir, image_file, suffix): + data = config.setdefault('backward-compatibility', 'symlink-data', []) link_file = os.path.join(dir, image_file + suffix) link_target = config.get('image', 'file') if dir == '/boot': link_target = os.path.basename(link_target) - config.set('backward-compatibility', 'symlink-image-data', (link_file, link_target)) + data.append((link_file, link_target)) link_file = os.path.join(dir, 'initrd.img' + suffix) link_target = None @@ -112,7 +110,7 @@ if dir == '/boot': link_target = os.path.basename(link_target) - config.set('backward-compatibility', 'symlink-initramfs-data', (link_file, link_target)) + data.append((link_file, link_target)) def boot_config_partition(self, bootconfigs, systemconfig): if not self._check_active(systemconfig): @@ -158,14 +156,14 @@ elif symlink_remove is symlink_old: symlink_old = symlink_act - ret = [] + ret = set() if symlink_old is not None: - self._set_config_partition(symlink_old.config, symlink_dir, symlink_image_file, 1) - ret.append(symlink_old) + self._set_config_partition(symlink_old.config, symlink_dir, symlink_image_file, '.old') + ret.add(symlink_old) if symlink_act is not None: - self._set_config_partition(symlink_act.config, symlink_dir, symlink_image_file, 0) - ret.append(symlink_act) - return [ret] + self._set_config_partition(symlink_act.config, symlink_dir, symlink_image_file, '') + ret.add(symlink_act) + return [list(ret)] def boot_config_deploy(self, bootconfigs, systemconfig): if not self._check_active(systemconfig): @@ -174,14 +172,10 @@ assert len(bootconfigs) <= 2 for bootconfig in bootconfigs: - file, target = bootconfig.config.get('backward-compatibility', 'symlink-image-data') - os.unlink(file) - os.symlink(target, file) - - file, target = bootconfig.config.get('backward-compatibility', 'symlink-image-data') - os.unlink(file) - if target: - os.symlink(target, file) + for file, target in bootconfig.config.get('backward-compatibility', 'symlink-data'): + os.unlink(file) + if target: + os.symlink(target, file) return True _______________________________________________ Kernel-svn-changes mailing list Kernel-svn-changes@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/kernel-svn-changes