From 211e3eab8d8318520985ae270becc83cd067aa59 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Wed, 11 May 2016 22:14:23 +0200 Subject: [PATCH] - python bindings: expose headers from spec file - rel 33 --- rpm-python-spec-header.patch | 56 ++++++++++++++++++++++++++++++++++++ rpm.spec | 4 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 rpm-python-spec-header.patch diff --git a/rpm-python-spec-header.patch b/rpm-python-spec-header.patch new file mode 100644 index 0000000..d56b6b2 --- /dev/null +++ b/rpm-python-spec-header.patch @@ -0,0 +1,56 @@ +diff -ur rpm-5.4.15/python/spec-py.c rpm-5.4.15-pyspec/python/spec-py.c +--- rpm-5.4.15/python/spec-py.c 2016-05-11 21:38:24.970137574 +0200 ++++ rpm-5.4.15-pyspec/python/spec-py.c 2016-05-10 22:47:04.748529737 +0200 +@@ -8,6 +8,9 @@ + #include + #define _MACRO_INTERNAL + #include ++#define _RPMTAG_INTERNAL ++#include "header_internal.h" /* XXX HEADERFLAG_ALLOCATED */ ++#include "header-py.h" + #include "spec-py.h" + + /** \ingroup python +@@ -192,6 +195,34 @@ + + } + ++static PyObject * ++spec_get_headers(specObject *s) ++ /*@*/ ++{ ++ PyObject *headerList; ++ Spec spec; ++ Package package; ++ Header header; ++ ++ headerList = PyList_New(0); ++ if (!headerList) { ++ return NULL; ++ } ++ spec = specFromSpec(s); ++ if ( spec != NULL) { ++ package = spec->packages; ++ ++ while (package != NULL) { ++ header = package->header; ++ if (header != NULL) ++ PyList_Append(headerList, (PyObject *) hdr_Wrap(header)); ++ package = package->next; ++ } ++ } ++ ++ return PyList_AsTuple(headerList); ++} ++ + /** + */ + /*@unchecked@*/ /*@observer@*/ +@@ -208,6 +239,7 @@ + {"clean", (PyCFunction) spec_get_clean, METH_VARARGS, NULL }, + {"buildRoot", (PyCFunction) spec_get_buildroot, METH_VARARGS, NULL }, + {"macros", (PyCFunction) spec_get_macros, METH_VARARGS, NULL }, ++ {"headers", (PyCFunction) spec_get_headers, METH_VARARGS, NULL }, + {NULL} /* Sentinel */ + }; + /*@=fullinitblock@*/ diff --git a/rpm.spec b/rpm.spec index a914ee6..2d6d3bb 100644 --- a/rpm.spec +++ b/rpm.spec @@ -51,7 +51,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 5.4.15 -Release: 32 +Release: 33 License: LGPL v2.1 Group: Base # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm @@ -181,6 +181,7 @@ Patch91: py-disable-fetch.patch Patch92: fast_python_deps.patch Patch93: python2_explicit.patch Patch94: do_not_write_before_macro_buffer.patch +Patch95: rpm-python-spec-header.patch # Patches imported from Mandriva @@ -1020,6 +1021,7 @@ cd - %patch92 -p1 %patch93 -p1 %patch94 -p1 +%patch95 -p1 %patch1050 -p1 -- 2.43.0