Skip to contentSkip to conversation

libvirt: Fix missing libvirt-python

PATCH Superseded Tom Hochstein (OSS) 2 participants 4 messages Nov 5, 2025 – Nov 6, 2025

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvirt: Fix missing libvirt-python

From: Tom Hochstein <[email protected]>

The do_rootfs task for an image that includes libvirt-python fails.

```
  - nothing provides libvirt-python needed by packagegroup-fsl-virtualization-1.0-r0.ls1012afrwy from oe-repo
```

The log shows that the do_compile:append() from libvirt-python.inc is failing but not reporting the failure.

```
174: cd: can't cd to /.../libvirt/v11.8.0+git/sources/libvirt-v11.8.0+git/libvirt-python-11.8.0
```

The root cause is the archive folder format is changed from libvirt-python-VERSION to libvirt_python-VERSION, but the do_compile and do_install tasks are hard-coded to the old format.

Fix the root cause by encoding the archive folder name in a common variable. Also, fix the build and install commands so the cd failure is not ignored.

Fixes 389df3b77e
---
 recipes-extended/libvirt/libvirt-python.inc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
recipes-extended/libvirt/libvirt-python.inc +7 -7
index c430ffe5..0a99296a 100644
@@ -18,8 +18,8 @@ FILES:${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
 # Currently the libvirt-python debug libraries contain buildpaths
 INSANE_SKIP:${PN}-dbg += "buildpaths"
 
-SRC_URI += "http://libvirt.org/sources/python/${BPN}_python-${LIBVIRT_VERSION}.tar.gz;name=libvirt_python;subdir=${BP}"
-
+SRC_URI += "http://libvirt.org/sources/python/${LIBVIRT_PYTHON_ARCHIVE_NAME}.tar.gz;name=libvirt_python;subdir=${BP}"
+LIBVIRT_PYTHON_ARCHIVE_NAME = "${BPN}_python-${LIBVIRT_VERSION}"
 SRC_URI[libvirt_python.sha256sum] = "5d80e13e0cfb96dd254d765ee60e77e5f9b6925172540056cec0aa0e6f0ca83c"
 
 export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml"
@@ -46,8 +46,8 @@ do_compile:append() {
 		# the syroot staged pkgconfig entries. So we clear the sysroot
 		# for just this portion.
 		export PKG_CONFIG_SYSROOT_DIR=
-		cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-		  ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
+		cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+		${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
 		cd -
 	fi
 }
@@ -58,9 +58,9 @@ do_install:append() {
 		# the syroot staged pkgconfig entries. So we clear the sysroot
 		# for just this portion.
 		export PKG_CONFIG_SYSROOT_DIR=
-		cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-		  ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py install \
-                       --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS}
+		cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+		${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py install \
+			--install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS}
 		cd -
 	fi
 }
Signature · 1 line
2.34.1
#1 lore raw

In message: [meta-virtualization][PATCH] libvirt: Fix missing libvirt-python

Quoted 9 lines · on 05/11/2025 Tom Hochstein via lists.yoctoproject.org wrote:

From: Tom Hochstein <[email protected]>

The do_rootfs task for an image that includes libvirt-python fails.

```
  - nothing provides libvirt-python needed by packagegroup-fsl-virtualization-1.0-r0.ls1012afrwy from oe-repo
```

The log shows that the do_compile:append() from libvirt-python.inc is failing but not reporting the failure.

Quoted 7 lines
```
174: cd: can't cd to /.../libvirt/v11.8.0+git/sources/libvirt-v11.8.0+git/libvirt-python-11.8.0
```

The root cause is the archive folder format is changed from libvirt-python-VERSION to libvirt_python-VERSION, but the do_compile and do_install tasks are hard-coded to the old format.

Indeed. I did change it for the main package but missed it here.

Quoted 6 lines

Fix the root cause by encoding the archive folder name in a common variable. Also, fix the build and install commands so the cd failure is not ignored.

Fixes 389df3b77e

Drop this fixes line. It doesn't fix that commit, it completes that update for the python part of libvirt.

Quoted 21 lines
---
 recipes-extended/libvirt/libvirt-python.inc | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
recipes-extended/libvirt/libvirt-python.inc +2 -2
index c430ffe5..0a99296a 100644
@@ -18,8 +18,8 @@ FILES:${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
 # Currently the libvirt-python debug libraries contain buildpaths
 INSANE_SKIP:${PN}-dbg += "buildpaths"
 
-SRC_URI += "http://libvirt.org/sources/python/${BPN}_python-${LIBVIRT_VERSION}.tar.gz;name=libvirt_python;subdir=${BP}"
-
+SRC_URI += "http://libvirt.org/sources/python/${LIBVIRT_PYTHON_ARCHIVE_NAME}.tar.gz;name=libvirt_python;subdir=${BP}"
+LIBVIRT_PYTHON_ARCHIVE_NAME = "${BPN}_python-${LIBVIRT_VERSION}"
 SRC_URI[libvirt_python.sha256sum] = "5d80e13e0cfb96dd254d765ee60e77e5f9b6925172540056cec0aa0e6f0ca83c"
 
 export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml"

recipes-extended/libvirt/libvirt-python.inc do_compile:append() { · line 50

Quoted 7 lines
recipes-extended/libvirt/libvirt-python.inc +2 -2
@@ -46,8 +46,8 @@ do_compile:append() {
 		# the syroot staged pkgconfig entries. So we clear the sysroot
 		# for just this portion.
 		export PKG_CONFIG_SYSROOT_DIR=
-		cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-		  ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
+		cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+		${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build

If the cd in it's own command fails, so should have the one in the &&

If one is failing and the other isn't when the directory doesn't exist, something strange is up with set -e in the routines, or am I not seeing something that change more than the new variable and the removal of the && ?

Bruce

Quoted 29 lines
recipes-extended/libvirt/libvirt-python.inc +3 -3
 		cd -
 	fi
 }
@@ -58,9 +58,9 @@ do_install:append() {
 		# the syroot staged pkgconfig entries. So we clear the sysroot
 		# for just this portion.
 		export PKG_CONFIG_SYSROOT_DIR=
-		cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-		  ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py install \
-                       --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS}
+		cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+		${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py install \
+			--install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS}
 		cd -
 	fi
 }
Signature · 11 lines
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9426): https://lists.yoctoproject.org/g/meta-virtualization/message/9426
Mute This Topic: https://lists.yoctoproject.org/mt/116141416/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
#2 lore raw
Quoted 14 lines · Bruce Ashfield

In message: [meta-virtualization][PATCH] libvirt: Fix missing libvirt-python

recipes-extended/libvirt/libvirt-python.inc do_compile:append() { · line 50

Quoted 8 lines · on 05/11/2025 Tom Hochstein via lists.yoctoproject.org wrote:
recipes-extended/libvirt/libvirt-python.inc +2 -2
@@ -46,8 +46,8 @@ do_compile:append() {
               # the syroot staged pkgconfig entries. So we clear the sysroot
               # for just this portion.
               export PKG_CONFIG_SYSROOT_DIR=
-             cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-               ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
+             cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+             ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build

If the cd in it's own command fails, so should have the one in the &&

Quoted 6 lines

If one is failing and the other isn't when the directory doesn't exist, something strange is up with set -e in the routines, or am I not seeing something that change more than the new variable and the removal of the && ?

Bruce

The cd with the && does fail, and it prevents the command on the right-hand-side. The problem is the && causes the same behavior as when using if, which is to assume that the logic is aware of the failure possibility and does not need the engine to perform the automatic exit-on-error. The script continues to the end, finds no other failure, and returns good status.

Tom

Quoted 8 lines
Quoted 8 lines
(quoted diff) +0 -1
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#9426):https://lists.yoctoproject.org/g/meta-virtualization/message/9426 Mute This Topic:https://lists.yoctoproject.org/mt/116141416/1050810
Group Owner:[email protected] Unsubscribe:https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 24 lines · Tom Hochstein

On 11/5/2025 10:36 PM, Bruce Ashfield wrote:

In message: [meta-virtualization][PATCH] libvirt: Fix missing libvirt-python on 05/11/2025 Tom Hochstein via lists.yoctoproject.org wrote:

recipes-extended/libvirt/libvirt-python.inc +2 -2
@@ -46,8 +46,8 @@ do_compile:append() {
              # the syroot staged pkgconfig entries. So we clear the sysroot
              # for just this portion.
              export PKG_CONFIG_SYSROOT_DIR=
-             cd ${UNPACKDIR}/${BP}/${BPN}-python-${LIBVIRT_VERSION} && \
-               ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
+             cd ${UNPACKDIR}/${BP}/${LIBVIRT_PYTHON_ARCHIVE_NAME}
+             ${STAGING_BINDIR_NATIVE}/python3-native/python3 setup.py build
 

If the cd in it's own command fails, so should have the one in the &&

If one is failing and the other isn't when the directory doesn't exist, something strange is up with set -e in the routines, or am I not seeing something that change more than the new variable and the removal of the && ?

Quoted 9 lines

Bruce

The cd with the && does fail, and it prevents the command on the right-hand-side. The problem is the && causes the same behavior as when using if, which is to assume that the logic is aware of the failure possibility and does not need the engine to perform the automatic exit-on-error. The script continues to the end, finds no other failure, and returns good status.

I wasn't clear, I'm quite aware of what && does in shell scripting. I just misunderstood the change in intent of the check in my rush late last night. We actually had intended for that to continue, or it wouldn't have been written with the &&

I tend to prefer proper tests and informative error messages versus the exit, since even when that fails on the cd command, someone seeing the error message will have very little idea what caused it. I'll comment on the new patch so my suggestion will be on that version.

Bruce

Quoted 12 lines

Tom

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9426): https://lists.yoctoproject.org/g/meta-virtualization/message/9426
Mute This Topic: https://lists.yoctoproject.org/mt/116141416/1050810
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II