Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg-tool] how to list all ports that depend on certain dependency #43348

Open
miyanyan opened this issue Jan 19, 2025 · 0 comments
Open

[vcpkg-tool] how to list all ports that depend on certain dependency #43348

miyanyan opened this issue Jan 19, 2025 · 0 comments
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@miyanyan
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I come to this idea when I update boost to 1.87.0, I want to know all ports that depend on asio, this command may something like:

vcpkg depend-on asio
# then all ports list below

I found vcpkg depend-info but it list the dependencies of asio
I found vcpkg ci which can get the ports needed to retest

Proposed solution

Can I add a command option to vcpkg-tool, like:

void command_depend_on_and_exit(const VcpkgCmdArguments& args,
                                const VcpkgPaths& paths,
                                Triplet default_triplet,
                                Triplet host_triplet)
{
    msg::default_output_stream = OutputStream::StdErr;
    const ParsedArguments options = args.parse_arguments(CommandDependOnMetadata);
    auto& fs = paths.get_filesystem();
    auto registry_set = paths.make_registry_set();
    PathsPortFileProvider provider(*registry_set, make_overlay_provider(fs, paths.overlay_ports));
    auto source_paragraphs =
        Util::fmap(provider.load_all_control_files(),
                   [](auto&& port) -> const SourceControlFile* { return port->source_control_file.get(); });
    const auto filter = options.command_arguments[0];

    for (const auto& source_control_file : source_paragraphs)
    {
        bool matched = Util::any_of(source_control_file->core_paragraph->dependencies,
                                    [&](const auto& dependency) { return dependency.name == filter; });

        if (!matched)
        {
            for (const auto& feature_paragraph : source_control_file->feature_paragraphs)
            {
                matched = Util::any_of(feature_paragraph->dependencies,
                                       [&](const auto& dependency) { return dependency.name == filter; });
                if (matched)
                {
                    break;
                }
            }
        }

        if (matched)
        {
            msg::write_unlocalized_text_to_stdout(Color::none, source_control_file->core_paragraph->name);
            msg::write_unlocalized_text_to_stdout(Color::none, "\n");
        }
    }
    Checks::exit_success(VCPKG_LINE_INFO);
}

Describe alternatives you've considered

No response

Additional context

No response

@miyanyan miyanyan added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Jan 19, 2025
@LilyWangLL LilyWangLL self-assigned this Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

No branches or pull requests

2 participants