我需要一个适用于我的 RHEL/EPEL/CentOS/Fedora 版本的软件包,但它仅适用于其他版本的 Redhatoids

我需要一个适用于我的 RHEL/EPEL/CentOS/Fedora 版本的软件包,但它仅适用于其他版本的 Redhatoids

我经常遇到这样的情况:将一些 Fedora 打包的软件向后移植到 CentOS,或者将某些东西从旧版本的 EPEL 向前移植到 Fedora,反之亦然。

我怎样才能用最少的努力做到这一点?

答案1

从本质上讲,这就是 distgit 的用途:保持包规范的协调和可用。那么,让我们使用它吧。

我们需要设置我们的系统才能构建包:

# only on CentOS and other RHEL derivatives:
sudo dnf install 'dnf-command(config-manager)'
sudo dnf config-manager --set-enabled powertools
sudo dnf install --refresh epel-release 
# all:
sudo dnf install --refresh fedpkg 'dnf-command(builddep)' git

首先,找到您的包裹https://src.fedoraproject.org/browse/projects/。我使用guile22作为一个例子:

太棒了,现在我们已经拥有了构建包所需的一切!让我们去guile22分布式站点正如我们通过搜索找到的那样,然后单击“克隆”按钮;我们会看到 URL https://src.fedoraproject.org/rpms/guile22.git

pkgname=guile22
# clone the distgit
git clone "https://src.fedoraproject.org/rpms/${pkgname}.git"
cd "${pkgname}"

## Ask dnf to install build dependencies
### if this fails, read diligently – packages might have changed names and you might
### need to slightly edit the .spec file, or you might need to build the missing 
### dependencies yourself, just like you're building this package, before you can
### continue.
sudo dnf builddep "${pkgname}.spec"

## build
### `fedpkg local` executes the build "unisolatedly" on this very distro.
### Instead of that, you could also omit the `dnf builddep` step above and do a
### `fedpkg mockbuild`. This will take a bit longer, as it needs to set up a clean
### build chroot. Often it's worth it.
fedpkg local
## install
### `fedpkg local` put the RPMs into $arch subdirs, so on my machine those are `x86_64`
### and `noarch`, but if you build for e.g. ppc64, that might be different.
sudo rpm -i x86_64/${pkgname}-*.rpm

就是这样!

相关内容