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

Bastian Blank waldi at alioth.debian.org
Wed Mar 5 13:38:16 UTC 2008


Author: waldi
Date: Wed Mar  5 13:38:15 2008
New Revision: 10714

Log:
* lib/dkt/hooks/modules/backward_config_boot.py: Change type setup.
* lib/dkt/hooks/modules/backward_symlinks.py: Add code to check symlinks.


Modified:
   people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.py
   people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py

Modified: people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.py
==============================================================================
--- people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.py	(original)
+++ people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.py	Wed Mar  5 13:38:15 2008
@@ -112,10 +112,10 @@
                 link_parts = os.path.basename(link).split('-', 1)
                 e = versions.get(link_parts[1], None)
                 if e is not None:
+                    type = 0
                     if file[1].endswith('.old'):
-                        e[2] = (file[0], 'old')
-                    else:
-                        e[2] = (file[0], 'actual')
+                        type = 1
+                    e[2] = (file[0], type)
 
         for file in iter(files[3]):
             if not os.path.islink(file[0]):

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	Wed Mar  5 13:38:15 2008
@@ -1,3 +1,5 @@
+from itertools import chain
+
 from dkt.config.interfaces import IMutableConfig
 from dkt.hooks import default_registry, interfaces, register
 
@@ -32,5 +34,34 @@
         if not self._check_active(systemconfig):
             return
 
+        symlink_act = symlink_act_file = symlink_old = symlink_old_file = None
+        symlink_create = symlink_remove = None
+
+        for i in chain(*bootconfigs):
+            config = i.config
+            if 'backward-compatibility' in config:
+                symlink_type = config.get('backward-compatibility', 'symlink-type', None)
+                if symlink_type == 0:
+                    symlink_act = i
+                    symlink_act_file = config.get('backward-compatibility', 'symlink-file')
+                elif symlink_type == 1:
+                    symlink_old = i
+                    symlink_old_file = config.get('backward-compatibility', 'symlink-file')
+
+                if config.get('backward-compatibility', 'symlink-create', None):
+                    symlink_create = i
+                if config.get('backward-compatibility', 'symlink-remove', None):
+                    symlink_remove = i
+
+        if symlink_create is not None:
+            if symlink_create not in (symlink_act, symlink_old):
+                raise NotImplementedError
+
+        if symlink_remove is not None:
+            if symlink_remove not in (symlink_act, symlink_old):
+                raise NotImplementedError
+
+        return [[symlink_old, symlink_act]]
+
 register('backward-symlinks', interfaces.IBootConfigPartition, Hook(), default_registry.PRIORITY_FIRST)
 register('backward-symlinks', interfaces.IImageTask, Hook())



More information about the Kernel-svn-changes mailing list