diff options
author | Sujith H <sujith.h@gmail.com> | 2016-03-08 18:09:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-03-09 22:45:16 +0000 |
commit | cc74a8ae26a7728828a3442ba441b1676bc2c8a1 (patch) | |
tree | 5a8ce987f308378274a7bc5caa51996eb1234106 | |
parent | aebc22dbfade9a107f1a05e42bf7fe3887c15ae8 (diff) | |
download | poky-cc74a8ae26a7728828a3442ba441b1676bc2c8a1.tar.gz |
bitbake: toaster: use force_bytes to display non-ascii project names
When user enters a non-ascii character in the project
name of toaster, the build doesn't get triggered.
Use force_bytes to fix this.
Also deal with non-ascii project names when logging the
build request in runbuilds.
[YOCTO #9071]
(Bitbake rev: b6141c4d170885d3bdf63074afcb1e41fde0a8f0)
Signed-off-by: Sujith H <sujith.h@gmail.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | 2 | ||||
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/models.py | 4 | ||||
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py index edf71a7d7b..0bd5d08226 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/runbuilds.py | |||
@@ -47,7 +47,7 @@ class Command(NoArgsCommand): | |||
47 | logger.debug("runbuilds: No build env") | 47 | logger.debug("runbuilds: No build env") |
48 | return | 48 | return |
49 | 49 | ||
50 | logger.debug("runbuilds: starting build %s, environment %s" % (br, bec.be)) | 50 | logger.debug("runbuilds: starting build %s, environment %s" % (str(br).decode('utf-8'), bec.be)) |
51 | 51 | ||
52 | # write the build identification variable | 52 | # write the build identification variable |
53 | BRVariable.objects.create(req = br, name="TOASTER_BRBE", value="%d:%d" % (br.pk, bec.be.pk)) | 53 | BRVariable.objects.create(req = br, name="TOASTER_BRBE", value="%d:%d" % (br.pk, bec.be.pk)) |
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py index 9244ed1d81..9b2d0d0b24 100644 --- a/bitbake/lib/toaster/bldcontrol/models.py +++ b/bitbake/lib/toaster/bldcontrol/models.py | |||
@@ -1,5 +1,7 @@ | |||
1 | from __future__ import unicode_literals | ||
1 | from django.db import models | 2 | from django.db import models |
2 | from django.core.validators import MaxValueValidator, MinValueValidator | 3 | from django.core.validators import MaxValueValidator, MinValueValidator |
4 | from django.utils.encoding import force_bytes | ||
3 | from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version | 5 | from orm.models import Project, ProjectLayer, ProjectVariable, ProjectTarget, Build, Layer_Version |
4 | 6 | ||
5 | # a BuildEnvironment is the equivalent of the "build/" directory on the localhost | 7 | # a BuildEnvironment is the equivalent of the "build/" directory on the localhost |
@@ -94,7 +96,7 @@ class BuildRequest(models.Model): | |||
94 | return self.brvariable_set.get(name="MACHINE").value | 96 | return self.brvariable_set.get(name="MACHINE").value |
95 | 97 | ||
96 | def __str__(self): | 98 | def __str__(self): |
97 | return "%s %s" % (self.project, self.get_state_display()) | 99 | return force_bytes('%s %s' % (self.project, self.get_state_display())) |
98 | 100 | ||
99 | # These tables specify the settings for running an actual build. | 101 | # These tables specify the settings for running an actual build. |
100 | # They MUST be kept in sync with the tables in orm.models.Project* | 102 | # They MUST be kept in sync with the tables in orm.models.Project* |
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 93b5df3d4e..f9c4fb0508 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -19,9 +19,12 @@ | |||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | 19 | # with this program; if not, write to the Free Software Foundation, Inc., |
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 | 21 | ||
22 | from __future__ import unicode_literals | ||
23 | |||
22 | from django.db import models, IntegrityError | 24 | from django.db import models, IntegrityError |
23 | from django.db.models import F, Q, Avg, Max, Sum | 25 | from django.db.models import F, Q, Avg, Max, Sum |
24 | from django.utils import timezone | 26 | from django.utils import timezone |
27 | from django.utils.encoding import force_bytes | ||
25 | 28 | ||
26 | from django.core.urlresolvers import reverse | 29 | from django.core.urlresolvers import reverse |
27 | 30 | ||
@@ -1614,7 +1617,7 @@ class LogMessage(models.Model): | |||
1614 | lineno = models.IntegerField(null=True) | 1617 | lineno = models.IntegerField(null=True) |
1615 | 1618 | ||
1616 | def __str__(self): | 1619 | def __str__(self): |
1617 | return "%s %s %s" % (self.get_level_display(), self.message, self.build) | 1620 | return force_bytes('%s %s %s' % (self.get_level_display(), self.message, self.build)) |
1618 | 1621 | ||
1619 | def invalidate_cache(**kwargs): | 1622 | def invalidate_cache(**kwargs): |
1620 | from django.core.cache import cache | 1623 | from django.core.cache import cache |