从动态子目录获取 SOURCES
Getting SOURCES from dynamic subdirectories
我需要构建多个 RPM 包。但是它在 /SOURCES/
目录中搜索而不是在相应的子目录中搜索时会丢失文件。
有什么方法可以在不触及 spec
文件的情况下使用 rpm macros
?
解决它
执行 rpmbuild -bb ~/rpmbuild/SPECS/*.spec
后出现以下错误:
error: File /home/centos/rpmbuild/SOURCES/autoconf-2.69.tar.gz: No such file or directory
这是我的 ~/rpmbuild/SOURCES/
与开发代码进行符号链接后的树:
~/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
和~/rpmbuild/SPECS/
树:
~/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
REPO
我认为你应该这样重新定义 _sourcedir
宏:
rpmbuild --define "_sourcedir /home/centos/Project/autoconf" \
-bb /home/centos/Project/autoconf/autoconf.spec
所以这个脚本应该完成全部工作:
for pkg in autoconf autorespond-toaster bind; do
rpmbuild --define "_sourcedir /home/centos/Project/$pkg" \
-bb /home/centos/Project/$pkg/${pkg}.spec
done
我需要构建多个 RPM 包。但是它在 /SOURCES/
目录中搜索而不是在相应的子目录中搜索时会丢失文件。
有什么方法可以在不触及 spec
文件的情况下使用 rpm macros
?
执行 rpmbuild -bb ~/rpmbuild/SPECS/*.spec
后出现以下错误:
error: File /home/centos/rpmbuild/SOURCES/autoconf-2.69.tar.gz: No such file or directory
这是我的 ~/rpmbuild/SOURCES/
与开发代码进行符号链接后的树:
~/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
和~/rpmbuild/SPECS/
树:
~/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
REPO
我认为你应该这样重新定义 _sourcedir
宏:
rpmbuild --define "_sourcedir /home/centos/Project/autoconf" \
-bb /home/centos/Project/autoconf/autoconf.spec
所以这个脚本应该完成全部工作:
for pkg in autoconf autorespond-toaster bind; do
rpmbuild --define "_sourcedir /home/centos/Project/$pkg" \
-bb /home/centos/Project/$pkg/${pkg}.spec
done