Bug 1724668 - dnf builddep fails trying to parse specfile
Summary: dnf builddep fails trying to parse specfile
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf-plugins-core
Version: 8.0
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: 8.0
Assignee: Marek Blaha
QA Contact: Karel Srot
URL:
Whiteboard:
: 1658292 (view as bug list)
Depends On: 1681085
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-27 13:41 UTC by Mikhail Campos
Modified: 2019-11-05 22:22 UTC (History)
4 users (show)

Fixed In Version: dnf-plugins-core-4.0.8-2.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:22:10 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:3583 None None None 2019-11-05 22:22:23 UTC

Description Mikhail Campos 2019-06-27 13:41:38 UTC
Description of problem:
Sometimes dnf builddep fails because can't parse specfile providing no clue of what happened wrong

Version-Release number of selected component (if applicable):
dnf-plugins-core-4.0.2.2-3.el8.noarch

How reproducible:
Sometimes for some spec files

Steps to Reproduce:
1. rpm2cpio systemd-239-13.el8_0.5.src.rpm | cpio -civ '*.spec'
2. dnf builddep systemd.spec

Actual results:

Failed to open: 'systemd.spec', not a valid spec file: can't parse specfile

Error: Some packages could not be found

Expected results:
Build deps are installed or at least descriptive msg is provided of what is going on

Additional info:
- posting here not in systemd bug because systemd builds OK with this spec
  so, how it can be build with 'truly wrong spec' ?
- rpmlint shows same error: 'not a valid spec'
- it seems, that fc28 has the same bug (tested on systemd-238-12.git07f8cd5.fc28.src.rpm + dnf-plugins-core-2.1.5-4.fc28)
- dnf builddep for same src.rpm works OK:
   # dnf builddep systemd-239-13.el8_0.5.src.rpm 
   # -> builddeps are installed

Comment 1 Marek Blaha 2019-07-01 13:16:27 UTC
I'm afraid all we can do here is to present error message from rpm in builddep command output. There is actually a pull request on this (https://github.com/rpm-software-management/dnf-plugins-core/pull/320).
To find out build requirements from a .spec file we use rpm to parse it and in this case rpm fails (and so does rpmlint). However, by using rpmspec tool, you can see more details:

# rpmspec -q systemd.spec 
error: Unable to open /root/rpmbuild/SOURCES/triggers.systemd: No such file or directory
error: query of specfile systemd.spec failed, can't parse

So basically rpm is not able to read source file mentioned in the spec file. You need to install this sourcerpm first to get list of requirements:

# rpm -i systemd-239-13.el8_0.5.src.rpm
# dnf builddep rpmbuild/SPECS/systemd.spec 
Updating Subscription Management repositories.
Last metadata expiration check: 0:23:08 ago on Mon Jul  1 08:42:11 2019.
Package firewalld-filesystem-0.6.3-7.el8.noarch is already installed.
Package gawk-4.2.1-1.el8.x86_64 is already installed.
Package gettext-0.19.8.1-14.el8.x86_64 is already installed.
No matching package to install: 'gnu-efi'
No matching package to install: 'gnu-efi-devel'
No matching package to install: 'gobject-introspection-devel'
No matching package to install: 'gperf'
No matching package to install: 'kmod-devel'
No matching package to install: 'libidn2-devel'
No matching package to install: 'libmicrohttpd-devel'
No matching package to install: 'libmount-devel'
No matching package to install: 'libseccomp-devel'
Package libxslt-1.1.32-3.el8.x86_64 is already installed.
No matching package to install: 'meson >= 0.43'
Package pkgconf-pkg-config-1.4.2-1.el8.x86_64 is already installed.
Package python3-lxml-4.2.3-1.el8.x86_64 is already installed.
Package xz-5.2.4-3.el8.x86_64 is already installed.
Not all dependencies satisfied
Error: Some packages could not be found.

I do not have all needed repositories set on my RHEL8 virtual machine but as you see, now spec file is successfully parsed and dnf is trying to install missing dependencies.

With patch https://github.com/rpm-software-management/dnf-plugins-core/pull/320 applied you will get more helpful output:

# dnf builddep systemd.spec
Last metadata expiration check: 0:23:51 ago on Po 1. července 2019, 14:50:19 CEST.
error: Unable to open /root/rpmbuild/SOURCES/triggers.systemd: No such file or directory
Failed to open: 'systemd.spec', not a valid spec file: can't parse specfile

Error: Some packages could not be found.

Comment 7 Marek Blaha 2019-07-17 07:10:56 UTC
*** Bug 1658292 has been marked as a duplicate of this bug. ***

Comment 12 errata-xmlrpc 2019-11-05 22:22:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3583


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