centos – How to re-build a RPM (rpmrebuild) in non-interactive mode?

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

Table of Contents


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


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: www.mankier.com/1/rpmrebuild#–change-spec-requires

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

Read more here: Source link