1 From 383c0b097b7eba16801a9e3c4b8e36a4b6de74ab Mon Sep 17 00:00:00 2001
2 From: Alexander Kanavin <alex.kanavin@gmail.com>
3 Date: Fri, 20 Jan 2017 13:33:05 +0200
4 Subject: [PATCH 2/2] Add support for prefixing /etc from RPM_ETCCONFIGDIR
7 This is needed so that rpm can pick up target-specific configuration
8 from target rootfs instead of its own native sysroot.
10 Upstream-Status: Inappropriate [oe-core specific]
11 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13 lib/rpmrc.c | 19 ++++++++++++++-----
14 1 file changed, 14 insertions(+), 5 deletions(-)
16 diff --git a/lib/rpmrc.c b/lib/rpmrc.c
17 index 19fe80f98..6b27b3941 100644
20 @@ -455,10 +455,14 @@ const char * lookupInDefaultTable(const char * name,
21 static void setDefaults(void)
23 const char *confdir = rpmConfigDir();
24 + const char *etcconfdir = getenv("RPM_ETCCONFIGDIR");
25 + if (etcconfdir == NULL)
29 defrcfiles = rstrscat(NULL, confdir, "/rpmrc", ":",
30 confdir, "/" RPMCANONVENDOR "/rpmrc", ":",
31 - SYSCONFDIR "/rpmrc", ":");
32 + etcconfdir, SYSCONFDIR "/rpmrc", ":", NULL);
36 @@ -468,9 +472,9 @@ static void setDefaults(void)
37 confdir, "/platform/%{_target}/macros", ":",
38 confdir, "/fileattrs/*.attr", ":",
39 confdir, "/" RPMCANONVENDOR "/macros", ":",
40 - SYSCONFDIR "/rpm/macros.*", ":",
41 - SYSCONFDIR "/rpm/macros", ":",
42 - SYSCONFDIR "/rpm/%{_target}/macros", ":");
43 + etcconfdir, SYSCONFDIR "/rpm/macros.*", ":",
44 + etcconfdir, SYSCONFDIR "/rpm/macros", ":",
45 + etcconfdir, SYSCONFDIR "/rpm/%{_target}/macros", ":", NULL);
48 macrofiles = MACROFILES;
49 @@ -989,7 +993,11 @@ static void read_auxv(void)
51 static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
53 - const char * const platform_path = SYSCONFDIR "/rpm/platform";
54 + const char *etcconfdir = getenv("RPM_ETCCONFIGDIR");
55 + if (etcconfdir == NULL)
58 + const char * const platform_path = rstrscat(NULL, etcconfdir, SYSCONFDIR "/rpm/platform", NULL);
59 static struct utsname un;
62 @@ -1286,6 +1294,7 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
64 if (arch) *arch = un.machine;
65 if (os) *os = un.sysname;
66 + free(platform_path);