Created attachment 613273 [details] Patch against 4.9, C and python access to fileFile, fileList and policyList Description of problem: When rpm-build parses the specfile, it also parses the file list and (nowadays?) also the policy. These are stored in specPackage objects attached to the spec. However, these items are not visible on the rpm.specPkg interface, neither from C nor from python. Version-Release number of selected component (if applicable): rpm-4.9.1.3-7.fc17 How reproducible: Akways Steps to Reproduce: - Download and install rpm source rpm. - python>>> import rpm >>> ts=rpm.TransactionSet() >>> spec=ts.parseSpec('/home/leamas/rpmbuild/SPECS/rpm.spec') >>> dir(spec.packages[0]) ['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'header'] Actual results: - The attributes fileFile, fileList and policyList are missing. A better result: - Attributes are there Additional info: This is related to fedora-review, which uses hand-crafted specfile parsing even though using rpmbuild's own seems like a much better option. However, this isn't possible until acces to these fields is there. Patch sent upstream, see http://lists.rpm.org/pipermail/rpm-maint/2012-September/thread.html. However, things seems to move so slowly at rpm.org so I would prefer if enclosed patch was accepted locally here until things are resolved upstream.
Created attachment 618989 [details] Updated patch Updated after discussion on the list [1]: - Returning plain string instead of ARGV_t from C. - Using single function specPkgGetSection, similar to specGetSection but working on package instead. [1]: http://lists.rpm.org/pipermail/rpm-maint/2012-September/003222.html
Created attachment 619780 [details] Updated patch Updated after comments from dmalcolm at redhat.com (thanks!) about low-memory failures in python C library. Although this patch now is safe(?), note that lower parts of the library, notably rpmstring, does not check return values from malloc/realloc so when memory is exhausted those will probably fail anyway.
Sorry, this got dropped somehow. We are now working our way through the back log. Added upstream as 05b7ac821487300f7c8924216087d9ee4347fe1d and beecf9cf26f6095c936368094c06ea3d84bd57f6 and will be part in the upcoming rpm-4.13 release.
Hm... in the meantime we now also have the %license stuff added. Probably we should allow access also to this is the same way, partly just for symmetry. I will try to have a look at it after the holidays (i. e., August).