Issue
I need to build multiple RPM packages. But it's getting a missing file as it is searching in the /SOURCES/
directory instead of searching in the respective subdirectory.
Is there any way to solve it without touching the spec
files, with rpm macros
?
After executing rpmbuild -bb ~/rpmbuild/SPECS/*.spec
getting the following error:
error: File /home/centos/rpmbuild/SOURCES/autoconf-2.69.tar.gz: No such file or directory
Here is my ~/rpmbuild/SOURCES/
tree after symlinking with the development codes:
~/rpmbuild/SOURCES/
├── autoconf -> /home/centos/Project/autoconf/
│ ├── autoconf-2.69.tar.gz
│ ├── autoconf.spec
│ └── config.site
├── autorespond-toaster -> /home/centos/Project/autorespond-toaster/
│ ├── autorespond-2.0.5.tar.bz2
│ ├── autorespond-toaster.spec
│ └── autorespond_utf-8.patch
├── bind -> /home/centos/Project/bind/
│ ├── bind-9.3.1rc1-sdb_tools-Makefile.in
│ ├── bind-9.9.9-P6.tar.gz
│ ├── bind.spec
│ ├── config-8.tar.bz2
│ ├── Copyright.caching-nameserver
│ ├── dnszone.schema
│ ├── flexible.m4
│ ├── ldap2zone.c
│ ├── named.conf.sample
│ ├── named.init
│ ├── named.init.el4
│ ├── named.logrotate
│ ├── named.NetworkManager
│ ├── named.portreserve
│ ├── named.sysconfig
│ ├── README.sdb_pgsql
│ └── rfc1912.txt
And ~/rpmbuild/SPECS/
tree:
~/rpmbuild/SPECS/
├── autoconf.spec -> /home/centos/Project/autoconf/autoconf.spec
├── autorespond-toaster.spec -> /home/centos/Project/autorespond-toaster/autorespond-toaster.spec
├── bind.spec -> /home/centos/Project/bind/bind.spec
REPOs
- https://github.com/KloxoNGCommunity/autoconf
- https://github.com/KloxoNGCommunity/autorespond-toaster
- https://github.com/KloxoNGCommunity/bind
Solution
I think you should redefine the _sourcedir
macro this way:
rpmbuild --define "_sourcedir /home/centos/Project/autoconf" \
-bb /home/centos/Project/autoconf/autoconf.spec
So this script should do the complete job:
for pkg in autoconf autorespond-toaster bind; do
rpmbuild --define "_sourcedir /home/centos/Project/$pkg" \
-bb /home/centos/Project/$pkg/${pkg}.spec
done
Answered By - Davide Madrisan