do not edit — generated by btf.
git.druid.rocksindexdruid520mpsrc/providers.pl

src/providers.pl


#!/usr/bin/env perl
use v5.16;
use strict;
use warnings FATAL => 'all';
use FindBin;
use lib "$FindBin::Bin";
use mplib::config;
use mplib::util qw(fail);
use mplib::db qw(read_db);
use mplib::resolve qw(init tag_providers portpin);
 
my $flags = mplib::config::parse_flags(\@ARGV);
mplib::config::load($flags);
fail("tag required") unless defined $ARGV[0] && length $ARGV[0];
init();
 
(my $tag = $ARGV[0]) =~ s/^%//;
# portpin (not a raw $CFG->{conf}{"TAG_$tag"} lookup): checks TARGET_$tag
# first (the primary, more commonly documented pin key -- see
# mp.conf.example) then TAG_$tag, the same precedence real %tag
# resolution (mplib::resolve::resolve_dep) actually uses -- the old raw
# lookup only ever checked TAG_, so a TARGET_-pinned tag with no real
# port declaring that tag printed "no port provides tag %..." even
# though the pin fully satisfies it. undef $cur: this is a generic,
# no-package-context listing, not resolving for one specific consumer.
my $pin = portpin(undef, $tag);
my $providers = tag_providers()->{$tag} || [];
if(!@$providers && !(defined $pin && $pin ne ''))
{
	fail("no port provides tag %$tag");
}
my $db = read_db();
if(defined $pin && $pin ne '')
{
	print "$pin\tpinned\n";
}
my @sorted = sort { $a->{pref} <=> $b->{pref} } @$providers;
for my $i (0 .. $#sorted)
{
	my $p = $sorted[$i];
	# "lowest-pref", not "auto-picked": actual resolution also backtracks
	# past a conflicting candidate to the next one (mplib::resolve::
	# pick_provider), which this simple listing doesn't simulate -- the
	# lowest-pref provider here isn't always the one that would actually
	# get installed.
	my $mark = $db->{$p->{name}} ? 'installed' : ($i == 0 && !defined $pin ? 'lowest-pref' : '');
	print "$p->{name}\t$p->{pref}\t$mark\n";
}
powered by btf.