On Wed, Nov 2, 2022 at 9:10 AM Gedare Bloom <ged...@rtems.org> wrote:
>
> On Wed, Nov 2, 2022 at 1:10 AM Christian MAUDERER
> <christian.maude...@embedded-brains.de> wrote:
> >
> > Hello Chris,
> >
> > Am 01.11.22 um 22:08 schrieb Chris Johns:
> > > On 2/11/2022 3:25 am, o...@c-mauderer.de wrote:> Is it a good idea to 
> > > make it a
> > > mandatory attribute? It makes the yaml files
> > >> bigger. It will only mean that we have to look for copy and paste bugs 
> > >> instead
> > >> of missing attributes if someone adds a new third party library.
> > >
> > > Can you avoid having to add the item to all? I am no spec build system 
> > > expert
> > > (having invested time) and seem to remember needing to hit a lot of files 
> > > when
> > > adding something ...
> > >
> > > https://git.rtems.org/rtems/commit/?id=6f2aa8ad36e3aaffc9fa2cb8c744b04da7339ee2
> > >
> > > Chris
> >
> > The documentation mentions at least some optional attributes in the
> > specification files. For example "format" in a build option item or the
> > "do-configure" in a build script item:
> >
> > https://docs.rtems.org/branches/master/eng/req/items.html#build-option-item-type
> > https://docs.rtems.org/branches/master/eng/req/items.html#build-script-item-type
> >
> > But I think the wscript has to take into account that the value might
> > not exist. I'm not sure whether it does that for the existing "optional"
> > attributes. For example my first guess would be that the "do-configure"
> > could throw a KeyError:
> >
> > https://git.rtems.org/rtems/tree/wscript#n1127
> >
> >      def do_configure(self, conf, cic):
> >          script = self.data["do-configure"]
> >          if script:
> >              exec(script)
> >
> > Usually I would have expected the following code instead:
> >
> >      def do_configure(self, conf, cic):
> >          try:
> >              script = self.data["do-configure"]
> >          except KeyError:
> >              script = None
> >          if script:
> >              exec(script)
> >
> Thanks for this recommendation and the discussion/example. Indeed, the
> plumbing right now in the wscript is not very robust to optional
> attributes. For this particular third-party attribute I will take a
> stab at making it optional.
>

This works pretty well. See attached. I'll continue with the optional
attribute route for now.

> I think the additional metadata we would like to track regarding
> third-party sources can be added incrementally or even separately. I
> would like to first solve the problem of how to separate third-party
> from project-owned sources. Once that is done, then we can discuss
> more ways to improve or use this capability.
>
> > So I can't clearly answer your question. I would have to try it. But
> > regardless whether there are currently such options or not: They
> > shouldn't be hard to implement. I just hope that this doesn't break some
> > use case. I'll try to remember to ask Sebastian about it next week.
> >
> Thanks, I will appreciate that feedback and any tricky things to watch out 
> for.
>
> > Best regards
> >
> > Christian
> > --
> > --------------------------------------------
> > embedded brains GmbH
> > Herr Christian MAUDERER
> > Dornierstr. 4
> > 82178 Puchheim
> > Germany
> > email:  christian.maude...@embedded-brains.de
> > phone:  +49-89-18 94 741 - 18
> > mobile: +49-176-152 206 08
> >
> > Registergericht: Amtsgericht München
> > Registernummer: HRB 157899
> > Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> > Unsere Datenschutzerklärung finden Sie hier:
> > https://embedded-brains.de/datenschutzerklaerung/
From b2e059a34e7e307c15f7542467400dae10f49bdd Mon Sep 17 00:00:00 2001
From: Gedare Bloom <ged...@rtems.org>
Date: Mon, 31 Oct 2022 12:52:09 -0600
Subject: [PATCH 2/3] spec/build: mark objdtc and libz as third-party

---
 spec/build/cpukit/libz.yml   | 1 +
 spec/build/cpukit/objdtc.yml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/spec/build/cpukit/libz.yml b/spec/build/cpukit/libz.yml
index 5e81384e28..90f804f44b 100644
--- a/spec/build/cpukit/libz.yml
+++ b/spec/build/cpukit/libz.yml
@@ -5,6 +5,7 @@ copyrights:
 - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
 cppflags: []
 cxxflags: []
+third-party: true
 enabled-by: true
 includes: []
 install:
diff --git a/spec/build/cpukit/objdtc.yml b/spec/build/cpukit/objdtc.yml
index 2492cbca74..43f16f2b02 100644
--- a/spec/build/cpukit/objdtc.yml
+++ b/spec/build/cpukit/objdtc.yml
@@ -5,7 +5,7 @@ copyrights:
 - Copyright (C) 2022 Gedare Bloom
 cppflags: []
 cxxflags: []
-third-party: false
+third-party: true
 enabled-by: true
 includes: []
 install:
-- 
2.34.1

From 89da3dd8d2ab55f3dba4cff214de282c0072d73b Mon Sep 17 00:00:00 2001
From: Gedare Bloom <ged...@rtems.org>
Date: Mon, 31 Oct 2022 12:52:35 -0600
Subject: [PATCH 3/3] wscript: add command to print third-party sources

---
 wscript | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/wscript b/wscript
index 4071cc9ef8..3bd88598a4 100755
--- a/wscript
+++ b/wscript
@@ -226,6 +226,17 @@ class Item(object):
                 p.build(bld, bic)
             self.do_build(bld, bic)
 
+    def third_parties(self, ctx):
+        tpl = []
+        for p in self.links():
+            x = p.third_parties(ctx)
+            if x is not None:
+                tpl.extend(x)
+        x = self.do_third_parties(ctx)
+        if x is not None:
+            tpl.extend(x)
+        return tpl
+
     def do_defaults(self, variant, family):
         return
 
@@ -241,6 +252,15 @@ class Item(object):
     def do_build(self, bld, bic):
         return
 
+    def do_third_parties(self, ctx):
+        source = None
+        try:
+            if self.data["third-party"]:
+                source = self.data["source"]
+        except KeyError:
+            pass
+        return source
+
     def substitute(self, ctx, value):
         if isinstance(value, str):
             try:
@@ -1711,3 +1731,15 @@ def bsp_list(ctx):
                 print(variant)
     if first:
         no_matches_error(ctx, white_list)
+
+def third_party_list(ctx):
+    """lists third-party sources"""
+    check_forbidden_options(
+        ctx, ["compiler", "config", "options", "tools", "top_group", "version"]
+    )
+    add_log_filter(ctx.cmd)
+    load_items_from_options(ctx)
+    top_group = get_top_group(ctx)
+    tp = items[top_group].third_parties(ctx)
+    for s in tp:
+        print(s)
-- 
2.34.1

From 4936478350baeda2339ca9381b25de49336f22d6 Mon Sep 17 00:00:00 2001
From: Gedare Bloom <ged...@rtems.org>
Date: Mon, 31 Oct 2022 12:49:25 -0600
Subject: [PATCH 1/3] spec/build: split dtc sources from librtemscpu

---
 spec/build/cpukit/librtemscpu.yml | 13 ++-----------
 spec/build/cpukit/objdtc.yml      | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 11 deletions(-)
 create mode 100644 spec/build/cpukit/objdtc.yml

diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml
index 0b0dc95912..14f4d101a0 100644
--- a/spec/build/cpukit/librtemscpu.yml
+++ b/spec/build/cpukit/librtemscpu.yml
@@ -14,9 +14,6 @@ install:
   - cpukit/include/crypt.h
   - cpukit/include/dlfcn.h
   - cpukit/include/endian.h
-  - cpukit/include/fdt.h
-  - cpukit/include/libfdt.h
-  - cpukit/include/libfdt_env.h
   - cpukit/include/link.h
   - cpukit/include/link_elf.h
   - cpukit/include/md4.h
@@ -507,6 +504,8 @@ links:
   uid: objdl
 - role: build-dependency
   uid: objdrvmgr
+- role: build-dependency
+  uid: objdtc
 - role: build-dependency
   uid: objexceptionmapping
 - role: build-dependency
@@ -541,14 +540,6 @@ source:
 - cpukit/dev/serial/sc16is752.c
 - cpukit/dev/spi/spi-bus.c
 - cpukit/dev/can/can.c
-- cpukit/dtc/libfdt/fdt.c
-- cpukit/dtc/libfdt/fdt_addresses.c
-- cpukit/dtc/libfdt/fdt_empty_tree.c
-- cpukit/dtc/libfdt/fdt_ro.c
-- cpukit/dtc/libfdt/fdt_rw.c
-- cpukit/dtc/libfdt/fdt_strerror.c
-- cpukit/dtc/libfdt/fdt_sw.c
-- cpukit/dtc/libfdt/fdt_wip.c
 - cpukit/libblock/src/bdbuf.c
 - cpukit/libblock/src/bdpart-create.c
 - cpukit/libblock/src/bdpart-dump.c
diff --git a/spec/build/cpukit/objdtc.yml b/spec/build/cpukit/objdtc.yml
new file mode 100644
index 0000000000..2492cbca74
--- /dev/null
+++ b/spec/build/cpukit/objdtc.yml
@@ -0,0 +1,27 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: objects
+cflags: []
+copyrights:
+- Copyright (C) 2022 Gedare Bloom
+cppflags: []
+cxxflags: []
+third-party: false
+enabled-by: true
+includes: []
+install:
+- destination: ${BSP_INCLUDEDIR}
+  source:
+  - cpukit/include/fdt.h
+  - cpukit/include/libfdt.h
+  - cpukit/include/libfdt_env.h
+links: []
+source:
+- cpukit/dtc/libfdt/fdt.c
+- cpukit/dtc/libfdt/fdt_addresses.c
+- cpukit/dtc/libfdt/fdt_empty_tree.c
+- cpukit/dtc/libfdt/fdt_ro.c
+- cpukit/dtc/libfdt/fdt_rw.c
+- cpukit/dtc/libfdt/fdt_strerror.c
+- cpukit/dtc/libfdt/fdt_sw.c
+- cpukit/dtc/libfdt/fdt_wip.c
+type: build
-- 
2.34.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to