]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: ignore incidental kernel module source
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Wed, 20 Sep 2017 04:43:33 +0000 (16:43 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 10 Nov 2017 14:44:31 +0000 (14:44 +0000)
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

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/recipetool/create.py
scripts/lib/recipetool/create_kmod.py

index 1532735ab8b04d15a01df19f1917e1e72e2b4861..055bdef436f37812ad110127b0b79b8868a9ba61 100644 (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):
index 7cf188db21d1dee508751831ba967bd2dc20e452..4569b53c805185ed352eaf1974061c38f82d2b21 100644 (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