From 77af264118522788e24e463309220f97dcff0a79 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 18 May 2019 18:15:31 -0700 Subject: [PATCH] [vcpkg] Fix regression in `--debug`. Remove old `features` featureflag. (#6507) --- toolsrc/include/vcpkg/globalstate.h | 2 -- toolsrc/src/vcpkg.cpp | 9 ++++----- toolsrc/src/vcpkg/build.cpp | 12 ++++-------- toolsrc/src/vcpkg/globalstate.cpp | 2 -- toolsrc/src/vcpkg/install.cpp | 22 +--------------------- toolsrc/src/vcpkg/paragraphs.cpp | 16 +++------------- 6 files changed, 12 insertions(+), 51 deletions(-) diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h index 2026ea369..263b5f80c 100644 --- a/toolsrc/include/vcpkg/globalstate.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -13,8 +13,6 @@ namespace vcpkg static Util::LockGuarded timer; static Util::LockGuarded g_surveydate; - static std::atomic debugging; - static std::atomic feature_packages; static std::atomic g_binary_caching; static std::atomic g_init_console_cp; diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 2c0f562b6..9102205d8 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -294,11 +294,11 @@ int main(const int argc, const char* const* const argv) Checks::register_global_shutdown_handler([]() { const auto elapsed_us_inner = GlobalState::timer.lock()->microseconds(); - bool debugging = GlobalState::debugging; + bool debugging = Debug::g_debugging; auto metrics = Metrics::g_metrics.lock(); metrics->track_metric("elapsed_us", elapsed_us_inner); - GlobalState::debugging = false; + Debug::g_debugging = false; metrics->flush(); #if defined(_WIN32) @@ -337,14 +337,13 @@ int main(const int argc, const char* const* const argv) const VcpkgCmdArguments args = VcpkgCmdArguments::create_from_command_line(argc, argv); - if (const auto p = args.featurepackages.get()) GlobalState::feature_packages = *p; if (const auto p = args.binarycaching.get()) GlobalState::g_binary_caching = *p; if (const auto p = args.printmetrics.get()) Metrics::g_metrics.lock()->set_print_metrics(*p); if (const auto p = args.sendmetrics.get()) Metrics::g_metrics.lock()->set_send_metrics(*p); - if (const auto p = args.debug.get()) GlobalState::debugging = *p; + if (const auto p = args.debug.get()) Debug::g_debugging = *p; - if (GlobalState::debugging) + if (Debug::g_debugging) { inner(args); Checks::exit_fail(VCPKG_LINE_INFO); diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 53b782edc..c5f145052 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -129,11 +130,6 @@ namespace vcpkg::Build::Command const FullPackageSpec spec = Input::check_and_get_full_package_spec( std::move(first_arg), default_triplet, COMMAND_STRUCTURE.example_text); Input::check_triplet(spec.package_spec.triplet(), paths); - if (!spec.features.empty() && !GlobalState::feature_packages) - { - Checks::exit_with_message( - VCPKG_LINE_INFO, "Feature packages are experimentally available under the --featurepackages flag."); - } perform_and_exit_ex(spec, paths.port_dir(spec.package_spec), options, paths); } } @@ -237,7 +233,7 @@ namespace vcpkg::Build if (!pre_build_info.cmake_system_name.empty() && pre_build_info.cmake_system_name != "WindowsStore") return ""; const char* tonull = " >nul"; - if (GlobalState::debugging) + if (Debug::g_debugging) { tonull = ""; } @@ -511,7 +507,7 @@ namespace vcpkg::Build // which will give a stable ordering and better names in the key entry. // this is not available in the filesystem TS so instead number the files for the key. std::string key = Strings::format("file_%03d", counter++); - if (GlobalState::debugging) + if (Debug::g_debugging) { System::print2("[DEBUG] mapping ", key, " from ", port_file.u8string(), "\n"); } @@ -536,7 +532,7 @@ namespace vcpkg::Build const std::string full_abi_info = Strings::join("", abi_tag_entries, [](const AbiEntry& p) { return p.key + " " + p.value + "\n"; }); - if (GlobalState::debugging) + if (Debug::g_debugging) { System::print2("[DEBUG] \n"); for (auto&& entry : abi_tag_entries) diff --git a/toolsrc/src/vcpkg/globalstate.cpp b/toolsrc/src/vcpkg/globalstate.cpp index 1a2c08474..aac5148fa 100644 --- a/toolsrc/src/vcpkg/globalstate.cpp +++ b/toolsrc/src/vcpkg/globalstate.cpp @@ -7,8 +7,6 @@ namespace vcpkg Util::LockGuarded GlobalState::timer; Util::LockGuarded GlobalState::g_surveydate; - std::atomic GlobalState::debugging(false); - std::atomic GlobalState::feature_packages(true); std::atomic GlobalState::g_binary_caching(false); std::atomic GlobalState::g_init_console_cp(0); diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 14dfb6fa3..646e9bc2e 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -302,8 +302,7 @@ namespace vcpkg::Install { const InstallPlanType& plan_type = action.plan_type; const std::string display_name = action.spec.to_string(); - const std::string display_name_with_features = - GlobalState::feature_packages ? action.displayname() : display_name; + const std::string display_name_with_features = action.displayname(); const bool is_user_requested = action.request_type == RequestType::USER_REQUESTED; const bool use_head_version = Util::Enum::to_bool(action.build_options.use_head_version); @@ -615,11 +614,6 @@ namespace vcpkg::Install for (auto&& spec : specs) { Input::check_triplet(spec.package_spec.triplet(), paths); - if (!spec.features.empty() && !GlobalState::feature_packages) - { - Checks::exit_with_message( - VCPKG_LINE_INFO, "Feature packages are experimentally available under the --featurepackages flag."); - } } const bool dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); @@ -655,20 +649,6 @@ namespace vcpkg::Install std::vector action_plan = create_feature_install_plan(provider, FullPackageSpec::to_feature_specs(specs), status_db); - if (!GlobalState::feature_packages) - { - for (auto&& action : action_plan) - { - if (action.remove_action.has_value()) - { - Checks::exit_with_message( - VCPKG_LINE_INFO, - "The installation plan requires feature packages support. Please re-run the " - "command with --featurepackages."); - } - } - } - for (auto&& action : action_plan) { if (auto p_install = action.install_action.get()) diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 45f939afd..431fad5ca 100644 --- a/toolsrc/src/vcpkg/paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include @@ -211,17 +211,7 @@ namespace vcpkg::Paragraphs Expected>> pghs = get_paragraphs(fs, path / "CONTROL"); if (auto vector_pghs = pghs.get()) { - auto csf = SourceControlFile::parse_control_file(std::move(*vector_pghs)); - if (!GlobalState::feature_packages) - { - if (auto ptr = csf.get()) - { - Checks::check_exit(VCPKG_LINE_INFO, ptr->get() != nullptr); - ptr->get()->core_paragraph->default_features.clear(); - ptr->get()->feature_paragraphs.clear(); - } - } - return csf; + return SourceControlFile::parse_control_file(std::move(*vector_pghs)); } auto error_info = std::make_unique(); error_info->name = path.filename().generic_u8string(); @@ -279,7 +269,7 @@ namespace vcpkg::Paragraphs auto results = try_load_all_ports(fs, ports_dir); if (!results.errors.empty()) { - if (GlobalState::debugging) + if (Debug::g_debugging) { print_error_message(results.errors); }