All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toaster: Fix adding of bitbake variables containing ':'
@ 2016-08-23  9:57 Alexander Egorenkov
  2016-08-23 10:54 ` Barros Pena, Belen
  2016-08-23 11:06 ` Ed Bartosh
  0 siblings, 2 replies; 3+ messages in thread
From: Alexander Egorenkov @ 2016-08-23  9:57 UTC (permalink / raw)
  To: toaster; +Cc: Alexander Egorenkov

This fix is a backport from toaster-next.

Krogoth Toaster is unable to add a variable containing ':'
and fails with the following error message:

error on request:
too many values to unpack
Traceback (most recent call last):
 File "bitbake/lib/toaster/toastergui/views.py", line 2171, in xhr_configvaredit
  variable, value = t.spli(":")
ValueError: too many values to unpack.

[YOCTO #10170]

Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@vector.com>
---
 bitbake/lib/toaster/toastergui/views.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index bd5bf63..2b714dc 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2164,11 +2164,12 @@ if True:
     def xhr_configvaredit(request, pid):
         try:
             prj = Project.objects.get(id = pid)
+            max_split=1
             # add conf variables
             if 'configvarAdd' in request.POST:
                 t=request.POST['configvarAdd'].strip()
                 if ":" in t:
-                    variable, value = t.split(":")
+                    variable, value = t.split(":", max_split)
                 else:
                     variable = t
                     value = ""
@@ -2178,7 +2179,7 @@ if True:
             if 'configvarChange' in request.POST:
                 t=request.POST['configvarChange'].strip()
                 if ":" in t:
-                    variable, value = t.split(":")
+                    variable, value = t.split(":", max_split)
                 else:
                     variable = t
                     value = ""
-- 
2.9.3



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

* Re: [PATCH] toaster: Fix adding of bitbake variables containing ':'
  2016-08-23  9:57 [PATCH] toaster: Fix adding of bitbake variables containing ':' Alexander Egorenkov
@ 2016-08-23 10:54 ` Barros Pena, Belen
  2016-08-23 11:06 ` Ed Bartosh
  1 sibling, 0 replies; 3+ messages in thread
From: Barros Pena, Belen @ 2016-08-23 10:54 UTC (permalink / raw)
  To: Alexander Egorenkov, toaster@yoctoproject.org



On 23/08/2016 10:57, "toaster-bounces@yoctoproject.org on behalf of
Alexander Egorenkov" <toaster-bounces@yoctoproject.org on behalf of
Alexander.Egorenkov@vector.com> wrote:

>This fix is a backport from toaster-next.
>
>Krogoth Toaster is unable to add a variable containing ':'
>and fails with the following error message:
>
>error on request:
>too many values to unpack
>Traceback (most recent call last):
> File "bitbake/lib/toaster/toastergui/views.py", line 2171, in
>xhr_configvaredit
>  variable, value = t.spli(":")
>ValueError: too many values to unpack.
>
>[YOCTO #10170]

This works for me.

Thanks!

Belén

>
>Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@vector.com>
>---
> bitbake/lib/toaster/toastergui/views.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/bitbake/lib/toaster/toastergui/views.py
>b/bitbake/lib/toaster/toastergui/views.py
>index bd5bf63..2b714dc 100755
>--- a/bitbake/lib/toaster/toastergui/views.py
>+++ b/bitbake/lib/toaster/toastergui/views.py
>@@ -2164,11 +2164,12 @@ if True:
>     def xhr_configvaredit(request, pid):
>         try:
>             prj = Project.objects.get(id = pid)
>+            max_split=1
>             # add conf variables
>             if 'configvarAdd' in request.POST:
>                 t=request.POST['configvarAdd'].strip()
>                 if ":" in t:
>-                    variable, value = t.split(":")
>+                    variable, value = t.split(":", max_split)
>                 else:
>                     variable = t
>                     value = ""
>@@ -2178,7 +2179,7 @@ if True:
>             if 'configvarChange' in request.POST:
>                 t=request.POST['configvarChange'].strip()
>                 if ":" in t:
>-                    variable, value = t.split(":")
>+                    variable, value = t.split(":", max_split)
>                 else:
>                     variable = t
>                     value = ""
>-- 
>2.9.3
>
>-- 
>_______________________________________________
>toaster mailing list
>toaster@yoctoproject.org
>https://lists.yoctoproject.org/listinfo/toaster



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

* Re: [PATCH] toaster: Fix adding of bitbake variables containing ':'
  2016-08-23  9:57 [PATCH] toaster: Fix adding of bitbake variables containing ':' Alexander Egorenkov
  2016-08-23 10:54 ` Barros Pena, Belen
@ 2016-08-23 11:06 ` Ed Bartosh
  1 sibling, 0 replies; 3+ messages in thread
From: Ed Bartosh @ 2016-08-23 11:06 UTC (permalink / raw)
  To: Alexander Egorenkov; +Cc: toaster

On Tue, Aug 23, 2016 at 11:57:50AM +0200, Alexander Egorenkov wrote:
> This fix is a backport from toaster-next.
> 
> Krogoth Toaster is unable to add a variable containing ':'
> and fails with the following error message:
> 
> error on request:
> too many values to unpack
> Traceback (most recent call last):
>  File "bitbake/lib/toaster/toastergui/views.py", line 2171, in xhr_configvaredit
>   variable, value = t.spli(":")
> ValueError: too many values to unpack.
> 
> [YOCTO #10170]
> 
> Signed-off-by: Alexander Egorenkov <Alexander.Egorenkov@vector.com>
> ---
>  bitbake/lib/toaster/toastergui/views.py | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
> index bd5bf63..2b714dc 100755
> --- a/bitbake/lib/toaster/toastergui/views.py
> +++ b/bitbake/lib/toaster/toastergui/views.py
> @@ -2164,11 +2164,12 @@ if True:
>      def xhr_configvaredit(request, pid):
>          try:
>              prj = Project.objects.get(id = pid)
> +            max_split=1
>              # add conf variables
>              if 'configvarAdd' in request.POST:
>                  t=request.POST['configvarAdd'].strip()
>                  if ":" in t:
> -                    variable, value = t.split(":")
> +                    variable, value = t.split(":", max_split)
>                  else:
>                      variable = t
>                      value = ""
> @@ -2178,7 +2179,7 @@ if True:
>              if 'configvarChange' in request.POST:
>                  t=request.POST['configvarChange'].strip()
>                  if ":" in t:
> -                    variable, value = t.split(":")
> +                    variable, value = t.split(":", max_split)
>                  else:
>                      variable = t
>                      value = ""

Would it be better to use 'variable, value = t.split(":", 1)' in both
lines, i.e. without adding max_split variable?
It would be more readable in my opinion.

--
Regards,
Ed


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

end of thread, other threads:[~2016-08-23 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-23  9:57 [PATCH] toaster: Fix adding of bitbake variables containing ':' Alexander Egorenkov
2016-08-23 10:54 ` Barros Pena, Belen
2016-08-23 11:06 ` Ed Bartosh

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.