Re: Filtering non-versioned provides/requires

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 11, 2010 at 6:27 AM, Stepan Kasal <skasal@xxxxxxxxxx> wrote:
> Hello,
>  the filtering macros from Chris Weyl do many useful things, but I
> have an idea about one more thing it should do: filter out
> non-versioned provides, if the same provide is available with a
> version.  Likewise, if there is a non-versioned requires with a
> corresponding versioned require, then the non-versioned ones can be
> dropped.
>
> The provides (requires) are sorted, so adding a member to the
> filter which would remove the spare non-versioned ones would be easy
> in awk for example (gawk is always available in the build root).
> It could even easily be done in sed with its hold space for one line.

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)

                                       -Chris
-- 
Chris Weyl
Ex astris, scientia
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/perl-devel


[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux