|
用 RPM 行话来讲,“python3” 是“主包”,因此该 spec 文件将称为 python3.spec。所有其他软件包均为“子软件包”。你可以下载 python3 的源 RPM,并查看其中的内容。(提示:补丁也是源代码的一部分):
$ dnf download --source python3python3-3.7.4-1.fc30.src.rpm-
$ rpm -qpl ./python3-3.7.4-1.fc30.src.rpm00001-rpath.patch00102-lib64.patch00111-no-static-lib.patch00155-avoid-ctypes-thunks.patch00170-gc-assertions.patch00178-dont-duplicate-flags-in-sysconfig.patch00189-use-rpm-wheels.patch00205-make-libpl-respect-lib64.patch00251-change-user-install-location.patch00274-fix-arch-names.patch00316-mark-bdist_wininst-unsupported.patchPython-3.7.4.tar.xzcheck-pyc-timestamps.pyidle3.appdata.xmlidle3.desktoppython3.spec
从源 RPM 构建 RPM
现在我们有了源 RPM,并且其中有什么内容,我们可以从中重建 RPM。但是,在执行此操作之前,我们应该设置系统以构建 RPM。首先,我们安装必需的工具:
$ sudo dnf install fedora-packager
这将安装 rpmbuild 工具。rpmbuild 需要一个默认布局,以便它知道源 RPM 中每个必需组件的位置。让我们看看它们是什么:
# spec 文件将出现在哪里?$ rpm -E %{_specdir}/home/asinha/rpmbuild/SPECS-
# 源代码将出现在哪里?$ rpm -E %{_sourcedir}/home/asinha/rpmbuild/SOURCES-
# 临时构建目录是哪里?$ rpm -E %{_builddir}/home/asinha/rpmbuild/BUILD-
# 构建根目录是哪里?$ rpm -E %{_buildrootdir}/home/asinha/rpmbuild/BUILDROOT-
# 源 RPM 将放在哪里?$ rpm -E %{_srcrpmdir}/home/asinha/rpmbuild/SRPMS-
# 构建的 RPM 将放在哪里?$ rpm -E %{_rpmdir}/home/asinha/rpmbuild/RPMS
我已经在系统上设置了所有这些目录:
$ cd$ tree -L 1 rpmbuild/rpmbuild/├── BUILD├── BUILDROOT├── RPMS├── SOURCES├── SPECS└── SRPMS-
6 directories, 0 files
RPM 还提供了一个为你全部设置好的工具:
$ rpmdev-setuptree
然后,确保已安装 fpaste 的所有构建依赖项:
sudo dnf builddep fpaste-0.3.9.2-3.fc30.src.rpm
对于 fpaste,你只需要 Python,并且它肯定已经安装在你的系统上(dnf 也使用 Python)。还可以给 builddep 命令一个 spec 文件,而不是源 RPM。在手册页中了解更多信息:
$ man dnf.plugin.builddep
现在我们有了所需的一切,从源 RPM 构建一个 RPM 就像这样简单:
$ rpmbuild --rebuild fpaste-0.3.9.2-3.fc30.src.rpm....-
$ tree ~/rpmbuild/RPMS/noarch//home/asinha/rpmbuild/RPMS/noarch/└── fpaste-0.3.9.2-3.fc30.noarch.rpm-
0 directories, 1 file
(编辑:92站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|