summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorNing Zhang <ning.zhang@windriver.com>2013-05-29 09:45:56 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-30 20:59:14 +0100
commit7285246deb55ed199c5f2a27d5771e1efec04e80 (patch)
tree3f17f47de8e4d006a5bc4fb4715e0aef93443a07 /scripts
parentf929c3bdede281f0d0e9f6dcef3e7fca8a2f884f (diff)
downloadpoky-7285246deb55ed199c5f2a27d5771e1efec04e80.tar.gz
yocto_kernel: check current items before add a new one
When use "yocto-kernel config add" to add the same config many times, all of these are list when use "yocto-kernel config list" to check. This fix modify routine yocto_kernel_config_add, if the new added components already exist in current configuration, just igore them. Now, one config could only be added one time. [YOCTO #4558] (From meta-yocto rev: 655ccc5ed77b52fb62dab5f6cfdf3de39b1bf055) Signed-off-by: Ning Zhang <ning.zhang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/bsp/kernel.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
index fc1e6bdd08..9ed6e9417c 100644
--- a/scripts/lib/bsp/kernel.py
+++ b/scripts/lib/bsp/kernel.py
@@ -239,22 +239,32 @@ def yocto_kernel_config_add(scripts_path, machine, config_items):
239 user-defined config fragment [${machine}-user-config.cfg]. 239 user-defined config fragment [${machine}-user-config.cfg].
240 """ 240 """
241 new_items = [] 241 new_items = []
242 dup_items = []
243
244 cur_items = read_config_items(scripts_path, machine)
242 245
243 for item in config_items: 246 for item in config_items:
244 if not item.startswith("CONFIG") or (not "=y" in item and not "=m" in item): 247 if not item.startswith("CONFIG") or (not "=y" in item and not "=m" in item):
245 print "Invalid config item (%s), exiting" % item 248 print "Invalid config item (%s), exiting" % item
246 sys.exit(1) 249 sys.exit(1)
247 new_items.append(item) 250 if item not in cur_items and item not in new_items:
248 251 new_items.append(item)
249 cur_items = read_config_items(scripts_path, machine) 252 else:
250 cur_items.extend(new_items) 253 dup_items.append(item)
251 254
252 write_config_items(scripts_path, machine, cur_items) 255 if len(new_items) > 0:
253 256 cur_items.extend(new_items)
254 print "Added items:" 257 write_config_items(scripts_path, machine, cur_items)
255 for n in new_items: 258 print "Added item%s:" % ("" if len(new_items)==1 else "s")
256 print "\t%s" % n 259 for n in new_items:
257 260 print "\t%s" % n
261
262 if len(dup_items) > 0:
263 output="Below item%s already exist%s in current configuration, ignore %s" % \
264 (("","s", "it") if len(dup_items)==1 else ("s", "", "them" ))
265 print output
266 for n in dup_items:
267 print "\t%s" % n
258 268
259def find_current_kernel(bsp_layer, machine): 269def find_current_kernel(bsp_layer, machine):
260 """ 270 """