From b1d7579debb237ac4b5a3112a9cfafd21a2457b3 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 5 Sep 2012 19:54:05 +0400 Subject: [PATCH] Add check on full kernel sources. --- pym/cl_kernel.py | 21 ++++++++++++++++----- pym/cl_kernel_cmd.py | 13 +++++++++++++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/pym/cl_kernel.py b/pym/cl_kernel.py index b6e3c35..3ddf926 100644 --- a/pym/cl_kernel.py +++ b/pym/cl_kernel.py @@ -74,12 +74,23 @@ class cl_kernel(color_print): """Test directory for kernel sources""" makefilepath = path.join(dirpath,'Makefile') kbuildpath = path.join(dirpath,'Kbuild') - if not path.exists(makefilepath) \ - or not path.exists(kbuildpath) \ - or not "Kbuild for top-level directory of the kernel" in \ + if path.exists(makefilepath) \ + and path.exists(kbuildpath) \ + and "Kbuild for top-level directory of the kernel" in \ open(kbuildpath,'r').read(): - return False - return True + return True + return False + + def _testFullKernelDirectory(self,dirpath): + """To check the directory for full kernel sources + + Kernel may be installed with minimal (later vmlinuz) flag""" + documentationPath = path.join(dirpath,'Documentation') + driversPath = path.join(dirpath,'drivers') + if path.exists(documentationPath) \ + and path.exists(driversPath): + return True + return False def setNoColor(self): self.color = False diff --git a/pym/cl_kernel_cmd.py b/pym/cl_kernel_cmd.py index 3a85ada..cf99e79 100644 --- a/pym/cl_kernel_cmd.py +++ b/pym/cl_kernel_cmd.py @@ -125,8 +125,21 @@ class kernel_cmd(share_cmd): if not self.logicObj._testKernelDirectory(values.k): self.optobj.error("%s:'%s'"% (_("wrong kernel source directory"),values.k)) + elif not self.logicObj._testFullKernelDirectory(values.k): + self.optobj.error(("%s:'%s'"% + (_("in directory of kernel source not enough needed files"), + values.k))+"\n"+ + _("Probably calculate-sources was " + "compiled with USE 'minimal'")) else: self.logicObj.clVars.Set('cl_kernel_src_path',values.k,True) + else: + if not self.logicObj._testFullKernelDirectory( + self.logicObj.clVars.Get('cl_kernel_src_path')): + self.optobj.error((_("in default directory of kernel source " + "not enough needed files")+"\n"+ + _("Probably calculate-sources was " + "compiled with USE 'minimal'"))) if values.c and values.o: self.optobj.error("%s: %s"%(_("incompatible options"), self.getStringIncompatibleOptions(["c","o"])))