All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] check current items before add a new one
@ 2013-05-29  8:14 Ning Zhang
  2013-05-29  8:14 ` [PATCH 1/1] yocto_kernel: " Ning Zhang
  2013-05-29  9:28 ` [PATCH 0/1] " ning
  0 siblings, 2 replies; 4+ messages in thread
From: Ning Zhang @ 2013-05-29  8:14 UTC (permalink / raw)
  To: openembedded-core

From: Zhang Ning <ning.zhan@windriver.com>

The following changes since commit 676fd3f394a0c0576b63c77ed2184bf5f42c29b6:

  dropbear: a fix for hang in dropbearkey, built for x32 (2013-05-24 14:14:49 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ning/bug4558
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ning/bug4558

Zhang Ning (1):
  yocto_kernel: check current items before add a new one

 scripts/lib/bsp/kernel.py |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] yocto_kernel: check current items before add a new one
  2013-05-29  8:14 [PATCH 0/1] check current items before add a new one Ning Zhang
@ 2013-05-29  8:14 ` Ning Zhang
  2013-05-29 13:22   ` Tom Zanussi
  2013-05-29  9:28 ` [PATCH 0/1] " ning
  1 sibling, 1 reply; 4+ messages in thread
From: Ning Zhang @ 2013-05-29  8:14 UTC (permalink / raw)
  To: openembedded-core

From: Zhang Ning <ning.zhan@windriver.com>

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 #4562]

Signen-off-by: Zhang Ning <ning.zhan@windriver.com>
---
 scripts/lib/bsp/kernel.py |   32 +++++++++++++++++++++-----------
 1 file 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):
     """
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/1] check current items before add a new one
  2013-05-29  8:14 [PATCH 0/1] check current items before add a new one Ning Zhang
  2013-05-29  8:14 ` [PATCH 1/1] yocto_kernel: " Ning Zhang
@ 2013-05-29  9:28 ` ning
  1 sibling, 0 replies; 4+ messages in thread
From: ning @ 2013-05-29  9:28 UTC (permalink / raw)
  To: openembedded-core

Hi all,

Some comments in this patch are wrong, please ignore this mail, i will 
send a new patch soon.

Thanks.

On 05/29/2013 04:14 PM, Ning Zhang wrote:
> From: Zhang Ning <ning.zhan@windriver.com>
>
> The following changes since commit 676fd3f394a0c0576b63c77ed2184bf5f42c29b6:
>
>    dropbear: a fix for hang in dropbearkey, built for x32 (2013-05-24 14:14:49 +0100)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib ning/bug4558
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ning/bug4558
>
> Zhang Ning (1):
>    yocto_kernel: check current items before add a new one
>
>   scripts/lib/bsp/kernel.py |   32 +++++++++++++++++++++-----------
>   1 file changed, 21 insertions(+), 11 deletions(-)
>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] yocto_kernel: check current items before add a new one
  2013-05-29  8:14 ` [PATCH 1/1] yocto_kernel: " Ning Zhang
@ 2013-05-29 13:22   ` Tom Zanussi
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Zanussi @ 2013-05-29 13:22 UTC (permalink / raw)
  To: Ning Zhang; +Cc: openembedded-core

On Wed, 2013-05-29 at 16:14 +0800, Ning Zhang wrote:
> From: Zhang Ning <ning.zhan@windriver.com>
> 
> 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 #4562]
> 
> Signen-off-by: Zhang Ning <ning.zhan@windriver.com>
> ---
>  scripts/lib/bsp/kernel.py |   32 +++++++++++++++++++++-----------
>  1 file 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" % \

This patch looks fine, but please change the text to:

+        output="The following item%s already exist%s in the current configuration, ignoring %s" % \

Thanks,

Tom

> +            (("","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):
>      """




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-29 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-29  8:14 [PATCH 0/1] check current items before add a new one Ning Zhang
2013-05-29  8:14 ` [PATCH 1/1] yocto_kernel: " Ning Zhang
2013-05-29 13:22   ` Tom Zanussi
2013-05-29  9:28 ` [PATCH 0/1] " ning

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.