Filtering non-versioned provides/requires

Chris Weyl cweyl at alumni.drew.edu
Thu Feb 11 20:00:06 UTC 2010


On Thu, Feb 11, 2010 at 10:25 AM, Stepan Kasal <skasal at redhat.com> wrote:
> Hello Chris,
>
> On Thu, Feb 11, 2010 at 09:32:11AM -0800, Chris Weyl wrote:
>> Or, appropriately enough, a Perl one-liner :)
>>
>> perl -e 'while (<>) { chomp; s/\s+$//; split / >= /; $v{$_[0]} =
>> $v{$_[0]} > $_[1] ? $v{$_[0]} : $_[1] } do { print $v{$_} ? "$_ >=
>> $v{$_}\n" : "$_\n" } for sort keys %v'
>>
>> (caveat: first shot, only one cup of coffee.  Possibly undercaffinated)
>
> I think the problem with the above is that is relies on ">="; there
> can be different relations.  Actually, the problem that triggered
> this idea was redundant provides, with relation "=".
>
> I invented an awk one-liner:
>
> awk 'prev != "" && $1 != prev {print prev}
> {sub(/[[:blank:]]+$/,"");prev=$0} END{print prev}'
>
> But I have run off energy right now, so I have not tested deploying
> it to the perl_default_filter.

Yeah.  The one-liner I had was aimed at the requires stream, not the provides.

> I believe that keeping sed & awk in the filtering macros is good for
> future inclusion into rpm or redhat-rpm-config, because it might be a
> good idea to have the minimal build root without perl, so that mock
> runs faster.

I don't think we'll ever actually see that -- rpm itself requires
perl, and the "minimal system spec" (whose actual name I'm blanking on
at the moment) requires that perl be available on a system.  Not that
I'm saying anything like we _have_ to use perl for it, just that
whatever works the best with the least amount of pain :)

                                                 -Chris
-- 
Chris Weyl
Ex astris, scientia



More information about the perl-devel mailing list