recipetool: ignore incidental kernel module source

If the source tree happens to contain a kernel module as an example, a
test or under a "contrib" directory then we shouldn't be picking it up
and making the determination that the entire thing is a kernel module.

An example that triggered this is zstd, which ships a kernel module
under contrib/linux-kernel:

  https://github.com/facebook/zstd

(From OE-Core rev: 5c89bd0db1b327483f674802740ff21b909e0876)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Armin Kuster <akuster@mvista.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2017-09-20 16:43:33 +12:00
committed by Richard Purdie
parent 611e4b43d8
commit e36cf9e621
2 changed files with 5 additions and 3 deletions

View File

@@ -156,10 +156,12 @@ class RecipeHandler(object):
RecipeHandler.recipebinmap[prog] = pn
@staticmethod
def checkfiles(path, speclist, recursive=False):
def checkfiles(path, speclist, recursive=False, excludedirs=None):
results = []
if recursive:
for root, _, files in os.walk(path):
for root, dirs, files in os.walk(path, topdown=True):
if excludedirs:
dirs[:] = [d for d in dirs if d not in excludedirs]
for fn in files:
for spec in speclist:
if fnmatch.fnmatch(fn, spec):

View File

@@ -40,7 +40,7 @@ class KernelModuleRecipeHandler(RecipeHandler):
makefiles = []
files = RecipeHandler.checkfiles(srctree, ['*.c', '*.h'], recursive=True)
files = RecipeHandler.checkfiles(srctree, ['*.c', '*.h'], recursive=True, excludedirs=['contrib', 'test', 'examples'])
if files:
for cfile in files:
# Look in same dir or parent for Makefile