Bug 662119
Summary: | [RFE] enhance rpm's spec parser | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Pierre-YvesChibon <pingou> |
Component: | rpm | Assignee: | Panu Matilainen <pmatilai> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 13 | CC: | ffesti, herrold, jnovy, pmatilai |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2011-01-19 14:48:08 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Pierre-YvesChibon
2010-12-10 16:52:53 UTC
You dont mention what language you're using to access the spec... but the dependency information is parsed into header structures which have always been accessible from C (but the librpmbuild API has been a big non-obvious mess). Also rpm -q --specfile has been able to query "all" aspects of headers for binaries (but not source headers, so buildrequires haven't been accesssible). Since rpm 4.8.x the headers for binary packages are also accessible from the python bindings. In rpm 4.9.x (now in rawhide), the librpmbuild C API has been entirely revamped providing saner interfaces to parsing spec. Additionally there's a new tool (rpmspec) for querying spec files, which allows querying source rpm headers in addition to binary rpm headers parsed from spec, and also python bindings have access to source headers too. The python bindings enhancements are likely to be backported to 4.8.x in time, but other than that I consider this fixed/rawhide as of rpm-4.9.0-0.beta1.1.fc15. Sorry, I am using python to access the information. I will try to look at rpmspec and the python bindings by F15, I have no rawhide available at the moment. Thanks for your answer. Ok. You can access various aspects of the spec from python already, eg this works on F13 and F14 now: >>> import rpm >>> spec = rpm.spec('net-snmp.spec') >>> for pkg in spec.packages: print pkg.header['name'] ... net-snmp net-snmp-utils net-snmp-devel net-snmp-perl net-snmp-gui net-snmp-libs net-snmp-python net-snmp-debuginfo >>> Dependencies and other data can be queried similarly (and access to source headers can be expected in 4.8.2 when that's released + pushed to Fedora) |