RPM Community Forums

Mailing List Message of <rpm-devel>

RE: Converting *.spec to Makefiles

From: Wichmann, Mats D <mats.d.wichmann@intel.com>
Date: Sun 07 Sep 2008 - 23:19:34 CEST
Message-ID: <FE028D69955796489B510CE43DBBE80305EA4000@rrsmsx503.amr.corp.intel.com>
Jeff Johnson wrote:
> Increasingly I'm seeing spec file recipes (and rpmbuild) used in
> horrendously
> complicated ways.
>
> rpm spec file recipes contain "known good" (at least wrto rpmbuild
> parsing/execution)
> content that results in successful builds and binary packages to be
> distributed.
>
> That was the whole design goal behind rpmbuild's "reproducible
> builds" for OSS.
>
> What is becoming increasingly obvious (to me if not to you) is that
> the lack
> of a grammar for spec files, and the abuse of macros, is interfering
> with the
> reliability of building OSS software.
>
> Sure you can accomplish just about any goal you wish by treating
> existing spec
> files as a template, and overloading existing tokens to insert
> additional goop
> into a build.
>
> But why bother using spec files for this purpose? If you want a
> paramaterized template
> for builds, then why not design a format that is more reliable than
> spec files are?
>
> There are certainly better templating candidates around than rpm spec
> files and macros,
> autoconf (and m4) and make(1) and ant instantly come to mind.
>
> Here is a rather simple popt alias for a --queryformat that starts to
> convert a specfile
> into Makefile rules.
>
> Put this in /etc/popt:
> ==============================================================
> rpm     alias --spec:makefile --qf '\
> # Display spec file scriptlets as Makefile targets \
> \n# (indentation of sections not yet implemented) \
> \n\
> \nall:  %{NAME}.prep %{NAME}.build %{NAME}.install %{NAME}.clean\
> \n\
> \n.PHONY:       %{NAME}.prep\
> \n%{NAME}.prep:\
> \n%{Buildprep}\
> \n\
> \n.PHONY:       %{NAME}.build\
> \n%{NAME}.build:\
> \n%{Buildbuild}\
> \n\
> \n.PHONY:       %{NAME}.install\
> \n%{NAME}.install:\
> \n%{Buildinstall}\
> \n\
> \n.PHONY:       %{NAME}.clean\
> \n%{NAME}.clean:\
> \n%{Buildclean}\
> \n' \
>          --POPTdesc=$"display spec file scriptlets as Makefile rules"
> ==============================================================
>
> (aside) Yes, I haven't attempted Makefile indentation nor filtering
> the tag content, not impossibly hard.
>
> Then create a Makefile from any *.spec by doing
>
>      rpm -q --spec:makefile --specsrpm foo.spec
>
> I'm increasingly convinced (see my FOSDEM 2005 presentation abstract)
> that's its time to eliminate rpmbuild in
> favor of more reliable and flexible means to produce *.rpm packages.
>
> Other opinions?

Apparently LSB folks have been told repeatedly by developers
coming from "other operating systems" that crafting specfiles
to drive rpmbuild is too hard (I guess, "too hard to accomplish
exactly what we're used to getting with other build procedures"
is what this means).  I word that a little hazily since no
developer has told this to me personally, but I do hear that
"we" get told this.

I think this means there's enough interest that the idea
should at least be explored.
Received on Sun Sep 7 23:22:56 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.