Bug 1040219

Summary: yum-builddep does not install a package that rpmbuild reports as missing
Product: Red Hat Enterprise Linux 7 Reporter: Alex Williamson <alex.williamson>
Component: yum-utilsAssignee: James Antill <james.antill>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: acathrow, jdenemar, packaging-team-maint, pmatilai, riehecky, zpavlas
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-24 11:52:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Alex Williamson 2013-12-11 00:42:23 UTC
Description of problem:

[root@virtlab407 SPECS]# yum-builddep ~/libvirt-1.1.1-14.el7.src.rpm
Loaded plugins: langpacks, product-id
Getting requirements for libvirt-1.1.1-14.el7.src
 --> Already installed : autoconf-2.69-10.el7.noarch
 --> Already installed : automake-1.13.4-2.el7.noarch
 --> Already installed : gettext-devel-0.18.2.1-2.el7.x86_64
 --> Already installed : libtool-2.4.2-18.el7.x86_64
 --> Already installed : perl-podlators-2.5.1-2.el7.noarch
 --> Already installed : python-devel-2.7.5-10.el7.x86_64
 --> Already installed : systemd-207-8.el7.x86_64
 --> Already installed : libxml2-devel-2.9.1-2.el7.x86_64
 --> Already installed : xhtml1-dtds-1.0-20020801.9.noarch
 --> Already installed : libxslt-1.1.28-3.el7.x86_64
 --> Already installed : readline-devel-6.2-6.el7.x86_64
 --> Already installed : ncurses-devel-5.9-11.20130511.el7.x86_64
 --> Already installed : gettext-0.18.2.1-2.el7.x86_64
 --> Already installed : libtasn1-devel-3.3-1.el7.x86_64
 --> Already installed : gnutls-devel-3.1.16-1.el7.x86_64
 --> Already installed : libattr-devel-2.4.46-10.el7.x86_64
 --> Already installed : libblkid-devel-2.23.2-7.el7.x86_64
 --> Already installed : augeas-1.1.0-4.el7.x86_64
 --> Already installed : systemd-devel-207-8.el7.x86_64
 --> Already installed : libpciaccess-devel-0.13.1-3.el7.x86_64
 --> Already installed : yajl-devel-2.0.4-2.el7.x86_64
 --> Already installed : 14:libpcap-devel-1.5.0-1.20131108git459712e.el7.x86_64
 --> Already installed : libnl3-devel-3.2.21-1.el7.x86_64
 --> Already installed : avahi-devel-0.6.31-11.el7.x86_64
 --> Already installed : libselinux-devel-2.2.1-2.el7.x86_64
 --> Already installed : dnsmasq-2.66-10.el7.x86_64
 --> Already installed : iptables-services-1.4.19.1-1.el7.x86_64
 --> Already installed : iptables-services-1.4.19.1-1.el7.x86_64
 --> Already installed : radvd-1.9.2-3.el7.x86_64
 --> Already installed : ebtables-2.0.10-9.el7.x86_64
 --> Already installed : kmod-14-2.el7.x86_64
 --> Already installed : cyrus-sasl-devel-2.1.26-13.el7.x86_64
 --> Already installed : polkit-devel-0.112-2.el7.x86_64
 --> Already installed : util-linux-2.23.2-7.el7.x86_64
 --> Already installed : 7:lvm2-2.02.103-6.el7.x86_64
 --> Already installed : iscsi-initiator-utils-6.2.0.873-16.el7.x86_64
 --> Already installed : parted-devel-3.1-14.el7.x86_64
 --> Already installed : 7:device-mapper-devel-1.02.82-6.el7.x86_64
 --> Already installed : numactl-devel-2.0.9-1.el7.x86_64
 --> Already installed : libcap-ng-devel-0.7.3-3.el7.x86_64
 --> Already installed : fuse-devel-2.9.2-3.el7.x86_64
 --> Already installed : netcf-devel-0.2.3-4.el7.x86_64
 --> Already installed : libcurl-devel-7.29.0-12.el7.x86_64
 --> Already installed : audit-libs-devel-2.3.2-3.el7.x86_64
 --> Already installed : systemtap-sdt-devel-2.4-1.el7.x86_64
 --> Already installed : 1:nfs-utils-1.2.9-0.3.el7.x86_64
 --> Already installed : 1:dbus-devel-1.6.12-6.el7.x86_64
 --> Already installed : gawk-4.0.2-2.el7.x86_64
 --> Already installed : scrub-2.5.2-3.el7.x86_64
 --> Already installed : numad-0.5-10.20121130git.el7.x86_64
No uninstalled build requires
[root@virtlab407 SPECS]# rpmbuild -ba libvirt.spec 
error: Failed build dependencies:
	sanlock-devel >= 2.4 is needed by libvirt-1.1.1-14.el7.x86_64

Version-Release number of selected component (if applicable):
libvirt-1.1.1-14.el7

How reproducible:
100%

Steps to Reproduce:
1. see above
2.
3.

Actual results:
yum-builddep does not find all build dependencies

Expected results:
yum-builddep does find all build dependencies

Additional info:

Comment 1 Jiri Denemark 2013-12-11 08:15:53 UTC
AFAIK sanlock package is in the optional channel so you may need to update your yum repos configuration. In any case, sanlock is present in rhel-7.0:

$ brew latest-pkg rhel-7.0 sanlock
Build                                     Tag                   Built by
----------------------------------------  --------------------  ----------------
sanlock-3.0.1-2.el7                       rhel-7.0              teigland

Comment 2 Alex Williamson 2013-12-11 13:57:53 UTC
I was able to yum install it without issue and without need to add any yum repos, that's not the problem I was reporting.  The problem is yum-builddep doesn't install it, but rpmbuild requires it.  yum remove sanlock and see for yourself.

Comment 3 Jiri Denemark 2013-12-12 09:59:56 UTC
Ah, sorry about that. I misread the bug description. You are indeed right, "rpmbuild --rebuild libvirt-1.1.1-14.el7.src.rpm" complains about missing sanlock-devel while "yum-builddep libvirt-1.1.1-14.el7.src.rpm" says all build dependencies are installed. Looks like a bug in yum-builddep to me. It's reproducible with yum-utils-1.1.31-19.el7.noarch

Comment 4 Panu Matilainen 2013-12-12 12:48:42 UTC
Most likely the difference comes from rpmbuild recalculating the build-requires by extracting the spec and parsing it, but yum-builddep using the src.rpm metadata. The results can differ for numerous reasons.

1) see 'rpm -qp --requires libvirt-1.1.1-14.el7.src.rpm' output, does the src.rpm as-built require sanlock-devel?
2) 'yum-builddep libvirt.spec' instead, this actually parses the spec and gets identical results to rpmbuild

Comment 5 Jiri Denemark 2013-12-12 13:34:05 UTC
1) the rpm command does not mention sanlock at all:
    autoconf
    automake
    gettext-devel
    libtool
    /usr/bin/pod2man
    python-devel
    systemd-units
    libxml2-devel
    xhtml1-dtds
    libxslt
    readline-devel
    ncurses-devel
    gettext
    libtasn1-devel
    gnutls-devel
    libattr-devel
    libblkid-devel >= 2.17
    augeas
    systemd-devel >= 185
    libpciaccess-devel >= 0.10.9
    yajl-devel
    libpcap-devel
    libnl3-devel
    avahi-devel
    libselinux-devel
    dnsmasq >= 2.41
    iptables
    iptables-ipv6
    radvd
    ebtables
    module-init-tools
    cyrus-sasl-devel
    polkit-devel >= 0.112
    util-linux
    lvm2
    iscsi-initiator-utils
    parted-devel
    device-mapper-devel
    numactl-devel
    libcap-ng-devel >= 0.5.0
    fuse-devel >= 2.8.6
    netcf-devel >= 0.2.2
    libcurl-devel
    audit-libs-devel
    systemtap-sdt-devel
    nfs-utils
    dbus-devel
    gawk
    scrub
    numad
    rpmlib(FileDigests) <= 4.6.0-1
    rpmlib(CompressedFileNames) <= 3.0.4-1

2) yes, yum-builddep used with libvirt.spec will install sanlock-devel

Can't yum-builddep just extract the spec file from the srpm and use it to get build requirements?

Comment 6 Panu Matilainen 2013-12-13 09:45:14 UTC
(In reply to Jiri Denemark from comment #5)
> 1) the rpm command does not mention sanlock at all:

Ok. What that means is the src.rpm was created in environment/conditions which differs from your build environment. The libvirt.spec is crazy with conditionals to make it buildable from rhel-5 to fedora-latest, making it more subject to this kind of fun than an average spec file.

> 2) yes, yum-builddep used with libvirt.spec will install sanlock-devel
> 
> Can't yum-builddep just extract the spec file from the srpm and use it to
> get build requirements?

Existing rpm versions dont provide an API for extracting contents from package payload (this is about to change in the next major rpm version, but that wont come to rhel-7). Doesn't mean it would be impossible to do so from yum-utils, but it hasn't been added because the functionality really belongs into rpm land. Also yum-builddep's ability to use .specs is relatively new in itself.

Comment 7 Miroslav Rezanina 2014-01-20 07:33:14 UTC
*** Bug 1040221 has been marked as a duplicate of this bug. ***

Comment 8 Zdeněk Pavlas 2014-01-24 11:52:39 UTC
> Can't yum-builddep just extract the spec file from the srpm and use it to get build requirements?

"yum-builddep <package>" uses the repository metadata for <package>.src.rpm only, but does not actually download the srpm, so we can't extract the spec file from it.  Implementing it is not trivial, and given that the current bahavior works fine in most cases and a workaround is available, I don't think it's necessary.