rpmbuild没有从rpmrc文件读取宏
我正在尝试在SLES-15上构建代码,并在MakeFile中执行rpmbuild命令,如下所示。
rpmbuild -ba -rcfile $(buildroot)/scripts/rpmrc -rmsource -target $(rpm_target_arch)$(debug_option)$(rpmdir)$(rpmdir)/specs/specs/$(specfile)/$(specfile)
rpmrc文件内容:
macrofiles:/usr/lib/rpm/macros:/usr/lib/rpm/% {_target }/macros:/usr/lib/rpm/rpm/redhat/macros:/etc/rpm/marpm/macros.specspo:/etc./etc../etc. /rpm/macros.cdb:/etc/rpm/macros.prelink:/etc/rpm/macros.solve:/etc/rpm/macros.up2date:/etc/rpm/macros:/etc/macros:/etc/etc/rpm/ rpm/% {_target} /macros:~/.rpmmacros:/home/build/builds/sourcecode/rpm/rpmmacros
file/home/home/build/builds/sourcecode/rpm/rpmmacros具有定义
%_ topdir/home/build/builds/code/build/linux-i686-sles11/release/tools
#override默认__OS_INSTALL_POST宏
#不要像这个
那样剥夺二进制的评论部分 #ASUS AVESERVER未能使其完整性检查#xxx:显然,默认情况下只有post安装中的redhat strips
#明确剥离所有东西
%__ OS_INSTALL_POST
/usr/lib/rpm/brp-compress
/usr/lib/rpm/brp-strip
/usr/lib/rpm/brp-strip-shared
/usr/lib/rpm/brp-strip static-Archive
%{nil}
#enable debuginfo套件用于SUSE构建 #xxx:这需要Elfutils软件包中的欧盟 - 斯特里 #通常不带SLE %安装%{debug_package}
%%安装
%{nil}
但是当执行rpmbuild命令时,它实际上选择了“ _topdir”的不同值(它是从/usr/lib/rpm/macros读取的),并且未找到错误xxx。
通过将额外的宏定义添加到rpmbuild命令(如下)
rpmbuild -ba ** - define ='_ topdir $(rpmdir)'** - rcfile $(buildroot)/scripts/ropmrc-rpmrc--rc--rc--rc--rc--rc--rc--rc----- -rmsource -target $(rpm_target_arch)$(debug_option)$(rpmdir)/specs/$(specfile)
,
但以后在未找到不同目录的失败上未找到错误,我相信这是由于没有阅读/选择的原因RPMRC文件的宏。有什么解决方案吗?为什么它不读取用户提供的宏/rpmrc文件。
此代码基于SLES-11,但在SLES-15上失败
SLES-15版本上的RPM版本:4.14.3版本:40.1
SLES-11上的rpm版本版本:4.4.2.3版本:37.16.37
注意: rpmbuild正在从/ usr/lib/lib/rpm/suse/macros 和< em>/usr/lib/rpm/宏。另外,/usr/lib/rpm/suse/macros 覆盖了/usr/lib/rpm/rpm/macros 的定义。例如,如果'%_ xxx '在两个文件中都定义em>,然后rpmbuild从/usr/lib/rpm/rpm/suse/macros 中选择%_ xxx 的值。
I am trying to build a code on SLES-15 and in Makefile it executes rpmbuild command as below.
rpmbuild -ba --rcfile $(BUILDROOT)/scripts/rpmrc --rmsource --target $(RPM_TARGET_ARCH) $(DEBUG_OPTION) $(RPMDIR)/SPECS/$(SPECFILE)
rpmrc file has below contents:
macrofiles: /usr/lib/rpm/macros:/usr/lib/rpm/%{_target}/macros:/usr/lib/rpm/redhat/macros:/etc/rpm/macros.specspo:/etc/rpm/macros.cdb:/etc/rpm/macros.prelink:/etc/rpm/macros.solve:/etc/rpm/macros.up2date:/etc/rpm/macros:/etc/rpm/%{_target}/macros:~/.rpmmacros:/home/build/builds/Sourcecode/rpm/rpmmacros
the file /home/build/builds/Sourcecode/rpm/rpmmacros has definition
%_topdir /home/build/builds/code/build/Linux-i686-SLES11/Release/tools
#Override default __os_install_post macro
#Do not strip comment section of binaries as this
#causes aveserver to fail its integrity check#XXX: Apparently, only RedHat strips in post install by default
#so explicitly strip everything
%__os_install_post
/usr/lib/rpm/brp-compress
/usr/lib/rpm/brp-strip
/usr/lib/rpm/brp-strip-shared
/usr/lib/rpm/brp-strip-static-archive
%{nil}
#Enable debuginfo packages for SuSE build
#XXX: This requires a working eu-strip from the elfutils package
#which normally does not come with SLES
%install %{debug_package}
%%install
%{nil}
But when rpmbuild command is executed It actually picks different value of ‘_topdir’ (which it reads from /usr/lib/rpm/macros) and failed with error XXX not found.
The _topdir problem was solved by adding extra macro definition to rpmbuild command (as below)
rpmbuild -ba **--define='_topdir $(RPMDIR)'** --rcfile $(BUILDROOT)/scripts/rpmrc --rmsource --target $(RPM_TARGET_ARCH) $(DEBUG_OPTION) $(RPMDIR)/SPECS/$(SPECFILE)
but later on fails with different directory not found error, which I believe is due as it not reading/picking macros from rpmrc file. Any Solution for this? Why its not reading macros from user provided macro/rpmrc files.
This code builds on SLES-11 but failes on SLES-15
RPM version on SLES-15 Version: 4.14.3 Release: 40.1
RPM version on SLES-11 Version: 4.4.2.3 Release: 37.16.37
Note: rpmbuild is picking macro definition from /usr/lib/rpm/suse/macros and /usr/lib/rpm/macros. Also, /usr/lib/rpm/suse/macros overrides the definition from /usr/lib/rpm/macros. For eg if '%_XXX' is defined in both files /usr/lib/rpm/macros and /usr/lib/rpm/suse/macros, then rpmbuild picks value of %_XXX from /usr/lib/rpm/suse/macros.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
rpm停止支持从v4.6开始的rcfile读数的大扇形。
解决方案是将RPMMACROS文件复制到〜/.rpmmacros。
另一个解决方案是提供带有“:”的宏文件列表,其中 - macros =从rpmbuild中。
RPM stops supporting macrofiles reading from rcfile from v4.6 onwards.
The solution is to copy rpmmacros files to ~/.rpmmacros.
Other solution was to provide macros file list separated with ":" with --macros= from rpmbuild.