summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-03-06 16:34:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-11 12:24:31 -0700
commitbff408ad6398a58ce92984597303876f258ce07c (patch)
tree4b8f7d462ba7a5b00c2c23e694df28974c786696 /bitbake/lib/toaster
parent00ca499a98a0244d02fca3497fb096b629947c5b (diff)
downloadpoky-bff408ad6398a58ce92984597303876f258ce07c.tar.gz
bitbake: toaster: add commands to list and delete builds
We add Django commands for the manage.py to manage the database content. The two commands added are: * buildslist - produces a list of current builds * builddelete - deletes a build and all associated data from the database (Bitbake rev: e9a8c32512bb270cda3dee4a3ed5fd22204c24bc) Signed-off-by: Alexandru DAMIAN <alexandru.damian@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/__init__.py0
-rw-r--r--bitbake/lib/toaster/toastermain/management/commands/__init__.py0
-rw-r--r--bitbake/lib/toaster/toastermain/management/commands/builddelete.py33
-rw-r--r--bitbake/lib/toaster/toastermain/management/commands/buildslist.py13
4 files changed, 46 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastermain/management/__init__.py b/bitbake/lib/toaster/toastermain/management/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/toastermain/management/__init__.py
diff --git a/bitbake/lib/toaster/toastermain/management/commands/__init__.py b/bitbake/lib/toaster/toastermain/management/commands/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/bitbake/lib/toaster/toastermain/management/commands/__init__.py
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 0000000000..5cec436714
--- /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
diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
new file mode 100644
index 0000000000..cad987fd93
--- /dev/null
+++ b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py
@@ -0,0 +1,13 @@
1from django.core.management.base import NoArgsCommand, CommandError
2from orm.models import Build
3import os
4
5
6
7class Command(NoArgsCommand):
8 args = ""
9 help = "Lists current builds"
10
11 def handle_noargs(self,**options):
12 for b in Build.objects.all():
13 print "%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()]))