Issue
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.
Solution
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
Answered By - Puneeth G R Answer Checked By - Dawn Plyler (WPSolving Volunteer)