0

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

itsazzad
  • 6,868
  • 7
  • 69
  • 89
  • All you're showing is symlinks; we need to see what the `Sources` line(s) say in the specfiles. – Aaron D. Marasco Sep 08 '21 at 23:11
  • @AaronD.Marasco I have updated the post with repositories. please check. – itsazzad Sep 09 '21 at 03:31
  • If you override `_topdir`, you can use project-specific directories, such as `autoconf/SPECS`, `autoconf/SOURCES`, etc. See https://stackoverflow.com/questions/416983/why-is-topdir-set-to-its-default-value-when-rpmbuild-called-from-tcl – omajid Sep 09 '21 at 20:47
  • I am asking for the `Sources` line(s) in the specfiles, not repositories. – Aaron D. Marasco Sep 09 '21 at 22:45
  • @AaronD.Marasco - https://github.com/KloxoNGCommunity/autoconf/blob/dev/autoconf.spec - https://github.com/KloxoNGCommunity/autorespond-toaster/blob/dev/autorespond-toaster.spec - https://github.com/KloxoNGCommunity/bind/blob/dev/bind.spec – itsazzad Sep 10 '21 at 00:15
  • @omajid How to make _topdir dynamic to subdirectories? – itsazzad Sep 10 '21 at 00:17
  • @omajid Not `autoconf/SOURCES` but `SOURCES/autoconf` – itsazzad Sep 10 '21 at 02:27

1 Answers1

1

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
Davide Madrisan
  • 1,969
  • 2
  • 14
  • 22