From: Johannes Berg <[email protected]>

If a defconfig file has symbols that can't be satisfied
with the given copy-list file, then there's no point in
shipping it, so just copy selectively the ones needed.

Signed-off-by: Johannes Berg <[email protected]>
---
 gentree.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/gentree.py b/gentree.py
index 44acb9a1250e..10588842fdfa 100755
--- a/gentree.py
+++ b/gentree.py
@@ -581,7 +581,7 @@ def process(kerneldir, outdir, copy_list_file, 
git_revision=None,
     # do the copy
     backport_files = [(x, x) for x in [
         'Kconfig', 'Makefile', 'Makefile.build', 'Makefile.kernel', 
'.gitignore',
-        'Makefile.real', 'compat/', 'backport-include/', 'kconf/', 
'defconfigs/',
+        'Makefile.real', 'compat/', 'backport-include/', 'kconf/',
         'scripts/', '.blacklist.map',
     ]]
     if not args.git_revision:
@@ -785,6 +785,29 @@ def process(kerneldir, outdir, copy_list_file, 
git_revision=None,
 
     git_debug_snapshot(args, "add versions/symbols files")
 
+    # add defconfigs that we want
+    defconfigs_dir = os.path.join(source_dir, 'backport', 'defconfigs')
+    os.mkdir(os.path.join(args.outdir, 'defconfigs'))
+    for dfbase in os.listdir(defconfigs_dir):
+        copy_defconfig = True
+        dfsrc = os.path.join(defconfigs_dir, dfbase)
+        for line in open(dfsrc, 'r'):
+            if not '=' in line:
+                continue
+            line_ok = False
+            for sym in symbols:
+                if sym + '=' in line:
+                    line_ok = True
+                    break
+            if not line_ok:
+                print dfbase, line
+                copy_defconfig = False
+                break
+        if copy_defconfig:
+            shutil.copy(dfsrc, os.path.join(args.outdir, 'defconfigs', dfbase))
+
+    git_debug_snapshot(args, "add (useful) defconfig files")
+
     logwrite('Rewrite Makefiles and Kconfig files ...')
 
     # rewrite Makefile and source symbols
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to