[rtems-central commit] build: Gather installed files of groups

Sebastian Huber sebh at rtems.org
Wed Jan 20 14:36:24 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    6ba755f11f80f624092618424e209f298d766562
Changeset: http://git.rtems.org/rtems-central/commit/?id=6ba755f11f80f624092618424e209f298d766562

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 20 15:29:15 2021 +0100

build: Gather installed files of groups

---

 rtemsspec/build.py                 | 16 +++++++++-------
 rtemsspec/tests/spec-build/bsp.yml |  6 ++++--
 rtemsspec/tests/spec-build/o.yml   |  2 +-
 rtemsspec/tests/spec-build/op.yml  |  4 ++++
 rtemsspec/tests/test_build.py      |  2 +-
 5 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/rtemsspec/build.py b/rtemsspec/build.py
index 5ead774..a2956be 100644
--- a/rtemsspec/build.py
+++ b/rtemsspec/build.py
@@ -32,16 +32,20 @@ BSPMap = Dict[str, Dict[str, Item]]
 ItemMap = Dict[str, Item]
 
 
-def _extend_by_install_and_source(item: Item, source_files: List[str]) -> None:
+def _extend_by_install(item: Item, source_files: List[str]) -> None:
     for install in item["install"]:
         source_files.extend(install["source"])
-    source_files.extend(item["source"])
 
 
 def _extend_by_source(item: Item, source_files: List[str]) -> None:
     source_files.extend(item["source"])
 
 
+def _extend_by_install_and_source(item: Item, source_files: List[str]) -> None:
+    _extend_by_install(item, source_files)
+    _extend_by_source(item, source_files)
+
+
 def _extend_by_nothing(_item: Item, _source_files: List[str]) -> None:
     pass
 
@@ -52,7 +56,7 @@ _EXTEND_SOURCE_FILES = {
     "config-file": _extend_by_nothing,
     "config-header": _extend_by_nothing,
     "test-program": _extend_by_source,
-    "group": _extend_by_nothing,
+    "group": _extend_by_install,
     "library": _extend_by_install_and_source,
     "objects": _extend_by_install_and_source,
     "option": _extend_by_nothing,
@@ -63,10 +67,8 @@ _EXTEND_SOURCE_FILES = {
 
 def _gather_source_files(item: Item, enabled: List[str],
                          source_files: List[str]) -> None:
-    for parent in item.parents():
-        if parent["type"] == "build" and parent["build-type"] in [
-                "group", "objects", "start-file", "test-program"
-        ] and parent.is_enabled(enabled):
+    for parent in item.parents("build-dependency"):
+        if parent.is_enabled(enabled):
             _gather_source_files(parent, enabled, source_files)
     _EXTEND_SOURCE_FILES[item["build-type"]](item, source_files)
 
diff --git a/rtemsspec/tests/spec-build/bsp.yml b/rtemsspec/tests/spec-build/bsp.yml
index 8e42c1b..6be302e 100644
--- a/rtemsspec/tests/spec-build/bsp.yml
+++ b/rtemsspec/tests/spec-build/bsp.yml
@@ -6,9 +6,11 @@ install:
 - source:
   - abc
 links:
-- role: null
+- role: build-dependency
   uid: o
-- role: null
+- role: build-dependency
+  uid: op
+- role: build-dependency
   uid: d
 source:
 - def
diff --git a/rtemsspec/tests/spec-build/o.yml b/rtemsspec/tests/spec-build/o.yml
index 3b45d87..c332868 100644
--- a/rtemsspec/tests/spec-build/o.yml
+++ b/rtemsspec/tests/spec-build/o.yml
@@ -4,7 +4,7 @@ install:
 - source:
   - jkl
 links:
-- role: null
+- role: build-dependency
   uid: s
 source:
 - mno
diff --git a/rtemsspec/tests/spec-build/op.yml b/rtemsspec/tests/spec-build/op.yml
new file mode 100644
index 0000000..49cf0df
--- /dev/null
+++ b/rtemsspec/tests/spec-build/op.yml
@@ -0,0 +1,4 @@
+build-type: option
+enabled-by: true
+links: []
+type: build
diff --git a/rtemsspec/tests/test_build.py b/rtemsspec/tests/test_build.py
index e529052..b5c3906 100644
--- a/rtemsspec/tests/test_build.py
+++ b/rtemsspec/tests/test_build.py
@@ -41,4 +41,4 @@ def test_build(tmpdir):
     build_config["sources"] = ["a", "b"]
     build_config["uids"] = ["/g"]
     files = gather_files(build_config, item_cache)
-    assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def", "th"]
+    assert files == ["a", "b", "stu", "jkl", "mno", "abc", "def", "ghi", "th"]



More information about the vc mailing list