[kernel] r10610 - people/waldi/dkt/lib/dkt/hooks/modules

Bastian Blank waldi at alioth.debian.org
Tue Feb 19 17:58:02 UTC 2008


Author: waldi
Date: Tue Feb 19 17:58:01 2008
New Revision: 10610

Log:
lib/dkt/hooks/modules/backward_symlinks.py
- Simplify.
- Add marker for symlink removal.


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	Tue Feb 19 17:58:01 2008
@@ -2,26 +2,34 @@
 from dkt.hooks import default_registry, interfaces, register
 
 class Hook(object):
+    def _check_active(self, systemconfig):
+        return systemconfig.get_parse_boolean('backward-compatibility', 'kpkg-do-symlinks', False)
+
+    def _set_config(self, imageconfig, name, value):
+        config = IMutableConfig(imageconfig.get_config())
+        config.add_section('backward-compatibility')
+        config.set('backward-compatibility', name, value)
+
     def image_preinst(*args):
         pass
 
     def image_postinst(self, systemconfig, imageconfig, maintainer_args):
-        if not systemconfig.get_parse_boolean('backward-compatibility', 'kpkg-do-symlinks', False):
-            return
-        if maintainer_args[0] != 'configure':
+        if not self._check_active(systemconfig):
             return
-        config = IMutableConfig(imageconfig.get_config())
-        config.add_section('backward-compatibility')
-        config.set('backward-compatibility', 'symlink-create', True)
+        if maintainer_args[0] == 'configure':
+            self._set_config(imageconfig, 'symlink-create', True)
 
     def image_prerm(self, systemconfig, imageconfig, maintainer_args):
-        pass
+        if not self._check_active(systemconfig):
+            return
+        if maintainer_args[0] == 'remove':
+            self._set_config(imageconfig, 'symlink-remove', True)
 
     def image_postrm(*args):
         pass
 
     def boot_config_partition(self, bootconfigs, systemconfig):
-        if not systemconfig.get_parse_boolean('backward-compatibility', 'kpkg-do-symlinks', False):
+        if not self._check_active(systemconfig):
             return
 
 register('backward-symlinks', interfaces.IBootConfigPartition, Hook(), default_registry.PRIORITY_FIRST)



More information about the Kernel-svn-changes mailing list