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.
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
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?
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.
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/ """
Good, closing.
For the record. The following lines need to be added: config_opts['macros']['%dist'] = '.el7' config_opts['macros']['%rhel'] = '7'