Bug 8309 - Spec-file patch-macro syntax deprecated in newer versions of rpmbuild
Summary: Spec-file patch-macro syntax deprecated in newer versions of rpmbuild
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Build system (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.17.0
Assignee: Alexander Zeijlon
URL:
Keywords: prosaic, tobfa_tester
Depends on:
Blocks:
 
Reported: 2024-02-12 13:25 CET by Alexander Zeijlon
Modified: 2024-02-23 11:30 CET (History)
1 user (show)

See Also:
Acceptance Criteria:
MUST: * It should be possible to build from cenbuild spec-files where the patch macro is used, with rpm >= 4.14.3 (RHEL 8). * Our cenbuild spec-files should not use patch syntax that was deprecated in rpm 4.18.1. Should: * It should be clear when using our template.spec that we require a certain patch macro syntax.


Attachments

Description Alexander Zeijlon cendio 2024-02-12 13:25:58 CET
When building packages on Fedora 39, which runs rpmbuild version 4.19.1, we get the following deprecation warning:
> RPM build warnings:
>     %patchN is deprecated (1 usages found), use %patch N (or %patch -P N)
The new "%patch N ..." syntax, however, is not valid e.g. on our build server, which runs rpmbuild version 4.14.3.

There is a risk of incompatibility issues when RPM decides to make the old syntax invalid in newer versions of rpmbuild.
Comment 1 Alexander Zeijlon cendio 2024-02-13 13:52:54 CET
RPM has now changed this from a warning to an error as of commit https://github.com/rpm-software-management/rpm/commit/afd35248.
Comment 2 Alexander Zeijlon cendio 2024-02-13 14:00:15 CET
Turns out that the alternate syntax "%patch -P N ..." works with both older and newer versions of rpmbuild, so this might be a way to keep backwards compatibility with our build server.
Comment 5 Alexander Zeijlon cendio 2024-02-22 09:16:33 CET
> MUST:
> * It should be possible to build from cenbuild spec-files where the patch
>   macro is used, with rpm >= 4.14.3 (RHEL 8).
We are still able to build cenbuild packages on RHEL 8 after the applied changes.

We are also able to build cenbuild packages on e.g. Fedora 39 without getting the patch macro deprecation warning after the applied changes.

> * Our cenbuild spec-files should not use patch syntax that was deprecated
>   in rpm 4.18.1.
All instances of %patchN have been replaced with %patch -P N.

> Should:
> * It should be clear when using our template.spec that we require a certain
>   patch macro syntax.
An example of the syntax we require has been added to the template, together with an explanatory comment.
Comment 7 Tobias cendio 2024-02-23 11:30:57 CET
General
=======
Eyeballed the updated instances of %patch and they appear to have been updated correctly, with no remaining instances of the deprecated syntax. Moreover, the template spec file has been updated with a %patch segment, including an informative comment which specifies relevant rpm build versions to keep in mind that will hopefully reduce any confusion in the future.

Tried and succeeded in building a sample package – libtasn1 – with no logged deprecration warnings. In addition, the build server successfully built the whole build system (build #269).

Acceptance criteria
===================
MUST:
✅ It should be possible to build from cenbuild spec-files where the patch macro is used, with rpm >= 4.14.3 (RHEL 8).

✅ Our cenbuild spec-files should not use patch syntax that was deprecated in rpm 4.18.1.

SHOULD:
✅ It should be clear when using our template.spec that we require a certain patch macro syntax.

Conclusion
==========
Patching is working as intended and the acceptance criteria are properly fulfilled. Closing.

Note You need to log in before you can comment on or make changes to this bug.