/[packages]/cauldron/perl-RPM4/current/SOURCES/RPM4-0.23-rpm49.patch
ViewVC logotype

Contents of /cauldron/perl-RPM4/current/SOURCES/RPM4-0.23-rpm49.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 156423 - (show annotations) (download)
Tue Oct 18 21:14:29 2011 UTC (12 years, 4 months ago) by tv
File size: 12401 byte(s)
SILENT: new file ./SOURCES/RPM4-0.23-rpm49.patch
1 commit 7281a00250355a3d283ccb5a5faef5df16bffc8c
2 Author: Dousig <thierry.vignaud@gmail.com>
3 Date: Fri Oct 7 17:38:06 2011 +0200
4
5 add rpm-4.9 support (tv, 2011-08)
6
7 diff --git a/src/Makefile.PL b/src/Makefile.PL
8 index db50c59..efc8be7 100644
9 --- a/src/Makefile.PL
10 +++ b/src/Makefile.PL
11 @@ -35,6 +35,10 @@ foreach (qw(
12 4.4.2
13 4.8.0
14 4.8.1
15 + 4.9.0
16 + 4.9.1
17 + 4.9.1.1
18 + 4.9.1.2
19 )) {
20 $v = $_;
21 $v =~ s/\./_/g;
22 @@ -85,7 +89,7 @@ WriteMakefile(
23 VERSION_FROM => '../lib/RPM4.pm',
24 OBJECT => "RPM4.o RPM4sign.o $obj",
25 INC => "-I$rpmheaderlocation",
26 - LIBS => "-lrpm -lrpmio -lrpmbuild -lpopt -lz -lbz2 $ldd",
27 + LIBS => "-lrpmsign -lrpm -lrpmio -lrpmbuild -lpopt -lz -lbz2 $ldd",
28 'CCFLAGS' => "-Wall $fl",
29 depend => { "RPM4.xs" => join(" ", @rpmconstantfiles) },
30 );
31 diff --git a/src/RPM4.xs b/src/RPM4.xs
32 index 64239d9..d90e46a 100644
33 --- a/src/RPM4.xs
34 +++ b/src/RPM4.xs
35 @@ -66,6 +66,9 @@
36
37 #include "rpmversion.h"
38
39 +#ifdef RPM4_9_0
40 +#include <rpm/rpmspec.h>
41 +#endif
42 #include <rpm/header.h>
43 #include <rpm/rpmio.h>
44 #include <rpm/rpmdb.h>
45 @@ -96,6 +99,10 @@ static unsigned char header_magic[8] = {
46 0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
47 };
48
49 +#ifdef RPM4_9_0
50 +typedef struct Package_s * Package;
51 +#endif
52 +
53 #define CHECK_RPMDS_IX(dep) if (rpmdsIx((dep)) < 0) croak("You call RPM4::Header::Dependencies method after lastest next() of before init()")
54
55 #define bless_rpmds "RPM4::Header::Dependencies"
56 @@ -406,11 +413,15 @@ void _newspec(rpmts ts, char * filename, SV * svpassphrase, SV * svrootdir, SV *
57 verify = SvIV(svverify);
58
59 if (filename) {
60 +#ifdef RPM4_9_0
61 + spec = rpmSpecParse(filename, RPMSPEC_ANYARCH|RPMSPEC_FORCE, NULL);
62 +#else
63 if (!parseSpec(ts, filename, rootdir
64 , NULL
65 ,0, passphrase, cookies, anyarch, force
66 ))
67 spec = rpmtsSetSpec(ts, NULL);
68 +#endif
69 #ifdef HHACK
70 } else {
71 spec = newSpec();
72 @@ -431,7 +442,11 @@ void _newspec(rpmts ts, char * filename, SV * svpassphrase, SV * svrootdir, SV *
73 int _specbuild(rpmts ts, rpmSpec spec, SV * sv_buildflags) {
74 rpmBuildFlags buildflags = sv2rpmbuildflags(sv_buildflags);
75 if (buildflags == RPMBUILD_NONE) croak("No action given for build");
76 +#ifdef RPM4_9_0
77 + return rpmSpecBuild(spec, buildflags);
78 +#else
79 return buildSpec(ts, spec, buildflags, 0);
80 +#endif
81 }
82
83 void _installsrpms(rpmts ts, char * filename) {
84 @@ -749,7 +764,26 @@ void
85 buildhost()
86 PREINIT:
87 PPCODE:
88 +#ifdef RPM4_9_0
89 + //croak("buildhost exists only in rpm < 4.9");
90 + static char hostname[1024];
91 + static int oneshot = 0;
92 + struct hostent *hbn;
93 +
94 + if (! oneshot) {
95 + (void) gethostname(hostname, sizeof(hostname));
96 + hbn = gethostbyname(hostname);
97 + if (hbn)
98 + strcpy(hostname, hbn->h_name);
99 + else
100 + rpmlog(RPMLOG_WARNING,
101 + _("Could not canonicalize hostname: %s\n"), hostname);
102 + oneshot = 1;
103 + }
104 + XPUSHs(sv_2mortal(newSVpv(hostname,0)));
105 +#else
106 XPUSHs(sv_2mortal(newSVpv(buildHost(),0)));
107 +#endif
108
109 # Dump to file functions:
110 void
111 @@ -1361,8 +1395,10 @@ rpmdbrebuild(rootdir = NULL)
112 PREINIT:
113 rpmts ts = rpmtsCreate();
114 CODE:
115 - if (rootdir)
116 + if (!rootdir) rootdir="/";
117 + if (rootdir) {
118 rpmtsSetRootDir(ts, rootdir);
119 + }
120 /* 0 on success */
121 RETVAL = rpmtsRebuildDB(ts);
122 ts = rpmtsFree(ts);
123 @@ -1471,8 +1507,12 @@ Ts_injectheader(db, header)
124 PREINIT:
125 rpmdb rdb;
126 CODE:
127 +#ifdef RPM4_9_0
128 + croak("injectheader>rpmdbAdd exists only in rpm < 4.9");
129 +#else
130 rdb = rpmtsGetRdb(db);
131 RETVAL = rpmdbAdd(rdb, 0, header, db, NULL);
132 +#endif
133 OUTPUT:
134 RETVAL
135
136 @@ -1486,9 +1526,14 @@ Ts_deleteheader(db, sv_offset)
137 CODE:
138 offset = SvUV(sv_offset);
139 rdb = rpmtsGetRdb(db);
140 - if (offset)
141 + if (offset) {
142 +#ifdef RPM4_9_0
143 + croak("injectheader>rpmdbAdd exists only in rpm < 4.9");
144 + RETVAL = 0;
145 +#else
146 RETVAL = rpmdbRemove(rdb, 0, offset, db, NULL);
147 - else
148 +#endif
149 + } else
150 RETVAL = 1;
151 OUTPUT:
152 RETVAL
153 @@ -1515,7 +1560,14 @@ Ts_traverse(ts, callback = NULL, sv_tagname = NULL, sv_tagvalue = NULL, keylen =
154 #ifdef HDLISTDEBUG
155 PRINTF_CALL;
156 #endif
157 +#ifdef RPM4_9_0
158 + croak("traverse is no more supported with rpm 4.9");
159 +#else
160 +#ifdef RPM4_9_0
161 + ts = rpmtsLink(ts);
162 +#else
163 ts = rpmtsLink(ts, "RPM4 Db::traverse()");
164 +#endif
165 if (sv_tagname == NULL || !SvOK(sv_tagname)) {
166 tag = RPMDBI_PACKAGES; /* Assume search into installed packages */
167 } else {
168 @@ -1544,7 +1596,11 @@ Ts_traverse(ts, callback = NULL, sv_tagname = NULL, sv_tagvalue = NULL, keylen =
169 SV **isv = av_fetch(av_exclude, i, 0);
170 exclude[i] = SvUV(*isv);
171 }
172 +#ifdef RPM4_9_0
173 + rpmtsPrunedIterator(ts, exclude, av_len(av_exclude) + 1);
174 +#else
175 rpmdbPruneIterator(mi, exclude, av_len(av_exclude) + 1, 0);
176 +#endif
177 }
178 while (rc && ((header = rpmdbNextIterator(mi)) != NULL)) {
179 RETVAL++;
180 @@ -1575,6 +1631,7 @@ Ts_traverse(ts, callback = NULL, sv_tagname = NULL, sv_tagvalue = NULL, keylen =
181 } else
182 RETVAL = -1;
183 ts = rpmtsFree(ts);
184 +#endif
185 OUTPUT:
186 RETVAL
187
188 @@ -1716,7 +1773,11 @@ Ts_traverse_transaction(ts, callback, type = 0)
189 rpmtsi pi;
190 rpmte Te;
191 CODE:
192 +#ifdef RPM4_9_0
193 + ts = rpmtsLink(ts);
194 +#else
195 ts = rpmtsLink(ts, "RPM4 Db::traverse_transaction()");
196 +#endif
197 pi = rpmtsiInit(ts);
198 RETVAL = 0;
199 while ((Te = rpmtsiNext(pi, type)) != NULL) {
200 @@ -1773,7 +1834,11 @@ Ts_transrun(ts, callback, ...)
201 rpmInstallFlags install_flags = INSTALL_NONE;
202 rpmps ps;
203 CODE:
204 +#ifdef RPM4_9_0
205 + ts = rpmtsLink(ts);
206 +#else
207 ts = rpmtsLink(ts, "RPM4 Db::transrun()");
208 +#endif
209 if (!SvOK(callback)) { /* undef value */
210 rpmtsSetNotifyCallback(ts,
211 rpmShowProgress,
212 @@ -2633,7 +2698,11 @@ Spec_new(perlclass, specfile = NULL, ...)
213 i++;
214 if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
215 ts = (rpmts)SvIV((SV*)SvRV(ST(i)));
216 +#ifdef RPM4_9_0
217 + ts = rpmtsLink(ts);
218 +#else
219 ts = rpmtsLink(ts, bless_spec);
220 +#endif
221 } else {
222 croak( "transaction is not a blessed SV reference" );
223 XSRETURN_UNDEF;
224 @@ -2672,15 +2741,24 @@ Spec_DESTROY(spec)
225 #ifdef HDRPMMEM
226 PRINTF_FREE(bless_spec, spec, -1);
227 #endif
228 +#ifdef RPM4_9_0
229 + rpmSpecFree(spec);
230 +#else
231 freeSpec(spec);
232 +#endif
233
234 void
235 Spec_srcheader(spec)
236 rpmSpec spec
237 PPCODE:
238 +#ifdef RPM4_9_0
239 + Header header = rpmSpecSourceHeader(spec);
240 + XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), bless_header, (void *)headerLink(header))));
241 +#else
242 if ( ! spec->sourceHeader)
243 initSourceHeader(spec);
244 XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), bless_header, (void *)headerLink(spec->sourceHeader))));
245 +#endif
246
247 void
248 Spec_binheader(spec)
249 @@ -2688,8 +2766,19 @@ Spec_binheader(spec)
250 PREINIT:
251 Package pkg;
252 PPCODE:
253 +#ifdef RPM4_9_0
254 +/* we could use something like:
255 + rpmSpecPkgIter iter = rpmSpecPkgIterInit(spec);
256 + while ((pkg = rpmSpecPkgIterNext(iter)) != NULL)
257 + (...)
258 +
259 + but it's unused...
260 +*/
261 + croak("binheader is no more supported with rpm 4.9");
262 +#else
263 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next)
264 XPUSHs(sv_2mortal(sv_setref_pv(newSVpv("", 0), bless_header, (void *)headerLink(pkg->header))));
265 +#endif
266
267 void
268 Spec_srcrpm(spec)
269 @@ -2697,6 +2786,9 @@ Spec_srcrpm(spec)
270 PREINIT:
271 const char *name, *version, *release;
272 PPCODE:
273 +#ifdef RPM4_9_0
274 + croak("srcrpm is no more supported with rpm 4.9");
275 +#else
276 (void) headerNVR(spec->packages->header, &name, &version, &release);
277 XPUSHs(sv_2mortal(newSVpvf("%s/%s-%s-%s.%ssrc.rpm",
278 rpmGetPath("%{_srcrpmdir}", NULL),
279 @@ -2706,6 +2798,7 @@ Spec_srcrpm(spec)
280 headerFreeTag(spec->packages->header, name, RPM_STRING_TYPE);
281 headerFreeTag(spec->packages->header, version, RPM_STRING_TYPE);
282 headerFreeTag(spec->packages->header, release, RPM_STRING_TYPE);
283 +#endif
284
285 void
286 Spec_binrpm(spec)
287 @@ -2716,6 +2809,9 @@ Spec_binrpm(spec)
288 char * binRpm;
289 char * path;
290 PPCODE:
291 +#ifdef RPM4_9_0
292 + croak("binrpm is no more supported with rpm 4.9");
293 +#else
294 for(pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
295 if (pkg->fileList == NULL)
296 continue;
297 @@ -2728,6 +2824,7 @@ Spec_binrpm(spec)
298 free(path);
299 free(binRpm);
300 }
301 +#endif
302
303 void
304 Spec_check(spec, ts = NULL)
305 @@ -2739,19 +2836,28 @@ Spec_check(spec, ts = NULL)
306 PPCODE:
307 PUTBACK;
308 if (ts)
309 +#ifdef RPM4_9_0
310 + ts = rpmtsLink(ts);
311 +#else
312 ts = rpmtsLink(ts, "Spec_check");
313 +#endif
314 else
315 ts = rpmtsCreate();
316 -
317 +#ifndef RPM4_9_0
318 if ( ! spec->sourceHeader)
319 initSourceHeader(spec);
320 -
321 - if (!headerIsEntry(spec->sourceHeader, RPMTAG_REQUIRENAME)
322 - && !headerIsEntry(spec->sourceHeader, RPMTAG_CONFLICTNAME))
323 +#endif
324 +#ifdef RPM4_9_0
325 + Header header = rpmSpecSourceHeader(spec);
326 +#else
327 + Header header = spec->sourceHeader;
328 +#endif
329 + if (!headerIsEntry(header, RPMTAG_REQUIRENAME)
330 + && !headerIsEntry(header, RPMTAG_CONFLICTNAME))
331 /* XSRETURN_UNDEF; */
332 return;
333
334 - (void) rpmtsAddInstallElement(ts, spec->sourceHeader, NULL, 0, NULL);
335 + (void) rpmtsAddInstallElement(ts, header, NULL, 0, NULL);
336
337 if(rpmtsCheck(ts))
338 croak("Can't check rpmts"); /* any better idea ? */
339 @@ -2779,7 +2885,11 @@ const char *
340 Spec_specfile(spec)
341 rpmSpec spec
342 CODE:
343 +#ifdef RPM4_9_0
344 + croak("specfile exists only in rpm < 4.9");
345 +#else
346 RETVAL = spec->specFile;
347 +#endif
348 OUTPUT:
349 RETVAL
350
351 @@ -2790,11 +2900,15 @@ Spec_sources(spec, is = 0)
352 PREINIT:
353 struct Source *srcPtr;
354 PPCODE:
355 +#ifdef RPM4_9_0
356 + croak("sources exists only in rpm < 4.9");
357 +#else
358 for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
359 if (is && !(srcPtr->flags & is))
360 continue;
361 XPUSHs(sv_2mortal(newSVpv(srcPtr->source, 0)));
362 }
363 +#endif
364
365 void
366 Spec_sources_url(spec, is = 0)
367 @@ -2803,11 +2917,15 @@ Spec_sources_url(spec, is = 0)
368 PREINIT:
369 struct Source * srcPtr;
370 PPCODE:
371 +#ifdef RPM4_9_0
372 +// XPUSHs(sv_2mortal(newSVpv(get_name(pkg->h, RPMTAG_URL), 0)));
373 +#else
374 for (srcPtr = spec->sources; srcPtr != NULL; srcPtr = srcPtr->next) {
375 if (is && !(srcPtr->flags & is))
376 continue;
377 XPUSHs(sv_2mortal(newSVpv(srcPtr->fullSource, 0)));
378 }
379 +#endif
380
381 void
382 Spec_icon(spec)
383 @@ -2815,6 +2933,9 @@ Spec_icon(spec)
384 PREINIT:
385 Package pkg;
386 PPCODE:
387 +#ifdef RPM4_9_0
388 + croak("icon exists only in rpm < 4.9");
389 +#else
390 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
391 char * dest = NULL;
392 int len;
393 @@ -2825,6 +2946,7 @@ Spec_icon(spec)
394 memcpy(dest, pkg->icon->source, len);
395 XPUSHs(sv_2mortal(newSVpv(dest, len)));
396 }
397 +#endif
398
399 void
400 Spec_icon_url(spec)
401 @@ -2832,6 +2954,9 @@ Spec_icon_url(spec)
402 PREINIT:
403 Package pkg;
404 PPCODE:
405 +#ifdef RPM4_9_0
406 + croak("icon_url exists only in rpm < 4.9");
407 +#else
408 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
409 char * dest = NULL;
410 int len;
411 @@ -2842,6 +2967,7 @@ Spec_icon_url(spec)
412 memcpy(dest, pkg->icon->fullSource, len);
413 XPUSHs(sv_2mortal(newSVpv(dest, len)));
414 }
415 +#endif
416
417 MODULE = RPM4 PACKAGE = RPM4::Db::_Problems PREFIX = ps_
418
419 diff --git a/src/RPM4sign.c b/src/RPM4sign.c
420 index 63e1d1b..2b5e06c 100644
421 --- a/src/RPM4sign.c
422 +++ b/src/RPM4sign.c
423 @@ -9,11 +9,17 @@
424 #undef Stat
425
426 #include <rpm/rpmcli.h>
427 +#ifdef RPM4_9_0
428 +#include <rpm/rpmsign.h>
429 +#endif
430
431 #include "RPM4.h"
432
433 /* Hight level function */
434 int rpmsign(char *passphrase, const char *rpm) {
435 +#ifdef RPM4_9_0
436 + return rpmPkgSign(rpm, NULL, passphrase);
437 +#else
438 QVA_t qva = &rpmQVKArgs;
439 ARGV_t file = NULL;
440
441 @@ -23,5 +29,6 @@ int rpmsign(char *passphrase, const char *rpm) {
442 qva->passPhrase = passphrase;
443
444 return rpmcliSign(NULL, qva, file);
445 +#endif
446 }
447

  ViewVC Help
Powered by ViewVC 1.1.30