Reading file list from .spec files in Python

Stuart Gathman stuart at
Thu Jan 22 17:03:45 UTC 2015

On 01/22/2015 10:10 AM, Pavel Fedin wrote:
>   Hello! Is there anybody alive here ?
>   I am taking over maintainership of Cygwin version of RPM and i am thinking
> about a tool to automatically convert an SRPM into Cygwin's native Cygport
> package.
>   I have looked at Python scripting possibilities and RPM v4.12 offers
> everything needed except for one "little" thing. File list in package header
> appears to empty. I have studied the C code, file list is stored internally
> in Package.fileList field (where Package is wrapped into what is rpm.spec on
> Python side), and package header gets populated only when the package is
> actually built.
>   What about adding an API to be able to read %files sections of the spec ?
> This is not a plain help request, i can do the implementation myself, just i
> would like the change to be upstreamed.
The %files list is dynamic, and can even be computed in %build (often 
done for python packages).   So, while getting the string may be 
straightforward, interpreting it is not.  What about building through 
the install stage on a native RPM system to extract an expanded list?

Otherwise, you'll probably end up doing heuristics, with manual override.

More information about the Rpm-list mailing list