[kernel] r10609 - in people/waldi/dkt: bin lib/dkt/bin lib/dkt/hooks lib/dkt/hooks/modules

Bastian Blank waldi at alioth.debian.org
Tue Feb 19 17:51:06 UTC 2008


Author: waldi
Date: Tue Feb 19 17:51:06 2008
New Revision: 10609

Log:
* bin/dkt-maintainer: imageconfig may only available during postinst and prerm.
* lib/dkt/bin/base.py: Don't make assumptions about arguments.
* lib/dkt/hooks/interfaces.py: Remove imageconfig from preinst and postrm calls.
* lib/dkt/hooks/modules/backward_symlinks.py: Update.


Modified:
   people/waldi/dkt/bin/dkt-maintainer
   people/waldi/dkt/lib/dkt/bin/base.py
   people/waldi/dkt/lib/dkt/hooks/interfaces.py
   people/waldi/dkt/lib/dkt/hooks/modules/backward_symlinks.py

Modified: people/waldi/dkt/bin/dkt-maintainer
==============================================================================
--- people/waldi/dkt/bin/dkt-maintainer	(original)
+++ people/waldi/dkt/bin/dkt-maintainer	Tue Feb 19 17:51:06 2008
@@ -9,12 +9,6 @@
         super(MainAll, self).__init__()
         self.package, self.version = package, version
 
-        try:
-            self.imageconfig = self.imageconfig_get(package)
-        except KeyError:
-            sys.stderr.write("Can't find image config for package %s\n" % self.package)
-            sys.exit(1)
-
 class MainAllPreInst(MainAll):
     def __init__(self, package, version, command, *args):
         super(MainAllPreInst, self).__init__(package, version)
@@ -37,6 +31,12 @@
             sys.stderr.write("postinst called with unknown argument '%s'\n" % self.command)
             sys.exit(1)
 
+        try:
+            self.imageconfig = self.imageconfig_get(package)
+        except KeyError:
+            sys.stderr.write("Can't find image config for package %s\n" % self.package)
+            sys.exit(1)
+
     def run_systemtask(self):
         if self.command in ('configure',):
             super(MainAllPostInst, self).run_systemtask('postinst')
@@ -50,6 +50,12 @@
             sys.stderr.write("prerm called with unknown argument '%s'\n" % self.command)
             sys.exit(1)
 
+        try:
+            self.imageconfig = self.imageconfig_get(package)
+        except KeyError:
+            sys.stderr.write("Can't find image config for package %s\n" % self.package)
+            sys.exit(1)
+
     def run_systemtask(self):
         if self.command in ('remove', 'upgrade'):
             super(MainAllPreRm, self).run_systemtask('prerm')
@@ -70,7 +76,7 @@
 class MainImagePreInst(MainAllPreInst):
     def __call__(self):
         self.run_systemtask()
-        self.run_imagetask('preinst', self.imageconfig, (self.command,) + self.args)
+        self.run_imagetask('preinst', (self.command,) + self.args)
         raise NotImplementedError
 
 class MainImagePostInst(MainAllPostInst):
@@ -88,7 +94,7 @@
 class MainImagePostRm(MainAllPostRm):
     def __call__(self):
         self.run_systemtask()
-        self.run_imagetask('postrm', self.imageconfig, (self.command,) + self.args)
+        self.run_imagetask('postrm', (self.command,) + self.args)
         raise NotImplementedError
 
 clss = {

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	Tue Feb 19 17:51:06 2008
@@ -34,8 +34,8 @@
                 return i
         raise KeyError(package)
 
-    def run_imagetask(self, type, imageconfig, maintainer_args):
-        return default_registry.run(IImageTask, 'image_' + type, self.config, imageconfig, maintainer_args)
+    def run_imagetask(self, type, *args):
+        return default_registry.run(IImageTask, 'image_' + type, self.config, *args)
 
     def run_systemtask(self, type):
         return default_registry.run(ISystemTask, 'system_' + type, self.config, self.imageconfigs)

Modified: people/waldi/dkt/lib/dkt/hooks/interfaces.py
==============================================================================
--- people/waldi/dkt/lib/dkt/hooks/interfaces.py	(original)
+++ people/waldi/dkt/lib/dkt/hooks/interfaces.py	Tue Feb 19 17:51:06 2008
@@ -33,7 +33,7 @@
         pass
 
 class IImageTask(IHookRunAll):
-    def image_preinst(self, systemconfig, imageconfig, maintainer_args):
+    def image_preinst(self, systemconfig, maintainer_args):
         pass
 
     def image_postinst(self, systemconfig, imageconfig, maintainer_args):
@@ -42,7 +42,7 @@
     def image_prerm(self, systemconfig, imageconfig, maintainer_args):
         pass
 
-    def image_postrm(self, systemconfig, imageconfig, maintainer_args):
+    def image_postrm(self, systemconfig, maintainer_args):
         pass
 
 class ISystemTask(IHookRunAll):

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:51:06 2008
@@ -2,7 +2,7 @@
 from dkt.hooks import default_registry, interfaces, register
 
 class Hook(object):
-    def image_preinst(self, systemconfig, imageconfig, maintainer_args):
+    def image_preinst(*args):
         pass
 
     def image_postinst(self, systemconfig, imageconfig, maintainer_args):
@@ -17,7 +17,7 @@
     def image_prerm(self, systemconfig, imageconfig, maintainer_args):
         pass
 
-    def image_postrm(self, systemconfig, imageconfig, maintainer_args):
+    def image_postrm(*args):
         pass
 
     def boot_config_partition(self, bootconfigs, systemconfig):



More information about the Kernel-svn-changes mailing list