Skip to contentSkip to conversation

qemu: Split the qemu package

PATCH In review [email protected] 3 participants 4 messages Jun 9, 2023 – Jun 12, 2023 1 message not in the archive

lore
Share & tools
lore
#1 lore raw

PATCH v6 1/1 qemu: Split the qemu package

In reply to a message not in the archive

From: Mingli Yu <[email protected]>

Currently all files as below packaged into one package such as qemu-7.2.0-*.rpm. After the qemu package installed on the target, it will take up about 464M which includes not only the one matches the arch of the target but aslo all available built qemu targets which set by QEMU_TARGETS.

 # ls tmp-glibc/work/core2-64-wrs-linux/qemu/7.2.0-r0/image/usr/bin/
 qemu-aarch64  qemu-img          qemu-mips64el   qemu-ppc64
 qemu-sh4    qemu-system-loongarch64  qemu-system-ppc      qemu-system-x86_64
 qemu-arm      qemu-io           qemu-mipsel     qemu-ppc64le
 qemu-storage-daemon  qemu-system-mips         qemu-system-ppc64
 qemu-x86_64 qemu-edid     qemu-loongarch64  qemu-mips.real
 qemu-pr-helper  qemu-system-aarch64  qemu-system-mips64
 qemu-system-riscv32 qemu-ga       qemu-mips         qemu-nbd
 qemu-riscv32    qemu-system-arm      qemu-system-mips64el
 qemu-system-riscv64 qemu-i386     qemu-mips64       qemu-ppc
 qemu-riscv64    qemu-system-i386     qemu-system-mipsel qemu-system-sh4

Split the qemu package into qemu-7.2.0-*.rpm, qemu-system-*.rpm, qemu-user-*.rpm and etc. And let user can only choose the corresponding qemu arch package they want to install should ease the concerns who cares much about the size in embedded device as it decreases the qemu rpm (qemu-7.2.0*.rpm) size from about 65M to about 19M and the size of the extracted qemu RPM decreased from about 464M to about 248M.

For the users who want to install all arch packages, they can install qemu-system-all and qemu-user-all to meet their need.

---
 meta/recipes-devtools/qemu/qemu.inc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
meta/recipes-devtools/qemu/qemu.inc +22 -0
index a87dee5c99..6acda61425 100644
@@ -230,6 +230,28 @@ INSANE_SKIP:${PN} = "arch"
 
 FILES:${PN} += "${datadir}/icons"
 
+# For user who want to install all arch packages
+PACKAGES =+ "${PN}-system-all ${PN}-user-all"
+
+ALLOW_EMPTY:${PN}-system-all = "1"
+ALLOW_EMPTY:${PN}-user-all = "1"
+
+PACKAGESPLITFUNCS =+ "split_qemu_packages"
+
+python split_qemu_packages () {
+    archdir = d.expand('${bindir}/')
+    syspackages = do_split_packages(d, archdir, r'^qemu-system-(.*)$', '${PN}-system-%s', 'QEMU full system emulation binaries(%s)' , prepend=True)
+    if syspackages:
+        d.setVar('RDEPENDS:' + d.getVar('PN') + '-system-all', ' '.join(syspackages))
+
+    userpackages = do_split_packages(d, archdir, r'^qemu-((?!system|edid|ga|img|io|nbd|pr-helper|storage-daemon).*)$', '${PN}-user-%s', 'QEMU full user emulation binaries(%s)' , prepend=True)
+    if userpackages:
+        d.setVar('RDEPENDS:' + d.getVar('PN') + '-user-all', ' '.join(userpackages))
+    mipspackage = d.getVar('PN') + "-user-mips"
+    if mipspackage in ' '.join(userpackages):
+        d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX") + 'bash')
+}
+
 # Put the guest agent in a separate package
 PACKAGES =+ "${PN}-guest-agent"
 SUMMARY:${PN}-guest-agent = "QEMU guest agent"
Signature · 1 line
2.25.1
#2 lore raw

meta/recipes-devtools/qemu/qemu.inc INSANE_SKIP:${PN} = "arch"

Quoted 8 lines · Mingli
(quoted diff) +2 -0
+    if userpackages:
+        d.setVar('RDEPENDS:' + d.getVar('PN') + '-user-all', '

'.join(userpackages))

meta/recipes-devtools/qemu/qemu.inc +4 -0
+    mipspackage = d.getVar('PN') + "-user-mips"
+    if mipspackage in ' '.join(userpackages):
+        d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX")
+ 'bash')

This is just a style question, you don't need to update.

Is it worth making this conditional on ${PN}-user-mips existence? I would just use

RDEPENDS:${PN}-user-mips = "bash"

outside this function and I don't think you would even need to explicitly use ${MLPREFIX}. Nothing will break when ${PN}-user-mips doesn't exist (e.g. when splitting is disabled) and it's a bit easier to read than corresponding 3 lines in python.

#3 lore raw

I'm seeing following QA issue after this change:

Quoted 35 lines · Martin Jansa
Quoted 8 lines · Mingli
(quoted diff) +2 -0
+    if userpackages:
+        d.setVar('RDEPENDS:' + d.getVar('PN') + '-user-all', '

'.join(userpackages))

meta/recipes-devtools/qemu/qemu.inc +3 -0
+    mipspackage = d.getVar('PN') + "-user-mips"
+    if mipspackage in ' '.join(userpackages):
+        d.appendVar('RDEPENDS:' + mipspackage, ' ' +

d.getVar("MLPREFIX") + 'bash')

This is just a style question, you don't need to update.

Is it worth making this conditional on ${PN}-user-mips existence? I would just use

RDEPENDS:${PN}-user-mips = "bash"

outside this function and I don't think you would even need to explicitly use ${MLPREFIX}. Nothing will break when ${PN}-user-mips doesn't exist (e.g. when splitting is disabled) and it's a bit easier to read than corresponding 3 lines in python.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#182530):
https://lists.openembedded.org/g/openembedded-core/message/182530
Mute This Topic: https://lists.openembedded.org/mt/99421260/3617605
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
In reply to Martin Jansa

I'm seeing following QA issue after this change:

ERROR: nativesdk-qemu-8.0.0-r0 do_package_qa: QA Issue:
nativesdk-qemu-user-mips rdepends on nativesdk-bash, but it isn't a build dependency, missing nativesdk-bash in DEPENDS or PACKAGECONFIG? [build-deps]
ERROR: nativesdk-qemu-8.0.0-r0 do_package_qa: Fatal QA errors were found, failing task.

Quoted 35 lines · Martin Jansa
Quoted 8 lines · Mingli
(quoted diff) +2 -0
+    if userpackages:
+        d.setVar('RDEPENDS:' + d.getVar('PN') + '-user-all', '

'.join(userpackages))

meta/recipes-devtools/qemu/qemu.inc +3 -0
+    mipspackage = d.getVar('PN') + "-user-mips"
+    if mipspackage in ' '.join(userpackages):
+        d.appendVar('RDEPENDS:' + mipspackage, ' ' +

d.getVar("MLPREFIX") + 'bash')

This is just a style question, you don't need to update.

Is it worth making this conditional on ${PN}-user-mips existence? I would just use

RDEPENDS:${PN}-user-mips = "bash"

outside this function and I don't think you would even need to explicitly use ${MLPREFIX}. Nothing will break when ${PN}-user-mips doesn't exist (e.g. when splitting is disabled) and it's a bit easier to read than corresponding 3 lines in python.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#182530):
https://lists.openembedded.org/g/openembedded-core/message/182530
Mute This Topic: https://lists.openembedded.org/mt/99421260/3617605
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-