rpmbuild 中文man頁面
NAME
rpmbuild - 構(gòu)建 RPM 打包
SYNOPSIS
構(gòu)建打包:
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 選項(xiàng)
[--buildroot DIRECTORY] [--clean] [--nobuild]
[--rmsource] [--rmspec] [--short-circuit] [--sign]
[--target PLATFORM]
DESCRIPTION
rpmbuild 是用來構(gòu)建軟件的二進(jìn)制和源代碼打包的。一個(gè)軟件包 package 包括文件的歸檔以及用來安裝和卸載歸檔中文件的元數(shù)據(jù)。元數(shù)據(jù)包括輔助腳本,文件屬性,以及有關(guān)的描述性的信息。軟件包有兩種 package:二進(jìn)制軟件包,用來封裝要安裝的軟件,源代碼軟件包,包含了源代碼和要構(gòu)建二進(jìn)制打包需要的內(nèi)容。
必須選擇下列基本模式之一:0 Build Package, Build Package from Tarball, Recompile Package, Show Configuration.
一般的選項(xiàng)
這些選項(xiàng)可以用于所有不同的模式。
- -?, --help
- 輸出較長的幫助信息
- --version
- 輸出一行信息,包含 rpmbuild 的版本號
- --quiet
- 輸出盡可能少的信息 - 通常只有錯(cuò)誤信息才會(huì)顯示出來
- -v
- 輸出冗余信息 - 通常常規(guī)的進(jìn)度信息都將被顯示
- -vv
- 輸出大量丑陋的調(diào)試信息
- --rcfile FILELIST
- FILELIST 中冒號分隔的每個(gè)文件名都被 rpm 按順序讀取,從中獲得配置信息。只有列表的***個(gè)文件必須存在,波浪線將被替換為 $HOME。默認(rèn)的 FILELIST 是 /usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc:/etc/rpmrc:~/.rpmrc
- --pipe CMD
- 將 rpm 的輸出通過管道送到命令 CMD。
- --dbpath DIRECTORY
- 使用 DIRECTORY 中的數(shù)據(jù)庫,而不是默認(rèn)的路徑 /var/lib/rpm
- --root DIRECTORY
- 以 DIRECTORY 作為根文件系統(tǒng),進(jìn)行所有操作。這意味著將使用 DIRECTORY 中的數(shù)據(jù)庫來進(jìn)行依賴性檢測,任何小程序 (也就是安裝中的 %post 和構(gòu)建中的 %prep) 都將在一個(gè) chroot(2) 到 DIRECTORY 之后執(zhí)行。
構(gòu)建選項(xiàng)
構(gòu)建命令的一般形式是
rpmbuild -bSTAGE|-tSTAGE [ rpmbuild-options ] FILE ...
如果要用某個(gè) spec 文件構(gòu)建,使用 -b 參數(shù)。如果需要根據(jù)一個(gè)可能是壓縮過的 tar 歸檔文件中的 spec 文件構(gòu)建,就使用 -t 參數(shù)。***個(gè)參數(shù)之后的字符 STAGE 指定了要完成的構(gòu)建和打包的階段,是下列其中之一:
- -ba
- 構(gòu)建二進(jìn)制和源代碼打包 (在執(zhí)行 %prep, %build 和 %install 之后)
- -bb
- 構(gòu)建二進(jìn)制打包 (在執(zhí)行 %prep, %build 和 %install 之后)
- -bp
- 執(zhí)行 spec 文件的 "%prep" 階段。通常,這會(huì)解包源代碼并應(yīng)用補(bǔ)丁
- -bc
- 執(zhí)行 spec 文件的 "%build" 階段 (在執(zhí)行了 %prep 階段之后)。這通常等價(jià)于執(zhí)行了一次 "make"
- -bi
- 執(zhí)行 spec 文件的 "%install" 階段 (在執(zhí)行了 %prep 和 %build 階段之后)。這通常等價(jià)于執(zhí)行了一次 "make install"
- -bl
- 執(zhí)行一次 "列表檢查"。spec 文件的 "%files" 段落中的宏被擴(kuò)展,檢測是否每個(gè)文件都存在。
- -bs
- 只構(gòu)建源代碼打包
還可以用下列選項(xiàng):
- --buildroot DIRECTORY
- 在構(gòu)建時(shí),使用目錄 DIRECTORY 覆蓋默認(rèn)的值
- --clean
- 在制作打包之后刪除構(gòu)建樹
- --nobuild
- 不執(zhí)行任何構(gòu)建步驟。用于測試 spec 文件
- --rmsource
- 在構(gòu)建后刪除源代碼 (也可以單獨(dú)使用,例如 "rpmbuild --rmsource foo.spec")
- --rmspec
- 在構(gòu)建之后刪除 spec 文件 (也可以單獨(dú)使用,例如 "rpmbuild --rmspec foo.spec")
- --short-circuit
- 直接跳到指定階段 (也就是說,跳過指定階段前面的所有步驟)。只有與 -bc 或 -bi 連用才有意義。
- --sign
- 在打包中包含 GPG 簽名。簽名可以用來校驗(yàn)打包的完整性和來源。參見 rpm(8) 的 "GPG 簽名" 章節(jié)中的配置細(xì)節(jié)。
- --target PLATFORM
- 在構(gòu)建時(shí),將 PLATFORM 解析為 arch-vendor-os,并以此設(shè)置宏 %_target, %_target_cpu, 和 %_target_os 的值。
重建和重編譯選項(xiàng)
還有兩種發(fā)起構(gòu)建的方法:
rpmbuild --rebuild|--recompile SOURCEPKG ...
這樣執(zhí)行的話,rpmbuild 安裝指定的源代碼打包,然后進(jìn)行準(zhǔn)備,編譯和安裝。另外,--rebuild 構(gòu)建一個(gè)新的二進(jìn)制打包,在構(gòu)建結(jié)束時(shí),構(gòu)建目錄被刪除 (就好像用了 --clean),源代碼和 spec 文件也被刪除。
SHOWRC
命令
rpmbuild --showrc
將顯示 rpmbuild 使用的,在 rpmrc 和 macros 配置文件中定義的選項(xiàng)的值。
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 數(shù)據(jù)庫
/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 臨時(shí)文件
/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),