RPM Community Forums

Mailing List Message of <rpm-devel>

Re: mire

From: Jeff Johnson <n3npq@mac.com>
Date: Sat 16 Aug 2008 - 23:36:50 CEST
Message-id: <8250EFAA-7CF1-45B4-83BE-62181E5609C9@mac.com>

On Aug 15, 2008, at 8:22 PM, Alexey Tourbin wrote:

> I wonder if mires are of any use.
> Suppose I want to query provides by glob pattern 'perl(*)'.
> The desired output is 4 columns
>
> perl(...)	perl(...)-version	%{NAME}		%{VERSION}
>

Note that miRE's are already (albeit obscurely) wired into queries as
     rpm -qa --qf '%{NAME}\n' "providename=perl(*)'

I have not pushed the syntax everywhere through the RPM CLI because  
there are
implicit boundaries associated with rpmdb primary keys that don't mix  
well with pattern matching.
E.g. "foo-1-2-3-4" is ambigous in several ways becuase of the  
multiple "-" separators. For
all rpm knows, there might be a package built from spec file containing
     Name: foo-1-2-3-4
or
     Name: foo-1-2-3
     Version: 4
or
     Name: foo-1-2
     Version: 3
     Release: 4


> E.g. something like
>
> $ rpm -qa --qf '%{PROVIDENAME}\t%{PROVIDEVERSION}\t%{NAME}\t% 
> {VERSION}\n' |grep '^perl(' |head
> perl(Unicode/UCD.pm)    0.250   perl-unicore    5.8.8
> perl(Text/Reform.pm)    1.012   perl-Text-Reform        1.12.2
> perl(Locale/Maketext/Simple.pm) 0.160   perl-Locale-Maketext- 
> Simple     0.16
> perl(XML/Parser.pm)     2.360   perl-XML-Parser 2.36
> perl(FreezeThaw.pm)     0.430   perl-FreezeThaw 0.43
> perl(List/MoreUtils.pm) 0.220   perl-List-MoreUtils     0.22
> perl(CGI.pm)    3.390   perl-CGI        3.39
> perl(Thread.pm) 2.010   perl-threads    5.8.8
> perl(DateTime/Format/Mail.pm)   0.300   perl-DateTime-Format- 
> Mail       0.30
> perl(Exception/Class.pm)        1.240   perl-Exception-Class    1.24
> $
>
> done with mire glob, not with external grep.

You are correct that much can be done with piping existing
--queryformat spewage through external utilities without any
need for pattern matching internal to ropm libraries.

__BUT__

A miRE data type is just a thin wrapper to glob or posix/PCRE RE's,
and there are lots of usage cases internal to RPM for globs and RE's.

E.g., rpm supports +foo/-bar install/update arguments as in
     rpm -Uvh +foo -bar
that needs __BOTH__ glob and RE patterns to achieve.

Another major usage case for miRE patterns is package -> platform  
affinity,
the replacement for rpmrc depends on RE patterns added to /etc/rpm/ 
platform.

It's not just filtering --queryformat where globs and RE's are used  
within RPM.

But you are absolutely correct that --pipe and post processing -- 
queryformat
could be used in many places.

OTOH, using --pipe also forces rpm to have dependencies on "other  
helpers".
Additional dependencies for rpm becomes quite complicated as well.

73 de Jeff
Received on Sat Aug 16 23:37:11 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.