rpm/0001-Warn-on-undefined-components-in-buildtree-macros.patch

31 lines
1.2 KiB
Diff
Raw Normal View History

From 701736a18a4625557a5181df3a4f3aed7ac13506 Mon Sep 17 00:00:00 2001
Message-Id: <701736a18a4625557a5181df3a4f3aed7ac13506.1587381334.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Wed, 8 Apr 2020 14:38:46 +0300
Subject: [PATCH] Warn on undefined components in buildtree macros
Issue a warning if buildtree macros (%_sourcedir etc) contain undefined
macro(s) after expansion, such as things only defined during spec parse.
This always was a murky case that doesn't work in all scenarios, so
a warning seems appropriate. Actual behavior doesn't change here though.
---
rpmio/rpmfileutil.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rpmio/rpmfileutil.c b/rpmio/rpmfileutil.c
index 84ee34f4d..4a939dbfe 100644
--- a/rpmio/rpmfileutil.c
+++ b/rpmio/rpmfileutil.c
@@ -439,6 +439,8 @@ int rpmMkdirs(const char *root, const char *pathstr)
for (char **d = dirs; *d; d++) {
char *path = rpmGetPath(root ? root : "", *d, NULL);
+ if (strstr(path, "%{"))
+ rpmlog(RPMLOG_WARNING, ("undefined macro(s) in %s: %s\n"), *d, path);
if ((rc = rpmioMkpath(path, 0755, -1, -1)) != 0) {
const char *msg = _("failed to create directory");
/* try to be more informative if the failing part was a macro */
--
2.25.2