diff options
author | brian avery <avery.brian@gmail.com> | 2015-09-14 16:45:40 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-18 09:05:32 +0100 |
commit | 013c030c42710e1779167cc90a675b26caa377e6 (patch) | |
tree | 983e5e31cfaafe39ccfa35dc62a82530e4a08f9a /bitbake/lib/toaster | |
parent | 3165af39bf9690fba35d9dd78252eeadf656b229 (diff) | |
download | poky-013c030c42710e1779167cc90a675b26caa377e6.tar.gz |
bitbake: toaster: delete multiple builds cleanup
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]
(Bitbake rev: a065f7e5e9c07dbd71a98e7db1d7f711607716f3)
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/toastermain/management/commands/builddelete.py | 13 |
1 files 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 343d3114c0..ff93e549df 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py +++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py | |||
@@ -1,4 +1,5 @@ | |||
1 | from django.core.management.base import BaseCommand, CommandError | 1 | from django.core.management.base import BaseCommand, CommandError |
2 | from django.core.exceptions import ObjectDoesNotExist | ||
2 | from orm.models import Build | 3 | from orm.models import Build |
3 | from django.db import OperationalError | 4 | from django.db import OperationalError |
4 | import os | 5 | import os |
@@ -6,12 +7,16 @@ import os | |||
6 | 7 | ||
7 | 8 | ||
8 | class Command(BaseCommand): | 9 | class Command(BaseCommand): |
9 | args = "buildId" | 10 | args = '<buildID1 buildID2 .....>' |
10 | help = "Deletes selected build(s)" | 11 | help = "Deletes selected build(s)" |
11 | 12 | ||
12 | def handle(self, buildId, *args, **options): | 13 | def handle(self, *args, **options): |
13 | for bid in buildId.split(","): | 14 | for bid in args: |
14 | b = Build.objects.get(pk = bid) | 15 | try: |
16 | b = Build.objects.get(pk = bid) | ||
17 | except ObjectDoesNotExist: | ||
18 | print 'build %s does not exist, skipping...' %(bid) | ||
19 | continue | ||
15 | # theoretically, just b.delete() would suffice | 20 | # theoretically, just b.delete() would suffice |
16 | # however SQLite runs into problems when you try to | 21 | # however SQLite runs into problems when you try to |
17 | # delete too many rows at once, so we delete some direct | 22 | # delete too many rows at once, so we delete some direct |