[vcpkg] Fix regression in `--debug`. Remove old `features` featureflag.
MODIFY
include/vcpkg/globalstate.h
include/vcpkg/globalstate.h
@@ -13,8 +13,6 @@ namespace vcpkg
static Util::LockGuarded<Chrono::ElapsedTimer> timer;
static Util::LockGuarded<std::string> g_surveydate;
- static std::atomic<bool> debugging;
- static std::atomic<bool> feature_packages;
static std::atomic<bool> g_binary_caching;
static std::atomic<int> g_init_console_cp;

MODIFY
src/vcpkg.cpp
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);

MODIFY
src/vcpkg/build.cpp
src/vcpkg/build.cpp
#include <vcpkg/base/stringliteral.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
+#include <vcpkg/base/system.debug.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
@@ -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] <abientries>\n");
for (auto&& entry : abi_tag_entries)

MODIFY
src/vcpkg/globalstate.cpp
src/vcpkg/globalstate.cpp
@@ -7,8 +7,6 @@ namespace vcpkg
Util::LockGuarded<Chrono::ElapsedTimer> GlobalState::timer;
Util::LockGuarded<std::string> GlobalState::g_surveydate;
- std::atomic<bool> GlobalState::debugging(false);
- std::atomic<bool> GlobalState::feature_packages(true);
std::atomic<bool> GlobalState::g_binary_caching(false);
std::atomic<int> GlobalState::g_init_console_cp(0);

MODIFY
src/vcpkg/install.cpp
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<AnyAction> 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())

MODIFY
src/vcpkg/paragraphs.cpp
src/vcpkg/paragraphs.cpp
#include <vcpkg/base/files.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
-#include <vcpkg/globalstate.h>
+#include <vcpkg/base/system.debug.h>
#include <vcpkg/paragraphparseresult.h>
#include <vcpkg/paragraphs.h>
@@ -211,17 +211,7 @@ namespace vcpkg::Paragraphs
Expected<std::vector<std::unordered_map<std::string, std::string>>> 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<ParseControlErrorInfo>();
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);
}

[vcpkg] Fix regression in `--debug`. Remove old `features` featureflag. (#6507)