Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-integ / recipes-devtools / rpm / files / 0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch
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
5  environment variable
6
7 This is needed so that rpm can pick up target-specific configuration
8 from target rootfs instead of its own native sysroot.
9
10 Upstream-Status: Inappropriate [oe-core specific]
11 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12 ---
13  lib/rpmrc.c | 19 ++++++++++++++-----
14  1 file changed, 14 insertions(+), 5 deletions(-)
15
16 diff --git a/lib/rpmrc.c b/lib/rpmrc.c
17 index 19fe80f98..6b27b3941 100644
18 --- a/lib/rpmrc.c
19 +++ b/lib/rpmrc.c
20 @@ -455,10 +455,14 @@ const char * lookupInDefaultTable(const char * name,
21  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;
49 @@ -989,7 +993,11 @@ static void read_auxv(void)
50   */
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;
62 @@ -1286,6 +1294,7 @@ static void defaultMachine(rpmrcCtx ctx, const char ** arch, const char ** os)
63  
64      if (arch) *arch = un.machine;
65      if (os) *os = un.sysname;
66 +    free(platform_path);
67  }
68  
69  static
70 -- 
71 2.11.0
72