Warn on undefined macros in buildtree setup macros (#1820349)

This commit is contained in:
Panu Matilainen 2020-04-20 14:18:05 +03:00
parent b48020478b
commit 9f5580ba45
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,30 @@
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

View File

@ -25,7 +25,7 @@
%global rpmver 4.15.90 %global rpmver 4.15.90
%global snapver git14971 %global snapver git14971
%global rel 5 %global rel 6
%global srcver %{version}%{?snapver:-%{snapver}} %global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x} %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -60,6 +60,7 @@ Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
Patch100: 0001-Unset-SOURCE_DATE_EPOCH-for-the-test-suite.patch Patch100: 0001-Unset-SOURCE_DATE_EPOCH-for-the-test-suite.patch
Patch101: 0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch Patch101: 0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch
Patch102: 0001-Fix-regression-causing-all-ELF-files-classified-as-O.patch Patch102: 0001-Fix-regression-causing-all-ELF-files-classified-as-O.patch
Patch103: 0001-Warn-on-undefined-components-in-buildtree-macros.patch
# These are not yet upstream # These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch Patch906: rpm-4.7.1-geode-i686.patch
@ -525,6 +526,9 @@ make check || (cat tests/rpmtests.log; exit 1)
%doc doc/librpm/html/* %doc doc/librpm/html/*
%changelog %changelog
* Fri Apr 20 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.6
- Warn on undefined macros in buildtree setup macros (#1820349)
* Thu Apr 09 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.5 * Thu Apr 09 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.5
- Fix regression causing all ELF files classified as OCaml - Fix regression causing all ELF files classified as OCaml