summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastermain/management/commands/builddelete.py')
-rw-r--r--bitbake/lib/toaster/toastermain/management/commands/builddelete.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
new file mode 100644
index 0000000..5cec436
--- /dev/null
+++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py
@@ -0,0 +1,33 @@
1from django.core.management.base import BaseCommand, CommandError
2from orm.models import Build
3import os
4
5
6
7class Command(BaseCommand):
8 args = "buildId"
9 help = "Deletes selected build"
10
11 def handle(self, buildId, *args, **options):
12 b = Build.objects.get(pk = buildId)
13 # theoretically, just b.delete() would suffice
14 # however SQLite runs into problems when you try to
15 # delete too many rows at once, so we delete some direct
16 # relationships from Build manually.
17
18 for t in b.target_set.all():
19 t.delete()
20 for t in b.task_build.all():
21 t.delete()
22 for p in b.package_set.all():
23 p.delete()
24 for lv in b.layer_version_build.all():
25 lv.delete()
26 for v in b.variable_build.all():
27 v.delete()
28 for l in b.logmessage_set.all():
29 l.delete()
30
31 # this should take care of the rest
32 b.delete()
33