Improve newly added %patch warning/error messages

Related: RHEL-6294
This commit is contained in:
Michal Domonkos 2024-11-06 16:53:30 +01:00
parent 216e684ef4
commit bcc1f9de8e
2 changed files with 55 additions and 3 deletions

View File

@ -1,7 +1,7 @@
From 2931047efc31f1288788bcdc8bd1d00b53cb9c76 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 30 Mar 2022 11:02:23 +0300
Subject: [PATCH 1/2] Issue warning on implicit "%patch zero" variants,
Subject: [PATCH 1/3] Issue warning on implicit "%patch zero" variants,
sanitize semantics
Supporting `%patch` with no number specified, in particular combinations
@ -82,7 +82,7 @@ index d92e5cdf0..533de8a2c 100644
From a8e821ff5c126613e13277bfd8b2050b71d1ea4e Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Fri, 9 Aug 2024 11:57:47 +0200
Subject: [PATCH 2/2] Safeguard against silent Patch0 omission
Subject: [PATCH 2/3] Safeguard against silent Patch0 omission
Commit 02b8d8dccc0f045b0ebf81785cf6ad1056cf550e fixed %patch so that it
no longer applies Patch0 implicitly when used without the -P option. A
@ -177,3 +177,51 @@ index 6d402319f..72f0d25bd 100644
--
2.47.0
From 896c7e37d65b1019cc179abcf9524807ba2006d2 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Wed, 6 Nov 2024 16:10:53 +0100
Subject: [PATCH 3/3] Improve newly added %patch warning/error messages
Make it obvious that the numberless %patch syntax is now *deprecated*
(and thus no longer works in RHEL-10).
Also suggest an actual fix to the user (in both messages), much like we
have for the %patchN warning in RPM 4.19 (see commit
eb5ece1267a22330f6116149997cf5cc1c22b21f).
Kudos to Eva Mrakova for noticing & suggesting this.
Related: RHEL-6294
---
build/parsePrep.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/build/parsePrep.c b/build/parsePrep.c
index 9d64c2141..63014ea89 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -455,7 +455,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
argvAppend(&patchnums, (ARGV_const_t) poptGetArgs(optCon));
if (argvCount(patchnums) == 0) {
- rpmlog(RPMLOG_WARNING, _("Patch number not specified: %s\n"), line);
+ rpmlog(RPMLOG_WARNING, _("%%patch (without a number) is deprecated, "
+ "add 0 (or -P 0): %s\n"), line);
argvAdd(&patchnums, "0");
}
@@ -524,8 +525,8 @@ int parsePrep(rpmSpec spec)
if (spec->patch0_implicit && !spec->patch0_explicit &&
findSource(spec, 0, RPMBUILD_ISPATCH)) {
- rpmlog(RPMLOG_ERR, _("Patch0 no longer applied implicitly, pass 0 or -P0: %s\n"),
- spec->patch0_implicit);
+ rpmlog(RPMLOG_ERR, _("%%patch N no longer applies Patch0 implicitly, "
+ "add 0 (or -P 0): %s\n"), spec->patch0_implicit);
res = PART_ERROR;
goto exit;
}
--
2.47.0

View File

@ -32,7 +32,7 @@
%global rpmver 4.16.1.3
#global snapver rc1
%global rel 35
%global rel 36
%global sover 9
%global srcver %{rpmver}%{?snapver:-%{snapver}}
@ -666,8 +666,12 @@ fi
%doc doc/librpm/html/*
%changelog
* Wed Nov 06 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-36
- Improve newly added %%patch warning/error messages (RHEL-6294)
* Wed Oct 16 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-35
- Fix %%patch N applying Patch0 implicitly (RHEL-6294)
- Issue deprecation warning for number-less %%patch (RHEL-6294)
* Tue Aug 13 2024 Michal Domonkos <mdomonko@redhat.com> - 4.16.1.3-34
- Fix discarded const qualifier in previous patch (RHEL-22607)