diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-07-15 14:14:56 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-07-23 20:06:58 +0100 |
commit | 8a3789a7b11565aa2ceae0b79f93edb0d353173b (patch) | |
tree | 2153ec0ed1c7bb1f6d3655105483a0a47cccdfcb /bitbake/lib | |
parent | 5aba3d7fcc3a9edf477bedeced96444b2fbcb8be (diff) | |
download | poky-8a3789a7b11565aa2ceae0b79f93edb0d353173b.tar.gz |
bitbake: toaster: move bldcontrol initial_data fixture to code
We move the initial_data fixture to a code migration,
in order to make sure that we don't overwrite modified data.
The data is inserted only if no data is present, instead
of always overwriting the entry.
The check settings returns 0 if the check was ok.
(Bitbake rev: 525c316ac95c06c52fbcfc836ca5599ee9dbfe8b)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
3 files changed, 109 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json b/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json deleted file mode 100644 index b2f12b38ae..0000000000 --- a/bitbake/lib/toaster/bldcontrol/fixtures/initial_data.json +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | [{"pk": 1, "model": "bldcontrol.buildenvironment", "fields": {"updated": "2014-05-20T12:17:30Z", "created": "2014-05-20T12:17:30Z", "lock": 0, "bbstate": 0, "bbaddress": "", "betype": 0, "bbtoken": "", "address": "", "bbport": -1}}] | ||
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index 0e8260e6c9..a91dd150ef 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
@@ -27,7 +27,12 @@ class Command(NoArgsCommand): | |||
27 | if not be.builddir.startswith("/"): | 27 | if not be.builddir.startswith("/"): |
28 | be.builddir = raw_input(" -- builddir must be an absolute path:") | 28 | be.builddir = raw_input(" -- builddir must be an absolute path:") |
29 | is_changed = True | 29 | is_changed = True |
30 | if is_changed: | ||
31 | print "saved" | ||
32 | be.save() | ||
30 | return is_changed | 33 | return is_changed |
31 | 34 | ||
32 | while (_verify_be()): | 35 | while (_verify_be()): |
33 | pass | 36 | pass |
37 | |||
38 | return 0 | ||
diff --git a/bitbake/lib/toaster/bldcontrol/migrations/0004_loadinitialdata.py b/bitbake/lib/toaster/bldcontrol/migrations/0004_loadinitialdata.py new file mode 100644 index 0000000000..d908578133 --- /dev/null +++ b/bitbake/lib/toaster/bldcontrol/migrations/0004_loadinitialdata.py | |||
@@ -0,0 +1,104 @@ | |||
1 | # -*- coding: utf-8 -*- | ||
2 | from south.utils import datetime_utils as datetime | ||
3 | from south.db import db | ||
4 | from south.v2 import DataMigration | ||
5 | from django.db import models | ||
6 | |||
7 | class 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 | try: | ||
15 | orm.BuildEnvironment.objects.get(pk = 1) | ||
16 | except: | ||
17 | from django.utils import timezone | ||
18 | orm.BuildEnvironment.objects.create(pk = 1, | ||
19 | created = timezone.now(), | ||
20 | updated = timezone.now(), | ||
21 | betype = 0) | ||
22 | |||
23 | def backwards(self, orm): | ||
24 | "Write your backwards methods here." | ||
25 | |||
26 | models = { | ||
27 | u'bldcontrol.brlayer': { | ||
28 | 'Meta': {'object_name': 'BRLayer'}, | ||
29 | 'commit': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | ||
30 | 'dirpath': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | ||
31 | 'giturl': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | ||
32 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
33 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
34 | 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"}) | ||
35 | }, | ||
36 | u'bldcontrol.brtarget': { | ||
37 | 'Meta': {'object_name': 'BRTarget'}, | ||
38 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
39 | 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"}), | ||
40 | 'target': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
41 | 'task': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'}) | ||
42 | }, | ||
43 | u'bldcontrol.brvariable': { | ||
44 | 'Meta': {'object_name': 'BRVariable'}, | ||
45 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
46 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
47 | 'req': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['bldcontrol.BuildRequest']"}), | ||
48 | 'value': ('django.db.models.fields.TextField', [], {'blank': 'True'}) | ||
49 | }, | ||
50 | u'bldcontrol.buildenvironment': { | ||
51 | 'Meta': {'object_name': 'BuildEnvironment'}, | ||
52 | 'address': ('django.db.models.fields.CharField', [], {'max_length': '254'}), | ||
53 | 'bbaddress': ('django.db.models.fields.CharField', [], {'max_length': '254', 'blank': 'True'}), | ||
54 | 'bbport': ('django.db.models.fields.IntegerField', [], {'default': '-1'}), | ||
55 | 'bbstate': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
56 | 'bbtoken': ('django.db.models.fields.CharField', [], {'max_length': '126', 'blank': 'True'}), | ||
57 | 'betype': ('django.db.models.fields.IntegerField', [], {}), | ||
58 | 'builddir': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}), | ||
59 | 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | ||
60 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
61 | 'lock': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
62 | 'sourcedir': ('django.db.models.fields.CharField', [], {'max_length': '512', 'blank': 'True'}), | ||
63 | 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) | ||
64 | }, | ||
65 | u'bldcontrol.buildrequest': { | ||
66 | 'Meta': {'object_name': 'BuildRequest'}, | ||
67 | 'build': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Build']", 'null': 'True'}), | ||
68 | 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | ||
69 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
70 | 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']"}), | ||
71 | 'state': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
72 | 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}) | ||
73 | }, | ||
74 | u'orm.build': { | ||
75 | 'Meta': {'object_name': 'Build'}, | ||
76 | 'bitbake_version': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
77 | 'build_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
78 | 'completed_on': ('django.db.models.fields.DateTimeField', [], {}), | ||
79 | 'cooker_log_path': ('django.db.models.fields.CharField', [], {'max_length': '500'}), | ||
80 | 'distro': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
81 | 'distro_version': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
82 | 'errors_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
83 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
84 | 'machine': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
85 | 'outcome': ('django.db.models.fields.IntegerField', [], {'default': '2'}), | ||
86 | 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['orm.Project']", 'null': 'True'}), | ||
87 | 'started_on': ('django.db.models.fields.DateTimeField', [], {}), | ||
88 | 'timespent': ('django.db.models.fields.IntegerField', [], {'default': '0'}), | ||
89 | 'warnings_no': ('django.db.models.fields.IntegerField', [], {'default': '0'}) | ||
90 | }, | ||
91 | u'orm.project': { | ||
92 | 'Meta': {'object_name': 'Project'}, | ||
93 | 'branch': ('django.db.models.fields.CharField', [], {'max_length': '50'}), | ||
94 | 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), | ||
95 | u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
96 | 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}), | ||
97 | 'short_description': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}), | ||
98 | 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), | ||
99 | 'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'}) | ||
100 | } | ||
101 | } | ||
102 | |||
103 | complete_apps = ['bldcontrol'] | ||
104 | symmetrical = True | ||