aboutsummaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorMilo Casagrande <milo.casagrande@linaro.org>2014-11-21 17:13:05 +0100
committerMilo Casagrande <milo.casagrande@linaro.org>2014-11-21 17:13:05 +0100
commit4bd4d35d22bac18b73d0db02be33d53eeda69fe0 (patch)
tree0e2ac0ea5aa05618e3ac3c930e074d33495e1edc /app/models
parentf603baa808908f4239e2dd85d5423d24639449f1 (diff)
Add defconfig_full field.
* Introduce new defconfig_full field for boot and defconfig model in order to store the full name of the defconfig. This is necessary since builds can still use the same defconfig name, but add config fragments. This field will store the defconfig name plus all the config fragments used. Change-Id: Ie9a592c6b97a4eb4861806cdd3597f2be9ab1334
Diffstat (limited to 'app/models')
-rw-r--r--app/models/__init__.py1
-rw-r--r--app/models/boot.py21
-rw-r--r--app/models/defconfig.py19
-rw-r--r--app/models/tests/test_boot_model.py4
-rw-r--r--app/models/tests/test_defconfig_model.py8
5 files changed, 45 insertions, 8 deletions
diff --git a/app/models/__init__.py b/app/models/__init__.py
index 2bf4bde..1c1ee16 100644
--- a/app/models/__init__.py
+++ b/app/models/__init__.py
@@ -43,6 +43,7 @@ COUNT_KEY = "count"
CREATED_KEY = 'created_on'
CROSS_COMPILE_KEY = 'cross_compile'
DATE_RANGE_KEY = 'date_range'
+DEFCONFIG_FULL_KEY = 'defconfig_full'
DEFCONFIG_ID_KEY = 'defconfig_id'
DEFCONFIG_KEY = 'defconfig'
DIRNAME_KEY = 'dirname'
diff --git a/app/models/boot.py b/app/models/boot.py
index 60eeb24..73ad1a5 100644
--- a/app/models/boot.py
+++ b/app/models/boot.py
@@ -27,7 +27,9 @@ class BootDocument(modb.BaseDocument):
Each document is a single booted board.
"""
- def __init__(self, board, job, kernel, defconfig, lab_name):
+ def __init__(
+ self, board, job, kernel, defconfig, lab_name,
+ defconfig_full=None):
"""A new BootDocument.
:param board: The name of the board.
@@ -44,9 +46,9 @@ class BootDocument(modb.BaseDocument):
self._board = board
self._name = models.BOOT_DOCUMENT_NAME % {
models.BOARD_KEY: board,
+ models.DEFCONFIG_KEY: defconfig_full or defconfig,
models.JOB_KEY: job,
models.KERNEL_KEY: kernel,
- models.DEFCONFIG_KEY: defconfig,
}
self._lab_name = lab_name
self._job = job
@@ -56,6 +58,7 @@ class BootDocument(modb.BaseDocument):
self._kernel = kernel
self._defconfig = defconfig
+ self._defconfig_full = defconfig_full
self._metadata = {}
self._job_id = None
@@ -436,6 +439,19 @@ class BootDocument(modb.BaseDocument):
"""Set the board architecture."""
self._arch = value
+ @property
+ def defconfig_full(self):
+ """The full defconfig name.
+
+ This parameter contains also the config fragments information.
+ """
+ return self._defconfig_full
+
+ @defconfig_full.setter
+ def defconfig_full(self, value):
+ """Set the full defconfig name."""
+ self._defconfig_full = value
+
def to_dict(self):
boot_dict = {
models.ARCHITECTURE_KEY: self.arch,
@@ -444,6 +460,7 @@ class BootDocument(modb.BaseDocument):
models.BOOT_LOG_KEY: self.boot_log,
models.BOOT_RESULT_DESC_KEY: self.boot_result_description,
models.CREATED_KEY: self.created_on,
+ models.DEFCONFIG_FULL_KEY: self.defconfig_full,
models.DEFCONFIG_ID_KEY: self.defconfig_id,
models.DEFCONFIG_KEY: self.defconfig,
models.DTB_ADDR_KEY: self.dtb_addr,
diff --git a/app/models/defconfig.py b/app/models/defconfig.py
index 04047d1..38573ea 100644
--- a/app/models/defconfig.py
+++ b/app/models/defconfig.py
@@ -27,12 +27,12 @@ class DefconfigDocument(modb.BaseDocument):
"""This class represents a defconfig folder as seen on the file system."""
- def __init__(self, job, kernel, defconfig):
+ def __init__(self, job, kernel, defconfig, defconfig_full=None):
doc_name = {
models.JOB_KEY: job,
models.KERNEL_KEY: kernel,
- models.DEFCONFIG_KEY: defconfig
+ models.DEFCONFIG_KEY: defconfig_full or defconfig
}
self._name = models.DEFCONFIG_DOCUMENT_NAME % doc_name
@@ -42,6 +42,7 @@ class DefconfigDocument(modb.BaseDocument):
self._job = job
self._kernel = kernel
self._defconfig = defconfig
+ self._defconfig_full = defconfig_full
self._job_id = None
self._dirname = None
self._status = None
@@ -376,6 +377,19 @@ class DefconfigDocument(modb.BaseDocument):
"""Set the config fragment used."""
self._kconfig_fragments = value
+ @property
+ def defconfig_full(self):
+ """The full defconfig name.
+
+ This parameter contains also the config fragments information.
+ """
+ return self._defconfig_full
+
+ @defconfig_full.setter
+ def defconfig_full(self, value):
+ """Set the full defconfig name."""
+ self._defconfig_full = value
+
def to_dict(self):
defconf_dict = {
models.ARCHITECTURE_KEY: self.arch,
@@ -383,6 +397,7 @@ class DefconfigDocument(modb.BaseDocument):
models.BUILD_PLATFORM_KEY: self.build_platform,
models.BUILD_TIME_KEY: self.build_time,
models.CREATED_KEY: self.created_on,
+ models.DEFCONFIG_FULL_KEY: self.defconfig_full,
models.DEFCONFIG_KEY: self.defconfig,
models.DIRNAME_KEY: self.dirname,
models.DTB_DIR_KEY: self.dtb_dir,
diff --git a/app/models/tests/test_boot_model.py b/app/models/tests/test_boot_model.py
index a50790e..3492c93 100644
--- a/app/models/tests/test_boot_model.py
+++ b/app/models/tests/test_boot_model.py
@@ -46,6 +46,7 @@ class TestBootModel(unittest.TestCase):
boot_doc.git_url = "git-url"
boot_doc.arch = "arm"
boot_doc.fastboot_cmd = "fastboot"
+ boot_doc.defconfig_full = "defconfig"
expected = {
'_id': 'id',
@@ -80,7 +81,8 @@ class TestBootModel(unittest.TestCase):
"git_describe": "git-describe",
"git_url": "git-url",
"arch": "arm",
- "fastboot_cmd": "fastboot"
+ "fastboot_cmd": "fastboot",
+ "defconfig_full": 'defconfig'
}
self.assertDictEqual(expected, boot_doc.to_dict())
diff --git a/app/models/tests/test_defconfig_model.py b/app/models/tests/test_defconfig_model.py
index 9d7a6d7..d808424 100644
--- a/app/models/tests/test_defconfig_model.py
+++ b/app/models/tests/test_defconfig_model.py
@@ -29,8 +29,9 @@ class TestDefconfModel(unittest.TestCase):
self.assertEqual(defconfig_doc.collection, 'defconfig')
def test_defconfig_document_to_dict(self):
+ self.maxDiff = None
defconf_doc = moddf.DefconfigDocument(
- 'job', 'kernel', 'defconfig'
+ 'job', 'kernel', 'defconfig', 'defconfig_full'
)
defconf_doc.id = "defconfig_id"
defconf_doc.job_id = "job_id"
@@ -59,7 +60,7 @@ class TestDefconfModel(unittest.TestCase):
defconf_doc.kconfig_fragments = "config-frag"
expected = {
- "name": "job-kernel-defconfig",
+ "name": "job-kernel-defconfig_full",
"_id": "defconfig_id",
"job": "job",
"kernel": "kernel",
@@ -88,7 +89,8 @@ class TestDefconfModel(unittest.TestCase):
"modules": "modules-file",
"modules_dir": "modules-dir",
"build_log": "build.log",
- "kconfig_fragments": "config-frag"
+ "kconfig_fragments": "config-frag",
+ "defconfig_full": "defconfig_full"
}
self.assertDictEqual(expected, defconf_doc.to_dict())