Skip to contentSkip to conversation

toaster: replace viewkeys() -> keys()

PATCH In review Elliot Smith 3 participants 10 messages Jun 7, 2016 – Jun 10, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/8 toaster: replace viewkeys() -> keys()

From: Ed Bartosh <[email protected]>

Python 3 doesn't have dict.viewkeys method, renaming to keys().

[YOCTO #9584]

---
 bitbake/lib/bb/ui/buildinfohelper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/ui/buildinfohelper.py +1 -1
index d59d6a5..d5ba629 100644
@@ -1067,7 +1067,7 @@ class BuildInfoHelper(object):
 
         for t in self.internal_state['targets']:
             if t.is_image == True:
-                output_files = list(evdata.viewkeys())
+                output_files = list(evdata.keys())
                 for output in output_files:
                     if t.target in output and 'rootfs' in output and not output.endswith(".manifest"):
                         self.orm_wrapper.save_target_image_file_information(t, output, evdata[output])
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw

PATCH v2 2/8 toaster: fix migrations

From: Ed Bartosh <[email protected]>

---
 .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
 .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
 2 files changed, 123 insertions(+)
 create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py
 create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py
bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py new file +34 -0
new file mode 100644
index 0000000..3d90629
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bldcontrol', '0003_add_cancelling_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='bbstate',
+            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='betype',
+            field=models.IntegerField(choices=[(0, 'local')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='lock',
+            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
+        ),
+        migrations.AlterField(
+            model_name='buildrequest',
+            name='state',
+            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
+        ),
+    ]
bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py new file +89 -0

89 lines not on this page · raw message

Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#4 lore raw

PATCH v2 3/8 toaster: decode response content

In reply to Elliot Smith

From: Ed Bartosh <[email protected]>

Decoded response content to str to pass it to json.load as it breaks in Python 3 with this error:
TypeError: expected bytes, bytearray or buffer compatible object

[YOCTO #9584]

---
 bitbake/lib/toaster/toastergui/tests.py | 38 ++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 19 deletions(-)
bitbake/lib/toaster/toastergui/tests.py +19 -19
index 9af1018..722b383 100644
@@ -77,7 +77,7 @@ class ViewTests(TestCase):
         self.assertEqual(response.status_code, 200)
         self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
 
         self.assertTrue("error" in data)
         self.assertEqual(data["error"], "ok")
@@ -106,7 +106,7 @@ class ViewTests(TestCase):
             self.assertEqual(response.status_code, 200)
             self.assertTrue(response['Content-Type'].startswith('application/json'))
 
-            data = json.loads(response.content)
+            data = json.loads(response.content.decode('utf-8'))
 
             self.assertTrue("error" in data)
             self.assertEqual(data["error"], "ok")
@@ -157,26 +157,26 @@ class ViewTests(TestCase):
                 'project_id': self.project.id,
                 'dir_path' : "/path/in/repository"}
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertEqual(response.status_code, 200)
         self.assertEqual(data["error"], "ok")
 
         #Test to verify import of a layer successful
         args['name'] = "meta-oe"
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertTrue(data["error"], "ok")
 
         #Test for html tag in the data
         args['<'] = "testing html tag"
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
         #Empty data passed
         args = {}
         response = self.client.post(reverse('xhr_importlayer'), args)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_custom_ok(self):
@@ -186,7 +186,7 @@ class ViewTests(TestCase):
                   'base': self.recipe1.id}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertEqual(data['error'], 'ok')
         self.assertTrue('url' in data)
         # get recipe from the database
@@ -202,7 +202,7 @@ class ViewTests(TestCase):
                        {'name': 'custom', 'project': self.project.id}]:
             response = self.client.post(url, params)
             self.assertEqual(response.status_code, 200)
-            data = json.loads(response.content)
+            data = json.loads(response.content.decode('utf-8'))
             self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_wrong_project(self):
@@ -211,7 +211,7 @@ class ViewTests(TestCase):
         params = {'name': 'custom', 'project': 0, "base": self.recipe1.id}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_wrong_base(self):
@@ -220,7 +220,7 @@ class ViewTests(TestCase):
         params = {'name': 'custom', 'project': self.project.id, "base": 0}
         response = self.client.post(url, params)
         self.assertEqual(response.status_code, 200)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
         self.assertNotEqual(data["error"], "ok")
 
     def test_xhr_custom_details(self):
@@ -235,7 +235,7 @@ class ViewTests(TestCase):
                              'project_id': self.project.id,
                             }
                    }
-        self.assertEqual(json.loads(response.content), expected)
+        self.assertEqual(json.loads(response.content.decode('utf-8')), expected)
 
     def test_xhr_custom_del(self):
         """Test deleting custom recipe"""
@@ -248,12 +248,12 @@ class ViewTests(TestCase):
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content), {"error": "ok"})
+        self.assertEqual(json.loads(response.content.decode('utf-8')), {"error": "ok"})
         # try to delete not-existent recipe
         url = reverse('xhr_customrecipe_id', args=(recipe.id,))
         response = self.client.delete(url)
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(json.loads(response.content)["error"], "ok")
+        self.assertNotEqual(json.loads(response.content.decode('utf-8'))["error"], "ok")
 
     def test_xhr_custom_packages(self):
         """Test adding and deleting package to a custom recipe"""
@@ -263,7 +263,7 @@ class ViewTests(TestCase):
                                                  self.cust_package.id)))
 
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content),
+        self.assertEqual(json.loads(response.content.decode('utf-8')),
                          {"error": "ok"})
         self.assertEqual(self.customr.appends_set.first().name,
                          self.cust_package.name)
@@ -274,7 +274,7 @@ class ViewTests(TestCase):
 
         response = self.client.delete(del_url)
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(json.loads(response.content), {"error": "ok"})
+        self.assertEqual(json.loads(response.content.decode('utf-8')), {"error": "ok"})
         all_packages = self.customr.get_all_packages().values_list('pk',
                                                                    flat=True)
 
@@ -286,7 +286,7 @@ class ViewTests(TestCase):
 
         response = self.client.delete(del_url)
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(json.loads(response.content)["error"], "ok")
+        self.assertNotEqual(json.loads(response.content.decode('utf-8'))["error"], "ok")
 
     def test_xhr_custom_packages_err(self):
         """Test error conditions of xhr_customrecipe_packages"""
@@ -297,7 +297,7 @@ class ViewTests(TestCase):
             for method in (self.client.put, self.client.delete):
                 response = method(url)
                 self.assertEqual(response.status_code, 200)
-                self.assertNotEqual(json.loads(response.content),
+                self.assertNotEqual(json.loads(response.content.decode('utf-8')),
                                     {"error": "ok"})
 
     def test_download_custom_recipe(self):
@@ -316,7 +316,7 @@ class ViewTests(TestCase):
         table = SoftwareRecipesTable()
         request = RequestFactory().get('/foo/', {'format': 'json'})
         response = table.get(request, pid=self.project.id)
-        data = json.loads(response.content)
+        data = json.loads(response.content.decode('utf-8'))
 
         recipes = Recipe.objects.filter(Q(is_image=False))
         self.assertTrue(len(recipes) > 1,
@@ -372,7 +372,7 @@ class ViewTests(TestCase):
                     'target_id': 1}
 
             response = table.get(request, **args)
-            return json.loads(response.content)
+            return json.loads(response.content.decode('utf-8'))
 
         def get_text_from_td(td):
             """If we have html in the td then extract the text portion"""
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#5 lore raw

PATCH v2 4/8 toaster: fix incorrect file mode

In reply to Elliot Smith

From: Ed Bartosh <[email protected]>

Python 3 complains about 'wa' mode this way:
ValueError: must have exactly one of create/read/write/append mode

Fixed by using 'a' mode.

[YOCTO #9584]

---
 bitbake/lib/toaster/toastergui/tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/toaster/toastergui/tests.py +1 -1
index 722b383..31f1431 100644
@@ -304,7 +304,7 @@ class ViewTests(TestCase):
         """Download the recipe file generated for the custom image"""
 
         # Create a dummy recipe file for the custom image generation to read
-        open("/tmp/a_recipe.bb", 'wa').close()
+        open("/tmp/a_recipe.bb", 'a').close()
         response = self.client.get(reverse('customrecipedownload',
                                            args=(self.project.id,
                                                  self.customr.id)))
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#6 lore raw

PATCH v2 5/8 toaster: fix test_toaster_tables

In reply to Elliot Smith

From: Ed Bartosh <[email protected]>

Removed unneeded code as it causes the following error in Python 3:
TypeError: expected bytes, bytearray or buffer compatible object

---
 bitbake/lib/toaster/toastergui/tests.py | 6 ------
 1 file changed, 6 deletions(-)
bitbake/lib/toaster/toastergui/tests.py +0 -6
index 31f1431..2cd2c7d 100644
@@ -382,12 +382,6 @@ class ViewTests(TestCase):
             else:
                 ret = BeautifulSoup(td).text
 
-            # We change the td into ascii as a way to remove characters
-            # such as \xa0 (non break space) which mess with the ordering
-            # comparisons
-            ret.strip().encode('ascii',
-                               errors='replace').replace('?', ' ')
-            # Case where the td is empty
             if len(ret):
                 return "0"
             else:
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#7 lore raw

PATCH v2 6/8 toaster: fix broken reference to urllib

In reply to Elliot Smith

The code previously imported urllib to make use of querystring quoting, but was modified to support Python 3. During this process, the reference to urllib was not fixed, which resulted in table filters breaking.

Remove the reference to urllib (which is no longer imported) and instead reference the imported unquote_plus() function.

---
 bitbake/lib/toaster/toastergui/widgets.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/toaster/toastergui/widgets.py +1 -1
index 4276c2a..005a562 100644
@@ -219,7 +219,7 @@ class ToasterTable(TemplateView):
 
         try:
             filter_name, action_name = filters.split(':')
-            action_params = urllib.unquote_plus(filter_value)
+            action_params = unquote_plus(filter_value)
         except ValueError:
             return
 
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#8 lore raw

PATCH v2 7/8 toaster-tests: fix tests for latest Selenium version

In reply to Elliot Smith

Previously, we didn't specify a specific version of Selenium. When upgrading to Python 3 and installing Selenium to work with it, the JS unit test broke, as the report format produced by Selenium had changed.

Modify the test so that it works with the latest Selenium report format.

Add a note to the README that the given Selenium version should be used to prevent unexpected test failures.

---
 bitbake/lib/toaster/tests/browser/README                | 7 ++++---
 bitbake/lib/toaster/tests/browser/test_js_unit_tests.py | 8 ++++----
 bitbake/lib/toaster/toastergui/static/js/tests/test.js  | 8 --------
 3 files changed, 8 insertions(+), 15 deletions(-)
bitbake/lib/toaster/tests/browser/README +4 -3
index 63e8169..f57154e 100644
@@ -4,10 +4,11 @@ These tests require Selenium to be installed in your Python environment.
 
 The simplest way to install this is via pip:
 
-  pip install selenium
+  pip install selenium==2.53.2
 
-Alternatively, if you used pip to install the libraries required by Toaster,
-selenium will already be installed.
+Note that if you use other versions of Selenium, some of the tests (such as
+tests.browser.test_js_unit_tests.TestJsUnitTests) may fail, as these rely on
+a Selenium test report with a version-specific format.
 
 To run tests against Chrome:
 
bitbake/lib/toaster/tests/browser/test_js_unit_tests.py +4 -4
index e63da8e..3c0b962 100644
@@ -38,11 +38,11 @@ class TestJsUnitTests(SeleniumTestCase):
     def test_that_js_unit_tests_pass(self):
         url = reverse('js-unit-tests')
         self.get(url)
-        self.wait_until_present('#tests-failed')
+        self.wait_until_present('#qunit-testresult .failed')
 
-        failed = self.find("#tests-failed").text
-        passed = self.find("#tests-passed").text
-        total = self.find("#tests-total").text
+        failed = self.find("#qunit-testresult .failed").text
+        passed = self.find("#qunit-testresult .passed").text
+        total = self.find("#qunit-testresult .total").text
 
         logger.info("Js unit tests completed %s out of %s passed, %s failed",
                     passed,
bitbake/lib/toaster/toastergui/static/js/tests/test.js +0 -8
index 2b62118..44b7522 100644
@@ -2,14 +2,6 @@
 /* Unit tests for Toaster's JS */
 
 /* libtoaster tests */
-QUnit.done(function(details){
-    /* Selenium test will look for these elements to get the results */
-  var body = $('body');
-  body.append("<span id='tests-failed'>"+details.failed+"</span>");
-  body.append("<span id='tests-passed'>"+details.passed+"</span>");
-  body.append("<span id='tests-total'>"+details.total+"</span>");
-});
-
 QUnit.test("Layer alert notification", function(assert) {
   var layer = {
     "layerdetailurl":"/toastergui/project/1/layer/22",
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#9 lore raw

PATCH v2 8/8 toaster: open image files in binary mode when sending in response

In reply to Elliot Smith

The view code for downloading image files used the "r" flag to read the file, then used the open file object to form the HTTP response.

While this worked in Python 2, Python 3 appears to be more strict about this sort of thing, and Django throws a UnicodeDecodeError when a file opened this way is used in a response.

Open the file with the "b" flag (binary mode) so that Django can correctly convert the binary file handle to an HTTP response.

---
 bitbake/lib/toaster/toastergui/views.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/toaster/toastergui/views.py +1 -1
index 1f908ea..16f98ee 100755
@@ -2339,7 +2339,7 @@ if True:
             )
 
             if file_name and response_file_name:
-                fsock = open(file_name, "r")
+                fsock = open(file_name, "rb")
                 content_type = MimeTypeFinder.get_mimetype(file_name)
 
                 response = HttpResponse(fsock, content_type = content_type)
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#2 lore raw

Re: [PATCH][v2 2/8] toaster: fix migrations

In reply to Elliot Smith

Is this patch needed? I see this is in master already:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake?id=15bb3d4e7fd33a921e9b0681297dfee6986a66eb

Quoted 145 lines · Elliot Smith

From: Ed Bartosh <[email protected]>

---
  .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
  .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
  2 files changed, 123 insertions(+)

create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py

bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py new file +34 -0
new file mode 100644
index 0000000..3d90629
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bldcontrol', '0003_add_cancelling_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='bbstate',
+            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='betype',
+            field=models.IntegerField(choices=[(0, 'local')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='lock',
+            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
+        ),
+        migrations.AlterField(
+            model_name='buildrequest',
+            name='state',
+            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
+        ),
+    ]
bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py new file +89 -0
new file mode 100644
index 0000000..b472e7c
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('orm', '0006_add_cancelled_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='build',
+            name='outcome',
+            field=models.IntegerField(default=2, choices=[(0, 'Succeeded'), (1, 'Failed'), (2, 'In Progress'), (3, 'Cancelled')]),
+        ),
+        migrations.AlterField(
+            model_name='helptext',
+            name='area',
+            field=models.IntegerField(choices=[(0, 'variable')]),
+        ),
+        migrations.AlterField(
+            model_name='layer',
+            name='summary',
+            field=models.TextField(default=None, null=True, help_text='One-line description of the layer'),
+        ),
+        migrations.AlterField(
+            model_name='layer_version',
+            name='local_path',
+            field=models.FilePathField(default='/', max_length=1024),
+        ),
+        migrations.AlterField(
+            model_name='layersource',
+            name='sourcetype',
+            field=models.IntegerField(choices=[(0, 'local'), (1, 'layerindex'), (2, 'imported')]),
+        ),
+        migrations.AlterField(
+            model_name='logmessage',
+            name='level',
+            field=models.IntegerField(default=0, choices=[(0, 'info'), (1, 'warn'), (2, 'error'), (3, 'critical'), (-1, 'toaster exception')]),
+        ),
+        migrations.AlterField(
+            model_name='package',
+            name='installed_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='package_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'depends'), (3, 'recommends'), (2, 'recommends'), (4, 'suggests'), (5, 'provides'), (6, 'replaces'), (7, 'conflicts')]),
+        ),
+        migrations.AlterField(
+            model_name='recipe_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'rdepends')]),
+        ),
+        migrations.AlterField(
+            model_name='release',
+            name='branch_name',
+            field=models.CharField(default='', max_length=50),
+        ),
+        migrations.AlterField(
+            model_name='releasedefaultlayer',
+            name='layer_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='target_file',
+            name='inodetype',
+            field=models.IntegerField(choices=[(1, 'regular'), (2, 'directory'), (3, 'symlink'), (4, 'socket'), (5, 'fifo'), (6, 'character'), (7, 'block')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='outcome',
+            field=models.IntegerField(default=-1, choices=[(-1, 'Not Available'), (0, 'Succeeded'), (1, 'Covered'), (2, 'Cached'), (3, 'Prebuilt'), (4, 'Failed'), (5, 'Empty')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='script_type',
+            field=models.IntegerField(default=0, choices=[(0, 'N/A'), (2, 'Python'), (3, 'Shell')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='sstate_result',
+            field=models.IntegerField(default=0, choices=[(0, 'Not Applicable'), (1, 'File not in cache'), (2, 'Failed'), (3, 'Succeeded')]),
+        ),
+    ]
#3 lore raw

Re: [PATCH][v2 2/8] toaster: fix migrations

If toaster starts without it then it's not needed.
It didn't work for me until I run manage.py makemirgrations, but it could be that I tried it without my previous patch in master.

-----Original Message-----
From: Michael Wood [mailto:[email protected]]
Sent: Thursday, June 9, 2016 8:07 PM
To: Smith, Elliot <[email protected]>; [email protected]
Cc: Bartosh, Eduard <[email protected]>
Subject: Re: [Toaster] [PATCH][v2 2/8] toaster: fix migrations

Is this patch needed? I see this is in master already:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/bitbake?id=15bb3d4e7fd33a921e9b0681297dfee6986a66eb

Quoted 135 lines · Elliot Smith

From: Ed Bartosh <[email protected]>

---
  .../migrations/0004_auto_20160523_1446.py          | 34 +++++++++
  .../orm/migrations/0007_auto_20160523_1446.py      | 89 ++++++++++++++++++++++
  2 files changed, 123 insertions(+)

create mode 100644 bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py create mode 100644 bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py

bitbake/lib/toaster/bldcontrol/migrations/0004_auto_20160523_1446.py new file +34 -0
new file mode 100644
index 0000000..3d90629
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('bldcontrol', '0003_add_cancelling_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='bbstate',
+            field=models.IntegerField(default=0, choices=[(0, 'stopped'), (1, 'started')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='betype',
+            field=models.IntegerField(choices=[(0, 'local')]),
+        ),
+        migrations.AlterField(
+            model_name='buildenvironment',
+            name='lock',
+            field=models.IntegerField(default=0, choices=[(0, 'free'), (1, 'lock'), (2, 'running')]),
+        ),
+        migrations.AlterField(
+            model_name='buildrequest',
+            name='state',
+            field=models.IntegerField(default=0, choices=[(0, 'created'), (1, 'queued'), (2, 'in progress'), (3, 'completed'), (4, 'failed'), (5, 'deleted'), (6, 'cancelling'), (7, 'archive')]),
+        ),
+    ]
bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py new file +79 -0
new file mode 100644
index 0000000..b472e7c
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('orm', '0006_add_cancelled_state'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='build',
+            name='outcome',
+            field=models.IntegerField(default=2, choices=[(0, 'Succeeded'), (1, 'Failed'), (2, 'In Progress'), (3, 'Cancelled')]),
+        ),
+        migrations.AlterField(
+            model_name='helptext',
+            name='area',
+            field=models.IntegerField(choices=[(0, 'variable')]),
+        ),
+        migrations.AlterField(
+            model_name='layer',
+            name='summary',
+            field=models.TextField(default=None, null=True, help_text='One-line description of the layer'),
+        ),
+        migrations.AlterField(
+            model_name='layer_version',
+            name='local_path',
+            field=models.FilePathField(default='/', max_length=1024),
+        ),
+        migrations.AlterField(
+            model_name='layersource',
+            name='sourcetype',
+            field=models.IntegerField(choices=[(0, 'local'), (1, 'layerindex'), (2, 'imported')]),
+        ),
+        migrations.AlterField(
+            model_name='logmessage',
+            name='level',
+            field=models.IntegerField(default=0, choices=[(0, 'info'), (1, 'warn'), (2, 'error'), (3, 'critical'), (-1, 'toaster exception')]),
+        ),
+        migrations.AlterField(
+            model_name='package',
+            name='installed_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='package_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'depends'), (3, 'recommends'), (2, 'recommends'), (4, 'suggests'), (5, 'provides'), (6, 'replaces'), (7, 'conflicts')]),
+        ),
+        migrations.AlterField(
+            model_name='recipe_dependency',
+            name='dep_type',
+            field=models.IntegerField(choices=[(0, 'depends'), (1, 'rdepends')]),
+        ),
+        migrations.AlterField(
+            model_name='release',
+            name='branch_name',
+            field=models.CharField(default='', max_length=50),
+        ),
+        migrations.AlterField(
+            model_name='releasedefaultlayer',
+            name='layer_name',
+            field=models.CharField(default='', max_length=100),
+        ),
+        migrations.AlterField(
+            model_name='target_file',
+            name='inodetype',
+            field=models.IntegerField(choices=[(1, 'regular'), (2, 'directory'), (3, 'symlink'), (4, 'socket'), (5, 'fifo'), (6, 'character'), (7, 'block')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='outcome',
+            field=models.IntegerField(default=-1, choices=[(-1, 'Not Available'), (0, 'Succeeded'), (1, 'Covered'), (2, 'Cached'), (3, 'Prebuilt'), (4, 'Failed'), (5, 'Empty')]),
+        ),
+        migrations.AlterField(

bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py line 89

Quoted 10 lines
bitbake/lib/toaster/orm/migrations/0007_auto_20160523_1446.py new file +10 -0
+            model_name='task',
+            name='script_type',
+            field=models.IntegerField(default=0, choices=[(0, 'N/A'), (2, 'Python'), (3, 'Shell')]),
+        ),
+        migrations.AlterField(
+            model_name='task',
+            name='sstate_result',
+            field=models.IntegerField(default=0, choices=[(0, 'Not Applicable'), (1, 'File not in cache'), (2, 'Failed'), (3, 'Succeeded')]),
+        ),
+    ]

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.