rpmbuild命令
 2016.02.28    |      命令与脚本    |     AilsonJack    |     暂无评论    |     1144 views
By: Ailson Jack
Date: 2016-02-28
个人博客: http://www.only2fire.com/
<p style="text-indent: 2em;">RPM(Redhat Package Manager)是用于Redhat、CentOS、Fedora等Linux 分发版(distribution)的常见的软件包管理器。因为它允许分发已编译的软件,所以用户只用一个命令就可以安装软件。</p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">rpmbuild</span>命令被用于创建rpm的二进制软件包和源码软件包,介绍如下:</p><p style="text-indent: 0em;">#rpmbuild</p><p style="text-indent: 2em;">-bp 只作准备 (解压与打补丁)</p><p style="text-indent: 2em;">-bc 准备并编译</p><p style="text-indent: 2em;">-bi 编译并安装</p><p style="text-indent: 2em;">-bl 检验文件是否齐全</p><p style="text-indent: 2em;">-ba 编译后做成*.rpm和src.rpm</p><p style="text-indent: 2em;">-bb 编译后做成*.rpm</p><p style="text-indent: 2em;">-bs 只做成*.src.rpm</p><p style="text-indent: 2em;">-tc -ti -ta -tb -ts 的功能类似,只是所需参数由spec文件变成tar包。</p><p style="text-indent: 2em;">如:<span style="color: rgb(255, 0, 0);">cd /usr/src/redhat/SPECS</span></p><p style="text-indent: 2em;"><span style="color: rgb(255, 0, 0);">rpmbuild -bp kernel-2.6.spec</span></p><p style="text-align:center"><span style="color: rgb(255, 0, 0);"><img src="/uploads/AilsonJack/2018.08.24/1535082049653886.jpg" onclick="preview_image(&#39;/uploads/AilsonJack/2018.08.24/1535082049653886.jpg&#39;)"/></span></p><p style="text-indent: 2em;">更具体的用法说明:<br/></p><p style="text-indent: 2em;">Build options with [ &lt;specfile&gt; | &lt;tarball&gt; | &lt;source package&gt; ]:</p><p style="text-indent: 2em;">*建立包的选项有:[从文件&lt;<span style="color: rgb(255, 0, 0);">specfile</span>&gt;建立 |从&lt;<span style="color: rgb(255, 0, 0);">tarball</span>&gt;包建立 |从&lt;<span style="color: rgb(255, 0, 0);">source package</span>&gt;包建立]</p><p class="artical_littlestyle1">1、从文件&lt;specfile&gt;建立</p><p style="text-align: left; text-indent: 0em;">-bp&nbsp;&nbsp;&nbsp;&nbsp;build through %prep (unpack sources and apply patches) from &lt;specfile&gt;</p><p style="text-align: left; text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *-bp 从&lt;specfile&gt;文件的%prep段开始建立(解开源码包并打补丁)</p><p style="text-indent: 0em;">-bc&nbsp;&nbsp;&nbsp;&nbsp;build through %build (%prep, then compile) from &lt;specfile&gt;</p><p style="text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *-bc 从&lt;specfile&gt;文件的%build</p><p style="text-indent: 0em;">-bi&nbsp;&nbsp;&nbsp;&nbsp;build through %install (%prep, %build, then install) from &lt;specfile&gt;</p><p style="text-indent: 0em;">-bl&nbsp;&nbsp;&nbsp;&nbsp;verify %files section from &lt;specfile&gt;</p><p style="text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *检查&lt;specfile&gt;文件的%files段</p><p style="text-indent: 0em;">-ba&nbsp;&nbsp;&nbsp;&nbsp;build source and binary packages from &lt;specfile&gt;</p><p style="text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *建立源码和二进制包</p><p style="text-indent: 0em;">-bb&nbsp;&nbsp;&nbsp;&nbsp;build binary package only from &lt;specfile&gt;</p><p style="text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *只建立二进制包</p><p style="text-indent: 0em;">-bs&nbsp;&nbsp;&nbsp;&nbsp;build source package only from &lt;specfile&gt;</p><p style="text-indent: 0em;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *只建立源码包<br/></p><p class="artical_littlestyle2">2、从 &lt;tarball&gt;包建立</p><p style="text-indent: 0em;">-tp&nbsp;&nbsp;&nbsp;&nbsp;build through %prep (unpack sources and apply patches) from &lt;tarball&gt;<br/>-tc&nbsp;&nbsp;&nbsp;&nbsp;build through %build (%prep, then compile) from &lt;tarball&gt;<br/>-ti&nbsp;&nbsp;&nbsp;&nbsp;build through %install (%prep, %build, then install) from &lt;tarball&gt;<br/>-ta&nbsp;&nbsp;&nbsp;&nbsp;build source and binary packages from &lt;tarball&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *建立源码和二进制包<br/>-tb&nbsp;&nbsp;&nbsp;&nbsp;build binary package only from &lt;tarball&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *只建立二进制包<br/>-ts&nbsp;&nbsp;&nbsp;&nbsp;build source package only from &lt;tarball&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *只建立源码包</p><p class="artical_littlestyle3">3、从 &lt;source package&gt;包建立</p><p style="text-indent: 0em;">-rebuild&nbsp; &nbsp;&nbsp; build binary package from &lt;source package&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*建立二进制包<br/>-recompile&nbsp; &nbsp; build through %install (%prep, %build, then install) from &lt;source package&gt;<br/></p><p class="artical_littlestyle4">4、rpmbuild的其他使用项</p><p style="text-indent: 0em;">-buildroot=DIRECTORY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; override build root<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *确定以root目录建立包<br/>-clean&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; remove build tree when done<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *完成打包后清除BUILD下的文件目录<br/>-nobuild&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do not execute any stages of the build<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *不进行BUILD的阶段<br/>-nodeps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do not verify build dependencies<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *不检查建立包时的关联文件<br/>-nodirtokens&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; generate package header(s) compatible with (legacy) rpm packaging<br/>-rmsource&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; remove sources when done<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *完成打包后清除sources<br/>-rmspec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;remove specfile when done<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *完成打包后清除specfile<br/>-short-circuit&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;skip straight to specified stage (only for c,i)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *跳过<br/>-target=CPU-VENDOR-OS &nbsp;&nbsp;&nbsp;&nbsp; override target platform<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *确定包的最终使用平台<br/><span style="color: rgb(0, 112, 192);">Common options for all rpm modes(所有rpm都可使用的选项):</span></p><p style="text-indent: 0em;">-D, -define=&#39;MACRO&#39;EXPR&#39;&nbsp;&nbsp;&nbsp; define MACRO with value EXPR<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *预定义<br/>-E, -eval=&#39;EXPR&#39;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print macro expansion of EXPR<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *显示大量EXPR扩展信息<br/>-macros=&lt;FILE:…&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; read &lt;FILE:…&gt; instead of default file(s)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *读&lt;FILE:…&gt;文件代替默认文件<br/>-nodigest&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; don’t verify package digest(s)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; *不检查包的说明信息<br/>-nosignature&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; don’t verify package signature(s)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *不检查包的签名信息<br/>-rcfile=&lt;FILE:…&gt;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; read &lt;FILE:…&gt; instead of default file(s)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; *读&lt;FILE:…&gt;文件代替默认文件<br/>-r, -root=ROOT&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; use ROOT as top level directory (default: “/”)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;*使ROOT为最高级别的路径<br/>-querytags&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; display known query tags<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *显示已知的有疑问的地方<br/>-showrc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; display final rpmrc and macro configuration<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; *显示最终的配置信息<br/>-quiet&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; provide less detailed output<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; *提供少量的信息<br/>-v, -verbose&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; provide more detailed output<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; *提供大量的详细的信息<br/>-version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;print the version of rpm being used<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;*显示rpm包的版本<br/></p>
欢迎关注博主的公众号呀,精彩内容随时掌握:
热情邀请仔细浏览下博客中的广告,万一有对自己有用或感兴趣的呢。◕ᴗ◕。。
如果这篇文章对你有帮助,记得点赞和关注博主就行了^_^,当然了能够赞赏博主,那就非常感谢啦!
注: 转载请注明出处,谢谢!^_^
转载请注明来源: 本文链接:  By: AilsonJack
rpmbuild命令  |  说好一起走
暂无评论,要不要来个沙发
发表评论

 
Copyright © 2015~2023  说好一起走   保留所有权利   |  百度统计  蜀ICP备15004292号