Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Fix up platform and related sysinfo file loading (part 2). |
| 2 | |
| 3 | Upstream-Status: Pending |
| 4 | |
| 5 | We need to ensure that we set the _gnu flag somehow. We do this by reading |
| 6 | from the platform file, and setting a new _platform_gnu and related vars. |
| 7 | |
| 8 | The default values of _host_cpu, _host_vendor and _host_os are changed to |
| 9 | reference either the automatically determined _target_... or _platform_... |
| 10 | values. The macros file uses the configure time defaults in _platform_... |
| 11 | versions have not been defined. This preserves existing behavior, but |
| 12 | ensures reasonable defaults are always available. |
| 13 | |
| 14 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> |
| 15 | |
| 16 | Index: rpm-5.4.14/lib/rpmrc.c |
| 17 | =================================================================== |
| 18 | --- rpm-5.4.14.orig/lib/rpmrc.c |
| 19 | +++ rpm-5.4.14/lib/rpmrc.c |
| 20 | @@ -328,10 +328,15 @@ static void setDefaults(void) |
| 21 | /*@modifies rpmGlobalMacroContext, internalState @*/ |
| 22 | { |
| 23 | |
| 24 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 25 | +#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_OE) |
| 26 | addMacro(NULL, "_usrlibrpm", NULL, __usrlibrpm, RMIL_DEFAULT); |
| 27 | addMacro(NULL, "_etcrpm", NULL, __etcrpm, RMIL_DEFAULT); |
| 28 | addMacro(NULL, "_vendor", NULL, "%{?_host_vendor}%{!?_host_vendor:wrs}", RMIL_DEFAULT); |
| 29 | + |
| 30 | + addMacro(NULL, "_host_cpu", NULL, "%{?_platform_cpu}%{!?_platform_cpu:%{?_target_cpu}}", RMIL_DEFAULT); |
| 31 | + addMacro(NULL, "_host_vendor", NULL, "%{?_platform_vendor}%{!?_platform_cpu:%{?_target_vendor}}", RMIL_DEFAULT); |
| 32 | + addMacro(NULL, "_host_os", NULL, "%{?_platform_os}%{!?_platform_os:%{?_target_os}}", RMIL_DEFAULT); |
| 33 | + addMacro(NULL, "_host_gnu", NULL, "%{?_platform_gnu}%{!?_platform_gnu:%{?_gnu}}", RMIL_DEFAULT); |
| 34 | #endif |
| 35 | |
| 36 | addMacro(NULL, "_usr", NULL, USRPREFIX, RMIL_DEFAULT); |
| 37 | @@ -487,9 +492,22 @@ static rpmRC rpmPlatform(const char * pl |
| 38 | } |
| 39 | |
| 40 | if (!parseCVOG(p, &cvog) && cvog != NULL) { |
| 41 | +#if defined(RPM_VENDOR_OE) |
| 42 | + char * _gnu = NULL; |
| 43 | + |
| 44 | + addMacro(NULL, "_platform_cpu", NULL, cvog->cpu, -1); |
| 45 | + addMacro(NULL, "_platform_vendor", NULL, cvog->vendor, -1); |
| 46 | + addMacro(NULL, "_platform_os", NULL, cvog->os, -1); |
| 47 | + |
| 48 | + if (cvog->gnu && cvog->gnu[0] != '\0') |
| 49 | + _gnu = rpmExpand("-", cvog->gnu, NULL); |
| 50 | + |
| 51 | + addMacro(NULL, "_platform_gnu", NULL, (_gnu ? _gnu : ""), -1); |
| 52 | +#else |
| 53 | addMacro(NULL, "_host_cpu", NULL, cvog->cpu, -1); |
| 54 | addMacro(NULL, "_host_vendor", NULL, cvog->vendor, -1); |
| 55 | addMacro(NULL, "_host_os", NULL, cvog->os, -1); |
| 56 | +#endif |
| 57 | } |
| 58 | |
| 59 | #if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */ |
| 60 | Index: rpm-5.4.14/macros/macros.in |
| 61 | =================================================================== |
| 62 | --- rpm-5.4.14.orig/macros/macros.in |
| 63 | +++ rpm-5.4.14/macros/macros.in |
| 64 | @@ -900,9 +900,9 @@ $_arbitrary_tags_tests Foo:Bar |
| 65 | %_os @RPMCANONOS@ |
| 66 | %_gnu @RPMCANONGNU@ |
| 67 | |
| 68 | -%_host_platform %{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu} |
| 69 | -%_build_platform %{_build_cpu}-%{_build_vendor}-%{_build_os}%{?_gnu} |
| 70 | -%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_gnu} |
| 71 | +%_host_platform %{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}} |
| 72 | +%_build_platform %{_build_cpu}-%{_build_vendor}-%{_build_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}} |
| 73 | +%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}} |
| 74 | |
| 75 | #============================================================================== |
| 76 | # ---- configure macros. |
| 77 | @@ -945,9 +945,10 @@ $_arbitrary_tags_tests Foo:Bar |
| 78 | %_build_os %{_host_os} |
| 79 | %_host @host@ |
| 80 | %_host_alias @host_alias@%{nil} |
| 81 | -%_host_cpu @host_cpu@ |
| 82 | -%_host_vendor @host_vendor@ |
| 83 | -%_host_os @host_os@ |
| 84 | +%_host_cpu %{?_platform_cpu}%{!?_platform_cpu:%{_arch}} |
| 85 | +%_host_vendor %{?_platform_vendor}%{!?_platform_vendor:%{_vendor}} |
| 86 | +%_host_os %{?_platform_os}%{!?_platform_os:%{_os}} |
| 87 | +%_host_gnu %{?_platform_gnu}%{!?_platform_gnu:%{_gnu}} |
| 88 | %_target %{_host} |
| 89 | %_target_alias %{_host_alias} |
| 90 | %_target_cpu %{_host_cpu} |
| 91 | Index: rpm-5.4.14/python/rpmmodule.c |
| 92 | =================================================================== |
| 93 | --- rpm-5.4.14.orig/python/rpmmodule.c |
| 94 | +++ rpm-5.4.14/python/rpmmodule.c |
| 95 | @@ -65,8 +65,8 @@ static PyObject * archScore(PyObject * s |
| 96 | if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &arch)) |
| 97 | return NULL; |
| 98 | |
| 99 | -#if defined(RPM_VENDOR_WINDRIVER) |
| 100 | - platform = rpmExpand(arch, "-%{_host_vendor}", "-%{_host_os}%{?_gnu}", NULL); |
| 101 | +#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_OE) |
| 102 | + platform = rpmExpand(arch, "-%{_host_vendor}", "-%{_host_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}}", NULL); |
| 103 | #else |
| 104 | platform = rpmExpand(arch, "-", "%{_vendor}", "-", "%{_os}", NULL); |
| 105 | #endif |