diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-02-26 21:41:58 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-27 07:36:07 +0000 |
commit | ee1af30548a6ac3f243c9ee61f0988aa307c0c6b (patch) | |
tree | c92a1b207e4df112c856ad960b49d6abff6f921a /bitbake/lib/bb/ui | |
parent | 87c6a5482f9042c7dd663078f7ebe5222649a547 (diff) | |
download | ast2050-yocto-poky-ee1af30548a6ac3f243c9ee61f0988aa307c0c6b.zip ast2050-yocto-poky-ee1af30548a6ac3f243c9ee61f0988aa307c0c6b.tar.gz |
bitbake: toasterui: do not use transactions if the database autocommits
Some databases, notably the SQLite3 adapter, force autocommits even if
the autocommit is turned off. The behavious is tracked in this bug:
http://bugs.python.org/issue8145#msg109965
Django refuses to work with autocommit off in this case, so we have
to take the same precautions when using manual transaction support.
[YOCTO #7363]
[YOCTO #7365]
(Bitbake rev: 90231ab63a129fa344d461c2911898ea0f07f206)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r-- | bitbake/lib/bb/ui/buildinfohelper.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index c0f42d2..19ddd8e 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -35,7 +35,7 @@ from bb.msg import BBLogFormatter as format from django.db import models import logging -from django.db import transaction +from django.db import transaction, connection logger = logging.getLogger("BitBake") @@ -609,7 +609,9 @@ class BuildInfoHelper(object): self.task_order = 0 self.autocommit_step = 1 self.server = server - transaction.set_autocommit(False) + # we use manual transactions if the database doesn't autocommit on us + if not connection.features.autocommits_when_autocommit_is_off: + transaction.set_autocommit(False) self.orm_wrapper = ORMWrapper() self.has_build_history = has_build_history self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0] @@ -929,11 +931,12 @@ class BuildInfoHelper(object): task_information['outcome'] = Task.OUTCOME_FAILED del self.internal_state['taskdata'][identifier] - # we force a sync point here, to get the progress bar to show - if self.autocommit_step % 3 == 0: - transaction.set_autocommit(True) - transaction.set_autocommit(False) - self.autocommit_step += 1 + if not connection.features.autocommits_when_autocommit_is_off: + # we force a sync point here, to get the progress bar to show + if self.autocommit_step % 3 == 0: + transaction.set_autocommit(True) + transaction.set_autocommit(False) + self.autocommit_step += 1 self.orm_wrapper.get_update_task_object(task_information, True) # must exist @@ -1207,4 +1210,5 @@ class BuildInfoHelper(object): for event in self.internal_state['backlog']: logger.error("UNSAVED log: %s", event.msg) - transaction.set_autocommit(True) + if not connection.features.autocommits_when_autocommit_is_off: + transaction.set_autocommit(True) |