RPM(Redhat Package Manager)是用于Redhat、CentOS、Fedora等Linux 分发版(distribution)的常见的软件包管理器。因为它允许分发已编译的软件,所以用户只用一个命令就可以安装软件。
rpmbuild命令被用于创建rpm的二进制软件包和源码软件包,介绍如下:
#rpmbuild
-bp 只作准备 (解压与打补丁)
-bc 准备并编译
-bi 编译并安装
-bl 检验文件是否齐全
-ba 编译后做成*.rpm和src.rpm
-bb 编译后做成*.rpm
-bs 只做成*.src.rpm
-tc -ti -ta -tb -ts 的功能类似,只是所需参数由spec文件变成tar包。
如:cd /usr/src/redhat/SPECS
rpmbuild -bp kernel-2.6.spec
更具体的用法说明:
Build options with [ | | ]:
*建立包的选项有:[从文件建立 |从包建立 |从包建立]
1、从文件建立
-bp build through %prep (unpack sources and apply patches) from
*-bp 从文件的%prep段开始建立(解开源码包并打补丁)
-bc build through %build (%prep, then compile) from
*-bc 从文件的%build
-bi build through %install (%prep, %build, then install) from
-bl verify %files section from
*检查文件的%files段
-ba build source and binary packages from
*建立源码和二进制包
-bb build binary package only from
*只建立二进制包
-bs build source package only from
*只建立源码包
2、从 包建立
-tp build through %prep (unpack sources and apply patches) from
-tc build through %build (%prep, then compile) from
-ti build through %install (%prep, %build, then install) from
-ta build source and binary packages from
*建立源码和二进制包
-tb build binary package only from
*只建立二进制包
-ts build source package only from
*只建立源码包
3、从 包建立
-rebuild build binary package from
*建立二进制包
-recompile build through %install (%prep, %build, then install) from
4、rpmbuild的其他使用项
-buildroot=DIRECTORY override build root
*确定以root目录建立包
-clean remove build tree when done
*完成打包后清除BUILD下的文件目录
-nobuild do not execute any stages of the build
*不进行BUILD的阶段
-nodeps do not verify build dependencies
*不检查建立包时的关联文件
-nodirtokens generate package header(s) compatible with (legacy) rpm packaging
-rmsource remove sources when done
*完成打包后清除sources
-rmspec remove specfile when done
*完成打包后清除specfile
-short-circuit skip straight to specified stage (only for c,i)
*跳过
-target=CPU-VENDOR-OS override target platform
*确定包的最终使用平台
Common options for all rpm modes(所有rpm都可使用的选项):
-D, -define=‘MACRO’EXPR’ define MACRO with value EXPR
*预定义
-E, -eval=‘EXPR’ print macro expansion of EXPR
*显示大量EXPR扩展信息
-macros=
*读
-nodigest don’t verify package digest(s)
*不检查包的说明信息
-nosignature don’t verify package signature(s)
*不检查包的签名信息
-rcfile=
*读
-r, -root=ROOT use ROOT as top level directory (default: “/”)
*使ROOT为最高级别的路径
-querytags display known query tags
*显示已知的有疑问的地方
-showrc display final rpmrc and macro configuration
*显示最终的配置信息
-quiet provide less detailed output
*提供少量的信息
-v, -verbose provide more detailed output
*提供大量的详细的信息
-version print the version of rpm being used
*显示rpm包的版本
著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:Ailson Jack
链接:http://www.only2fire.com/archives/42.html
来源:www.only2fire.com