RPM Community Forums

Mailing List Message of <rpm-users>

Re: RPM5 and YML-like Specfiles

From: Jeff Johnson <n3npq@mac.com>
Date: Sun 10 May 2009 - 21:38:05 CEST
Message-id: <25A3C0A7-AAF9-47F8-9D46-1AAF622E1934@mac.com>

On May 10, 2009, at 3:19 PM, Eric MSP Veith wrote:

> Hash: SHA1
> Hello,
> since a while rpm supports spec files that do not only look like  
> YAML files,
> but indeed are. At least as far as I know.
> %prep
> %setup -q
> Becomes:
> %prep
>    %setup -q
> ... with proper indentation.

FYi: Try
	rpm -qp --yaml foo*.src.rpm
	rpm -qp --yaml --specfile foo.spec
for as close as rpm has come to YAMLspec!

Yes, the indentation could be automated.

> I've been trying to adopt this to my own projects. (I actually just  
> began
> re-formatting my old specfiles.) What I found out is that it really  
> works in
> the script parts, a thing that broke the spec file parser before.  
> However,
> the description part still doesn't seem to get it, or I am making  
> mistakes.
> When I write something like:
> %description
>    This is some indented text for this package.
>    It shouldn't look like this when using "rpm -qi PKG".
> The description is indented, too, when I run "rpm -qi PKG". While I
> understand that there's no good way to have YML-like indentation *and*
> preserve text formatting that might have been done in the  
> description part,
> I long for a real YML-ish look of my spec files. :-)
> Is there any way to do it right?

With markup like XML/YAML, "right" is pretty much an aesthetic
rather than engineering POV.

But what is rate-limiting for RPM + YAML is the bikeshed discussions re
what is "aesthetic" and what is "ugly".

For example, I'm actively (for 9+ months) shopping
markup that captures the same information as what
is permitted in %trigger* sections in spec files.

The trigger sections include multiple dependencies, as well
as the usual -p and -n scriptlet flags, so example YAML markup
for %triggers would generalize to all spec file sections rather
quickly and easily.

So if you are inclined, take a stab at example YAML markup
for %trigger* sections, and send along please. I'll take a stab at
a proof-of-concept parser for the markup using /etc/rpm/sysinfo/ 

If/when I'm able to fire triggers from external configuration, then
its time to start on the larger job of alternatives to *.spec file  
Note that the same YAML parser and markup would be used for both
externally configured triggers and spec file parsing (in case the
connection is not obvious).

> Or am I perhaps totally mistaken regarding the YML thing?

Not sure what "mistaken" means, since there has been almost
no discussion about RPM + YAML.

But IMHO, YAML is data focussed and human readable markup,
very much not true for XML (which is syntax focussed) or JSON
(which is hardly human readable, its just fancy CSV in most usage
cases I've seen).

Note that syck was re-added (it was in rpm-4.4.9 but too fragile
and flimsy to carry forward to @rpm5.org) last month. syck adds
a YAML parser to rpm, so far all the --yaml spewage is just


73 de Jeff
Received on Sun May 10 21:38:51 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.