summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch134
1 files changed, 134 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch b/meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch
new file mode 100644
index 0000000000..36190585ca
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-canonarch.patch
@@ -0,0 +1,134 @@
1lib/rpmrc.c: Update --target processing to support full GNU canonical arch
2
3Prior to this patch, when using --target, RPM supported the format:
4 <arch>
5 <arch>-<os>
6 <arch>-<os>-gnu
7 <arch>-<arbitrary items>-<os>
8 <arch>-<arbitrary items>-<os>-gnu
9
10This patch changes the list of supported items to:
11 <arch>
12 <arch>-<os>
13 <arch>-<os>-gnu
14 <arch>-<vendor>-<os>
15 <arch>-<vendor>-<os>-<extension>
16
17Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
18
19Index: rpm-5.4.0/lib/rpmrc.c
20===================================================================
21--- rpm-5.4.0.orig/lib/rpmrc.c 2011-08-10 17:04:35.798814821 -0500
22+++ rpm-5.4.0/lib/rpmrc.c 2011-08-10 17:33:51.505871895 -0500
23@@ -916,8 +916,8 @@
24
25 static void rpmRebuildTargetVars(const char ** target, const char ** canontarget)
26 {
27-
28- char *ca = NULL, *co = NULL, *ct = NULL;
29+ /* ca = arch, cv = vendor, co = os, ce = extension, ct = canon target */
30+ char *ca = NULL, *cv = NULL, *co = NULL, *ce = NULL, *ct = NULL;
31 int x;
32
33 /* Rebuild the compat table to recalculate the current target arch. */
34@@ -927,23 +927,60 @@
35 rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
36
37 if (target && *target) {
38+ /* GNU canonical format is:
39+ * <arch>-<vendor>-<os>[-extension]
40+ *
41+ * We support the both the GNU canonical format
42+ * as well as the traditional RPM formats:
43+ * <arch>
44+ * <arch>-<os>[-gnu]
45+ */
46 char *c;
47 /* Set arch and os from specified build target */
48 ca = xstrdup(*target);
49- if ((c = strchr(ca, '-')) != NULL) {
50+ if ((c = strchr(ca, '-')) == NULL) {
51+ /* Format is <arch> */
52+ ;
53+ } else {
54 *c++ = '\0';
55-
56- if ((co = strrchr(c, '-')) == NULL) {
57- co = c;
58+ cv = c;
59+
60+ if ((c = strchr(c, '-')) == NULL) {
61+ /* Format is <arch>-<os> */
62+ co = cv;
63+ cv = NULL;
64 } else {
65- if (!xstrcasecmp(co, "-gnu"))
66- *co = '\0';
67- if ((co = strrchr(c, '-')) == NULL)
68- co = c;
69- else
70- co++;
71+ *c++ = '\0';
72+ co = c;
73+
74+ if ((c = strchr(c, '-')) == NULL) {
75+ /* Might be:
76+ * <arch>-<vendor>-<os>
77+ * <arch>-<os>-gnu
78+ */
79+ if (!xstrcasecmp(co, "gnu")) {
80+ /* Format was <arch>-<os>-gnu */
81+ ce = co;
82+ co = cv;
83+ cv = NULL;
84+ }
85+ } else {
86+ /* Format was <arch>-<vendor>-<os>-<extension> */
87+ *c++ = '\0';
88+ ce = c;
89+ }
90 }
91+ if (cv != NULL) cv = xstrdup(cv);
92 if (co != NULL) co = xstrdup(co);
93+ if (ce != NULL) {
94+ /* We need to prefix it with a "-" */
95+ char * lce = NULL;
96+
97+ lce = xmalloc(strlen(ce) + sizeof("-"));
98+ sprintf(lce, "-%s", ce);
99+
100+ ce = lce;
101+ }
102 }
103 } else {
104 const char *a = NULL;
105@@ -988,8 +1025,16 @@
106 addMacro(NULL, "_target", NULL, ct, RMIL_RPMRC);
107 delMacro(NULL, "_target_cpu");
108 addMacro(NULL, "_target_cpu", NULL, ca, RMIL_RPMRC);
109+ if (cv) {
110+ delMacro(NULL, "_target_vendor");
111+ addMacro(NULL, "_target_vendor", NULL, cv, RMIL_RPMRC);
112+ }
113 delMacro(NULL, "_target_os");
114 addMacro(NULL, "_target_os", NULL, co, RMIL_RPMRC);
115+ if (ce) {
116+ delMacro(NULL, "_gnu");
117+ addMacro(NULL, "_gnu", NULL, ce, RMIL_RPMRC);
118+ }
119
120 if (canontarget)
121 *canontarget = ct;
122@@ -997,8 +1041,12 @@
123 ct = _free(ct);
124 ca = _free(ca);
125 /*@-usereleased@*/
126+ cv = _free(cv);
127+ /*@-usereleased@*/
128 co = _free(co);
129 /*@=usereleased@*/
130+ ce = _free(ce);
131+ /*@-usereleased@*/
132 }
133
134 void rpmFreeRpmrc(void)