[elbe-devel] [PATCH 04/10] elbeproject: add <hostsdk-pkg-list> to define packages for host sysroot

Torben Hohn torben.hohn at linutronix.de
Mon Apr 8 15:42:25 CEST 2019


use the extract_pkg machinery to install specific packages into the
host sysroot. This allows, for example, to install a specific qt version
into the host sysroot.

When no <hostsdk-pkg-list> is specified, it falls back to evaluating
self.xml.defs["sdkarch"] and installing 'g++-$sdkarch' and 'gdb-multiarch'

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/elbeproject.py | 38 ++++++++++++++++++++------------------
 schema/dbsfed.xsd       |  8 ++++++++
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 59fd9b04..73f917e9 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -301,10 +301,18 @@ class ElbeProject (object):
     def build_sdk(self):
         triplet = self.xml.defs["triplet"]
 
-        try:
-            crosstoolchainpkg = "g++-%s" % self.xml.defs["sdkarch"]
-        except KeyError:
-            raise UnsupportedSDKException(triplet)
+        host_pkglist = []
+        if self.xml.tgt.has('hostsdk-pkg-list'):
+            for p in self.xml.tgt.node('hostsdk-pkg-list'):
+                if p.tag == 'pkg':
+                    host_pkglist.append(p.et.text.strip())
+        else:
+            try:
+                host_pkglist.append("g++-%s" % self.xml.defs["sdkarch"])
+            except KeyError:
+                raise UnsupportedSDKException(triplet)
+
+            host_pkglist.append('gdb-multiarch')
 
         # build target sysroot including libs and headers for the target
         self.build_sysroot()
@@ -315,20 +323,14 @@ class ElbeProject (object):
         # build host sysroot including cross compiler
         hostsysrootpath = os.path.join(self.sdkpath, 'sysroots', 'host')
         self.log.do('mkdir -p "%s"' % hostsysrootpath)
-        extract_pkg(self.xml.prj,
-                    hostsysrootpath,
-                    self.xml.defs,
-                    crosstoolchainpkg,
-                    'amd64',
-                    self.log,
-                    True)
-        extract_pkg(self.xml.prj,
-                    hostsysrootpath,
-                    self.xml.defs,
-                    'gdb-multiarch',
-                    'amd64',
-                    self.log,
-                    True)
+        for p in host_pkglist:
+            extract_pkg(self.xml.prj,
+                        hostsysrootpath,
+                        self.xml.defs,
+                        p,
+                        'amd64',
+                        self.log,
+                        True)
 
         n = gen_sdk_scripts(triplet,
                             self.name,
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index ccab23be..333c0a8b 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -873,6 +873,14 @@
           </documentation>
         </annotation>
       </element>
+      <element name="hostsdk-pkg-list" type="rfs:pkg-list" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+	    install the given packages into the hostsdk. (ignores pin and versions,
+	    with the current implementation)
+          </documentation>
+        </annotation>
+      </element>
     </all>
     <attribute ref="xml:base"/>
   </complexType>
-- 
2.11.0




More information about the elbe-devel mailing list