以下 rpm“%prep”步驟的作用是什麼?

以下 rpm“%prep”步驟的作用是什麼?

假設

Source0:        %{gnu_download_url}/coreutils/coreutils-%{version}.tar.gz
Source1:        mk7distro.tar.bz2
Patch0:         hostutils.patch.bz2

%prep有人可以告訴我以下指令在RPM 規範文件部分的作用嗎?

%setup -q -n %{name} -c -a 1

答案1

它是解壓縮原始碼的宏:

the %setup macro is used to unpack the original sources, in preparation for the
build. In its simplest form, the macro is used with no options and gets the name
of the source archive from the source tag specified earlier in the spec file.

答案2

為了更準確地回答問題並提供更新的鏈接,是的,%設定指令將解壓縮 Source1 tarball,但由於指定的選項,它不會解壓縮 Source0 tarball -a 1。該-c選項將導致它將 tarball 解壓縮到根據 命名的子目錄-n %{name},該子目錄來自規範檔案的「Name:」部分。

%setup -q 此指令變更到建置目錄,通常為 /usr/src/redhat/BUILD,然後提取來源檔案。此巨集要求至少一個來源檔案將在 /usr/src/redhat/BUILD 下建立必要的子目錄。此子目錄應以軟體包名稱和版本命名,例如 telnet-1.0.1。如果您沒有使用會自動建立正確子目錄的壓縮 tar 存檔,請將 –c 選項新增至 %setup 巨集中。 –c 選項建立用於提取原始程式碼的子目錄。

%setup 指令可以自動解壓縮 tar、zip、gzip、bzip2、pack、compress 和 lzh 壓縮檔。不過,tar-gzip 格式使用最廣。

相關內容