Skip to contentSkip to conversation

sdk.py: error out when moving file fails

PATCH New [email protected] 1 participant 3 messages Jun 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 sdk.py: error out when moving file fails

From: Chen Qi <[email protected]>

Instead of printing an error message and continuing, we should just error out when moving file fails.

---
 meta/lib/oe/sdk.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/sdk.py +1 -1
index 81fcf15371..3dc3672210 100644
@@ -70,7 +70,7 @@ class Sdk(object, metaclass=ABCMeta):
         #FIXME: using umbrella exc catching because bb.utils method raises it
         except Exception as e:
             bb.debug(1, "printing the stack trace\n %s" %traceback.format_exc())
-            bb.error("unable to place %s in final SDK location" % sourcefile)
+            bb.fatal("unable to place %s in final SDK location" % sourcefile)
 
     def mkdirhier(self, dirpath):
         try:
Signature · 1 line
2.40.0
#1 lore raw

PATCH 2/3 sdk.py: fix moving dnf contents

From: Chen Qi <[email protected]>

The dnf contents should be moved to <host_sysroot>/etc/dnf/xxx instead of just <host_sysroot>/etc.

---
 meta/lib/oe/package_manager/rpm/sdk.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oe/package_manager/rpm/sdk.py +2 -1
index 0726a18b91..85df6e949c 100644
@@ -112,5 +112,6 @@ class PkgSdk(Sdk):
         for f in glob.glob(os.path.join(self.sdk_output, "etc", "rpm*")):
             self.movefile(f, native_sysconf_dir)
         for f in glob.glob(os.path.join(self.sdk_output, "etc", "dnf", "*")):
-            self.movefile(f, native_sysconf_dir)
+            self.mkdirhier(native_sysconf_dir + "/dnf")
+            self.movefile(f, native_sysconf_dir + "/dnf")
         self.remove(os.path.join(self.sdk_output, "etc"), True)
Signature · 1 line
2.40.0
#2 lore raw

PATCH 3/3 rpm: write macros under libdir

In reply to [email protected]

From: Chen Qi <[email protected]>

If we create a macros file under etc/, the populate_sdk task would fail if 'package-management' is in SDKIMAGE_FEATURES and nativesdk-rpm-build is installed.. The error message is like below:

unable to place /.../sdk/image/etc/rpm in final SDK location

This is because it's trying to move the etc/rpm dictory into the host sysroot but the <host_sysroot>/etc/rpm has already exists.

To solve this problem, avoid creating /etc/rpm/macros for nativesdk-rpm-build, use ${libdir}/macros instead. In this way, the macros file is hold in nativesdk-rpm. As nativesdk-rpm-build depends on nativesdk-rpm, the 'rpmbuild' command inside SDK can still correctly find find-debuginfo binary.

---
 meta/recipes-devtools/rpm/rpm_4.18.1.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-devtools/rpm/rpm_4.18.1.bb +2 -3
index 6da2edddf3..83537d4761 100644
@@ -134,8 +134,8 @@ do_install:append:class-target() {
 do_install:append:class-nativesdk() {
     rm -rf ${D}${SDKPATHNATIVE}/var
     # Ensure find-debuginfo is located correctly inside SDK
-    mkdir -p ${D}${SDKPATHNATIVE}/etc/rpm
-    echo "%__find_debuginfo   ${SDKPATHNATIVE}/usr/bin/find-debuginfo" >> ${D}${SDKPATHNATIVE}/etc/rpm/macros
+    mkdir -p ${D}${libdir}/rpm
+    echo "%__find_debuginfo   ${SDKPATHNATIVE}/usr/bin/find-debuginfo" >> ${D}${libdir}/rpm/macros
 }
 
 do_install:append () {
@@ -173,7 +173,6 @@ FILES:${PN}-build = "\
     ${libdir}/rpm/macros.p* \
     ${libdir}/rpm/fileattrs/* \
 "
-FILES:${PN}-build:append:class-nativesdk = " ${SDKPATHNATIVE}/etc/rpm/macros"
 
 FILES:${PN}-sign = "\
     ${bindir}/rpmsign \
Signature · 1 line
2.40.0