Re: [PATCH] package_rpm: allow arch overriding

Sergey Zhmylev

Exactly! Even more: when I build for "genericx86_64", I get mix of
packages with architecture one of: "x86_64", "genericx86_64",
"core2_64", and "noarch". Our audit team highlited this as this is not
compliant with common RPM naming convention.

In that case override architecture string only for packaging would be,
from my perspective, the best workaround.

At the same time I doubt we have to change other package backends as
they're less strict while architecture overriding effectively looses
(probably) important information.

With best wishes,
Sergei Zhmylev
Engineering consultant
OS development department

On Thu, 2023-01-12 at 22:32 +0000, Richard Purdie wrote:
«Внимание! Данное письмо от внешнего адресата!»

On Fri, 2023-01-13 at 00:33 +0300, Sergey Zhmylev wrote:
From: Sergei Zhmylev <s.zhmylev@...>

Currently arch is being calculated from either MACHINE_ARCH or
TUNE_PKGARCH.  Some recipes do override PACKAGE_ARCH intentionally.
This commit makes possible to override ARCH for RPM packages
separately in order to simplify common rpm naming conformance.

Signed-off-by: Sergei Zhmylev <s.zhmylev@...>
 meta/classes-global/package_rpm.bbclass | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes-global/package_rpm.bbclass
index 85d0bd7fce..3fb7466778 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -678,6 +678,10 @@ python do_package_rpm () {
     os.chmod(pkgwritedir, 0o755)

+    rpm_arch_override = d.getVar("RPM_ARCH_OVERRIDE")
+    if package_arch != "noarch" and rpm_arch_override:
+        pkgarch = rpm_arch_override
     cmd = rpmbuild
     cmd = cmd + " --noclean --nodeps --short-circuit --target " +
pkgarch + " --buildroot " + pkgd
     cmd = cmd + " --define '_topdir " + workdir + "' --define
'_rpmdir " + pkgwritedir + "'"
This makes me very nervous. PACKAGE_ARCH can be overridden and I know
of BSPs which inject a whole new level of architecture into the
but they don't need to make rpm backend specific changes to make it

If we were to add such a thing we'd need a much clearer picture of
it should be used and why it is needed. Wouldn't all package backends
need to adjust this?



Join to automatically receive all group messages.