Bug 2193157 - "dnf builddep" fails to detect the architecture in use
Summary: "dnf builddep" fails to detect the architecture in use
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf-plugins-core
Version: 8.7
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Marek Blaha
QA Contact: swm-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-05-04 13:52 UTC by Renaud Métrich
Modified: 2023-08-16 08:07 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-156419 0 None None None 2023-05-04 13:55:37 UTC

Description Renaud Métrich 2023-05-04 13:52:40 UTC
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.

Comment 1 Panu Matilainen 2023-05-05 05:51:45 UTC
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.

Comment 2 Jaroslav Mracek 2023-05-11 12:10:24 UTC
The bug is a duplicate of https://bugzilla.redhat.com/show_bug.cgi?id=2087703


Note You need to log in before you can comment on or make changes to this bug.