Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Fix up platform and related sysinfo file loading. |
| 2 | |
| 3 | Upstream-Status: Pending |
| 4 | |
| 5 | This ensures that RPM knows the compatible set of package types at all times. |
| 6 | |
| 7 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 8 | |
| 9 | Index: rpm-5.4.14/lib/depends.c |
| 10 | =================================================================== |
| 11 | --- rpm-5.4.14.orig/lib/depends.c |
| 12 | +++ rpm-5.4.14/lib/depends.c |
| 13 | @@ -250,7 +250,7 @@ static int rpmtsAddUpgrades(rpmts ts, rp |
| 14 | he->p.ptr = _free(he->p.ptr); |
| 15 | } |
| 16 | |
| 17 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 18 | +#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_OE) |
| 19 | /* |
| 20 | * If we're capable of installing multiple colors |
| 21 | * but at least one of the packages are white (0), we |
| 22 | @@ -507,7 +507,7 @@ assert(lastx >= 0 && lastx < ts->orderCo |
| 23 | return 0; |
| 24 | } |
| 25 | |
| 26 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 27 | +#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_OE) |
| 28 | /* Is "compat" compatible w/ arch? */ |
| 29 | int _isCompatibleArch(const char * arch, const char * compat) |
| 30 | { |
| 31 | @@ -663,7 +663,7 @@ assert(he->p.str != NULL); |
| 32 | |
| 33 | if (arch == NULL || (parch = rpmteA(p)) == NULL) |
| 34 | continue; |
| 35 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 36 | +#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_OE) |
| 37 | /* XXX hackery for alias matching. */ |
| 38 | if (!_isCompatibleArch(arch, parch)) |
| 39 | continue; |
| 40 | @@ -829,6 +829,12 @@ int rpmtsAddEraseElement(rpmts ts, Heade |
| 41 | return rc; |
| 42 | } |
| 43 | |
| 44 | +#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_OE) |
| 45 | +#define _ETC_RPM_SYSINFO "%{_etcrpm}/sysinfo" |
| 46 | +#else |
| 47 | +#define _ETC_RPM_SYSINFO SYSCONFIGDIR "/sysinfo" |
| 48 | +#endif |
| 49 | + |
| 50 | /*@only@*/ /*@null@*/ /*@unchecked@*/ |
| 51 | static char *sysinfo_path = NULL; |
| 52 | |
| 53 | @@ -1311,7 +1317,7 @@ retry: |
| 54 | sysinfo_path = rpmExpand("%{?_rpmds_sysinfo_path}", NULL); |
| 55 | if (!(sysinfo_path != NULL && *sysinfo_path == '/')) { |
| 56 | sysinfo_path = _free(sysinfo_path); |
| 57 | - sysinfo_path = xstrdup(SYSCONFIGDIR "/sysinfo"); |
| 58 | + sysinfo_path = rpmExpand(_ETC_RPM_SYSINFO, NULL); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | Index: rpm-5.4.14/lib/rpmds.c |
| 63 | =================================================================== |
| 64 | --- rpm-5.4.14.orig/lib/rpmds.c |
| 65 | +++ rpm-5.4.14/lib/rpmds.c |
| 66 | @@ -1759,7 +1759,7 @@ int rpmdsSysinfo(rpmPRCO PRCO, const cha |
| 67 | /*@-observertrans @*/ |
| 68 | _sysinfo_path = _free(_sysinfo_path); |
| 69 | /*@=observertrans @*/ |
| 70 | - _sysinfo_path = xstrdup(_ETC_RPM_SYSINFO); |
| 71 | + _sysinfo_path = rpmExpand(_ETC_RPM_SYSINFO, NULL); |
| 72 | } |
| 73 | } |
| 74 | /*@=modobserver@*/ |
| 75 | Index: rpm-5.4.14/lib/rpmrc.c |
| 76 | =================================================================== |
| 77 | --- rpm-5.4.14.orig/lib/rpmrc.c |
| 78 | +++ rpm-5.4.14/lib/rpmrc.c |
| 79 | @@ -38,7 +38,13 @@ |
| 80 | static const char * configTarget = NULL; |
| 81 | |
| 82 | /*@observer@*/ /*@unchecked@*/ |
| 83 | -static const char * platform = SYSCONFIGDIR "/platform"; |
| 84 | +#if defined(RPM_VENDOR_WINDRIVER) |
| 85 | +#define _ETC_RPM_PLATFORM "%{_etcrpm}/platform" |
| 86 | +#else |
| 87 | +#define _ETC_RPM_PLATFORM SYSCONFIGDIR "/platform" |
| 88 | +#endif |
| 89 | + |
| 90 | +static const char * _platform = NULL; |
| 91 | |
| 92 | /*@only@*/ /*@relnull@*/ /*@unchecked@*/ |
| 93 | void * platpat = NULL; |
| 94 | @@ -694,16 +700,17 @@ static void defaultMachine(/*@out@*/ con |
| 95 | int rc; |
| 96 | |
| 97 | while (!gotDefaults) { |
| 98 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 99 | - const char * _platform = rpmGetPath(__etcrpm, "/platform", NULL); |
| 100 | -#else |
| 101 | - const char * _platform = platform; |
| 102 | -#endif |
| 103 | + if (_platform == NULL) { |
| 104 | + _platform = rpmExpand("%{?_rpmrc_platform_path}", NULL); |
| 105 | + /* XXX may need to validate path existence somewhen. */ |
| 106 | + if (!(_platform != NULL && *_platform == '/')) { |
| 107 | + _platform = _free(_platform); |
| 108 | + _platform = rpmExpand(_ETC_RPM_PLATFORM, NULL); |
| 109 | + } |
| 110 | + } |
| 111 | CVOG_t cvog = NULL; |
| 112 | #if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */ |
| 113 | const char *cp; |
| 114 | -#endif |
| 115 | -#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */ |
| 116 | /* utsname fields on some platforms (like HP-UX) are very small |
| 117 | (just about 8 characters). This is too small for OpenPKG, so cheat! */ |
| 118 | rc = uname(&un_real); |
| 119 | @@ -780,9 +787,7 @@ static void defaultMachine(/*@out@*/ con |
| 120 | if (cp != NULL && cp != _platform) |
| 121 | cp = _free(cp); |
| 122 | #endif |
| 123 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 124 | _platform = _free(_platform); |
| 125 | -#endif |
| 126 | |
| 127 | if (configTarget && !parseCVOG(configTarget, &cvog) && cvog != NULL) { |
| 128 | gotDefaults = 1; |
| 129 | @@ -1101,6 +1106,8 @@ int rpmReadConfigFiles(/*@unused@*/ cons |
| 130 | |
| 131 | #ifdef PREMACROFILES |
| 132 | if (rpmReadRC(PREMACROFILES)) return -1; |
| 133 | +#else |
| 134 | + if (rpmReadRC(NULL)) return -1; |
| 135 | #endif |
| 136 | |
| 137 | /* Reset umask to its default umask(2) value. */ |