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)
downloadast2050-yocto-poky-7285246deb55ed199c5f2a27d5771e1efec04e80.zip
ast2050-yocto-poky-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 fc1e6bd..9ed6e94 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):
user-defined config fragment [${machine}-user-config.cfg].
"""
new_items = []
+ dup_items = []
+
+ cur_items = read_config_items(scripts_path, machine)
for item in config_items:
if not item.startswith("CONFIG") or (not "=y" in item and not "=m" in item):
print "Invalid config item (%s), exiting" % item
sys.exit(1)
- new_items.append(item)
-
- cur_items = read_config_items(scripts_path, machine)
- cur_items.extend(new_items)
-
- write_config_items(scripts_path, machine, cur_items)
-
- print "Added items:"
- for n in new_items:
- print "\t%s" % n
-
+ if item not in cur_items and item not in new_items:
+ new_items.append(item)
+ else:
+ dup_items.append(item)
+
+ if len(new_items) > 0:
+ cur_items.extend(new_items)
+ write_config_items(scripts_path, machine, cur_items)
+ print "Added item%s:" % ("" if len(new_items)==1 else "s")
+ for n in new_items:
+ print "\t%s" % n
+
+ if len(dup_items) > 0:
+ output="Below item%s already exist%s in current configuration, ignore %s" % \
+ (("","s", "it") if len(dup_items)==1 else ("s", "", "them" ))
+ print output
+ for n in dup_items:
+ print "\t%s" % n
def find_current_kernel(bsp_layer, machine):
"""
OpenPOWER on IntegriCloud