diff options
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm')
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch b/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch new file mode 100644 index 0000000000..e4db0e4211 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/rpm-scriptletexechelper.patch | |||
@@ -0,0 +1,159 @@ | |||
1 | Enable a cross-install scriptlet helper. | ||
2 | |||
3 | The helper is called from outside of the chroot with the arguments: | ||
4 | |||
5 | <root> <prog> <script> <arg1> [<arg2> ... <argN>] | ||
6 | |||
7 | The helper script is used by oe-core to facilitate shell script actions that | ||
8 | can not be run from within a chroot on a foreign target system during a | ||
9 | cross install. | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
14 | |||
15 | diff -ur rpm-5.4.0.orig/lib/psm.c rpm-5.4.0/lib/psm.c | ||
16 | --- rpm-5.4.0.orig/lib/psm.c 2010-12-29 07:42:11.000000000 -0600 | ||
17 | +++ rpm-5.4.0/lib/psm.c 2011-11-08 13:38:48.132791154 -0600 | ||
18 | @@ -792,6 +792,10 @@ | ||
19 | int xx; | ||
20 | int i; | ||
21 | |||
22 | +#ifdef RPM_VENDOR_POKY | ||
23 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
24 | +#endif | ||
25 | + | ||
26 | if (psm->sstates != NULL && ix >= 0 && ix < RPMSCRIPT_MAX) | ||
27 | ssp = psm->sstates + ix; | ||
28 | if (ssp != NULL) | ||
29 | @@ -858,14 +862,29 @@ | ||
30 | (F_ISSET(psm, UNORDERED) ? "a" : "")); | ||
31 | |||
32 | if (Phe->p.argv == NULL) { | ||
33 | - argv = alloca(5 * sizeof(*argv)); | ||
34 | - argv[0] = "/bin/sh"; | ||
35 | - argc = 1; | ||
36 | + argv = alloca(7 * sizeof(*argv)); | ||
37 | + argc = 0; | ||
38 | + } else { | ||
39 | + argv = alloca((Phe->c + 6) * sizeof(*argv)); | ||
40 | + argc = 0; | ||
41 | + } | ||
42 | + | ||
43 | +#ifdef RPM_VENDOR_POKY | ||
44 | + if (scriptletWrapper && *scriptletWrapper) { | ||
45 | + argv[argc++] = scriptletWrapper; | ||
46 | + argv[argc] = rpmtsRootDir(ts); | ||
47 | + if (!argv[argc] || !*argv[argc]) | ||
48 | + argv[argc] = "/"; | ||
49 | + argc++; | ||
50 | + } | ||
51 | +#endif | ||
52 | + | ||
53 | + if (Phe->p.argv == NULL) { | ||
54 | + argv[argc++] = "/bin/sh"; | ||
55 | ldconfig_done = 0; | ||
56 | } else { | ||
57 | - argv = alloca((Phe->c + 4) * sizeof(*argv)); | ||
58 | - memcpy(argv, Phe->p.argv, Phe->c * sizeof(*argv)); | ||
59 | - argc = Phe->c; | ||
60 | + memcpy((argv + argc), Phe->p.argv, Phe->c * sizeof(*argv)); | ||
61 | + argc += Phe->c; | ||
62 | ldconfig_done = (ldconfig_path && !strcmp(argv[0], ldconfig_path) | ||
63 | ? 1 : 0); | ||
64 | } | ||
65 | @@ -916,7 +935,12 @@ | ||
66 | goto exit; | ||
67 | |||
68 | if (rpmIsDebug() && | ||
69 | - (!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash"))) | ||
70 | + (!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")) | ||
71 | +#ifdef RPM_VENDOR_POKY | ||
72 | + || (scriptletWrapper && *scriptletWrapper && !strcmp(argv[1], "/bin/sh")) | ||
73 | + || (scriptletWrapper && *scriptletWrapper && !strcmp(argv[1], "/bin/bash")) | ||
74 | +#endif | ||
75 | + ) | ||
76 | { | ||
77 | static const char set_x[] = "set -x\n"; | ||
78 | nw = Fwrite(set_x, sizeof(set_x[0]), sizeof(set_x)-1, fd); | ||
79 | @@ -1051,12 +1075,22 @@ | ||
80 | |||
81 | { const char * rootDir = rpmtsRootDir(ts); | ||
82 | if (!rpmtsChrootDone(ts) && rootDir != NULL && | ||
83 | +#ifdef RPM_VENDOR_POKY | ||
84 | + !(scriptletWrapper && *scriptletWrapper) && | ||
85 | +#endif | ||
86 | !(rootDir[0] == '/' && rootDir[1] == '\0')) | ||
87 | { | ||
88 | /*@-modobserver@*/ | ||
89 | xx = Chroot(rootDir); | ||
90 | /*@=modobserver@*/ | ||
91 | } | ||
92 | +#ifdef RPM_VENDOR_POKY | ||
93 | + if (!rpmtsChrootDone(ts) && rootDir != NULL && | ||
94 | + (scriptletWrapper && *scriptletWrapper) && | ||
95 | + !(rootDir[0] == '/' && rootDir[1] == '\0')) | ||
96 | + xx = Chdir(rootDir); | ||
97 | + else | ||
98 | +#endif | ||
99 | xx = Chdir("/"); | ||
100 | rpmlog(RPMLOG_DEBUG, D_("%s: %s(%s)\texecv(%s) pid %d\n"), | ||
101 | psm->stepName, sln, NVRA, | ||
102 | @@ -2961,6 +2995,13 @@ | ||
103 | case PSM_SCRIPT: /* Run current package scriptlets. */ | ||
104 | /* XXX running %verifyscript/%sanitycheck doesn't have psm->te */ | ||
105 | { rpmtxn _parent = (psm && psm->te ? psm->te->txn : NULL); | ||
106 | + | ||
107 | +#ifdef RPM_VENDOR_POKY | ||
108 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
109 | + if (scriptletWrapper && *scriptletWrapper) | ||
110 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
111 | +#endif | ||
112 | + | ||
113 | xx = rpmtxnBegin(rpmtsGetRdb(ts), _parent, NULL); | ||
114 | rc = runInstScript(psm); | ||
115 | if (rc) | ||
116 | @@ -2968,11 +3009,24 @@ | ||
117 | else | ||
118 | xx = rpmtxnCommit(rpmtsGetRdb(ts)->db_txn); | ||
119 | rpmtsGetRdb(ts)->db_txn = NULL; | ||
120 | +#ifdef RPM_VENDOR_POKY | ||
121 | + if (scriptletWrapper && *scriptletWrapper) | ||
122 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
123 | +#endif | ||
124 | } break; | ||
125 | case PSM_TRIGGERS: | ||
126 | /* Run triggers in other package(s) this package sets off. */ | ||
127 | if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break; | ||
128 | +#ifdef RPM_VENDOR_POKY | ||
129 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
130 | + if (scriptletWrapper && *scriptletWrapper) | ||
131 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
132 | +#endif | ||
133 | rc = runTriggers(psm); | ||
134 | +#ifdef RPM_VENDOR_POKY | ||
135 | + if (scriptletWrapper && *scriptletWrapper) | ||
136 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
137 | +#endif | ||
138 | break; | ||
139 | case PSM_IMMED_TRIGGERS: | ||
140 | /* Run triggers in this package other package(s) set off. */ | ||
141 | @@ -2982,7 +3036,18 @@ | ||
142 | F_SET(psm, GOTTRIGGERS); | ||
143 | } | ||
144 | if (psm->triggers != NULL) | ||
145 | +#ifdef RPM_VENDOR_POKY | ||
146 | + { | ||
147 | + const char * scriptletWrapper = rpmExpand("%{?_cross_scriptlet_wrapper}", NULL); | ||
148 | + if (scriptletWrapper && *scriptletWrapper) | ||
149 | + rc = rpmpsmNext(psm, PSM_CHROOT_OUT); | ||
150 | +#endif | ||
151 | rc = runImmedTriggers(psm); | ||
152 | +#ifdef RPM_VENDOR_POKY | ||
153 | + if (scriptletWrapper && *scriptletWrapper) | ||
154 | + rc = rpmpsmNext(psm, PSM_CHROOT_IN); | ||
155 | + } | ||
156 | +#endif | ||
157 | break; | ||
158 | |||
159 | case PSM_RPMIO_FLAGS: | ||