]>
Commit | Line | Data |
---|---|---|
211e3eab JR |
1 | diff -ur rpm-5.4.15/python/spec-py.c rpm-5.4.15-pyspec/python/spec-py.c |
2 | --- rpm-5.4.15/python/spec-py.c 2016-05-11 21:38:24.970137574 +0200 | |
3 | +++ rpm-5.4.15-pyspec/python/spec-py.c 2016-05-10 22:47:04.748529737 +0200 | |
4 | @@ -8,6 +8,9 @@ | |
5 | #include <rpmio.h> | |
6 | #define _MACRO_INTERNAL | |
7 | #include <rpmmacro.h> | |
8 | +#define _RPMTAG_INTERNAL | |
9 | +#include "header_internal.h" /* XXX HEADERFLAG_ALLOCATED */ | |
10 | +#include "header-py.h" | |
11 | #include "spec-py.h" | |
12 | ||
13 | /** \ingroup python | |
14 | @@ -192,6 +195,34 @@ | |
15 | ||
16 | } | |
17 | ||
18 | +static PyObject * | |
19 | +spec_get_headers(specObject *s) | |
20 | + /*@*/ | |
21 | +{ | |
22 | + PyObject *headerList; | |
23 | + Spec spec; | |
24 | + Package package; | |
25 | + Header header; | |
26 | + | |
27 | + headerList = PyList_New(0); | |
28 | + if (!headerList) { | |
29 | + return NULL; | |
30 | + } | |
31 | + spec = specFromSpec(s); | |
32 | + if ( spec != NULL) { | |
33 | + package = spec->packages; | |
34 | + | |
35 | + while (package != NULL) { | |
36 | + header = package->header; | |
37 | + if (header != NULL) | |
38 | + PyList_Append(headerList, (PyObject *) hdr_Wrap(header)); | |
39 | + package = package->next; | |
40 | + } | |
41 | + } | |
42 | + | |
43 | + return PyList_AsTuple(headerList); | |
44 | +} | |
45 | + | |
46 | /** | |
47 | */ | |
48 | /*@unchecked@*/ /*@observer@*/ | |
49 | @@ -208,6 +239,7 @@ | |
50 | {"clean", (PyCFunction) spec_get_clean, METH_VARARGS, NULL }, | |
51 | {"buildRoot", (PyCFunction) spec_get_buildroot, METH_VARARGS, NULL }, | |
52 | {"macros", (PyCFunction) spec_get_macros, METH_VARARGS, NULL }, | |
53 | + {"headers", (PyCFunction) spec_get_headers, METH_VARARGS, NULL }, | |
54 | {NULL} /* Sentinel */ | |
55 | }; | |
56 | /*@=fullinitblock@*/ |