NAME
rpmbuild - 构建 RPM 打包
SYNOPSIS
构建打包:
rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [rpmbuild-options] SPECFILE ...
rpmbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [rpmbuild-options] TARBALL ...
rpmbuild {--rebuild|--recompile} SOURCEPKG ...
其他:
rpmbuild --showrc
rpmbuild 选项
[--buildroot DIRECTORY] [--clean] [--nobuild]
[--rmsource] [--rmspec] [--short-circuit] [--sign]
[--target PLATFORM]
DESCRIPTION
rpmbuild 是用来构建软件的二进制和源代码打包的。一个软件包 package 包括文件的归档以及用来安装和卸载归档中文件的元数据。元数据包括辅助脚本,文件属性,以及有关的描述性的信息。软件包有两种 package:二进制软件包,用来封装要安装的软件,源代码软件包,包含了源代码和要构建二进制打包需要的内容。
必须选择下列基本模式之一:0 Build Package, Build Package from Tarball, Recompile Package, Show Configuration.
一般的选项
这些选项可以用于所有不同的模式。
- -?, --help
- 输出较长的帮助信息
- --version
- 输出一行信息,包含 rpmbuild 的版本号
- --quiet
- 输出尽可能少的信息 - 通常只有错误信息才会显示出来
- -v
- 输出冗余信息 - 通常常规的进度信息都将被显示
- -vv
- 输出大量丑陋的调试信息
- --rcfile FILELIST
- FILELIST 中冒号分隔的每个文件名都被 rpm 按顺序读取,从中获得配置信息。只有列表的***个文件必须存在,波浪线将被替换为 $HOME。默认的 FILELIST 是 /usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc
- --pipe CMD
- 将 rpm 的输出通过管道送到命令 CMD。
- --dbpath DIRECTORY
- 使用 DIRECTORY 中的数据库,而不是默认的路径 /var/lib/rpm
- --root DIRECTORY
- 以 DIRECTORY 作为根文件系统,进行所有操作。这意味着将使用 DIRECTORY 中的数据库来进行依赖性检测,任何小程序 (也就是安装中的 %post 和构建中的 %prep) 都将在一个 chroot(2) 到 DIRECTORY 之后执行。
构建选项
构建命令的一般形式是
rpmbuild -bSTAGE|-tSTAGE [ rpmbuild-options ] FILE ...
如果要用某个 spec 文件构建,使用 -b 参数。如果需要根据一个可能是压缩过的 tar 归档文件中的 spec 文件构建,就使用 -t 参数。***个参数之后的字符 STAGE 指定了要完成的构建和打包的阶段,是下列其中之一:
- -ba
- 构建二进制和源代码打包 (在执行 %prep, %build 和 %install 之后)
- -bb
- 构建二进制打包 (在执行 %prep, %build 和 %install 之后)
- -bp
- 执行 spec 文件的 "%prep" 阶段。通常,这会解包源代码并应用补丁
- -bc
- 执行 spec 文件的 "%build" 阶段 (在执行了 %prep 阶段之后)。这通常等价于执行了一次 "make"
- -bi
- 执行 spec 文件的 "%install" 阶段 (在执行了 %prep 和 %build 阶段之后)。这通常等价于执行了一次 "make install"
- -bl
- 执行一次 "列表检查"。spec 文件的 "%files" 段落中的宏被扩展,检测是否每个文件都存在。
- -bs
- 只构建源代码打包
还可以用下列选项:
- --buildroot DIRECTORY
- 在构建时,使用目录 DIRECTORY 覆盖默认的值
- --clean
- 在制作打包之后删除构建树
- --nobuild
- 不执行任何构建步骤。用于测试 spec 文件
- --rmsource
- 在构建后删除源代码 (也可以单独使用,例如 "rpmbuild --rmsource foo.spec")
- --rmspec
- 在构建之后删除 spec 文件 (也可以单独使用,例如 "rpmbuild --rmspec foo.spec")
- --short-circuit
- 直接跳到指定阶段 (也就是说,跳过指定阶段前面的所有步骤)。只有与 -bc 或 -bi 连用才有意义。
- --sign
- 在打包中包含 GPG 签名。签名可以用来校验打包的完整性和来源。参见 rpm(8) 的 "GPG 签名" 章节中的配置细节。
- --target PLATFORM
- 在构建时,将 PLATFORM 解析为 arch-vendor-os,并以此设置宏 %_target, %_target_cpu, 和 %_target_os 的值。
重建和重编译选项
还有两种发起构建的方法:
rpmbuild --rebuild|--recompile SOURCEPKG ...
这样执行的话,rpmbuild 安装指定的源代码打包,然后进行准备,编译和安装。另外,--rebuild 构建一个新的二进制打包,在构建结束时,构建目录被删除 (就好像用了 --clean),源代码和 spec 文件也被删除。
SHOWRC
命令
rpmbuild --showrc
将显示 rpmbuild 使用的,在 rpmrc 和 macros 配置文件中定义的选项的值。
FILES
rpmrc 配置文件
/usr/lib/rpm/rpmrc /usr/lib/rpm/redhat/rpmrc /etc/rpmrc ~/.rpmrc
Macro 宏定义文件
/usr/lib/rpm/macros /usr/lib/rpm/redhat/macros /etc/rpm/macros ~/.rpmmacros
Database 数据库
/var/lib/rpm/Basenames /var/lib/rpm/Conflictname /var/lib/rpm/Dirnames /var/lib/rpm/Filemd5s /var/lib/rpm/Group /var/lib/rpm/Installtid /var/lib/rpm/Name /var/lib/rpm/Packages /var/lib/rpm/Providename /var/lib/rpm/Provideversion /var/lib/rpm/Pubkeys /var/lib/rpm/Removed /var/lib/rpm/Requirename /var/lib/rpm/Requireversion /var/lib/rpm/Sha1header /var/lib/rpm/Sigmd5 /var/lib/rpm/Triggername
Temporary 临时文件
/var/tmp/rpm*
SEE ALSO
popt(3), rpm2cpio(8), gendiff(1), rpm(8),
#p#
NAME
rpmbuild - Build RPM Package(s)
SYNOPSIS
BUILDING PACKAGES:
rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [rpmbuild-options] SPECFILE ...
rpmbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [rpmbuild-options] TARBALL ...
rpmbuild {--rebuild|--recompile} SOURCEPKG ...
MISCELLANEOUS:
rpmbuild --showrc
rpmbuild-options
[--buildroot DIRECTORY] [--clean] [--nobuild]
[--rmsource] [--rmspec] [--short-circuit] [--sign]
[--target PLATFORM]
DESCRIPTION
rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.
One of the following basic modes must be selected: Build Package, Build Package from Tarball, Recompile Package, Show Configuration.
GENERAL OPTIONS
These options can be used in all the different modes.
- -?, --help
- Print a longer usage message then normal.
- --version
- Print a single line containing the version number of rpm being used.
- --quiet
- Print as little as possible - normally only error messages will be displayed.
- -v
- Print verbose information - normally routine progress messages will be displayed.
- -vv
- Print lots of ugly debugging information.
- --rcfile FILELIST
- Each of the files in the colon separated FILELIST is read sequentially by rpm for configuration information. Only the first file in the list must exist, and tildes will be expanded to the value of $HOME. The default FILELIST is /usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc.
- --pipe CMD
- Pipes the output of rpm to the command CMD.
- --dbpath DIRECTORY
- Use the database in DIRECTORY rather than the default path /var/lib/rpm
- --root DIRECTORY
- Use the file system tree rooted at DIRECTORY for all operations. Note that this means the database within DIRECTORY will be used for dependency checks and any scriptlet(s) (e.g. %post if installing, or %prep if building, a package) will be run after a chroot(2) to DIRECTORY.
BUILD OPTIONS
The general form of an rpm build command is
rpmbuild -bSTAGE|-tSTAGE [ rpmbuild-options ] FILE ...
The argument used is -b if a spec file is being used to build the package and -t if rpmbuild should look inside of a (possibly compressed) tar file for the spec file to use. After the first argument, the next character (STAGE) specifies the stages of building and packaging to be done and is one of:
- -ba
- Build binary and source packages (after doing the %prep, %build, and %install stages).
- -bb
- Build a binary package (after doing the %prep, %build, and %install stages).
- -bp
- Executes the "%prep" stage from the spec file. Normally this involves unpacking the sources and applying any patches.
- -bc
- Do the "%build" stage from the spec file (after doing the %prep stage). This generally involves the equivalent of a "make".
- -bi
- Do the "%install" stage from the spec file (after doing the %prep and %build stages). This generally involves the equivalent of a "make install".
- -bl
- Do a "list check". The "%files" section from the spec file is macro expanded, and checks are made to verify that each file exists.
- -bs
- Build just the source package.
The following options may also be used:
- --buildroot DIRECTORY
- When building a package, override the BuildRoot tag with directory DIRECTORY.
- --clean
- Remove the build tree after the packages are made.
- --nobuild
- Do not execute any build stages. Useful for testing out spec files.
- --rmsource
- Remove the sources after the build (may also be used standalone, e.g. "rpmbuild --rmsource foo.spec").
- --rmspec
- Remove the spec file after the build (may also be used standalone, eg. "rpmbuild --rmspec foo.spec").
- --short-circuit
- Skip straight to specified stage (i.e., skip all stages leading up to the specified stage). Only valid with -bc and -bi.
- --sign
- Embed a GPG signature in the package. This signature can be used to verify the integrity and the origin of the package. See the section on GPG SIGNATURES in rpm(8) for configuration details.
- --target PLATFORM
- When building the package, interpret PLATFORM as arch-vendor-os and set the macros %_target, %_target_cpu, and %_target_os accordingly.
REBUILD AND RECOMPILE OPTIONS
There are two other ways to invoke building with rpm:
rpmbuild --rebuild|--recompile SOURCEPKG ...
When invoked this way, rpmbuild installs the named source package, and does a prep, compile and install. In addition, --rebuild builds a new binary package. When the build has completed, the build directory is removed (as in --clean) and the the sources and spec file for the package are removed.
SHOWRC
The command
rpmbuild --showrc
shows the values rpmbuild will use for all of the options are currently set in rpmrc and macros configuration file(s).
FILES
rpmrc Configuration
/usr/lib/rpm/rpmrc /usr/lib/rpm/redhat/rpmrc /etc/rpmrc ~/.rpmrc
Macro Configuration
/usr/lib/rpm/macros /usr/lib/rpm/redhat/macros /etc/rpm/macros ~/.rpmmacros
Database
/var/lib/rpm/Basenames /var/lib/rpm/Conflictname /var/lib/rpm/Dirnames /var/lib/rpm/Filemd5s /var/lib/rpm/Group /var/lib/rpm/Installtid /var/lib/rpm/Name /var/lib/rpm/Packages /var/lib/rpm/Providename /var/lib/rpm/Provideversion /var/lib/rpm/Pubkeys /var/lib/rpm/Removed /var/lib/rpm/Requirename /var/lib/rpm/Requireversion /var/lib/rpm/Sha1header /var/lib/rpm/Sigmd5 /var/lib/rpm/Triggername
Temporary
/var/tmp/rpm*
SEE ALSO
popt(3), rpm2cpio(8), gendiff(1), rpm(8),