blob: 2fe96a839c3464d44ad69d58ac53d2c916281551 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 383c0b097b7eba16801a9e3c4b8e36a4b6de74ab Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 20 Jan 2017 13:33:05 +0200
4Subject: [PATCH 2/2] Add support for prefixing /etc from RPM_ETCCONFIGDIR
5 environment variable
6
7This is needed so that rpm can pick up target-specific configuration
8from target rootfs instead of its own native sysroot.
9
10Upstream-Status: Inappropriate [oe-core specific]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 lib/rpmrc.c | 19 ++++++++++++++-----
14 1 file changed, 14 insertions(+), 5 deletions(-)
15
Andrew Geissler87f5cff2022-09-30 13:13:31 -050016Index: git/lib/rpmrc.c
17===================================================================
18--- git.orig/lib/rpmrc.c
19+++ git/lib/rpmrc.c
20@@ -455,10 +455,14 @@ const char * lookupInDefaultTable(const
Brad Bishop6e60e8b2018-02-01 10:27:11 -050021 static void setDefaults(void)
22 {
23 const char *confdir = rpmConfigDir();
24+ const char *etcconfdir = getenv("RPM_ETCCONFIGDIR");
25+ if (etcconfdir == NULL)
26+ etcconfdir = "";
27+
28 if (!defrcfiles) {
29 defrcfiles = rstrscat(NULL, confdir, "/rpmrc", ":",
30 confdir, "/" RPMCANONVENDOR "/rpmrc", ":",
31- SYSCONFDIR "/rpmrc", ":");
32+ etcconfdir, SYSCONFDIR "/rpmrc", ":", NULL);
33 }
34
35 #ifndef MACROFILES
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);
46 }
47 #else
48 macrofiles = MACROFILES;
Andrew Geissler87f5cff2022-09-30 13:13:31 -050049@@ -997,7 +1001,11 @@ static void read_auxv(void)
Brad Bishop6e60e8b2018-02-01 10:27:11 -050050 */
51 static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
52 {
53- const char * const platform_path = SYSCONFDIR "/rpm/platform";
54+ const char *etcconfdir = getenv("RPM_ETCCONFIGDIR");
55+ if (etcconfdir == NULL)
56+ etcconfdir = "";
57+
58+ const char * const platform_path = rstrscat(NULL, etcconfdir, SYSCONFDIR "/rpm/platform", NULL);
59 static struct utsname un;
60 char * chptr;
61 canonEntry canon;
Andrew Geissler87f5cff2022-09-30 13:13:31 -050062@@ -1307,6 +1315,7 @@ static void defaultMachine(rpmrcCtx ctx,
Brad Bishop6e60e8b2018-02-01 10:27:11 -050063
64 if (arch) *arch = un.machine;
65 if (os) *os = un.sysname;
66+ free(platform_path);
67 }
68
69 static