| Summary: | Toaster broken with recent SQLite | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Toaster | Reporter: | BogDan Vatra <bogdan> | ||||||
| Component: | toaster | Assignee: | David Reyna <david.reyna> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Toaster default assignee <toaster> | ||||||
| Severity: | major | ||||||||
| Priority: | Medium+ | CC: | amber.n.elliot, jessica.zhang, stanciux.mihail, tim.orling | ||||||
| Version: | 2.6.2 | ||||||||
| Target Milestone: | 3.1 M4 | ||||||||
| Hardware: | x86 | ||||||||
| OS: | Multiple | ||||||||
| Whiteboard: | |||||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||||
| Verified: | Documentation change: | Don't know | |||||||
| Attachments: |
|
||||||||
|
Description
BogDan Vatra
2019-02-27 11:32:52 UTC
This is quite mysterious. The Toaster database is failing when loading the "poky.xml" fixture file, but there is no reference to "orm_build" in that file, let alone "orm_build__old", nor have we ever put one in since we do not preset data in the build table at startup. The notation "orm_build__old" in Django speak generally means the "old" structure within the "orm_build" class, which does not exist in the schema (there is at most a non-db transient member called old_state). The fact that the orm structure ends up empty is because the initialization process failed at the fixture process phase, so no data was ever fetched from teh Layer Index. I am wondering if the local copy of "orm/fixtures/poky.xml" was somehow corrupted. Please attached a copy of "orm/fixtures/poky.xml" so that we can see. Created attachment 4479 [details] poky/bitbake/lib/toaster/orm/fixtures/poky.xml Attached the poky/bitbake/lib/toaster/orm/fixtures/poky.xml file, I also tar.xz the entire folder here https://drive.google.com/open?id=1Z1LGe0n76nTorSreskF4ZA_8eht0ILvL .The archive will be available for a few weeks. Thanks, I got the archive. This defect is due to the fact that the latest SQLite breaks Django, which is why I could not reproduce it. * [Django] #29182: SQLite 3.26 breaks database migration ForeignKey constraint, leaving <table_name>__old in db schema A patch set is in progress. - David Note that this also requires an update to Django 2.2, since the Django community will not backport the patch to Django 1.11. https://groups.google.com/forum/#!topic/django-updates/htVqH24DImg https://github.com/django/django/pull/11986 https://github.com/django/django/commit/c8ffdbe514b55ff5c9a2b8cb8bbdf2d3978c188f https://github.com/django/django/pull/10733#issuecomment-456731434 The simple patch to Django 1.11 is included in the above links. Created attachment 4602 [details]
Workaround patch for Django 1.11
I've been hitting this recently. As a quick shortcut, I've attached a patch which you can apply to Django 1.11 in your virtualenv (adapted from the rejected backport patch linked above):
cd /path/to/virtual_env_dir/lib/python*/site-packages
patch -p1 < /path/to/django_sqlite326_fix.patch
Django 1.11 LTS is EOL April 2020. Time to move to 2.2 LTS, which is supported until April 2022. https://www.djangoproject.com/download/ commit 4dabdbe11ddc47a885c7f8cc6b3f26439d40d77c |