summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/migrations/0003_timespent.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/orm/migrations/0003_timespent.py')
-rw-r--r--bitbake/lib/toaster/orm/migrations/0003_timespent.py182
1 files changed, 182 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/migrations/0003_timespent.py b/bitbake/lib/toaster/orm/migrations/0003_timespent.py
new file mode 100644
index 0000000..9600f9e
--- /dev/null
+++ b/bitbake/lib/toaster/orm/migrations/0003_timespent.py
@@ -0,0 +1,182 @@
1# -*- coding: utf-8 -*-
2from south.utils import datetime_utils as datetime
3from south.db import db
4from south.v2 import DataMigration
5from django.db import models
6
7class Migration(DataMigration):
8
9 def forwards(self, orm):
10 "Write your forwards methods here."
11 # Note: Don't use "from appname.models import ModelName".
12 # Use orm.ModelName to refer to models in this application,
13 # and orm['appname.ModelName'] for models in other applications.
14
15 for build in orm.Build.objects.all():
16 build.timespent = int((build.completed_on - build.started_on).total_seconds())
17 build.save()
18
19 def backwards(self, orm):
20 "Write your backwards methods here."
21 raise RuntimeError("Cannot reverse this migration.")
22
23 models = {
24 u'orm.build': {
25 'Meta': {'object_name': 'Build'},
26 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
27 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
28 'completed_on': ('django.db.models.fields.DateTimeField', [], {}),
29 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
30 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
31 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
32 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
33 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34 'image_fstypes': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
35 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
36 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
37 'started_on': ('django.db.models.fields.DateTimeField', [], {}),
38 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
39 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'})
40 },
41 u'orm.layer': {
42 'Meta': {'object_name': 'Layer'},
43 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
44 'layer_index_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
45 'local_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
46 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
47 },
48 u'orm.layer_version': {
49 'Meta': {'object_name': 'Layer_Version'},
50 'branch': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
51 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_build'", 'to': u"orm['orm.Build']"}),
52 'commit': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
53 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
54 'layer': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'layer_version_layer'", 'to': u"orm['orm.Layer']"}),
55 'priority': ('django.db.models.fields.IntegerField', [], {})
56 },
57 u'orm.logmessage': {
58 'Meta': {'object_name': 'LogMessage'},
59 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
60 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
61 'level': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
62 'lineno': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
63 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
64 'pathname': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
65 },
66 u'orm.package': {
67 'Meta': {'object_name': 'Package'},
68 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
69 'description': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
70 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
71 'installed_size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
72 'license': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
73 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
74 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Recipe']", 'null': 'True'}),
75 'revision': ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
76 'section': ('django.db.models.fields.CharField', [], {'max_length': '80', 'blank': 'True'}),
77 'size': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
78 'summary': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
79 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
80 },
81 u'orm.package_dependency': {
82 'Meta': {'object_name': 'Package_Dependency'},
83 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
84 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_target'", 'to': u"orm['orm.Package']"}),
85 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
86 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'package_dependencies_source'", 'to': u"orm['orm.Package']"}),
87 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']", 'null': 'True'})
88 },
89 u'orm.package_file': {
90 'Meta': {'object_name': 'Package_File'},
91 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
92 'package': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'buildfilelist_package'", 'to': u"orm['orm.Package']"}),
93 'path': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
94 'size': ('django.db.models.fields.IntegerField', [], {})
95 },
96 u'orm.recipe': {
97 'Meta': {'object_name': 'Recipe'},
98 'bugtracker': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
99 'description': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
100 'file_path': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
101 'homepage': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
102 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
103 'layer_version': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'recipe_layer_version'", 'to': u"orm['orm.Layer_Version']"}),
104 'license': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
105 'licensing_info': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
106 'name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
107 'section': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
108 'summary': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
109 'version': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'})
110 },
111 u'orm.recipe_dependency': {
112 'Meta': {'object_name': 'Recipe_Dependency'},
113 'dep_type': ('django.db.models.fields.IntegerField', [], {}),
114 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_depends'", 'to': u"orm['orm.Recipe']"}),
115 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'r_dependencies_recipe'", 'to': u"orm['orm.Recipe']"})
117 },
118 u'orm.target': {
119 'Meta': {'object_name': 'Target'},
120 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']"}),
121 'file_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
122 'file_size': ('django.db.models.fields.IntegerField', [], {}),
123 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
124 'is_image': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
125 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'})
126 },
127 u'orm.target_installed_package': {
128 'Meta': {'object_name': 'Target_Installed_Package'},
129 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
130 'package': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Package']"}),
131 'target': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Target']"})
132 },
133 u'orm.task': {
134 'Meta': {'ordering': "('order', 'recipe')", 'object_name': 'Task'},
135 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_build'", 'to': u"orm['orm.Build']"}),
136 'cpu_usage': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '6', 'decimal_places': '2'}),
137 'disk_io': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
138 'elapsed_time': ('django.db.models.fields.CharField', [], {'default': '0', 'max_length': '50'}),
139 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
140 'line_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
141 'logfile': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
142 'message': ('django.db.models.fields.CharField', [], {'max_length': '240'}),
143 'order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
144 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '5'}),
145 'path_to_sstate_obj': ('django.db.models.fields.FilePathField', [], {'max_length': '500', 'blank': 'True'}),
146 'recipe': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'build_recipe'", 'to': u"orm['orm.Recipe']"}),
147 'script_type': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
148 'source_url': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'}),
149 'sstate_checksum': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
150 'sstate_result': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
151 'task_executed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
152 'task_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
153 'work_directory': ('django.db.models.fields.FilePathField', [], {'max_length': '255', 'blank': 'True'})
154 },
155 u'orm.task_dependency': {
156 'Meta': {'object_name': 'Task_Dependency'},
157 'depends_on': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_depends'", 'to': u"orm['orm.Task']"}),
158 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
159 'task': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'task_dependencies_task'", 'to': u"orm['orm.Task']"})
160 },
161 u'orm.variable': {
162 'Meta': {'object_name': 'Variable'},
163 'build': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variable_build'", 'to': u"orm['orm.Build']"}),
164 'changed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
165 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
166 'human_readable_name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
167 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
168 'variable_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
169 'variable_value': ('django.db.models.fields.TextField', [], {'blank': 'True'})
170 },
171 u'orm.variablehistory': {
172 'Meta': {'object_name': 'VariableHistory'},
173 'file_name': ('django.db.models.fields.FilePathField', [], {'max_length': '255'}),
174 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
175 'line_number': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
176 'operation': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
177 'variable': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'vhistory'", 'to': u"orm['orm.Variable']"})
178 }
179 }
180
181 complete_apps = ['orm']
182 symmetrical = True