Description of problem: Trying to use `dnf builddep` on the kernel package on a x86_64 system, the tool complains about a missing package: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # dnf builddep kernel-4.18.0-425.10.1.el8_7.src.rpm [...] No matching package to install: 'opencsd-devel >= 1.0.0-2' [...] -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- This package is used on aarch64 only, from the spec file: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- %ifarch aarch64 BuildRequires: opencsd-devel >= 1.0.0-2 %endif -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- I then tried using global option `--forcearch=x86_64` but this doesn't help either. Would it be possible to force using a specific arch and/or default to system's arch? Version-Release number of selected component (if applicable): dnf-4.7.0-11.el8.noarch How reproducible: Always, see above.
builddep on an src.rpm uses the exact recorded dependencies in the src.rpm header, which are specific to the platform and environment the src.rpm was built on. That's a feature on which our buildsystems rely on, but in the buildsystem the src.rpm is always specific to that architecture. Where this all goes missing is when an src.rpm of a random arch is thrown into the repo, and then used in the same manner for other platforms. Using src.rpm recorded data is only valid for the platform and the distro it was created on, everything else needs to parse the spec to get something meaningful. For that, unpack the src.rpm and run 'dnf builddep kernel.spec' instead. What the builddep plugin could and should do is check whether the architecture matches and complain when it doesn't. And have an option to automatically pull the spec from an src.rpm and parse for dependencies.
The bug is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=2087703