|
|
|
@ -24,7 +24,7 @@ import traceback
|
|
|
|
|
from os import path
|
|
|
|
|
from cl_utils import process,pathJoin,getRunCommands,getTupleVersion,\
|
|
|
|
|
childMounts,_toUNICODE,isMount,typeFile, \
|
|
|
|
|
removeDir
|
|
|
|
|
removeDir, pathJoin
|
|
|
|
|
from subprocess import STDOUT,PIPE
|
|
|
|
|
from cl_print import color_print
|
|
|
|
|
from cl_datavars import DataVars
|
|
|
|
@ -193,23 +193,23 @@ class cl_builder(color_print):
|
|
|
|
|
delFiles = filter(lambda x: not x in rightKernelFiles,
|
|
|
|
|
filter(reTrash.search,
|
|
|
|
|
os.listdir(bootDir)))
|
|
|
|
|
map(lambda x:os.unlink(path.join(bootDir,x)),delFiles)
|
|
|
|
|
map(lambda x:os.unlink(pathJoin(bootDir,x)),delFiles)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
self.printMessageForTest(_("Cleaning %s directory") % "/lib/modules")
|
|
|
|
|
reKernelVer = re.compile(" version (\S+)\s",re.S)
|
|
|
|
|
ftype = typeFile(magic=0x4).getMType
|
|
|
|
|
resReg = reKernelVer.search(ftype(path.join(bootDir,
|
|
|
|
|
resReg = reKernelVer.search(ftype(pathJoin(bootDir,
|
|
|
|
|
self.clVars.Get('cl_builder_kernel'))))
|
|
|
|
|
if resReg:
|
|
|
|
|
kernelVersion = resReg.groups()[0]
|
|
|
|
|
map(lambda x:removeDir(path.join(modulesDir,x)),
|
|
|
|
|
map(lambda x:removeDir(pathJoin(modulesDir,x)),
|
|
|
|
|
filter(lambda x:x != kernelVersion,
|
|
|
|
|
os.listdir(modulesDir)))
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
self.printMessageForTest(_("Cleaning %s directory")% "/usr/src")
|
|
|
|
|
removeKernelSources = filter(lambda x:x and x != "/usr/src/linux",
|
|
|
|
|
self.runChroot(distrPath,"qfile -o /usr/src/*"))
|
|
|
|
|
map(lambda x:removeDir(path.join(distrPath,x)),
|
|
|
|
|
map(lambda x:removeDir(pathJoin(distrPath,x)),
|
|
|
|
|
removeKernelSources)
|
|
|
|
|
self.printByResult(True)
|
|
|
|
|
|
|
|
|
|