summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>2023-11-23 10:12:15 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-23 15:25:01 +0000
commit6a87f5d53b52422f4a1e12f945495ed9951f7676 (patch)
tree7bbaddb69305fd06ea651065b2183d3dcba5deb4 /bitbake
parent6a9db991e70a89c6cf4d6bd9bb388f33959560ad (diff)
downloadpoky-6a87f5d53b52422f4a1e12f945495ed9951f7676.tar.gz
bitbake: toaster: make django temp directory configurable
Modify the django settings to make cache, logs and databases save to a configurable directory with TOASTER_DJANGO_TMPDIR instead of the machine root level /tmp directory. In addition, add this variable to the passthroughs for tox. This change is made to facilitate cleaning test files for runs on the autobuilder and avoid errors involving the persisted database. (Bitbake rev: 887aaa91fd54ef24fc3cce42d584b381e37d3343) Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py7
-rw-r--r--bitbake/lib/toaster/toastermain/settings_test.py4
-rw-r--r--bitbake/lib/toaster/tox.ini1
3 files changed, 7 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index 69aa5a10c0..3c12359366 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -148,6 +148,8 @@ STATICFILES_FINDERS = (
148# Make this unique, and don't share it with anybody. 148# Make this unique, and don't share it with anybody.
149SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT' 149SECRET_KEY = 'NOT_SUITABLE_FOR_HOSTED_DEPLOYMENT'
150 150
151TMPDIR = os.environ.get('TOASTER_DJANGO_TMPDIR', '/tmp')
152
151class InvalidString(str): 153class InvalidString(str):
152 def __mod__(self, other): 154 def __mod__(self, other):
153 from django.template.base import TemplateSyntaxError 155 from django.template.base import TemplateSyntaxError
@@ -214,7 +216,7 @@ CACHES = {
214 # }, 216 # },
215 'default': { 217 'default': {
216 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 218 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
217 'LOCATION': '/tmp/toaster_cache_%d' % os.getuid(), 219 'LOCATION': '%s/toaster_cache_%d' % (TMPDIR, os.getuid()),
218 'TIMEOUT': 1, 220 'TIMEOUT': 1,
219 } 221 }
220 } 222 }
@@ -312,7 +314,7 @@ for t in os.walk(os.path.dirname(currentdir)):
312LOGGING = LOGGING_SETTINGS 314LOGGING = LOGGING_SETTINGS
313 315
314# Build paths inside the project like this: BASE_DIR / 'subdir'. 316# Build paths inside the project like this: BASE_DIR / 'subdir'.
315BUILDDIR = os.environ.get("BUILDDIR", "/tmp") 317BUILDDIR = os.environ.get("BUILDDIR", TMPDIR)
316 318
317# LOG VIEWER 319# LOG VIEWER
318# https://pypi.org/project/django-log-viewer/ 320# https://pypi.org/project/django-log-viewer/
@@ -325,7 +327,6 @@ LOG_VIEWER_PATTERNS = ['INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL']
325# Optionally you can set the next variables in order to customize the admin: 327# Optionally you can set the next variables in order to customize the admin:
326LOG_VIEWER_FILE_LIST_TITLE = "Logs list" 328LOG_VIEWER_FILE_LIST_TITLE = "Logs list"
327 329
328
329if DEBUG and SQL_DEBUG: 330if DEBUG and SQL_DEBUG:
330 LOGGING['loggers']['django.db.backends'] = { 331 LOGGING['loggers']['django.db.backends'] = {
331 'level': 'DEBUG', 332 'level': 'DEBUG',
diff --git a/bitbake/lib/toaster/toastermain/settings_test.py b/bitbake/lib/toaster/toastermain/settings_test.py
index 6538d9e453..74def2d240 100644
--- a/bitbake/lib/toaster/toastermain/settings_test.py
+++ b/bitbake/lib/toaster/toastermain/settings_test.py
@@ -19,10 +19,10 @@ TEMPLATE_DEBUG = DEBUG
19DATABASES = { 19DATABASES = {
20 'default': { 20 'default': {
21 'ENGINE': 'django.db.backends.sqlite3', 21 'ENGINE': 'django.db.backends.sqlite3',
22 'NAME': '/tmp/toaster-test-db.sqlite', 22 'NAME': '%s/toaster-test-db.sqlite' % TMPDIR,
23 'TEST': { 23 'TEST': {
24 'ENGINE': 'django.db.backends.sqlite3', 24 'ENGINE': 'django.db.backends.sqlite3',
25 'NAME': '/tmp/toaster-test-db.sqlite', 25 'NAME': '%s/toaster-test-db.sqlite' % TMPDIR,
26 } 26 }
27 } 27 }
28} 28}
diff --git a/bitbake/lib/toaster/tox.ini b/bitbake/lib/toaster/tox.ini
index 9928657106..1516a527ae 100644
--- a/bitbake/lib/toaster/tox.ini
+++ b/bitbake/lib/toaster/tox.ini
@@ -8,6 +8,7 @@ passenv = *
8passenv = 8passenv =
9 SSTATE_DIR 9 SSTATE_DIR
10 DL_DIR 10 DL_DIR
11 TOASTER_DJANGO_TMPDIR
11setenv = 12setenv =
12 DJANGO_SETTINGS_MODULE=toastermain.settings_test 13 DJANGO_SETTINGS_MODULE=toastermain.settings_test
13 TOASTER_BUILDSERVER=1 14 TOASTER_BUILDSERVER=1