diff options
author | Joshua Lock <joshua.g.lock@intel.com> | 2016-04-06 13:50:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-06 23:10:30 +0100 |
commit | 7a309d964a86f3474eaab7df6d438ed797f935c0 (patch) | |
tree | 0eff7577e5ba18d722d285c875c978e944022db2 | |
parent | 860cba85cfb3047c8a2c9b3127a9b3f4441fd1a6 (diff) | |
download | poky-7a309d964a86f3474eaab7df6d438ed797f935c0.tar.gz |
bitbake: buildinfohelper: work around unicode exceptions
We have been seeing UnicodeDecodeErrors when handling the
ImagePkgList MetadataEvent in ORMWrapper's
save_target_file_information() if the event includes filenames
that include non-ASCII characters.
In the short term work around this by converting paths to the
unicode type when passing them to Django's ORM. This is a bit of
a hack but it's too late in the cycle to do anything more invasive.
[YOCTO #9142]
(Bitbake rev: f50fff03b3de02e73a3cc2eb9935f7c345dbddc4)
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 1473a67222..93979054d5 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py | |||
@@ -494,7 +494,7 @@ class ORMWrapper(object): | |||
494 | parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY) | 494 | parent_obj = self._cached_get(Target_File, target = target_obj, path = parent_path, inodetype = Target_File.ITYPE_DIRECTORY) |
495 | tf_obj = Target_File.objects.create( | 495 | tf_obj = Target_File.objects.create( |
496 | target = target_obj, | 496 | target = target_obj, |
497 | path = path, | 497 | path = unicode(path, 'utf-8'), |
498 | size = size, | 498 | size = size, |
499 | inodetype = Target_File.ITYPE_DIRECTORY, | 499 | inodetype = Target_File.ITYPE_DIRECTORY, |
500 | permission = permission, | 500 | permission = permission, |
@@ -519,7 +519,7 @@ class ORMWrapper(object): | |||
519 | 519 | ||
520 | tf_obj = Target_File.objects.create( | 520 | tf_obj = Target_File.objects.create( |
521 | target = target_obj, | 521 | target = target_obj, |
522 | path = path, | 522 | path = unicode(path, 'utf-8'), |
523 | size = size, | 523 | size = size, |
524 | inodetype = inodetype, | 524 | inodetype = inodetype, |
525 | permission = permission, | 525 | permission = permission, |
@@ -550,7 +550,9 @@ class ORMWrapper(object): | |||
550 | filetarget_path = "/".join(fcpl) | 550 | filetarget_path = "/".join(fcpl) |
551 | 551 | ||
552 | try: | 552 | try: |
553 | filetarget_obj = Target_File.objects.get(target = target_obj, path = filetarget_path) | 553 | filetarget_obj = Target_File.objects.get( |
554 | target = target_obj, | ||
555 | path = unicode(filetarget_path, 'utf-8')) | ||
554 | except Target_File.DoesNotExist: | 556 | except Target_File.DoesNotExist: |
555 | # we might have an invalid link; no way to detect this. just set it to None | 557 | # we might have an invalid link; no way to detect this. just set it to None |
556 | filetarget_obj = None | 558 | filetarget_obj = None |
@@ -559,7 +561,7 @@ class ORMWrapper(object): | |||
559 | 561 | ||
560 | tf_obj = Target_File.objects.create( | 562 | tf_obj = Target_File.objects.create( |
561 | target = target_obj, | 563 | target = target_obj, |
562 | path = path, | 564 | path = unicode(path, 'utf-8'), |
563 | size = size, | 565 | size = size, |
564 | inodetype = Target_File.ITYPE_SYMLINK, | 566 | inodetype = Target_File.ITYPE_SYMLINK, |
565 | permission = permission, | 567 | permission = permission, |