How get a spec preprocesed with all macros expanded.

Home » CentOS » How get a spec preprocesed with all macros expanded.
CentOS 3 Comments


I need to get a spec file with all macro exanded, so i can extract info of some tags, that my be consitional based on macros, i know that some rpm utils need to make this to figure out dependencies and so on.

I don’t know if is posible to get a preprocesed spec file with actual Centos & rpm tools, if this is on librpm, i can make a simple tool to make this.


3 thoughts on - How get a spec preprocesed with all macros expanded.

  • That does not make any sense to me, what is it that you want in clear
    terms ?

    are you just looking for something like : ‘yum install redhat-rpm-config
    rpm-build && rpm –showrc’

    – KB

  • Also, if you are trying to get buildtime results, you can add %dump to
    the spec file, and grab buildtime output

  • Hi,

    Excuse my poor explication.

    This is my scenario, now i have some tasks that i make semi-manual that i
    want to automate, basically i have some package sources (spec, patches and
    in some cases additional files), this packages are fetched from SCM and
    converted to SRPMs, to build later with mock, but i need to build these
    packages in order with some staging process, so there are some
    inter-package dependeces, this is the part that i make semi-automatic.

    The problem arrises, when some of these spec support diferent archs os
    distributions, some of then have macros that include / exclude certain
    build requisites (also run-time requisites), so a grep of spec give me all
    requires (some of then are inside a ‘if’ that evaluates false), it’s a
    roundabout; from my part, but i’m triing to solve this.

    Basically that i want is the spec file as rpmbuild interpret it, i try to
    find somethink but i can’t figure a tool to get this info (also some other
    info of the spec that is conditional based on rpm macros), now i’m surfing
    the rpm API and i think that i’m near the solution.