[kernel] r11128 - people/waldi/dkt/lib/dkt/hooks/modules
Bastian Blank
waldi at alioth.debian.org
Wed Apr 23 08:48:56 UTC 2008
Author: waldi
Date: Wed Apr 23 08:48:55 2008
New Revision: 11128
Log:
lib/dkt/hooks/modules/modules_info.py: Add.
Added:
people/waldi/dkt/lib/dkt/hooks/modules/modules_info.py
Added: people/waldi/dkt/lib/dkt/hooks/modules/modules_info.py
==============================================================================
--- (empty file)
+++ people/waldi/dkt/lib/dkt/hooks/modules/modules_info.py Wed Apr 23 08:48:55 2008
@@ -0,0 +1,35 @@
+import os, subprocess
+
+from dkt.hooks import default_registry, interfaces, register
+from dkt.itemconfig.interfaces import IItemModulesConfig
+
+class Hook(object):
+ def _get_info(self, itemconfig):
+ config = IItemModulesConfig(itemconfig)
+ abi = config.abi
+ return abi, '/boot/System.map-%s' % abi, '/lib/modules/%s' % abi
+
+ def modules_preinst(*args):
+ pass
+
+ def modules_postinst(self, systemconfig, itemconfig, maintainer_args):
+ abi, map, modules = self._get_info(itemconfig)
+ ret = subprocess.call(['depmod', '-F', map, abi], executable = '/sbin/depmod', stdin = subprocess.PIPE, stdout = subprocess.PIPE)
+
+ def modules_prerm(*args):
+ pass
+
+ def modules_postrm(self, systemconfig, itemconfig, maintainer_args):
+ abi, map, modules = self._get_info(itemconfig)
+ for root, dirnames, filenames in os.walk(modules):
+ del dirnames[:]
+ for filename in filenames:
+ if filename.startswith('modules.'):
+ filename = os.path.join(root, filename)
+ try:
+ os.unlink(filename)
+ except OSError, e:
+ import traceback
+ traceback.print_exc()
+
+register('modules-info', interfaces.IModulesTask, Hook())
More information about the Kernel-svn-changes
mailing list