Skip to contentSkip to conversation

testimage: get real os-release file

PATCH Superseded Peter Marko 2 participants 4 messages May 12, 2025 – May 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testimage: get real os-release file

From: Peter Marko <[email protected]>

/etc/os-release is a symlink to /usr/lib.
Symlink is retrieved as a dead link which points to nowhere if also the original file is not accompanying it.
Fetch the real file instead of this link.

Alternative could be to use "tar -h" (supported also by busybox tar), however that could lose some important information if links are relevant for failure analysis.

---
 meta/classes-recipe/testimage.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/testimage.bbclass +1 -1
index e090b1ef4b..862f3e53a3 100644
@@ -26,7 +26,7 @@ TESTIMAGE_FAILED_QA_ARTIFACTS = "\
     ${localstatedir}/log \
     ${localstatedir}/volatile/log \
     ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
+    ${nonarch_libdir}/os-release"
 
 # If some ptests are run and fail, retrieve corresponding directories
 TESTIMAGE_FAILED_QA_ARTIFACTS += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${libdir}/*/ptest', '', d)}"
#1 lore raw
Quoted 26 lines · Peter Marko via lists.openembedded.org

From: Peter Marko <[email protected]>

/etc/os-release is a symlink to /usr/lib.
Symlink is retrieved as a dead link which points to nowhere if also the original file is not accompanying it.
Fetch the real file instead of this link.

Alternative could be to use "tar -h" (supported also by busybox tar), however that could lose some important information if links are relevant for failure analysis.

---
 meta/classes-recipe/testimage.bbclass | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/testimage.bbclass +1 -1
index e090b1ef4b..862f3e53a3 100644
@@ -26,7 +26,7 @@ TESTIMAGE_FAILED_QA_ARTIFACTS = "\
      ${localstatedir}/log \
      ${localstatedir}/volatile/log \
      ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
+    ${nonarch_libdir}/os-release"
Quoted 3 lines


 # If some ptests are run and fail, retrieve corresponding directories TESTIMAGE_FAILED_QA_ARTIFACTS += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${libdir}/*/ptest', '', d)}"

The definitive location for this is ${sysconfdir} as far as I know and I'm nervous about replacing that. We could list both? For this file, resolving the symlink is the right thing to do but that might not be the case for all files listed in the variable which does make this trickier to solve...

Cheers,

RIchard

#2 lore raw
Quoted 49 lines

-----Original Message-----
From: Richard Purdie <[email protected]>
Sent: Tuesday, May 13, 2025 0:21
To: Marko, Peter (FT D EU SK BFS1) <[email protected]>; [email protected]
Subject: Re: [OE-core] [PATCH] testimage: get real os-release file

meta/classes-

Quoted 17 lines · Peter Marko via lists.openembedded.org

From: Peter Marko <[email protected]>

/etc/os-release is a symlink to /usr/lib.
Symlink is retrieved as a dead link which points to nowhere if also the original file is not accompanying it.
Fetch the real file instead of this link.

Alternative could be to use "tar -h" (supported also by busybox tar), however that could lose some important information if links are relevant for failure analysis.

---
 meta/classes-recipe/testimage.bbclass | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes- renamed from meta/classes-recipe/testimage.bbclass +0 -0

recipe/testimage.bbclass

Quoted 11 lines

index e090b1ef4b..862f3e53a3 100644

meta/classes-recipe/testimage.bbclass +1 -1
@@ -26,7 +26,7 @@ TESTIMAGE_FAILED_QA_ARTIFACTS = "\
      ${localstatedir}/log \
      ${localstatedir}/volatile/log \
      ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
+    ${nonarch_libdir}/os-release"
 
  # If some ptests are run and fail, retrieve corresponding directories
Quoted 1 line

 TESTIMAGE_FAILED_QA_ARTIFACTS +=

"${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${libdir}/*/ptest', '', d)}"

The definitive location for this is ${sysconfdir} as far as I know and I'm nervous about replacing that. We could list both? For this file, resolving the symlink is the right thing to do but that might not be the case for all files listed in the variable which does make this trickier to solve...

Quoted 3 lines

Cheers,

Richard

OK, I'm sending a v2 to fetch both files.
I have also tested that the3 code works when a requested file does not exist.
If someone changes where the link points to, this variable will need to be adapted in such layer, too.

Peter

#3 lore raw

PATCH v2 1/1 testimage: get real os-release file

In reply to Peter Marko

From: Peter Marko <[email protected]>

/etc/os-release is a symlink to /usr/lib.
Symlink is retrieved as a dead link which points to nowhere if also the original file is not accompanying it.
Fetch the real file in addition to this link.

Alternative could be to use "tar -h" (supported also by busybox tar), however that could lose some important information if links are relevant for failure analysis.

---
 meta/classes-recipe/testimage.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/classes-recipe/testimage.bbclass +3 -1
index e090b1ef4b..847a6f18a8 100644
@@ -26,7 +26,9 @@ TESTIMAGE_FAILED_QA_ARTIFACTS = "\
     ${localstatedir}/log \
     ${localstatedir}/volatile/log \
     ${sysconfdir}/version \
-    ${sysconfdir}/os-release"
+    ${sysconfdir}/os-release \
+    ${nonarch_libdir}/os-release \
+"
 
 # If some ptests are run and fail, retrieve corresponding directories
 TESTIMAGE_FAILED_QA_ARTIFACTS += "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '${libdir}/*/ptest', '', d)}"