[elbe-devel] [PATCH 4/4] elbeproject: add targetsdk packages to target sysroot

martinsteih at gmx.de martinsteih at gmx.de
Wed Feb 19 15:38:25 CET 2025


From: Martin Steih <martin.steih at lachmann-rink.de>

Signed-off-by: Martin Steih <martin.steih at lachmann-rink.de>
---
 elbepack/elbeproject.py | 45 +++++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 11 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index c3c9b214..2204bac9 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -236,7 +236,7 @@ class ElbeProject:

         return paths

-    def build_sysroot(self):
+    def build_sysroot(self, target_pkgs):

         do(['rm', '-rf', self.sysrootpath])
         do(['mkdir', self.sysrootpath])
@@ -269,6 +269,18 @@ class ElbeProject:
                 cache.update()
             except Exception as e:
                 raise AptCacheUpdateError(e)
+
+            self._pkglist_mark_install(cache, target_pkgs)
+
+            for p in target_pkgs:
+                try:
+                    cache.mark_install(p, None)
+                except KeyError:
+                    logging.exception('No Package %s', p)
+                except SystemError:
+                    logging.exception('Unable to correct problems in '
+                                      'package %s',
+                                      p)

             try:
                 cache.mark_install_devpkgs(set(ignore_pkgs),
@@ -338,15 +350,7 @@ class ElbeProject:
             except Exception as e:
                 raise AptCacheUpdateError(e)

-            for p in pkgs:
-                try:
-                    cache.mark_install(p, None)
-                except KeyError:
-                    logging.exception('No Package %s', p)
-                except SystemError:
-                    logging.exception('Unable to correct problems in '
-                                      'package %s',
-                                      p)
+            self._pkglist_mark_install(cache, pkgs)

             try:
                 cache.commit()
@@ -392,8 +396,16 @@ class ElbeProject:

             host_pkglist.append('gdb-multiarch')

+        # add packages, that shall only be installed in the target sysroot,
+        # but not in the target itself
+        target_pkglist = []
+        if self.xml.tgt.has('targetsdk-pkg-list'):
+            for p in self.xml.tgt.node('targetsdk-pkg-list'):
+                if p.tag == 'pkg':
+                    target_pkglist.append(p.et.text.strip())
+
         # build target sysroot including libs and headers for the target
-        self.build_sysroot()
+        self.build_sysroot(target_pkglist)
         sdktargetpath = os.path.join(self.sdkpath, 'sysroots', 'target')
         do(['mkdir', '-p', sdktargetpath])
         do(['tar', 'xJf', os.path.join(self.builddir, 'sysroot.tar.xz'), '-C', sdktargetpath],
@@ -1084,3 +1096,14 @@ class ElbeProject:
         with io.open(lic_txt_fname, 'w+',
                      encoding='utf-8', errors='replace') as f:
             env.rfs.write_licenses(f, pkg_list, lic_xml_fname)
+
+    def _pkglist_mark_install(self, cache, packages):
+        for p in packages:
+            try:
+                cache.mark_install(p, None)
+            except KeyError:
+                logging.exception('No Package %s', p)
+            except SystemError:
+                logging.exception('Unable to correct problems in '
+                                    'package %s',
+                                    p)
--
2.39.5



More information about the elbe-devel mailing list