rpm/backport-Conditionalize-macro-traceback-dump-on-rpm-verbosity.patch
2022-11-07 12:12:55 +08:00

41 lines
1.3 KiB
Diff

From 5bfb49d6b7539691d5ca4b81577082fe27036f24 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 25 Jan 2021 13:38:53 +0200
Subject: [PATCH] Conditionalize macro traceback dump on rpm verbosity level
Only dump out macro tracebacks in verbose mode, which incidentally
rpmbuild normally runs in.
Sadly our tracebacks are not as useful as they could be, but improving
that is a separate topic...
---
rpmio/macro.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/rpmio/macro.c b/rpmio/macro.c
index a342b2403..6b53c6e2e 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -458,7 +458,6 @@ expandMacro(macroBuf mk, const char *src, size_t slen)
mbErr(mb, 1,
_("Too many levels of recursion in macro expansion. It is likely caused by recursive macro declaration.\n"));
mb->depth--;
- mb->expand_trace = 1;
goto exit;
}
@@ -471,7 +470,9 @@ expandMacro(macroBuf mk, const char *src, size_t slen)
mb->buf[mb->tpos] = '\0';
mb->depth--;
- if (mb->error != 0 || mb->expand_trace)
+ if (mb->error && rpmIsVerbose())
+ mb->expand_trace = 1;
+ if (mb->expand_trace)
printExpansion(mb, mb->buf+tpos, mb->buf+mb->tpos);
mb->macro_trace = store_macro_trace;
mb->expand_trace = store_expand_trace;
--
2.27.0