build-from-scratch: pre-processor/parser for .spec files?
On Aug 15, 2008, at 7:57 PM, Brian Schüler wrote:
Hi,
does anybody know a tool/script which pre-processes/parse and dumps
a .spec
file with preloaded RPM macros?
What is "preloaded macros"?
If you want expanded macros, then
rpm -E "`cat foo.spec`"
will do all the expansions.
If you want all macros use duriong a build (with rpm-5.x), then
rpmbuild ... --macrosused foo.spec
will list all macros used during a build. These are also added to a
*.src.rpm
rpm -qp --qf '[%{buildmacros}
]' foo*.src.rpm
I'm working on a script which will build a set of source RPMs (or
even a whole
distribution) on a mock build server. The aim of it is to get well
defined source
RPMs with exact requirements (BuildReqs and Requres by running
installation
tests in mock in conjunction with ldd on multilib systems). The
goal of this is
to get all Packages mock-buildable and "certified".
I will have to shorten the build duration by calculating the
package order with
correlation algorythms on the package names.
But there are cases where correlation does not work - especially
when SRPMs
creates packages named different (e.g. mplayer(src) creates mencoder
(bin))
and when scanning for "%files" or "%files -n" in the .spec returns
unresolved
macros. (Example: %files -n vdr-%{pname}-server)
When my build-from-scratch script is finished I will release it to
the CentOS
project, because it will be very important for automation and
shorten the
release time when (re)building the Distro.
Current features:
- Building binary packages from SRPMS (in a repository) on a mock
server via ssh
- Creating root-logs, build-logs and missingdeps-logs
- Bypassing bad packages (missdeps, build-failures) on next turns
- Semi-"brute-force"-build: re-running as so long as no more
packages are built.
Planned features:
- Certification tests (post-install tests, respin/updates
integration tests)
- Handling cross-build issues in RPM
- Exact build order and circular dependencies detection.
I think the solution for my problem can be found in the internals
of the
rpmbuild utility - if someone has a hint or solution of a .spec
parser, he/she is
welcome (Google did not satisfy me right now).
There aren't any parsers for spec files other than rpmbuild afaik.
But (again rpm-5.0), there is
rpm -q --yaml --specsrpm foo.spec
which is at least more predictable YAML output than grammar-less spec
files.
Note that the --specsrpm --yaml also spews the build dependencies
that you need
for what you are calling "correlation".
73 de Jeff______________________________________________ _
CentOS-devel mailing list
CentOS-devel@centos.org
http://lists.centos.org/mailman/listinfo/centos-devel
|