All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] [review-request][PATCH]toaster:cleanup buildelete command
@ 2015-09-10 17:39 brian avery
  2015-09-10 17:39 ` [PATCH 1/1] bitbake: toaster: delete multiple builds cleanup brian avery
  0 siblings, 1 reply; 3+ messages in thread
From: brian avery @ 2015-09-10 17:39 UTC (permalink / raw)
  To: toaster

This patch cleans up the multiple build delete. It:
  1) skips build id's that don't exist rather than giving a traceback.
  2) let you pass in the ids as a space separated list
  3) fixes the usage to match the space separated list format

this comand is accessed by doing something like:
poky/bitbake/lib/toaster/manage.py builddelete 1  99 2

[YOCTO #7726]

The following changes since commit d4585fa23d56a58c583ee33db067a23177a936b1:

  bsps: update 3.14 SRCREVs (2015-09-09 14:27:57 +0100)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib bavery/cleanup-builddelete
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=bavery/cleanup-builddelete

brian avery (1):
  bitbake: toaster: delete multiple builds cleanup

 .../toaster/toastermain/management/commands/builddelete.py  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

-- 
1.9.1



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

* [PATCH 1/1] bitbake: toaster: delete multiple builds cleanup
  2015-09-10 17:39 [PATCH 0/1] [review-request][PATCH]toaster:cleanup buildelete command brian avery
@ 2015-09-10 17:39 ` brian avery
  2015-09-14 15:38   ` Smith, Elliot
  0 siblings, 1 reply; 3+ messages in thread
From: brian avery @ 2015-09-10 17:39 UTC (permalink / raw)
  To: toaster

This patch cleans up the multiple delete. It:
   1) skips build id's that don't exist rather than giving a traceback.
   2) let you pass in the ids as a space separated list
   3) fixes the usage to match the space separated list format

[YOCTO #7726]

Signed-off-by: brian avery <avery.brian@gmail.com>
---
 .../toaster/toastermain/management/commands/builddelete.py  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
index 343d311..ff93e54 100644
--- a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
+++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
@@ -1,4 +1,5 @@
 from django.core.management.base import BaseCommand, CommandError
+from django.core.exceptions import ObjectDoesNotExist
 from orm.models import Build
 from django.db import OperationalError
 import os
@@ -6,12 +7,16 @@ import os
 
 
 class Command(BaseCommand):
-    args    = "buildId"
+    args    = '<buildID1 buildID2 .....>'
     help    = "Deletes selected build(s)"
 
-    def handle(self, buildId, *args, **options):
-        for bid in buildId.split(","):
-            b = Build.objects.get(pk = bid)
+    def handle(self, *args, **options):
+        for bid in args:
+            try:
+                b = Build.objects.get(pk = bid)
+            except ObjectDoesNotExist:
+                print 'build %s does not exist, skipping...' %(bid)
+                continue
             # theoretically, just b.delete() would suffice
             # however SQLite runs into problems when you try to
             # delete too many rows at once, so we delete some direct
-- 
1.9.1



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

* Re: [PATCH 1/1] bitbake: toaster: delete multiple builds cleanup
  2015-09-10 17:39 ` [PATCH 1/1] bitbake: toaster: delete multiple builds cleanup brian avery
@ 2015-09-14 15:38   ` Smith, Elliot
  0 siblings, 0 replies; 3+ messages in thread
From: Smith, Elliot @ 2015-09-14 15:38 UTC (permalink / raw)
  To: brian avery; +Cc: toaster

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

Looks OK to me, I'll submit it.

Elliot

On 10 September 2015 at 18:39, brian avery <avery.brian@gmail.com> wrote:

> This patch cleans up the multiple delete. It:
>    1) skips build id's that don't exist rather than giving a traceback.
>    2) let you pass in the ids as a space separated list
>    3) fixes the usage to match the space separated list format
>
> [YOCTO #7726]
>
> Signed-off-by: brian avery <avery.brian@gmail.com>
> ---
>  .../toaster/toastermain/management/commands/builddelete.py  | 13
> +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git
> a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
> b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
> index 343d311..ff93e54 100644
> --- a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
> +++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
> @@ -1,4 +1,5 @@
>  from django.core.management.base import BaseCommand, CommandError
> +from django.core.exceptions import ObjectDoesNotExist
>  from orm.models import Build
>  from django.db import OperationalError
>  import os
> @@ -6,12 +7,16 @@ import os
>
>
>  class Command(BaseCommand):
> -    args    = "buildId"
> +    args    = '<buildID1 buildID2 .....>'
>      help    = "Deletes selected build(s)"
>
> -    def handle(self, buildId, *args, **options):
> -        for bid in buildId.split(","):
> -            b = Build.objects.get(pk = bid)
> +    def handle(self, *args, **options):
> +        for bid in args:
> +            try:
> +                b = Build.objects.get(pk = bid)
> +            except ObjectDoesNotExist:
> +                print 'build %s does not exist, skipping...' %(bid)
> +                continue
>              # theoretically, just b.delete() would suffice
>              # however SQLite runs into problems when you try to
>              # delete too many rows at once, so we delete some direct
> --
> 1.9.1
>
> --
> _______________________________________________
> toaster mailing list
> toaster@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>



-- 
Elliot Smith
Software Engineer
Intel Open Source Technology Centre

[-- Attachment #2: Type: text/html, Size: 3190 bytes --]

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

end of thread, other threads:[~2015-09-14 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10 17:39 [PATCH 0/1] [review-request][PATCH]toaster:cleanup buildelete command brian avery
2015-09-10 17:39 ` [PATCH 1/1] bitbake: toaster: delete multiple builds cleanup brian avery
2015-09-14 15:38   ` Smith, Elliot

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.