[kernel] r10601 - people/waldi/dkt/bin
Bastian Blank
waldi at alioth.debian.org
Tue Feb 19 14:19:30 UTC 2008
Author: waldi
Date: Tue Feb 19 14:19:29 2008
New Revision: 10601
Log:
bin/dkt-maintainer: Check maintainer script arguments.
Modified:
people/waldi/dkt/bin/dkt-maintainer
Modified: people/waldi/dkt/bin/dkt-maintainer
==============================================================================
--- people/waldi/dkt/bin/dkt-maintainer (original)
+++ people/waldi/dkt/bin/dkt-maintainer Tue Feb 19 14:19:29 2008
@@ -5,35 +5,71 @@
from dkt.bin.base import MainBase
class MainAll(MainBase):
- def __init__(self, command, package, version, *args):
+ def __init__(self, package, version):
super(MainAll, self).__init__()
- self.command, self.package, self.version, self.args = command, package, version, args
+ self.package, self.version = package, version
try:
self.imageconfig = self.get_imageconfig(package)
except KeyError:
- sys.stderr.write("Can't find image config for package %s\n" % package)
+ sys.stderr.write("Can't find image config for package %s\n" % self.package)
sys.exit(1)
-class MainImagePreInst(MainAll):
+class MainAllPreInst(MainAll):
+ def __init__(self, package, version, command, *args):
+ super(MainAllPreInst, self).__init__(package, version)
+ self.command, self.args = command, args
+
+ if self.command not in ('install', 'upgrade', 'abort-upgrade'):
+ sys.stderr.write("preinst called with unknown argument '%s'\n" % self.command)
+ sys.exit(1)
+
+class MainAllPostInst(MainAll):
+ def __init__(self, package, version, command, *args):
+ super(MainAllPreInst, self).__init__(package, version)
+ self.command, self.args = command, args
+
+ if self.command not in ('configure', 'abort-upgrade', 'abort-remove', 'abort-deconfigure'):
+ sys.stderr.write("postinst called with unknown argument '%s'\n" % self.command)
+ sys.exit(1)
+
+class MainAllPreRm(MainAll):
+ def __init__(self, package, version, command, *args):
+ super(MainAllPreRm, self).__init__(package, version)
+ self.command, self.args = command, args
+
+ if self.command not in ('remove', 'upgrade', 'deconfigure', 'failed-upgrade'):
+ sys.stderr.write("prerm called with unknown argument '%s'\n" % self.command)
+ sys.exit(1)
+
+class MainAllPostRm(MainAll):
+ def __init__(self, package, version, command, *args):
+ super(MainAllPreRm, self).__init__(package, version)
+ self.command, self.args = command, args
+
+ if self.command not in ('purge', 'remove', 'upgrade', 'failed-upgrade', 'abort-install', 'abort-upgrade', 'disappear'):
+ sys.stderr.write("postrm called with unknown argument '%s'\n" % self.command)
+ sys.exit(1)
+
+class MainImagePreInst(MainAllPreInst):
def __call__(self):
self.run_systemtask('preinst')
self.run_imagetask('preinst', self.imageconfig, [])
raise NotImplementedError
-class MainImagePostInst(MainAll):
+class MainImagePostInst(MainAllPostInst):
def __call__(self):
self.run_systemtask('postinst')
self.run_imagetask('postinst', self.imageconfig, [])
raise NotImplementedError
-class MainImagePreRm(MainAll):
+class MainImagePreRm(MainAllPreRm):
def __call__(self):
self.run_systemtask('prerm')
self.run_imagetask('prerm', self.imageconfig, [])
raise NotImplementedError
-class MainImagePostRm(MainAll):
+class MainImagePostRm(MainAllPostRm):
def __call__(self):
self.run_systemtask('postrm')
self.run_imagetask('postrm', self.imageconfig, [])
More information about the Kernel-svn-changes
mailing list