[kernel] r11122 - in people/waldi/dkt/lib/dkt: bin bootconfig hooks/modules itemconfig

Bastian Blank waldi at alioth.debian.org
Wed Apr 23 07:55:06 UTC 2008


Author: waldi
Date: Wed Apr 23 07:55:05 2008
New Revision: 11122

Log:
* lib/dkt/bin/base.py: Use IItemPackageConfig.
* lib/dkt/bootconfig/base.py,
  lib/dkt/bootconfig/linux.py,
  lib/dkt/bootconfig/hooks_prepare_linux.py,
  lib/dkt/hooks/modules/backward_config_boot.py,
  lib/dkt/hooks/modules/backward_symlinks.py: Use IItemImageConfig.
* lib/dkt/itemconfig/__init__.py: 
* lib/dkt/itemconfig/base.py: Remove.
* lib/dkt/itemconfig/interfaces.py:
  Split IImageBaseConfig into IItemImageConfig and IItemPackageConfig.
* lib/dkt/itemconfig/list.py: Don't check for valid config.
* lib/dkt/itemconfig/image.py: Add.


Added:
   people/waldi/dkt/lib/dkt/itemconfig/image.py
      - copied, changed from r11121, /people/waldi/dkt/lib/dkt/itemconfig/base.py
Removed:
   people/waldi/dkt/lib/dkt/itemconfig/base.py
Modified:
   people/waldi/dkt/lib/dkt/bin/base.py
   people/waldi/dkt/lib/dkt/bootconfig/base.py
   people/waldi/dkt/lib/dkt/bootconfig/hooks_prepare_linux.py
   people/waldi/dkt/lib/dkt/bootconfig/linux.py
   people/waldi/dkt/lib/dkt/hooks/modules/backward_config_boot.py
   people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py
   people/waldi/dkt/lib/dkt/itemconfig/__init__.py
   people/waldi/dkt/lib/dkt/itemconfig/interfaces.py
   people/waldi/dkt/lib/dkt/itemconfig/list.py

Modified: people/waldi/dkt/lib/dkt/bin/base.py
==============================================================================
--- people/waldi/dkt/lib/dkt/bin/base.py	(original)
+++ people/waldi/dkt/lib/dkt/bin/base.py	Wed Apr 23 07:55:05 2008
@@ -1,7 +1,7 @@
 from dkt.hooks import default_registry
 from dkt.hooks.interfaces import *
 from dkt.itemconfig.list import ImageConfigList
-from dkt.itemconfig.interfaces import IImageBaseConfig
+from dkt.itemconfig.interfaces import IItemPackageConfig
 from dkt.systemconfig.file import SystemConfig
 from dkt.systemconfig.defaults import CONFIG_FILE, IMAGECONFIG_DIRS
 
@@ -25,7 +25,7 @@
     def bootconfig_delete(self, package):
         for i in self.bootconfig:
             for c in i.configs:
-                if IImageBaseConfig(c).package == self.package:
+                if IItemPackageConfig(c).name == self.package:
                     self.bootconfig.remove(i)
 
     def bootconfig_deploy(self):
@@ -42,13 +42,13 @@
 
     def imageconfig_get(self, package):
         for i in self.imageconfigs.itervalues():
-            if IImageBaseConfig(i).package == package:
+            if IItemPackageConfig(i).name == package:
                 return i
         raise KeyError(package)
 
     def imageconfig_delete(self, package):
         for name, value in self.imageconfigs.iteritems():
-            if IImageBaseConfig(name).package == package:
+            if IItemPackageConfig(name).name == package:
                 del self.imageconfigs[name]
 
     def run_imagetask(self, type, *args):

Modified: people/waldi/dkt/lib/dkt/bootconfig/base.py
==============================================================================
--- people/waldi/dkt/lib/dkt/bootconfig/base.py	(original)
+++ people/waldi/dkt/lib/dkt/bootconfig/base.py	Wed Apr 23 07:55:05 2008
@@ -1,5 +1,5 @@
 from interfaces import IBootBaseConfig
-from dkt.itemconfig.interfaces import IImageBaseConfig
+from dkt.itemconfig.interfaces import IItemImageConfig
 from dkt.support.version import VersionImage
 from zope.interface import implements
 
@@ -21,9 +21,9 @@
 
     @property
     def features(self):
-        return IImageBaseConfig(self.config).features
+        return IItemImageConfig(self.config).features
 
     @property
     def version(self):
-        return VersionImage(IImageBaseConfig(self.config).version)
+        return VersionImage(IItemImageConfig(self.config).version)
 

Modified: people/waldi/dkt/lib/dkt/bootconfig/hooks_prepare_linux.py
==============================================================================
--- people/waldi/dkt/lib/dkt/bootconfig/hooks_prepare_linux.py	(original)
+++ people/waldi/dkt/lib/dkt/bootconfig/hooks_prepare_linux.py	Wed Apr 23 07:55:05 2008
@@ -1,13 +1,13 @@
 from linux import BootConfigLinux
 from dkt.hooks import default_registry, register
 from dkt.hooks.interfaces import IBootConfigPrepare
-from dkt.itemconfig.interfaces import IImageBaseConfig
+from dkt.itemconfig.interfaces import IItemImageConfig
 
 class Hook(object):
     def boot_config_prepare(self, bootconfigs, systemconfig, imageconfigs):
         for config in imageconfigs.itervalues():
             try:
-                image = IImageBaseConfig(config)
+                image = IItemImageConfig(config)
             except:
                 raise
             if image.type == 'linux' and image.subtype is None:

Modified: people/waldi/dkt/lib/dkt/bootconfig/linux.py
==============================================================================
--- people/waldi/dkt/lib/dkt/bootconfig/linux.py	(original)
+++ people/waldi/dkt/lib/dkt/bootconfig/linux.py	Wed Apr 23 07:55:05 2008
@@ -1,7 +1,7 @@
 from base import BootConfigBase
 from entry import BootEntry
 from interfaces import IBootMainConfig
-from dkt.itemconfig.interfaces import IImageBaseConfig, IImageLinuxInitramfsConfig
+from dkt.itemconfig.interfaces import IItemImageConfig, IImageLinuxInitramfsConfig
 #from dkt.hooks.interfaces import 
 from zope.interface import implements
 
@@ -12,7 +12,7 @@
         super(BootConfigLinux, self).__init__([config])
         self.config = config
 
-        self.kernel_entry = BootEntry(IImageBaseConfig(self.config).file, "")
+        self.kernel_entry = BootEntry(IItemImageConfig(self.config).file, "")
 
     @property
     def initrd_file(self):

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 Apr 23 07:55:05 2008
@@ -3,7 +3,7 @@
 from dkt.config.base import MutableConfig
 from dkt.config.interfaces import IMutableConfig
 from dkt.hooks import default_registry, interfaces, register
-from dkt.itemconfig.interfaces import IImageBaseConfig
+from dkt.itemconfig.interfaces import IItemImageConfig
 
 class Hook(object):
     def _add_config(self, configs, version, image_file, initramfs_file):
@@ -27,7 +27,7 @@
         image_file = data[0]
 
         for l in configs.itervalues():
-            if IImageBaseConfig(l).file == image_file:
+            if IItemImageConfig(l).file == image_file:
                 return self._update_config(l, *data)
 
         return self._add_config(configs, version, *data)

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 Apr 23 07:55:05 2008
@@ -3,7 +3,7 @@
 
 from dkt.config.interfaces import IMutableConfig
 from dkt.hooks import default_registry, interfaces, register
-from dkt.itemconfig.interfaces import IImageBaseConfig
+from dkt.itemconfig.interfaces import IItemImageConfig
 from dkt.support.system import architecture
 
 class Hook(object):
@@ -17,7 +17,7 @@
 
     def _check_file_config(self, configs, type, target, dir, file):
         for l in configs.itervalues():
-            if IImageBaseConfig(l).file == target:
+            if IItemImageConfig(l).file == target:
                 self._set_config(l, 'symlink-dir', dir)
                 self._set_config(l, 'symlink-image-file', file)
                 self._set_config(l, 'symlink-type-' + type, True)

Modified: people/waldi/dkt/lib/dkt/itemconfig/__init__.py
==============================================================================
--- people/waldi/dkt/lib/dkt/itemconfig/__init__.py	(original)
+++ people/waldi/dkt/lib/dkt/itemconfig/__init__.py	Wed Apr 23 07:55:05 2008
@@ -1,4 +1,4 @@
 #from __future__ import absolute_import
 
 #from . import base, linux_initramfs, linux_xen
-import base, linux_initramfs, xen
+import image, linux_initramfs, xen

Copied: people/waldi/dkt/lib/dkt/itemconfig/image.py (from r11121, /people/waldi/dkt/lib/dkt/itemconfig/base.py)
==============================================================================
--- /people/waldi/dkt/lib/dkt/itemconfig/base.py	(original)
+++ people/waldi/dkt/lib/dkt/itemconfig/image.py	Wed Apr 23 07:55:05 2008
@@ -6,8 +6,8 @@
 from dkt.interface import implements
 from dkt.interface.adapter import registry
 
-class ImageBaseConfig(object):
-    implements(interfaces.IImageBaseConfig)
+class ItemImageConfig(object):
+    implements(interfaces.IItemImageConfig)
 
     @classmethod
     def _factory(cls, context):
@@ -41,8 +41,4 @@
     def features(self):
         return self.context.get('image', 'features', '').split()
 
-    @property
-    def package(self):
-        return self.context.get('image', 'package', None)
-
-registry.register([IConfig], interfaces.IImageBaseConfig, '', ImageBaseConfig._factory)
+registry.register([IConfig], interfaces.IItemImageConfig, '', ItemImageConfig._factory)

Modified: people/waldi/dkt/lib/dkt/itemconfig/interfaces.py
==============================================================================
--- people/waldi/dkt/lib/dkt/itemconfig/interfaces.py	(original)
+++ people/waldi/dkt/lib/dkt/itemconfig/interfaces.py	Wed Apr 23 07:55:05 2008
@@ -1,13 +1,16 @@
 from dkt.interface import Attribute, Interface
 
-class IImageBaseConfig(Interface):
+class IItemImageConfig(Interface):
     type = Attribute("")
     subtype = Attribute("")
     architecture = Attribute("")
     file = Attribute("")
     version = Attribute("")
     features = Attribute("")
-    package = Attribute("")
+
+class IItemPackageConfig(Interface):
+    name = Attribute("")
+    version = Attribute("")
 
 class IImageLinuxInitramfsConfig(Interface):
     file = Attribute("")

Modified: people/waldi/dkt/lib/dkt/itemconfig/list.py
==============================================================================
--- people/waldi/dkt/lib/dkt/itemconfig/list.py	(original)
+++ people/waldi/dkt/lib/dkt/itemconfig/list.py	Wed Apr 23 07:55:05 2008
@@ -1,11 +1,9 @@
 import os
 
 from dkt.config.file import MutableConfig
-from dkt.itemconfig.interfaces import IImageBaseConfig
 
 class ImageConfigList(dict):
     def add(self, name, value):
-        IImageBaseConfig(value)
         self[name] = value
 
     def read_dir(self, dir):



More information about the Kernel-svn-changes mailing list