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

41zrol4v  于 2022-11-23  发布在  其他
关注(0)|答案(1)|浏览(263)

我需要使用rpmrebuild重新构建RPM,其中我需要修改spec文件中的Requires:行。

命令:

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

规格文件中的更改:

rpmbuild -ba <spec-file>生成的旧规格文件:

Requires: python(abi) = 3.8

运行rpmrebuild后,它将打开vi编辑器,我需要在其中修改spec文件,如下所示:

### 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的插件:https://www.mankier.com/1/rpmrebuild#--change-spec-requires
但是我不确定在这里怎么用,请告诉我。

qpgpyjmq

qpgpyjmq1#

我想出了解决办法:
我们可以使用sed命令将其替换并传递给--change-spec-requires,如下所示:

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

这个example帮助我:

batch change of version tag

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

相关问题