summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2023-02-21 14:21:14 +0100
committerPanu Matilainen <pmatilai@redhat.com>2023-02-23 13:41:54 +0200
commit6c17e2fbee8ae2aa7ab960a4ede380dfba55e610 (patch)
tree763b7464563b82d1bf8e331499613ea734830a26 /build
parente3c11a790367016aed7ea48cfcc78751a71ce862 (diff)
downloadrpm-6c17e2fbee8ae2aa7ab960a4ede380dfba55e610.tar.gz
Don't repeat %patchN deprecation warning
Avoid flooding the build log for SPECs that contain a lot of these lines, one warning should be enough. Just mention how many were found. Including the line itself in the message is no longer relevant so remove that, too. The cost we pay for having the total count is that we'll no longer log the warning when an RPMLOG_ERR occurs somewhere in the process. Moving it below the exit label would fix that but also cause the warning to always be printed *last*, possibly confusing the user if there's an actual error further up in the output... so just go with the former. Note that we may want to revert this in the future and replace it with a proper rpmlog-native suppression mechanism for duplicate warnings. Fixes: #2383
Diffstat (limited to 'build')
-rw-r--r--build/parsePrep.c9
-rw-r--r--build/rpmbuild_internal.h2
-rw-r--r--build/spec.c1
3 files changed, 9 insertions, 3 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c
index cc97303d3..f8e09a8c7 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -346,10 +346,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
/* Convert %patchN to %patch -PN to simplify further processing */
if (! strchr(" \t\n", line[6])) {
- rpmlog(RPMLOG_WARNING,
- _("%%patchN is deprecated, use %%patch N (or %%patch -P N):\n%s"),
- line);
rasprintf(&buf, "%%patch -P %s", line + 6);
+ spec->numConverted++;
}
poptParseArgvString(buf ? buf : line, &argc, &argv);
@@ -449,6 +447,11 @@ int parsePrep(rpmSpec spec)
}
}
+ if (spec->numConverted)
+ rpmlog(RPMLOG_WARNING,
+ _("%%patchN is deprecated (%i usages found), "
+ "use %%patch N (or %%patch -P N)\n"), spec->numConverted);
+
exit:
argvFree(saveLines);
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index cc3afc0a7..3094b9217 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -151,6 +151,8 @@ struct rpmSpec_s {
StringBuf parsed; /*!< parsed spec contents */
Package packages; /*!< Package list. */
+
+ int numConverted; /*!< no. of automatic %patchN conversions */
};
#define PACKAGE_NUM_DEPS 12
diff --git a/build/spec.c b/build/spec.c
index 1a59266ac..c43124c49 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -231,6 +231,7 @@ rpmSpec newSpec(void)
spec->numSources = 0;
spec->autonum_patch = -1;
spec->autonum_source = -1;
+ spec->numConverted = 0;
spec->sourceRpmName = NULL;
spec->sourcePkgId = NULL;