aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-31 03:04:28 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-31 03:04:28 -0700
commit925fab565a76c23e76329193bc25158608bc9fc6 (patch)
treef7dad07950be67ca8404dd5f70d5deeb6402ca9c
parent912c38d466a7edf5a9d8727e3f6143f294e2f9fc (diff)
downloadvcpkg-925fab565a76c23e76329193bc25158608bc9fc6.tar.gz
vcpkg-925fab565a76c23e76329193bc25158608bc9fc6.zip
[vcpkg] --head should only apply to USER_REQUESTED packages.
-rw-r--r--toolsrc/include/vcpkg/dependencies.h5
-rw-r--r--toolsrc/include/vcpkg/install.h2
-rw-r--r--toolsrc/src/vcpkg/commands.ci.cpp5
-rw-r--r--toolsrc/src/vcpkg/dependencies.cpp14
-rw-r--r--toolsrc/src/vcpkg/export.cpp4
-rw-r--r--toolsrc/src/vcpkg/install.cpp59
6 files changed, 54 insertions, 35 deletions
diff --git a/toolsrc/include/vcpkg/dependencies.h b/toolsrc/include/vcpkg/dependencies.h
index 60c83fcca..5411ee166 100644
--- a/toolsrc/include/vcpkg/dependencies.h
+++ b/toolsrc/include/vcpkg/dependencies.h
@@ -3,6 +3,7 @@
#include <vcpkg/base/graphs.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/util.h>
+#include <vcpkg/build.h>
#include <vcpkg/packagespec.h>
#include <vcpkg/statusparagraphs.h>
#include <vcpkg/vcpkgpaths.h>
@@ -18,6 +19,9 @@ namespace vcpkg::Dependencies
AUTO_SELECTED
};
+ std::string to_output_string(RequestType request_type,
+ const CStringView s,
+ const Build::BuildPackageOptions& options);
std::string to_output_string(RequestType request_type, const CStringView s);
struct AnyParagraph
@@ -63,6 +67,7 @@ namespace vcpkg::Dependencies
AnyParagraph any_paragraph;
InstallPlanType plan_type;
RequestType request_type;
+ Build::BuildPackageOptions build_options;
std::unordered_set<std::string> feature_list;
};
diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h
index 895028865..7bf823e99 100644
--- a/toolsrc/include/vcpkg/install.h
+++ b/toolsrc/include/vcpkg/install.h
@@ -53,7 +53,6 @@ namespace vcpkg::Install
Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action,
- const Build::BuildPackageOptions& install_plan_options,
StatusParagraphs& status_db);
enum class InstallResult
@@ -70,7 +69,6 @@ namespace vcpkg::Install
StatusParagraphs* status_db);
InstallSummary perform(const std::vector<Dependencies::AnyAction>& action_plan,
- const Build::BuildPackageOptions& install_plan_options,
const KeepGoing keep_going,
const VcpkgPaths& paths,
StatusParagraphs& status_db);
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp
index 559dc4541..d012ff6dc 100644
--- a/toolsrc/src/vcpkg/commands.ci.cpp
+++ b/toolsrc/src/vcpkg/commands.ci.cpp
@@ -44,11 +44,12 @@ namespace vcpkg::Commands::CI
const Build::BuildPackageOptions install_plan_options = {Build::UseHeadVersion::NO, Build::AllowDownloads::YES};
const std::vector<Dependencies::AnyAction> action_plan =
- Util::fmap(install_plan, [](InstallPlanAction& install_action) {
+ Util::fmap(install_plan, [&install_plan_options](InstallPlanAction& install_action) {
+ install_action.build_options = install_plan_options;
return Dependencies::AnyAction(std::move(install_action));
});
- return Install::perform(action_plan, install_plan_options, Install::KeepGoing::YES, paths, status_db);
+ return Install::perform(action_plan, Install::KeepGoing::YES, paths, status_db);
}
struct TripletAndSummary
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp
index 4c4a8a31c..6f599afd4 100644
--- a/toolsrc/src/vcpkg/dependencies.cpp
+++ b/toolsrc/src/vcpkg/dependencies.cpp
@@ -133,6 +133,20 @@ namespace vcpkg::Dependencies
"Cannot get dependencies because there was none of: source/binary/status paragraphs");
}
+ std::string to_output_string(RequestType request_type,
+ const CStringView s,
+ const Build::BuildPackageOptions& options)
+ {
+ const char* const from_head = options.use_head_version == Build::UseHeadVersion::YES ? " (from HEAD)" : "";
+
+ switch (request_type)
+ {
+ case RequestType::AUTO_SELECTED: return Strings::format(" * %s%s", s, from_head);
+ case RequestType::USER_REQUESTED: return Strings::format(" %s%s", s, from_head);
+ default: Checks::unreachable(VCPKG_LINE_INFO);
+ }
+ }
+
std::string to_output_string(RequestType request_type, const CStringView s)
{
switch (request_type)
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp
index f0a3b23d0..eb4f5db3c 100644
--- a/toolsrc/src/vcpkg/export.cpp
+++ b/toolsrc/src/vcpkg/export.cpp
@@ -68,6 +68,8 @@ namespace vcpkg::Export
{
static constexpr std::array<ExportPlanType, 2> ORDER = {ExportPlanType::ALREADY_BUILT,
ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT};
+ static constexpr Build::BuildPackageOptions build_options = {Build::UseHeadVersion::NO,
+ Build::AllowDownloads::YES};
for (const ExportPlanType plan_type : ORDER)
{
@@ -80,7 +82,7 @@ namespace vcpkg::Export
std::vector<const ExportPlanAction*> cont = it->second;
std::sort(cont.begin(), cont.end(), &ExportPlanAction::compare_by_name);
const std::string as_string = Strings::join("\n", cont, [](const ExportPlanAction* p) {
- return Dependencies::to_output_string(p->request_type, p->spec.to_string());
+ return Dependencies::to_output_string(p->request_type, p->spec.to_string(), build_options);
});
switch (plan_type)
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp
index 7bab740be..b1f722d59 100644
--- a/toolsrc/src/vcpkg/install.cpp
+++ b/toolsrc/src/vcpkg/install.cpp
@@ -250,7 +250,6 @@ namespace vcpkg::Install
BuildResult perform_install_plan_action(const VcpkgPaths& paths,
const InstallPlanAction& action,
- const Build::BuildPackageOptions& build_package_options,
StatusParagraphs& status_db)
{
const InstallPlanType& plan_type = action.plan_type;
@@ -259,7 +258,7 @@ namespace vcpkg::Install
GlobalState::feature_packages ? action.displayname() : display_name;
const bool is_user_requested = action.request_type == RequestType::USER_REQUESTED;
- const bool use_head_version = to_bool(build_package_options.use_head_version);
+ const bool use_head_version = to_bool(action.build_options.use_head_version);
if (plan_type == InstallPlanType::ALREADY_INSTALLED)
{
@@ -285,7 +284,7 @@ namespace vcpkg::Install
*action.any_paragraph.source_control_file.value_or_exit(VCPKG_LINE_INFO),
action.spec.triplet(),
paths.port_dir(action.spec),
- build_package_options,
+ action.build_options,
action.feature_list};
return Build::build_package(paths, build_config, status_db);
}
@@ -295,7 +294,7 @@ namespace vcpkg::Install
action.any_paragraph.source_paragraph.value_or_exit(VCPKG_LINE_INFO),
action.spec.triplet(),
paths.port_dir(action.spec),
- build_package_options};
+ action.build_options};
return Build::build_package(paths, build_config, status_db);
}
}();
@@ -407,46 +406,38 @@ namespace vcpkg::Install
std::sort(already_installed_plans.begin(), already_installed_plans.end(), &InstallPlanAction::compare_by_name);
std::sort(excluded.begin(), excluded.end(), &InstallPlanAction::compare_by_name);
+ static auto actions_to_output_string = [](const std::vector<const InstallPlanAction*>& v) {
+ return Strings::join("\n", v, [](const InstallPlanAction* p) {
+ return to_output_string(p->request_type, p->displayname(), p->build_options);
+ });
+ };
+
if (excluded.size() > 0)
{
- const std::string excluded_string = Strings::join("\n", excluded, [](const InstallPlanAction* p) {
- return to_output_string(p->request_type, p->displayname());
- });
- System::println("The following packages are excluded:\n%s", excluded_string);
+ System::println("The following packages are excluded:\n%s", actions_to_output_string(excluded));
}
if (already_installed_plans.size() > 0)
{
- const std::string already_string =
- Strings::join("\n", already_installed_plans, [](const InstallPlanAction* p) {
- return to_output_string(p->request_type, p->displayname());
- });
- System::println("The following packages are already installed:\n%s", already_string);
+ System::println("The following packages are already installed:\n%s",
+ actions_to_output_string(already_installed_plans));
}
if (rebuilt_plans.size() > 0)
{
- const std::string rebuilt_string = Strings::join("\n", rebuilt_plans, [](const InstallPlanAction* p) {
- return to_output_string(p->request_type, p->displayname());
- });
- System::println("The following packages will be rebuilt:\n%s", rebuilt_string);
+ System::println("The following packages will be rebuilt:\n%s", actions_to_output_string(rebuilt_plans));
}
if (new_plans.size() > 0)
{
- const std::string new_string = Strings::join("\n", new_plans, [](const InstallPlanAction* p) {
- return to_output_string(p->request_type, p->displayname());
- });
- System::println("The following packages will be built and installed:\n%s", new_string);
+ System::println("The following packages will be built and installed:\n%s",
+ actions_to_output_string(new_plans));
}
if (only_install_plans.size() > 0)
{
- const std::string only_install_string =
- Strings::join("\n", only_install_plans, [](const InstallPlanAction* p) {
- return to_output_string(p->request_type, p->displayname());
- });
- System::println("The following packages will be directly installed:\n%s", only_install_string);
+ System::println("The following packages will be directly installed:\n%s",
+ actions_to_output_string(only_install_plans));
}
if (has_non_user_requested_packages)
@@ -489,7 +480,6 @@ namespace vcpkg::Install
}
InstallSummary perform(const std::vector<AnyAction>& action_plan,
- const Build::BuildPackageOptions& install_plan_options,
const KeepGoing keep_going,
const VcpkgPaths& paths,
StatusParagraphs& status_db)
@@ -513,8 +503,7 @@ namespace vcpkg::Install
if (const auto install_action = action.install_plan.get())
{
- const BuildResult result =
- perform_install_plan_action(paths, *install_action, install_plan_options, status_db);
+ const BuildResult result = perform_install_plan_action(paths, *install_action, status_db);
if (result != BuildResult::SUCCEEDED && keep_going == KeepGoing::NO)
{
System::println(Build::create_user_troubleshooting_message(install_action->spec));
@@ -629,6 +618,16 @@ namespace vcpkg::Install
install_plan, [](InstallPlanAction& install_action) { return AnyAction(std::move(install_action)); });
}
+ for (auto&& action : action_plan)
+ {
+ if (auto p_install = action.install_plan.get())
+ {
+ p_install->build_options = install_plan_options;
+ if (p_install->request_type != RequestType::USER_REQUESTED)
+ p_install->build_options.use_head_version = Build::UseHeadVersion::NO;
+ }
+ }
+
// install plan will be empty if it is already installed - need to change this at status paragraph part
Checks::check_exit(VCPKG_LINE_INFO, !action_plan.empty(), "Install plan cannot be empty");
@@ -650,7 +649,7 @@ namespace vcpkg::Install
Checks::exit_success(VCPKG_LINE_INFO);
}
- const InstallSummary summary = perform(action_plan, install_plan_options, keep_going, paths, status_db);
+ const InstallSummary summary = perform(action_plan, keep_going, paths, status_db);
System::println("\nTotal elapsed time: %s", summary.total_elapsed_time);