]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-mcontext.patch
- obsolete
[packages/rpm.git] / rpm-mcontext.patch
CommitLineData
84a0c9af
AM
1diff -ur rpm-4.4.7.org/build/build.c rpm-4.4.7/build/build.c
2--- rpm-4.4.7.org/build/build.c 2005-02-10 21:09:43.000000000 +0100
3+++ rpm-4.4.7/build/build.c 2007-01-13 20:28:18.114303000 +0100
4@@ -330,6 +330,15 @@
5 (rc = processSourceFiles(spec)))
6 goto exit;
7
8+ /* XXX Reset buildroot to its expansion to insure invariant. */
9+ { const char *buildroot = rpmExpand("%{?buildroot}", NULL);
10+ if (buildroot && *buildroot) {
11+ (void) delMacro(NULL, "buildroot");
12+ (void) addMacro(NULL, ".buildroot", NULL, buildroot, -1);
13+ }
14+ buildroot = _free(buildroot);
15+ }
16+
17 if (((what & RPMBUILD_INSTALL) || (what & RPMBUILD_PACKAGEBINARY) ||
18 (what & RPMBUILD_FILECHECK)) &&
19 (rc = processBinaryFiles(spec, what & RPMBUILD_INSTALL, test)))
20diff -ur rpm-4.4.7.org/build/files.c rpm-4.4.7/build/files.c
21--- rpm-4.4.7.org/build/files.c 2007-01-13 20:27:16.002421000 +0100
22+++ rpm-4.4.7/build/files.c 2007-01-13 20:28:18.118303250 +0100
23@@ -2640,6 +2640,8 @@
24 if (pkg->fileList == NULL)
25 continue;
26
27+ (void) headerMacrosLoad(pkg->header);
28+
29 (void) headerNVR(pkg->header, &n, &v, &r);
30 rpmMessage(RPMMESS_NORMAL, _("Processing files: %s-%s-%s\n"), n, v, r);
31
32@@ -2654,6 +2656,8 @@
33
34 /* XXX this should be earlier for deps to be entirely sorted. */
35 providePackageNVR(pkg->header);
36+
37+ (void) headerMacrosUnload(pkg->header);
38 }
39
40 /* Now we have in fileList list of files from all packages.
41diff -ur rpm-4.4.7.org/lib/psm.c rpm-4.4.7/lib/psm.c
42--- rpm-4.4.7.org/lib/psm.c 2007-01-13 20:27:16.102427000 +0100
43+++ rpm-4.4.7/lib/psm.c 2007-01-13 20:28:41.251749000 +0100
44@@ -82,70 +82,6 @@
45 }
46
47 /**
48- * Macros to be defined from per-header tag values.
49- * @todo Should other macros be added from header when installing a package?
50- */
51-/*@observer@*/ /*@unchecked@*/
52-static struct tagMacro {
53-/*@observer@*/ /*@null@*/ const char * macroname; /*!< Macro name to define. */
54- rpmTag tag; /*!< Header tag to use for value. */
55-} tagMacros[] = {
56- { "name", RPMTAG_NAME },
57- { "version", RPMTAG_VERSION },
58- { "release", RPMTAG_RELEASE },
59- { "epoch", RPMTAG_EPOCH },
60- { NULL, 0 }
61-};
62-
63-/**
64- * Define per-header macros.
65- * @param fi transaction element file info
66- * @param h header
67- * @return 0 always
68- */
69-static int rpmInstallLoadMacros(rpmfi fi, Header h)
70- /*@globals rpmGlobalMacroContext @*/
71- /*@modifies rpmGlobalMacroContext @*/
72-{
73- HGE_t hge = (HGE_t) fi->hge;
74- struct tagMacro * tagm;
75- union {
76-/*@unused@*/ void * ptr;
77-/*@unused@*/ const char ** argv;
78- const char * str;
79- int_32 * i32p;
80- } body;
81- char numbuf[32];
82- rpmTagType type;
83-
84- for (tagm = tagMacros; tagm->macroname != NULL; tagm++) {
85- if (!hge(h, tagm->tag, &type, (void **) &body, NULL))
86- continue;
87- switch (type) {
88- case RPM_INT32_TYPE:
89-/*@-boundsread@*/
90- sprintf(numbuf, "%d", *body.i32p);
91-/*@=boundsread@*/
92- addMacro(NULL, tagm->macroname, NULL, numbuf, -1);
93- /*@switchbreak@*/ break;
94- case RPM_STRING_TYPE:
95- addMacro(NULL, tagm->macroname, NULL, body.str, -1);
96- /*@switchbreak@*/ break;
97- case RPM_NULL_TYPE:
98- case RPM_CHAR_TYPE:
99- case RPM_INT8_TYPE:
100- case RPM_INT16_TYPE:
101- case RPM_BIN_TYPE:
102- case RPM_STRING_ARRAY_TYPE:
103- case RPM_I18NSTRING_TYPE:
104- default:
105- /*@switchbreak@*/ break;
106- }
107- }
108- return 0;
109-}
110-
111-/**
112 * Mark files in database shared with this package as "replaced".
113 * @param psm package state machine data
114 * @return 0 always
115@@ -294,7 +230,7 @@
116 hge = fi->hge;
117 hfd = fi->hfd;
118
119-/*@i@*/ (void) rpmInstallLoadMacros(fi, fi->h);
120+/*@i@*/ (void) headerMacrosLoad(fi->h);
121
122 psm->fi = rpmfiLink(fi, NULL);
123 /*@-assignexpose -usereleased @*/
124diff -ur rpm-4.4.7.org/lib/rpmlib.h rpm-4.4.7/lib/rpmlib.h
125--- rpm-4.4.7.org/lib/rpmlib.h 2006-10-08 21:01:41.000000000 +0200
126+++ rpm-4.4.7/lib/rpmlib.h 2007-01-13 20:28:18.118303250 +0100
127@@ -123,6 +123,24 @@
128 */
129 typedef /*@abstract@*/ /*@refcounted@*/ struct rpmgi_s * rpmgi;
130
131+/**
132+ * Define per-header macros.
133+ * @param h header
134+ * @return 0 always
135+ */
136+int headerMacrosLoad(Header h)
137+ /*@globals rpmGlobalMacroContext @*/
138+ /*@modifies rpmGlobalMacroContext @*/;
139+
140+/**
141+ * Define per-header macros.
142+ * @param h header
143+ * @return 0 always
144+ */
145+int headerMacrosUnload(Header h)
146+ /*@globals rpmGlobalMacroContext @*/
147+ /*@modifies rpmGlobalMacroContext @*/;
148+
149 /** \ingroup header
150 * Return name, version, release strings from header.
151 * @param h header
152diff -ur rpm-4.4.7.org/macros.in rpm-4.4.7/macros.in
153--- rpm-4.4.7.org/macros.in 2007-01-13 20:27:16.078426000 +0100
154+++ rpm-4.4.7/macros.in 2007-01-13 20:28:18.122303500 +0100
155@@ -1348,8 +1348,8 @@
156 #
157 # Note: Used iff _use_internal_dependency_generator is non-zero. The
158 # helpers are also used by @RPMCONFIGDIR@/rpmdeps {--provides|--requires}.
159-%__libtool_provides @RPMCONFIGDIR@/libtooldeps.sh --provides %{buildroot}
160-%__libtool_requires @RPMCONFIGDIR@/libtooldeps.sh --requires %{buildroot}
161+%__libtool_provides @RPMCONFIGDIR@/libtooldeps.sh --provides %{buildroot} %{name}
162+%__libtool_requires @RPMCONFIGDIR@/libtooldeps.sh --requires %{buildroot} %{name}
163
164 #------------------------------------------------------------------------
165 # pkgconfig(...) configuration.
166diff -ur rpm-4.4.7.org/rpmdb/hdrNVR.c rpm-4.4.7/rpmdb/hdrNVR.c
167--- rpm-4.4.7.org/rpmdb/hdrNVR.c 2003-01-17 18:43:45.000000000 +0100
168+++ rpm-4.4.7/rpmdb/hdrNVR.c 2007-01-13 20:28:18.122303500 +0100
169@@ -3,9 +3,112 @@
170 */
171
172 #include "system.h"
173-#include "lib/rpmlib.h"
174+#include <rpmlib.h>
175+#include <rpmmacro.h>
176 #include "debug.h"
177
178+/**
179+ * Macros to be defined from per-header tag values.
180+ * @todo Should other macros be added from header when installing a package?
181+ */
182+/*@observer@*/ /*@unchecked@*/
183+static struct tagMacro {
184+/*@observer@*/ /*@null@*/
185+ const char *macroname; /*!< Macro name to define. */
186+ rpmTag tag; /*!< Header tag to use for value. */
187+} tagMacros[] = {
188+ { "name", RPMTAG_NAME },
189+ { "version", RPMTAG_VERSION },
190+ { "release", RPMTAG_RELEASE },
191+ { "epoch", RPMTAG_EPOCH },
192+ { "arch", RPMTAG_ARCH },
193+ { "os", RPMTAG_OS },
194+ { NULL, 0 }
195+};
196+
197+int headerMacrosLoad(Header h)
198+{
199+ struct tagMacro * tagm;
200+ union {
201+ const void * ptr;
202+/*@unused@*/
203+ const char ** argv;
204+ const char * str;
205+ int_32 * i32p;
206+ } body;
207+ char numbuf[32];
208+ int_32 type;
209+ int xx;
210+
211+ for (tagm = tagMacros; tagm->macroname != NULL; tagm++) {
212+ xx = headerGetEntryMinMemory(h, tagm->tag, &type, (hPTR_t *) &body.ptr, NULL);
213+ if (!xx)
214+ continue;
215+ switch (type) {
216+ case RPM_INT32_TYPE:
217+/*@-boundsread@*/
218+ sprintf(numbuf, "%d", *body.i32p);
219+/*@=boundsread@*/
220+ addMacro(NULL, tagm->macroname, NULL, numbuf, -1);
221+ /*@switchbreak@*/ break;
222+ case RPM_STRING_TYPE:
223+ addMacro(NULL, tagm->macroname, NULL, body.str, -1);
224+ /*@switchbreak@*/ break;
225+ case RPM_STRING_ARRAY_TYPE:
226+ case RPM_I18NSTRING_TYPE:
227+ case RPM_BIN_TYPE:
228+ body.ptr = headerFreeData(body.ptr, type);
229+ /*@fallthrough@*/
230+ case RPM_NULL_TYPE:
231+ case RPM_CHAR_TYPE:
232+ case RPM_INT8_TYPE:
233+ case RPM_INT16_TYPE:
234+ default:
235+ /*@switchbreak@*/ break;
236+ }
237+ }
238+ return 0;
239+}
240+int headerMacrosUnload(Header h)
241+{
242+ struct tagMacro * tagm;
243+ union {
244+ const void * ptr;
245+/*@unused@*/
246+ const char ** argv;
247+ const char * str;
248+ int_32 * i32p;
249+ } body;
250+ int_32 type;
251+ int xx;
252+
253+ for (tagm = tagMacros; tagm->macroname != NULL; tagm++) {
254+ xx = headerGetEntryMinMemory(h, tagm->tag, &type, (hPTR_t *) &body.ptr, NULL);
255+ if (!xx)
256+ continue;
257+ switch (type) {
258+ case RPM_INT32_TYPE:
259+ delMacro(NULL, tagm->macroname);
260+ /*@switchbreak@*/ break;
261+ case RPM_STRING_TYPE:
262+ delMacro(NULL, tagm->macroname);
263+ /*@switchbreak@*/ break;
264+ case RPM_STRING_ARRAY_TYPE:
265+ case RPM_I18NSTRING_TYPE:
266+ case RPM_BIN_TYPE:
267+ body.ptr = headerFreeData(body.ptr, type);
268+ /*@fallthrough@*/
269+ case RPM_NULL_TYPE:
270+ case RPM_CHAR_TYPE:
271+ case RPM_INT8_TYPE:
272+ case RPM_INT16_TYPE:
273+ default:
274+ /*@switchbreak@*/ break;
275+ }
276+ }
277+ return 0;
278+}
279+
280 int headerNVR(Header h, const char **np, const char **vp, const char **rp)
281 {
282 int type;
283diff -ur rpm-4.4.7.org/rpmdb/librpmdb.vers rpm-4.4.7/rpmdb/librpmdb.vers
284--- rpm-4.4.7.org/rpmdb/librpmdb.vers 2006-07-08 18:53:54.000000000 +0200
285+++ rpm-4.4.7/rpmdb/librpmdb.vers 2007-01-13 20:28:18.122303500 +0100
286@@ -28,6 +28,8 @@
287 headerDump;
288 headerGetLangs;
289 headerGetRawEntry;
290+ headerMacrosLoad;
291+ headerMacrosUnload;
292 headerNEVRA;
293 headerNVR;
294 htAddEntry;
This page took 0.064914 seconds and 4 git commands to generate.