[rtems-central commit] items: Add ItemMapper.copyrights_by_license

Sebastian Huber sebh at rtems.org
Tue Nov 21 13:35:40 UTC 2023


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Nov 21 11:13:15 2023 +0100

items: Add ItemMapper.copyrights_by_license

Register the copyrights by license in the ItemMapper.  This allows
getting an aggregated copyright information from the item mapper.

---

 rtemsspec/items.py                         | 3 +++
 rtemsspec/tests/spec-interface/other.yml   | 3 +++
 rtemsspec/tests/spec-interface/term.yml    | 3 +++
 rtemsspec/tests/spec-item-cache/d/c.yml    | 3 +++
 rtemsspec/tests/spec-item-cache/p.yml      | 3 +++
 rtemsspec/tests/spec-item-cache/proxy.yml  | 3 +++
 rtemsspec/tests/spec-item-cache/proxy2.yml | 3 +++
 rtemsspec/tests/spec-item-cache/q.yml      | 3 +++
 rtemsspec/tests/spec-item-cache/r.yml      | 3 +++
 rtemsspec/tests/spec-item-cache/s.yml      | 3 +++
 rtemsspec/tests/spec-sphinx/x.yml          | 3 +++
 rtemsspec/tests/spec-sphinx/y.yml          | 3 +++
 rtemsspec/tests/spec-sphinx/z.yml          | 3 +++
 13 files changed, 39 insertions(+)

diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 30af77f3..49e08415 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -539,6 +539,7 @@ class ItemMapper:
         self._recursive = recursive
         self._prefix = [""]
         self._get_value_map: Dict[str, ItemGetValueMap] = {}
+        self.copyrights_by_license: Dict[str, Set[str]] = {}
 
     @property
     def item(self) -> Item:
@@ -621,6 +622,8 @@ class ItemMapper:
                 parts[0], (_get_value, {}))
             value = get_value(ctx)
             path = os.path.join(path, key)
+        self.copyrights_by_license.setdefault(item["SPDX-License-Identifier"],
+                                              set()).update(item["copyrights"])
         return value
 
     def map(self,
diff --git a/rtemsspec/tests/spec-interface/other.yml b/rtemsspec/tests/spec-interface/other.yml
index 02b17731..24ed7c3c 100644
--- a/rtemsspec/tests/spec-interface/other.yml
+++ b/rtemsspec/tests/spec-interface/other.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH & Co. KG
 comment: Some comment.
 enabled-by: true
 links:
diff --git a/rtemsspec/tests/spec-interface/term.yml b/rtemsspec/tests/spec-interface/term.yml
index c5b57911..2379ecd5 100644
--- a/rtemsspec/tests/spec-interface/term.yml
+++ b/rtemsspec/tests/spec-interface/term.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 term: x
 glossary-type: term
diff --git a/rtemsspec/tests/spec-item-cache/d/c.yml b/rtemsspec/tests/spec-item-cache/d/c.yml
index 786b66cd..3d4addd2 100644
--- a/rtemsspec/tests/spec-item-cache/d/c.yml
+++ b/rtemsspec/tests/spec-item-cache/d/c.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 a:
   b: e
   f:
diff --git a/rtemsspec/tests/spec-item-cache/p.yml b/rtemsspec/tests/spec-item-cache/p.yml
index ca1545e7..95a3d8cd 100644
--- a/rtemsspec/tests/spec-item-cache/p.yml
+++ b/rtemsspec/tests/spec-item-cache/p.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 enabled-by:
   not: foobar
 links:
diff --git a/rtemsspec/tests/spec-item-cache/proxy.yml b/rtemsspec/tests/spec-item-cache/proxy.yml
index 5c068b28..27c48bfb 100644
--- a/rtemsspec/tests/spec-item-cache/proxy.yml
+++ b/rtemsspec/tests/spec-item-cache/proxy.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 links: []
 type: proxy
diff --git a/rtemsspec/tests/spec-item-cache/proxy2.yml b/rtemsspec/tests/spec-item-cache/proxy2.yml
index 7507739d..c7de9e5c 100644
--- a/rtemsspec/tests/spec-item-cache/proxy2.yml
+++ b/rtemsspec/tests/spec-item-cache/proxy2.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 links:
 - role: xyz
diff --git a/rtemsspec/tests/spec-item-cache/q.yml b/rtemsspec/tests/spec-item-cache/q.yml
index c33c3a6b..d8fab25c 100644
--- a/rtemsspec/tests/spec-item-cache/q.yml
+++ b/rtemsspec/tests/spec-item-cache/q.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
 enabled-by: blub
 links:
 - role: proxy-member
diff --git a/rtemsspec/tests/spec-item-cache/r.yml b/rtemsspec/tests/spec-item-cache/r.yml
index 2678ce82..2e59323e 100644
--- a/rtemsspec/tests/spec-item-cache/r.yml
+++ b/rtemsspec/tests/spec-item-cache/r.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 links: []
 type: other
diff --git a/rtemsspec/tests/spec-item-cache/s.yml b/rtemsspec/tests/spec-item-cache/s.yml
index cc19b614..ee7c4d02 100644
--- a/rtemsspec/tests/spec-item-cache/s.yml
+++ b/rtemsspec/tests/spec-item-cache/s.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2023 embedded brains GmbH & Co. KG
 enabled-by: foobar
 links:
 - role: proxy-member
diff --git a/rtemsspec/tests/spec-sphinx/x.yml b/rtemsspec/tests/spec-sphinx/x.yml
index 5ac0270a..1e0af0c1 100644
--- a/rtemsspec/tests/spec-sphinx/x.yml
+++ b/rtemsspec/tests/spec-sphinx/x.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 term: y
 glossary-type: term
diff --git a/rtemsspec/tests/spec-sphinx/y.yml b/rtemsspec/tests/spec-sphinx/y.yml
index 1cba37cd..94a351e8 100644
--- a/rtemsspec/tests/spec-sphinx/y.yml
+++ b/rtemsspec/tests/spec-sphinx/y.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 name: foobar
 links: []
diff --git a/rtemsspec/tests/spec-sphinx/z.yml b/rtemsspec/tests/spec-sphinx/z.yml
index 870f1b77..c9751dc3 100644
--- a/rtemsspec/tests/spec-sphinx/z.yml
+++ b/rtemsspec/tests/spec-sphinx/z.yml
@@ -1,3 +1,6 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020, 2023 embedded brains GmbH & Co. KG
 enabled-by: true
 term: z
 glossary-type: term



More information about the vc mailing list