Changing the rpm default queryformat to include arch

seth vidal skvidal at fedoraproject.org
Tue Nov 27 18:33:51 UTC 2007


On Tue, 2007-11-27 at 12:32 -0600, Jima wrote:
> On Tue, 27 Nov 2007, Lubomir Kundrak wrote:
> > Jima, are we talking about readability? Well, then we should exchange
> > names like orange-devel-0.3-5.cvs20051118.fc8.x86_64.rpm for "Orange
> > Development Package" and so on. Can you see how nice would they look on
> > a desktop? ;)
> 
>   I wasn't dismissing your suggestion out of hand.  (Sorry, I should have 
> been clearer.)  I'd advocate for a different separator if possible, though 
> (_ maybe?).  - is a bit heavily used, appearing in the %name (as many as 5 
> times!), and as a separator between %name, %version, and %release. 
> Occasionally, with numbers in %name, it can take a moment to tell where 
> %name ends and %version begins. :-)

Yah - you have to read backward from left to right to parse an rpm
filename into the subcomponents.

here are the steps:
- get rid of .rpm
- read backward until a '.' - that's the arch
- read backward until the next '-' - that's the release
- read backward until the next '-' - that's the version
- read backward until you hit a ':' (if there is one) - that's the name
- read backward until the beginning of the string - that's the epoch

That let's you parse a filename like:

epoch:name-ver-rel.arch.rpm

and it handles -'s in names

if you wanted
name-epoch:ver-rel.arch.rpm you'd just have to make sure that : is
banished from ver and rel and always included.

-sv






More information about the fedora-devel-list mailing list