RPM Community Forums

Mailing List Message of <rpm-devel>

Re: disttag/distepoch in RPMTAG_NVRA [Fwd: [Cooker] Warning: remaining bugs in RPM ? (no distro tag)]

From: Per Řyvind Karlsen <pkarlsen@rpm5.org>
Date: Thu 20 Jan 2011 - 02:39:00 CET
Message-ID: <AANLkTinkfiH7S7mZq9zbLQe_XcBhvGJa9q0sNz4+bsDH@mail.gmail.com>
2011/1/20 Jeff Johnson <n3npq@mac.com>:
> On Jan 19, 2011, at 7:45 AM, Per Řyvind Karlsen wrote:
>> For RPMTAG_NVRA to expand to using%{___NVRA}, I found myself
>> having to modify hGetNevra().
> Why did you have to modify?
> While this setting is a huge mess, its _IS_ adequate to compose
> an "identification" string based on other tag data:
> %___NVRA        %%{NAME}-%%{VERSION}-%%{RELEASE}%%|DISTTAG?{-%%{DISTTAG}%%|DISTEPOCH?{%%{DISTEPOCH}}|}|%%|ARCH?{.%%|SOURCERPM?{%%{ARCH}}:{src}|}:{}|
> I fail to understand why changes to hGetNevra() method are _ALSO_ needed.
>> To make dbiFindMatches() to match -%{disttag}%{distepoch}, I changed
>> _post_NVRA to:
>> static const char _post_NVRA[] =
>> "(-[^-]+-[^-]+-[^-]+\\.[^.]+|-[^-]+-[^-]+\\.[^.]+|-[^-]+\\.[^.]+|\\.[^.]+|)$";
>> This expression gets too greedy for packages with '-' in the name and
>> without disttag/distepoch though..
> Yes _post_NVRA MUST be able to parse through variant (like N.A or N-V.A) forms
> using a pattern.
> If you can't write a pattern (usually as a tail anchor'es *RE, the usual
> parsing rule is that the last 2 '-' characters are GUARANTEED to surround V)
> for NVRA strings that include Disttag/Distepoch, well, you are likely screwed.
>> ie. 'rpm -q foo' might return:
>> foo-1-1-mdv2011.0.x86_64
>> foo-bar-1-1mdv2011.0.x86_64
> Yep. Can't tell what's what because the syntax isn't predictable.
One workaround could be something like this:
if(keyp[0] != '^') {
     Header h;
     while((h = rpmmiNext(mi)) {
           he->tag = RPMTAG_NAME;
           if(headerGet(h, he, 0))
                if(strlen(keyp) < strlen(he->p.str))

This would remove the matches that has a name longer than the package
queried for.

Might not make immediate sense, I'll take a closer look tomorrow,
bedtime now. :)

Per Řyvind
Received on Thu Jan 20 02:39:43 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.