以下 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 格式使用最广泛。

相关内容