日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux 命令之 rpmbuild -- 用于创建 rpm 格式的二进制软件包和源码软件包

發布時間:2023/12/3 linux 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux 命令之 rpmbuild -- 用于创建 rpm 格式的二进制软件包和源码软件包 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 一、命令介紹
  • 二、命令選項
    • (一)從 specfile 建立
    • (二)從 tarball 包建立
    • (三)從 source package 包建立
    • (四)其它選項
    • (五)所有 rpm 都可使用的選項
    • (六)附加選項
    • (七)幫助選項
  • 三、命令示例
    • (一)根據配置文件對源碼包進一步解壓,得到最終的源碼文件

一、命令介紹

命令 rpmbuild 用于創建 RPM 軟件包和 SRPM 軟件包,這兩類軟件包分別是 rpm 格式的二進制軟件包和源碼軟件包

二、命令選項

Build options with [ <specfile> | <tarball> | <source package> ]

中文譯為:通過配置文件或 tar.gz 格式的源碼包或者 rpm 格式的源碼包來構建

(一)從 specfile 建立

選項說明
-bpbuild through %prep (unpack sources and apply patches) from <specfile>.
譯文:從 specfile 文件的 %prep 開始建立(解開源碼包并打補丁),只作準備,解壓與打補丁
-bcbuild through %build (%prep, then compile) from <specfile>.
譯文:從文件的 %build 開始建立(解開源碼包、打補丁、編譯)
-bibuild through %install (%prep, %build, then install) from <specfile>
譯文:從文件的 %install 開始建立(解開源碼包、打補丁、編譯、安裝)
-blverify %files section from <specfile>.
譯文:檢查文件的 %files 段,檢驗文件是否齊全
-babuild source and binary packages from <specfile>.
譯文:創建源碼包(SRPM)和二進制包(RPM)
-bbbuild binary package only from <specfile>.
譯文:只構建二進制包
-bsbuild source package only from <specfile>.
譯文:只建立源碼包(SRPM)

(二)從 tarball 包建立

這個 tarball 應該是以 .tar 為后綴名的包。

選項說明
-tpbuild through %prep (unpack sources and apply patches) from <tarball>.
譯文:從 tar 包的 %prep 開始構建(解開源碼包并打補丁)
-tcbuild through %build (%prep, then compile) from <tarball>.
譯文:從 tar 包的 %build 開始建立(解開源碼包、打補丁、編譯)
-tibuild through %install (%prep, %build, then install) from <tarball>.
譯文:從 tar 包的 %install 開始建立(解開源碼包、打補丁、編譯、安裝)
-tabuild source and binary packages from <tarball>.
譯文:從 tar 包建立源碼包和二進制包
-tbbuild binary package only from <tarball>.
譯文:只建立二進制包
-tsbuild source package only from <tarball>.
譯文:只建立源碼包

(三)從 source package 包建立

這個源碼包,應該是以 .tar.gz 為后綴名的包。

選項說明
--rebuildbuild binary package from <source package>.
譯文:基于源碼包建立二進制包(*.rpm)
--recompilebuild through %install (%prep, %build, then install) from <source package>.
譯文:基于源碼包的 %install 開始建立(解開源碼包、打補丁、編譯、安裝)

(四)其它選項

選項說明
--buildroot<DIRECTORY>override build root. 重寫生成根目錄
--cleanremove build tree when done. 完成打包后清除 BUILD下的文件目錄
--nobuilddo not execute any stages of the build. 不進行 BUILD 的階段
--nodepsdo not verify build dependencies. 不檢查建立包時的關聯文件
--nodirtokensgenerate package header(s) compatible with (legacy) rpm[23] packaging. 生成與(傳統)rpm[23]打包兼容的包頭
--rmsourceremove sources when done. 完成打包后清除 sources
--rmspecremove specfile when done. 完成打包后清除 specfile
--short-circuitskip straight to specified stage (only for c,i). 直接跳到指定的階段(僅適用于c、i)
--target<CPU-VENDOR-OS>override target platform. 覆蓋目標平臺,確定包的最終使用平臺

(五)所有 rpm 都可使用的選項

Common options for all rpm modes.

選項說明
-D 或 --define<宏表達式>define MACRO with value EXPR. 用值表達式定義宏
-E 或 --eval<表達式>print macro expansion of EXPR. 打印表達式的宏擴展
--macros<filename>read instead of default file(s). 讀取而不是默認文件
--nodigestdon’t verify package digest(s). 不驗證包摘要,不檢查包的說明信息
--nosignaturedon’t verify package signature(s). 不檢查包的簽名信息
--rcfile<filename>read instead of default file(s). 讀 文件代替默認文件
-r 或 --root<ROOT>use ROOT as top level directory (default: “/”). 使用根目錄作為頂級目錄(默認值:“/”)
--querytagsdisplay known query tags. 顯示已知查詢標記
--showrcdisplay final rpmrc and macro configuration. 顯示最終的rpmrc和宏配置
--quietprovide less detailed output. 提供不太詳細的輸出
-v 或 --verboseprovide more detailed output. 提供大量的詳細的信息
--versionprint the version of rpm being used. 顯示rpm包的版本

(六)附加選項

Options implemented via popt alias/exec. 通過popt alias/exec實現的選項

選項說明
--dbpath<目錄>use database in DIRECTORY. 使用目錄中的數據庫
--with<選項>enable configure for build. 建立時允許配置的選項
--without<選項>disable configure for build. 建立時不允許配置的選項

(七)幫助選項

Help options.

選項說明
-? 或 --helpShow this help message. 顯示幫助信息
--usageDisplay brief usage message. 顯示使用方法的信息

三、命令示例

(一)根據配置文件對源碼包進一步解壓,得到最終的源碼文件

這個最終的源碼文件應該是存放在目錄 BUILD 下。

先切換到目錄 SPECS 下:

[root@localhost ~]# cd /root/rpmbuild/SPECS

選項 -bp 會根據配置文件對 SOURCES 目錄下源碼包進一步解壓:

rpmbuild -bp httpd.specs

欲了解命令 rpmbuild 在安裝 SRPM 軟件包的實際使用,猛戳《Linux 如何安裝 SRPM 包》

總結

以上是生活随笔為你收集整理的Linux 命令之 rpmbuild -- 用于创建 rpm 格式的二进制软件包和源码软件包的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。