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

Bastian Blank waldi at alioth.debian.org
Tue Feb 19 17:42:38 UTC 2008


Author: waldi
Date: Tue Feb 19 17:42:38 2008
New Revision: 10606

Log:
lib/dkt/hooks/modules/backward_config_boot.py:
Also add settings in real images.


Modified:
   people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.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	Tue Feb 19 17:42:38 2008
@@ -1,29 +1,54 @@
 import os
 
-from dkt.config.base import Config
+from dkt.config.base import MutableConfig
+from dkt.config.interfaces import IMutableConfig
 from dkt.hooks import default_registry, interfaces, register
 
 class Hook(object):
-    def _check_config(self, configs, version, data):
-        for l in configs.itervalues():
-            if data[0] == l.file:
-                return
+    def _add_config(self, configs, version, data):
+        image_file = data[0]
+        initramfs_file = data[1]
+        symlinks_data = data[2]
+
         c = {
             'image': {
                 'type': 'linux',
                 'architecture': 'unknown',
-                'file': data[0],
+                'file': image_file,
                 'version': version,
                 'features': [],
             },
-            'backward': {
-                'symlink-file': data[2][0],
-                'symlink-type': data[2][1],
-            },
         }
-        if data[1] is not None:
-            c['initramfs'] = {'file': data[1]}
-        configs.add('boot-backward-' + version, Config(c))
+
+        if initramfs_file is not None:
+            c['initramfs'] = {'file': initramfs_file}
+
+        if symlinks_data is not None:
+            c['backward-compatibility'] = {
+                'symlink-file': symlinks_data[0],
+                'symlink-type': symlinks_data[1],
+            }
+
+        configs.add('boot-backward-' + version, MutableConfig(c))
+
+    def _check_config(self, configs, version, data):
+        image_file = data[0]
+
+        for l in configs.itervalues():
+            if l.file == image_file:
+                return self._update_config(l, data)
+
+        return self._add_config(configs, version, data)
+
+    def _update_config(self, config, data):
+        symlinks_data = data[2]
+
+        config = IMutableConfig(config.get_config())
+
+        if symlinks_data is not None:
+            config.add_section('backward-compatibility')
+            config.set('backward-compatibility', 'symlink-file', symlinks_data[0])
+            config.set('backward-compatibility', 'symlink-type', symlinks_data[1])
 
     def _get_files(self):
         ret = ([], [], [], [])



More information about the Kernel-svn-changes mailing list