如何在非交互模式下重建RPM(rpmrebuild)?

发布于 2025-02-07 00:34:44 字数 1057 浏览 3 评论 0 原文

我需要使用规格文件中的行。

命令:

rpmrebuild --edit-spec --notest-install --package <rpm-name>
Do you want to continue ? (y/N) y
result: <updated-rpm-name>

规格文件中的更改:

rpmbuild -ba&lt; spec -file&gt; 生成的旧规格文件:

Requires: python(abi) = 3.8

一旦运行rpmrebuild,它将打开VI编辑器,我需要在其中修改Spec File,例如这样:

### Comment out this line
# Requires: python(abi) = 3.8 

### Add this line
Requires: rh-python38

问题

如何在非相互作用模式下运行?换句话说,我只想在不打开文件的情况下运行rpmrebuild ,而只需指定命令行本身的更改即可。类似:

rpmrebuild --replace-requires --old-requires=python(abi)=3.8 --new-requires=rh-python38 <rpm-name>

我看到rpmrebuild的插件:

,但我不确定如何在这里使用它。请告诉我。

I need to re-build an RPM using rpmrebuild where I need to modify the Requires: lines in a spec file.

Commands:

rpmrebuild --edit-spec --notest-install --package <rpm-name>
Do you want to continue ? (y/N) y
result: <updated-rpm-name>

Changes in spec file:

Old Spec file generated by rpmbuild -ba <spec-file>:

Requires: python(abi) = 3.8

Once I run rpmrebuild, it opens vi editor, where I need to modify the spec file like this:

### Comment out this line
# Requires: python(abi) = 3.8 

### Add this line
Requires: rh-python38

Issue

How can I do run this in non-interactive mode? In other words, I just want to run rpmrebuild without opening the file and just specify the changes in command line itself. Something like:

rpmrebuild --replace-requires --old-requires=python(abi)=3.8 --new-requires=rh-python38 <rpm-name>

I see plugins for rpmrebuild: https://www.mankier.com/1/rpmrebuild#--change-spec-requires

But I am not sure how can I use it here. Please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江挽川 2025-02-14 00:34:45

我发现了解决方案:

我们可以使用 sed 命令将其替换为 - 更改spec-requires 如下:

rpmrebuild --change-spec-requires='sed "s/Requires:.*python(abi) = 3.8/Requires: rh-python38/g"' --notest-install --package <rpm-name>

this 示例帮助我:

batch change of version tag

rpmrebuild --change-spec-preamble='sed -e "s/^Version:.*/Version: YourVersion/"' YourPackage

I figured out the solution:

We can use sed command to replace and pass it to --change-spec-requires as follows:

rpmrebuild --change-spec-requires='sed "s/Requires:.*python(abi) = 3.8/Requires: rh-python38/g"' --notest-install --package <rpm-name>

This example helped me:

batch change of version tag

rpmrebuild --change-spec-preamble='sed -e "s/^Version:.*/Version: YourVersion/"' YourPackage
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文