Bug 1041480 - Unable to build EL7 package
Summary: Unable to build EL7 package
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-12 16:23 UTC by Miroslav Suchý
Modified: 2014-01-21 13:46 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-20 18:15:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miroslav Suchý 2013-12-12 16:23:49 UTC
Description of problem:
I'm trying to build package in el7-beta chroot and it fails with very strange error:
ERROR: No Spec file found in srpm: sssd-1.11.2-13.el7.src.rpm

Version-Release number of selected component (if applicable):
mock-1.1.32-1.el7.noarch
tested even with mock-1.1.35-1.fc20.noarch

How reproducible:
deterministic

Steps to Reproduce:
1. create /etc/mock/epel-7-x86_64.cfg with:
config_opts['root'] = 'epel-7-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-release-server redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which xz'
config_opts['dist'] = 'el7'  # only useful for --resultdir variable subst
config_opts['macros'] = {}
config_opts['macros']['%__arch_install_post'] = '%{nil}'

config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/yum
debuglevel=1
logfile=/var/log/yum.log
reposdir=/dev/null
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=

# repos

[beta]
name=beta
baseurl=http://ftp.redhat.com/redhat/rhel/beta/7/x86_64/os/
"""

2. take some package (I tried several ones - even some taken straight from koji)

3.  mock -r epel-7-x86_64 sssd-1.11.2-13.el7.src.rpm

Actual results:
INFO: mock.py version 1.1.35 starting...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
INFO: Start(sssd-1.11.2-13.el7.src.rpm)  Config(epel-7-x86_64)
Start: lock buildroot
Start: clean chroot
INFO: chroot (/var/lib/mock/epel-7-x86_64) unlocked and deleted
Finish: clean chroot
Finish: lock buildroot
Start: chroot init
Start: lock buildroot
Mock Version: 1.1.35
INFO: Mock Version: 1.1.35
INFO: calling preinit hooks
INFO: enabled root cache
Start: unpacking root cache
Finish: unpacking root cache
INFO: enabled yum cache
Start: cleaning yum metadata
Finish: cleaning yum metadata
INFO: enabled ccache
Start: device setup
Finish: device setup
Start: yum update
Start: Outputting list of available packages
Finish: Outputting list of available packages
Finish: yum update
Finish: lock buildroot
Finish: chroot init
INFO: Installed packages:
Start: build phase for sssd-1.11.2-13.el7.src.rpm
Start: device setup
Finish: device setup
Start: build setup for sssd-1.11.2-13.el7.src.rpm
ERROR: Exception(sssd-1.11.2-13.el7.src.rpm) Config(epel-7-x86_64) 0 minutes 7 seconds
INFO: Results and/or logs in: /var/lib/mock/epel-7-x86_64/result
ERROR: No Spec file found in srpm: sssd-1.11.2-13.el7.src.rpm

Expected results:
flawless build of package

Additional info:
Mock successfully build package if I point it to internal repo from brew. So it is most likely that the real cause is on rel-eng side. But the error of mock is wrong as that package *have* spec file.

Comment 1 Miroslav Suchý 2013-12-13 15:07:13 UTC
That error is cause because mock look for:
  /var/lib/mock/epel-7-x86_64/root/builddir/build/SPECS/*.spec
while that spec reside in:
  /var/lib/mock/epel-7-x86_64/root/builddir/rpmbuild/SPECS/sssd.spec

Comment 2 Clark Williams 2014-01-04 20:10:56 UTC
Any idea who is creating the 'rpmbuild' directory? 

Mock creates the 'builddir' directory under the chroot path as the homedir for the mockbuild user (the uid mock uses to build things as) and then creates the 'build' directory under that. So the question is: how is the 'rpmbuild' directory being created inside the chroot? Is it part of the SRPM install?

Comment 3 Miroslav Suchý 2014-01-06 12:29:57 UTC
No idea.

But I can even reproduce it on Fedora 20. Take mock config from #0 and with:
  mock-1.1.35-1.fc20.noarch
run:
  wget http://kojipkgs.fedoraproject.org//packages/mock/1.1.35/1.fc20/src/mock-1.1.35-1.fc20.src.rpm
  mock -r epel-7-x86_64 mock-1.1.35-1.fc20.src.rpm
....
ERROR: No Spec file found in srpm: mock-1.1.35-1.fc20.src.rpm, /var/lib/mock/epel-7-x86_64/root/builddir/build/SPECS/*.spec, /builddir/build/originals/mock-1.1.35-1.fc20.src.rpm

Mock just run:
  rpm -Uvh foo.src.rpm
and as result it place spec file into $CHROOT/rpmbuild/SPECS/foo.spec

My guess is that this is because of macro %{_topdir} which is defined as %{getenv:HOME}/rpmbuild. Mock redefine it (in util.py) to:
  '%_topdir': '%s/build' % config_opts['chroothome'],

but this substitution probably does not happend on EL7. Or el7 override it. I do not know.

Comment 4 Miroslav Suchý 2014-01-13 19:23:27 UTC
SOLVED. This config works:

config_opts['chroothome'] = '/builddir'
config_opts['basedir'] = '/var/lib/mock'
config_opts['root'] = 'epel-7-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install bash bzip2 coreutils cpio diffutils findutils gawk gcc gcc-c++ grep gzip info make patch redhat-release-server redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which xz'
config_opts['dist'] = 'el7'  # only useful for --resultdir variable subst
config_opts['macros'] = {}
config_opts['macros']['%_topdir'] = '/builddir/build'
config_opts['macros']['%_rpmfilename'] = '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'

config_opts['plugin_conf']['root_cache_enable'] = False
config_opts['plugin_conf']['yum_cache_enable'] = False
config_opts['plugin_conf']['ccache_enable'] = False

config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/yum
debuglevel=1
logfile=/var/log/yum.log
reposdir=/dev/null
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=

# repos

[beta]
name=beta
baseurl=http://ftp.redhat.com/redhat/rhel/beta/7/x86_64/os/
"""

Comment 5 Clark Williams 2014-01-20 18:15:35 UTC
Good, closing.

Comment 6 Miroslav Suchý 2014-01-21 13:46:29 UTC
For the record. The following lines need to be added:
config_opts['macros']['%dist'] = '.el7'
config_opts['macros']['%rhel'] = '7'


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