aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-06-23 08:16:07 +0800
committermyd7349 <myd7349@gmail.com>2019-06-23 08:16:07 +0800
commit644851da5fbe46aadd0a8fa54e1d7d213f469fb0 (patch)
tree3f5d20aca85fcf02375cf553e893c105758a5d39 /toolsrc/src
parentf1870ae02bedbaa5a501ddf3a7ba5d0a743a1053 (diff)
parentf3db66b403840b24ea2612d09cca30a5285f5ea3 (diff)
downloadvcpkg-644851da5fbe46aadd0a8fa54e1d7d213f469fb0.tar.gz
vcpkg-644851da5fbe46aadd0a8fa54e1d7d213f469fb0.zip
Merge branch 'master' into sx-init
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/tests.arguments.cpp12
-rw-r--r--toolsrc/src/tests.dependencies.cpp2
-rw-r--r--toolsrc/src/tests.packagespec.cpp2
-rw-r--r--toolsrc/src/tests.paragraph.cpp2
-rw-r--r--toolsrc/src/tests.plan.cpp8
-rw-r--r--toolsrc/src/tests.update.cpp16
-rw-r--r--toolsrc/src/vcpkg.cpp13
-rw-r--r--toolsrc/src/vcpkg/archives.cpp2
-rw-r--r--toolsrc/src/vcpkg/base/chrono.cpp10
-rw-r--r--toolsrc/src/vcpkg/base/downloads.cpp38
-rw-r--r--toolsrc/src/vcpkg/base/files.cpp86
-rw-r--r--toolsrc/src/vcpkg/base/strings.cpp2
-rw-r--r--toolsrc/src/vcpkg/base/system.cpp27
-rw-r--r--toolsrc/src/vcpkg/build.cpp104
-rw-r--r--toolsrc/src/vcpkg/commands.autocomplete.cpp3
-rw-r--r--toolsrc/src/vcpkg/commands.buildexternal.cpp9
-rw-r--r--toolsrc/src/vcpkg/commands.ci.cpp158
-rw-r--r--toolsrc/src/vcpkg/commands.create.cpp3
-rw-r--r--toolsrc/src/vcpkg/commands.dependinfo.cpp22
-rw-r--r--toolsrc/src/vcpkg/commands.edit.cpp34
-rw-r--r--toolsrc/src/vcpkg/commands.exportifw.cpp24
-rw-r--r--toolsrc/src/vcpkg/commands.import.cpp5
-rw-r--r--toolsrc/src/vcpkg/commands.integrate.cpp38
-rw-r--r--toolsrc/src/vcpkg/commands.search.cpp8
-rw-r--r--toolsrc/src/vcpkg/commands.upgrade.cpp10
-rw-r--r--toolsrc/src/vcpkg/dependencies.cpp181
-rw-r--r--toolsrc/src/vcpkg/export.cpp18
-rw-r--r--toolsrc/src/vcpkg/globalstate.cpp2
-rw-r--r--toolsrc/src/vcpkg/help.cpp6
-rw-r--r--toolsrc/src/vcpkg/install.cpp113
-rw-r--r--toolsrc/src/vcpkg/metrics.cpp2
-rw-r--r--toolsrc/src/vcpkg/packagespecparseresult.cpp5
-rw-r--r--toolsrc/src/vcpkg/paragraphs.cpp16
-rw-r--r--toolsrc/src/vcpkg/postbuildlint.cpp5
-rw-r--r--toolsrc/src/vcpkg/remove.cpp5
-rw-r--r--toolsrc/src/vcpkg/sourceparagraph.cpp3
-rw-r--r--toolsrc/src/vcpkg/tools.cpp26
-rw-r--r--toolsrc/src/vcpkg/update.cpp10
-rw-r--r--toolsrc/src/vcpkg/userconfig.cpp5
-rw-r--r--toolsrc/src/vcpkg/vcpkgcmdarguments.cpp115
-rw-r--r--toolsrc/src/vcpkg/vcpkglib.cpp16
-rw-r--r--toolsrc/src/vcpkg/vcpkgpaths.cpp3
42 files changed, 752 insertions, 417 deletions
diff --git a/toolsrc/src/tests.arguments.cpp b/toolsrc/src/tests.arguments.cpp
index c87281fa8..51ababd3d 100644
--- a/toolsrc/src/tests.arguments.cpp
+++ b/toolsrc/src/tests.arguments.cpp
@@ -1,7 +1,9 @@
#include "tests.pch.h"
+#if defined(_WIN32)
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
+#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
@@ -33,8 +35,8 @@ namespace UnitTest1
TEST_METHOD(create_from_arg_sequence_valued_options)
{
- std::array<CommandSetting, 1> settings = { {{"--a", ""}} };
- CommandStructure cmdstruct = { "", 0, SIZE_MAX, {{}, settings }, nullptr };
+ std::array<CommandSetting, 1> settings = {{{"--a", ""}}};
+ CommandStructure cmdstruct = {"", 0, SIZE_MAX, {{}, settings}, nullptr};
std::vector<std::string> t = {"--a=b", "command", "argument"};
auto v = VcpkgCmdArguments::create_from_arg_sequence(t.data(), t.data() + t.size());
@@ -47,8 +49,8 @@ namespace UnitTest1
TEST_METHOD(create_from_arg_sequence_valued_options2)
{
- std::array<CommandSwitch, 2> switches = { {{"--a", ""}, {"--c", ""}} };
- std::array<CommandSetting, 2> settings = { { {"--b", ""}, {"--d", ""}} };
+ std::array<CommandSwitch, 2> switches = {{{"--a", ""}, {"--c", ""}}};
+ std::array<CommandSetting, 2> settings = {{{"--b", ""}, {"--d", ""}}};
CommandStructure cmdstruct = {"", 0, SIZE_MAX, {switches, settings}, nullptr};
std::vector<std::string> t = {"--a", "--b=c"};
@@ -61,4 +63,4 @@ namespace UnitTest1
Assert::AreEqual(size_t{0}, v.command_arguments.size());
}
};
-} \ No newline at end of file
+}
diff --git a/toolsrc/src/tests.dependencies.cpp b/toolsrc/src/tests.dependencies.cpp
index f82fad4e4..7d8283ed6 100644
--- a/toolsrc/src/tests.dependencies.cpp
+++ b/toolsrc/src/tests.dependencies.cpp
@@ -1,7 +1,9 @@
#include "tests.pch.h"
+#if defined(_WIN32)
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
+#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
diff --git a/toolsrc/src/tests.packagespec.cpp b/toolsrc/src/tests.packagespec.cpp
index 32ad81227..d3bc18c79 100644
--- a/toolsrc/src/tests.packagespec.cpp
+++ b/toolsrc/src/tests.packagespec.cpp
@@ -2,8 +2,10 @@
#include <tests.utils.h>
+#if defined(_WIN32)
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
+#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
diff --git a/toolsrc/src/tests.paragraph.cpp b/toolsrc/src/tests.paragraph.cpp
index 9a56ad9ee..e99d07694 100644
--- a/toolsrc/src/tests.paragraph.cpp
+++ b/toolsrc/src/tests.paragraph.cpp
@@ -1,7 +1,9 @@
#include "tests.pch.h"
+#if defined(_WIN32)
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
+#endif
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
diff --git a/toolsrc/src/tests.plan.cpp b/toolsrc/src/tests.plan.cpp
index 238aa7032..ab24266b4 100644
--- a/toolsrc/src/tests.plan.cpp
+++ b/toolsrc/src/tests.plan.cpp
@@ -47,7 +47,8 @@ namespace UnitTest1
Assert::AreEqual(plan.spec.triplet().to_string().c_str(), triplet.to_string().c_str());
- Assert::AreEqual(pkg_name.c_str(), plan.source_control_file.get()->core_paragraph->name.c_str());
+ auto* scfl = plan.source_control_file_location.get();
+ Assert::AreEqual(pkg_name.c_str(), scfl->source_control_file->core_paragraph->name.c_str());
Assert::AreEqual(size_t(vec.size()), feature_list.size());
for (auto&& feature_name : vec)
@@ -79,7 +80,7 @@ namespace UnitTest1
/// </summary>
struct PackageSpecMap
{
- std::unordered_map<std::string, SourceControlFile> map;
+ std::unordered_map<std::string, SourceControlFileLocation> map;
Triplet triplet;
PackageSpecMap(const Triplet& t = Triplet::X86_WINDOWS) noexcept { triplet = t; }
@@ -94,7 +95,8 @@ namespace UnitTest1
{
auto spec = PackageSpec::from_name_and_triplet(scf.core_paragraph->name, triplet);
Assert::IsTrue(spec.has_value());
- map.emplace(scf.core_paragraph->name, std::move(scf));
+ map.emplace(scf.core_paragraph->name,
+ SourceControlFileLocation{std::unique_ptr<SourceControlFile>(std::move(&scf)), ""});
return PackageSpec{*spec.get()};
}
};
diff --git a/toolsrc/src/tests.update.cpp b/toolsrc/src/tests.update.cpp
index b6e487c17..5e3f9f3e2 100644
--- a/toolsrc/src/tests.update.cpp
+++ b/toolsrc/src/tests.update.cpp
@@ -21,9 +21,9 @@ namespace UnitTest1
StatusParagraphs status_db(std::move(status_paragraphs));
- std::unordered_map<std::string, SourceControlFile> map;
+ std::unordered_map<std::string, SourceControlFileLocation> map;
auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}}));
- map.emplace("a", std::move(*scf));
+ map.emplace("a", SourceControlFileLocation { std::move(scf), "" });
Dependencies::MapPortFileProvider provider(map);
auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db),
@@ -45,9 +45,9 @@ namespace UnitTest1
StatusParagraphs status_db(std::move(status_paragraphs));
- std::unordered_map<std::string, SourceControlFile> map;
+ std::unordered_map<std::string, SourceControlFileLocation> map;
auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}}));
- map.emplace("a", std::move(*scf));
+ map.emplace("a", SourceControlFileLocation { std::move(scf), "" });
Dependencies::MapPortFileProvider provider(map);
auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db),
@@ -71,9 +71,9 @@ namespace UnitTest1
StatusParagraphs status_db(std::move(status_paragraphs));
- std::unordered_map<std::string, SourceControlFile> map;
+ std::unordered_map<std::string, SourceControlFileLocation> map;
auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "0"}}}));
- map.emplace("a", std::move(*scf));
+ map.emplace("a", SourceControlFileLocation{ std::move(scf), "" });
Dependencies::MapPortFileProvider provider(map);
auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db),
@@ -92,9 +92,9 @@ namespace UnitTest1
StatusParagraphs status_db(std::move(status_paragraphs));
- std::unordered_map<std::string, SourceControlFile> map;
+ std::unordered_map<std::string, SourceControlFileLocation> map;
auto scf = unwrap(SourceControlFile::parse_control_file(Pgh{{{"Source", "a"}, {"Version", "2"}}}));
- map.emplace("a", std::move(*scf));
+ map.emplace("a", SourceControlFileLocation{ std::move(scf), "" });
Dependencies::MapPortFileProvider provider(map);
auto pkgs = SortedVector<OutdatedPackage>(Update::find_outdated_packages(provider, status_db),
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp
index 2c0f562b6..e02bdc71f 100644
--- a/toolsrc/src/vcpkg.cpp
+++ b/toolsrc/src/vcpkg.cpp
@@ -40,8 +40,10 @@
#include <memory>
#include <random>
+#if defined(_WIN32)
#pragma comment(lib, "ole32")
#pragma comment(lib, "shell32")
+#endif
using namespace vcpkg;
@@ -294,11 +296,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 +339,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);
@@ -389,6 +390,6 @@ int main(const int argc, const char* const* const argv)
}
fflush(stdout);
- //It is expected that one of the sub-commands will exit cleanly before we get here.
+ // It is expected that one of the sub-commands will exit cleanly before we get here.
Checks::exit_fail(VCPKG_LINE_INFO);
}
diff --git a/toolsrc/src/vcpkg/archives.cpp b/toolsrc/src/vcpkg/archives.cpp
index 037cbdc14..69a916828 100644
--- a/toolsrc/src/vcpkg/archives.cpp
+++ b/toolsrc/src/vcpkg/archives.cpp
@@ -1,8 +1,8 @@
#include "pch.h"
#include <vcpkg/archives.h>
-#include <vcpkg/commands.h>
#include <vcpkg/base/system.process.h>
+#include <vcpkg/commands.h>
namespace vcpkg::Archives
{
diff --git a/toolsrc/src/vcpkg/base/chrono.cpp b/toolsrc/src/vcpkg/base/chrono.cpp
index 959ff90c8..86dc590f8 100644
--- a/toolsrc/src/vcpkg/base/chrono.cpp
+++ b/toolsrc/src/vcpkg/base/chrono.cpp
@@ -22,7 +22,7 @@ namespace vcpkg::Chrono
static tm to_local_time(const std::time_t& t)
{
- tm parts {};
+ tm parts{};
#if defined(_WIN32)
localtime_s(&parts, &t);
#else
@@ -33,7 +33,7 @@ namespace vcpkg::Chrono
static Optional<tm> to_utc_time(const std::time_t& t)
{
- tm parts {};
+ tm parts{};
#if defined(_WIN32)
const errno_t err = gmtime_s(&parts, &t);
if (err)
@@ -127,7 +127,7 @@ namespace vcpkg::Chrono
const Optional<tm> opt = to_utc_time(ct);
if (auto p_tm = opt.get())
{
- return CTime {*p_tm};
+ return CTime{*p_tm};
}
return nullopt;
@@ -160,11 +160,11 @@ namespace vcpkg::Chrono
return ret;
}
- CTime CTime::add_hours(const int hours) const { return CTime {date_plus_hours(&this->m_tm, hours)}; }
+ CTime CTime::add_hours(const int hours) const { return CTime{date_plus_hours(&this->m_tm, hours)}; }
std::string CTime::to_string() const
{
- std::array<char, 80> date {};
+ std::array<char, 80> date{};
strftime(&date[0], date.size(), "%Y-%m-%dT%H:%M:%S.0Z", &m_tm);
return &date[0];
}
diff --git a/toolsrc/src/vcpkg/base/downloads.cpp b/toolsrc/src/vcpkg/base/downloads.cpp
index 590c48ff5..4bb2178e5 100644
--- a/toolsrc/src/vcpkg/base/downloads.cpp
+++ b/toolsrc/src/vcpkg/base/downloads.cpp
@@ -44,18 +44,20 @@ namespace vcpkg::Downloads
Checks::check_exit(VCPKG_LINE_INFO, hSession, "WinHttpOpen() failed: %d", GetLastError());
// Win7 IE Proxy fallback
- if (IsWindows7OrGreater() && !IsWindows8Point1OrGreater()) {
+ if (IsWindows7OrGreater() && !IsWindows8Point1OrGreater())
+ {
// First check if any proxy has been found automatically
- WINHTTP_PROXY_INFO proxyInfo;
- DWORD proxyInfoSize = sizeof(WINHTTP_PROXY_INFO);
- auto noProxyFound =
- !WinHttpQueryOption(hSession, WINHTTP_OPTION_PROXY, &proxyInfo, &proxyInfoSize)
- || proxyInfo.dwAccessType == WINHTTP_ACCESS_TYPE_NO_PROXY;
-
- // If no proxy was found automatically, use IE's proxy settings, if any
- if (noProxyFound) {
+ WINHTTP_PROXY_INFO proxyInfo;
+ DWORD proxyInfoSize = sizeof(WINHTTP_PROXY_INFO);
+ auto noProxyFound = !WinHttpQueryOption(hSession, WINHTTP_OPTION_PROXY, &proxyInfo, &proxyInfoSize) ||
+ proxyInfo.dwAccessType == WINHTTP_ACCESS_TYPE_NO_PROXY;
+
+ // If no proxy was found automatically, use IE's proxy settings, if any
+ if (noProxyFound)
+ {
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxy;
- if (WinHttpGetIEProxyConfigForCurrentUser(&ieProxy) && ieProxy.lpszProxy != nullptr) {
+ if (WinHttpGetIEProxyConfigForCurrentUser(&ieProxy) && ieProxy.lpszProxy != nullptr)
+ {
WINHTTP_PROXY_INFO proxy;
proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
proxy.lpszProxy = ieProxy.lpszProxy;
@@ -103,7 +105,7 @@ namespace vcpkg::Downloads
bResults = WinHttpQueryDataAvailable(hRequest, &dwSize);
Checks::check_exit(VCPKG_LINE_INFO, bResults, "WinHttpQueryDataAvailable() failed: %d", GetLastError());
- if (buf.size() < dwSize) buf.resize(dwSize * 2);
+ if (buf.size() < dwSize) buf.resize(static_cast<size_t>(dwSize) * 2);
bResults = WinHttpReadData(hRequest, (LPVOID)buf.data(), dwSize, &downloaded_size);
Checks::check_exit(VCPKG_LINE_INFO, bResults, "WinHttpReadData() failed: %d", GetLastError());
@@ -155,9 +157,10 @@ namespace vcpkg::Downloads
const std::string& sha512)
{
const std::string download_path_part = download_path.u8string() + ".part";
+ auto download_path_part_path = fs::u8path(download_path_part);
std::error_code ec;
fs.remove(download_path, ec);
- fs.remove(download_path_part, ec);
+ fs.remove(download_path_part_path, ec);
#if defined(_WIN32)
auto url_no_proto = url.substr(8); // drop https://
auto path_begin = Util::find(url_no_proto, '/');
@@ -171,14 +174,7 @@ namespace vcpkg::Downloads
Checks::check_exit(VCPKG_LINE_INFO, code == 0, "Could not download %s", url);
#endif
- verify_downloaded_file_hash(fs, url, download_path_part, sha512);
- fs.rename(download_path_part, download_path, ec);
- Checks::check_exit(VCPKG_LINE_INFO,
- !ec,
- "Failed to do post-download rename-in-place.\n"
- "fs.rename(%s, %s, %s)",
- download_path_part,
- download_path.u8string(),
- ec.message());
+ verify_downloaded_file_hash(fs, url, download_path_part_path, sha512);
+ fs.rename(download_path_part_path, download_path, VCPKG_LINE_INFO);
}
}
diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp
index 164394100..5099795e9 100644
--- a/toolsrc/src/vcpkg/base/files.cpp
+++ b/toolsrc/src/vcpkg/base/files.cpp
@@ -7,24 +7,60 @@
#include <vcpkg/base/system.process.h>
#include <vcpkg/base/util.h>
-#if defined(__linux__)
+#if defined(__linux__) || defined(__APPLE__)
#include <fcntl.h>
-#include <sys/sendfile.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#endif
+#if defined(__linux__)
+#include <sys/sendfile.h>
+#elif defined(__APPLE__)
+#include <copyfile.h>
+#endif
namespace vcpkg::Files
{
static const std::regex FILESYSTEM_INVALID_CHARACTERS_REGEX = std::regex(R"([\/:*?"<>|])");
- void Filesystem::write_contents(const fs::path& file_path, const std::string& data)
+ std::string Filesystem::read_contents(const fs::path& path, LineInfo linfo) const
+ {
+ auto maybe_contents = this->read_contents(path);
+ if (auto p = maybe_contents.get())
+ return std::move(*p);
+ else
+ Checks::exit_with_message(
+ linfo, "error reading file: %s: %s", path.u8string(), maybe_contents.error().message());
+ }
+ void Filesystem::write_contents(const fs::path& path, const std::string& data, LineInfo linfo)
+ {
+ std::error_code ec;
+ this->write_contents(path, data, ec);
+ if (ec) Checks::exit_with_message(linfo, "error writing file: %s: %s", path.u8string(), ec.message());
+ }
+ void Filesystem::rename(const fs::path& oldpath, const fs::path& newpath, LineInfo linfo)
+ {
+ std::error_code ec;
+ this->rename(oldpath, newpath, ec);
+ if (ec)
+ Checks::exit_with_message(
+ linfo, "error renaming file: %s: %s: %s", oldpath.u8string(), newpath.u8string(), ec.message());
+ }
+
+ bool Filesystem::remove(const fs::path& path, LineInfo linfo)
+ {
+ std::error_code ec;
+ auto r = this->remove(path, ec);
+ if (ec) Checks::exit_with_message(linfo, "error removing file: %s: %s", path.u8string(), ec.message());
+ return r;
+ }
+
+ void Filesystem::write_lines(const fs::path& path, const std::vector<std::string>& lines, LineInfo linfo)
{
std::error_code ec;
- write_contents(file_path, data, ec);
- Checks::check_exit(
- VCPKG_LINE_INFO, !ec, "error while writing file: %s: %s", file_path.u8string(), ec.message());
+ this->write_lines(path, lines, ec);
+ if (ec) Checks::exit_with_message(linfo, "error writing lines: %s: %s", path.u8string(), ec.message());
}
struct RealFilesystem final : Filesystem
@@ -142,31 +178,40 @@ namespace vcpkg::Files
return ret;
}
- virtual void write_lines(const fs::path& file_path, const std::vector<std::string>& lines) override
+ virtual void write_lines(const fs::path& file_path,
+ const std::vector<std::string>& lines,
+ std::error_code& ec) override
{
std::fstream output(file_path, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc);
+ if (!output)
+ {
+ ec.assign(errno, std::generic_category());
+ return;
+ }
for (const std::string& line : lines)
{
output << line << "\n";
+ if (!output)
+ {
+ output.close();
+ ec.assign(errno, std::generic_category());
+ return;
+ }
}
output.close();
}
-
virtual void rename(const fs::path& oldpath, const fs::path& newpath, std::error_code& ec) override
{
fs::stdfs::rename(oldpath, newpath, ec);
}
- virtual void rename(const fs::path& oldpath, const fs::path& newpath) override
- {
- fs::stdfs::rename(oldpath, newpath);
- }
virtual void rename_or_copy(const fs::path& oldpath,
const fs::path& newpath,
StringLiteral temp_suffix,
std::error_code& ec) override
{
this->rename(oldpath, newpath, ec);
-#if defined(__linux__)
+ Util::unused(temp_suffix);
+#if defined(__linux__) || defined(__APPLE__)
if (ec)
{
auto dst = newpath;
@@ -182,13 +227,25 @@ namespace vcpkg::Files
return;
}
+#if defined(__linux__)
off_t bytes = 0;
struct stat info = {0};
fstat(i_fd, &info);
auto written_bytes = sendfile(o_fd, i_fd, &bytes, info.st_size);
+#elif defined(__APPLE__)
+ auto written_bytes = fcopyfile(i_fd, o_fd, 0, COPYFILE_ALL);
+#endif
+ if (written_bytes == -1)
+ {
+ ec.assign(errno, std::generic_category());
+ close(i_fd);
+ close(o_fd);
+
+ return;
+ }
+
close(i_fd);
close(o_fd);
- if (written_bytes == -1) return;
this->rename(dst, newpath, ec);
if (ec) return;
@@ -196,7 +253,6 @@ namespace vcpkg::Files
}
#endif
}
- virtual bool remove(const fs::path& path) override { return fs::stdfs::remove(path); }
virtual bool remove(const fs::path& path, std::error_code& ec) override { return fs::stdfs::remove(path, ec); }
virtual std::uintmax_t remove_all(const fs::path& path, std::error_code& ec) override
{
diff --git a/toolsrc/src/vcpkg/base/strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp
index ce634a227..54a74a7a1 100644
--- a/toolsrc/src/vcpkg/base/strings.cpp
+++ b/toolsrc/src/vcpkg/base/strings.cpp
@@ -185,7 +185,7 @@ std::vector<std::string> Strings::split(const std::string& s, const std::string&
return output;
}
-std::vector<std::string> Strings::split(const std::string& s, const std::string& delimiter, int max_count)
+std::vector<std::string> Strings::split(const std::string& s, const std::string& delimiter, size_t max_count)
{
std::vector<std::string> output;
diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp
index 132c1f074..c5ff050f0 100644
--- a/toolsrc/src/vcpkg/base/system.cpp
+++ b/toolsrc/src/vcpkg/base/system.cpp
@@ -16,7 +16,9 @@
#include <sys/sysctl.h>
#endif
+#if defined(_WIN32)
#pragma comment(lib, "Advapi32")
+#endif
using namespace vcpkg::System;
@@ -177,8 +179,8 @@ namespace vcpkg
}
std::string System::make_cmake_cmd(const fs::path& cmake_exe,
- const fs::path& cmake_script,
- const std::vector<CMakeVariable>& pass_variables)
+ const fs::path& cmake_script,
+ const std::vector<CMakeVariable>& pass_variables)
{
const std::string cmd_cmake_pass_variables = Strings::join(" ", pass_variables, [](auto&& v) { return v.s; });
return Strings::format(
@@ -345,7 +347,8 @@ namespace vcpkg
}
#endif
- int System::cmd_execute_clean(const ZStringView cmd_line, const std::unordered_map<std::string, std::string>& extra_env)
+ int System::cmd_execute_clean(const ZStringView cmd_line,
+ const std::unordered_map<std::string, std::string>& extra_env)
{
auto timer = Chrono::ElapsedTimer::create_started();
#if defined(_WIN32)
@@ -385,6 +388,7 @@ namespace vcpkg
// Flush stdout before launching external process
fflush(nullptr);
+ auto timer = Chrono::ElapsedTimer::create_started();
#if defined(_WIN32)
// We are wrap the command line in quotes to cause cmd.exe to correctly process it
auto actual_cmd_line = Strings::concat('"', cmd_line, '"');
@@ -392,11 +396,19 @@ namespace vcpkg
g_ctrl_c_state.transition_to_spawn_process();
const int exit_code = _wsystem(Strings::to_utf16(actual_cmd_line).c_str());
g_ctrl_c_state.transition_from_spawn_process();
- Debug::print("_wsystem() returned ", exit_code, '\n');
+ Debug::print("_wsystem() returned ",
+ exit_code,
+ " after ",
+ Strings::format("%8d", static_cast<int>(timer.microseconds())),
+ " us\n");
#else
Debug::print("_system(", cmd_line, ")\n");
const int exit_code = system(cmd_line.c_str());
- Debug::print("_system() returned ", exit_code, '\n');
+ Debug::print("_system() returned ",
+ exit_code,
+ " after ",
+ Strings::format("%8d", static_cast<int>(timer.microseconds())),
+ " us\n");
#endif
return exit_code;
}
@@ -595,6 +607,11 @@ namespace vcpkg
#else
void System::register_console_ctrl_handler() {}
#endif
+
+ int System::get_num_logical_cores()
+ {
+ return std::thread::hardware_concurrency();
+ }
}
namespace vcpkg::Debug
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index 53b782edc..059a09432 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -6,6 +6,7 @@
#include <vcpkg/base/hash.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/stringliteral.h>
+#include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/system.process.h>
@@ -22,6 +23,7 @@
#include <vcpkg/vcpkglib.h>
using vcpkg::Build::BuildResult;
+using vcpkg::Dependencies::PathsPortFileProvider;
using vcpkg::Parse::ParseControlErrorInfo;
using vcpkg::Parse::ParseExpected;
@@ -33,34 +35,26 @@ namespace vcpkg::Build::Command
static constexpr StringLiteral OPTION_CHECKS_ONLY = "--checks-only";
void perform_and_exit_ex(const FullPackageSpec& full_spec,
- const fs::path& port_dir,
+ const SourceControlFileLocation& scfl,
const ParsedArguments& options,
const VcpkgPaths& paths)
{
const PackageSpec& spec = full_spec.package_spec;
+ const auto& scf = *scfl.source_control_file;
if (Util::Sets::contains(options.switches, OPTION_CHECKS_ONLY))
{
const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet());
const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec));
- const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
+ const size_t error_count =
+ PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info, scfl.source_location);
Checks::check_exit(VCPKG_LINE_INFO, error_count == 0);
Checks::exit_success(VCPKG_LINE_INFO);
}
- const ParseExpected<SourceControlFile> source_control_file =
- Paragraphs::try_load_port(paths.get_filesystem(), port_dir);
-
- if (!source_control_file.has_value())
- {
- print_error_message(source_control_file.error());
- Checks::exit_fail(VCPKG_LINE_INFO);
- }
-
- const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO);
Checks::check_exit(VCPKG_LINE_INFO,
- spec.name() == scf->core_paragraph->name,
+ spec.name() == scf.core_paragraph->name,
"The Source field inside the CONTROL file does not match the port directory: '%s' != '%s'",
- scf->core_paragraph->name,
+ scf.core_paragraph->name,
spec.name());
const StatusParagraphs status_db = database_load_check(paths);
@@ -69,6 +63,7 @@ namespace vcpkg::Build::Command
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
+ Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO,
Build::FailOnTombstone::NO,
@@ -78,7 +73,7 @@ namespace vcpkg::Build::Command
features_as_set.emplace("core");
const Build::BuildPackageConfig build_config{
- *scf, spec.triplet(), fs::path{port_dir}, build_package_options, features_as_set};
+ scf, spec.triplet(), fs::path(scfl.source_location), build_package_options, features_as_set};
const auto build_timer = Chrono::ElapsedTimer::create_started();
const auto result = Build::build_package(paths, build_config, status_db);
@@ -126,15 +121,19 @@ namespace vcpkg::Build::Command
// Build only takes a single package and all dependencies must already be installed
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
std::string first_arg = args.command_arguments.at(0);
+
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);
+
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
+ const auto port_name = spec.package_spec.name();
+ const auto* scfl = provider.get_control_file(port_name).get();
+
+ Checks::check_exit(VCPKG_LINE_INFO, scfl != nullptr, "Error: Couldn't find port '%s'", port_name);
+
+ perform_and_exit_ex(spec, *scfl, options, paths);
}
}
@@ -237,7 +236,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 = "";
}
@@ -283,7 +282,7 @@ namespace vcpkg::Build
start += "\n" + Strings::serialize(feature);
}
const fs::path binary_control_file = paths.packages / bcf.core_paragraph.dir() / "CONTROL";
- paths.get_filesystem().write_contents(binary_control_file, start);
+ paths.get_filesystem().write_contents(binary_control_file, start, VCPKG_LINE_INFO);
}
static std::vector<FeatureSpec> compute_required_feature_specs(const BuildPackageConfig& config,
@@ -337,6 +336,23 @@ namespace vcpkg::Build
return ret;
}
+ static int get_concurrency()
+ {
+ static int concurrency = [] {
+ auto user_defined_concurrency = System::get_environment_variable("VCPKG_MAX_CONCURRENCY");
+ if (user_defined_concurrency)
+ {
+ return std::stoi(user_defined_concurrency.value_or_exit(VCPKG_LINE_INFO));
+ }
+ else
+ {
+ return System::get_num_logical_cores() + 1;
+ }
+ }();
+
+ return concurrency;
+ }
+
static ExtendedBuildResult do_build_package(const VcpkgPaths& paths,
const PreBuildInfo& pre_build_info,
const PackageSpec& spec,
@@ -346,6 +362,12 @@ namespace vcpkg::Build
auto& fs = paths.get_filesystem();
const Triplet& triplet = spec.triplet();
+ if (!Strings::starts_with(Strings::ascii_to_lowercase(config.port_dir.u8string()),
+ Strings::ascii_to_lowercase(paths.ports.u8string())))
+ {
+ System::printf("-- Installing port from location: %s\n", config.port_dir.u8string());
+ }
+
#if !defined(_WIN32)
// TODO: remove when vcpkg.exe is in charge for acquiring tools. Change introduced in vcpkg v0.0.107.
// bootstrap should have already downloaded ninja, but making sure it is present in case it was deleted.
@@ -363,19 +385,19 @@ namespace vcpkg::Build
const Toolset& toolset = paths.get_toolset(pre_build_info);
- std::vector<System::CMakeVariable> variables {
+ std::vector<System::CMakeVariable> variables{
{"CMD", "BUILD"},
{"PORT", config.scf.core_paragraph->name},
{"CURRENT_PORT_DIR", config.port_dir},
{"TARGET_TRIPLET", spec.triplet().canonical_name()},
{"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()},
- {"VCPKG_USE_HEAD_VERSION",
- Util::Enum::to_bool(config.build_package_options.use_head_version) ? "1" : "0"},
+ {"VCPKG_USE_HEAD_VERSION", Util::Enum::to_bool(config.build_package_options.use_head_version) ? "1" : "0"},
{"DOWNLOADS", paths.downloads},
{"_VCPKG_NO_DOWNLOADS", !Util::Enum::to_bool(config.build_package_options.allow_downloads) ? "1" : "0"},
{"_VCPKG_DOWNLOAD_TOOL", to_string(config.build_package_options.download_tool)},
{"FEATURES", Strings::join(";", config.feature_list)},
{"ALL_FEATURES", all_features},
+ {"VCPKG_CONCURRENCY", std::to_string(get_concurrency())},
};
if (!System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value())
@@ -383,10 +405,7 @@ namespace vcpkg::Build
variables.push_back({"GIT", git_exe_path});
}
- const std::string cmd_launch_cmake = System::make_cmake_cmd(
- cmake_exe_path,
- paths.ports_cmake,
- variables);
+ const std::string cmd_launch_cmake = System::make_cmake_cmd(cmake_exe_path, paths.ports_cmake, variables);
auto command = make_build_env_cmd(pre_build_info, toolset);
if (!command.empty())
@@ -417,7 +436,8 @@ namespace vcpkg::Build
}
const BuildInfo build_info = read_build_info(fs, paths.build_info_file_path(spec));
- const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info);
+ const size_t error_count =
+ PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info, config.port_dir);
auto bcf = create_binary_control_file(*config.scf.core_paragraph, triplet, build_info, abi_tag);
@@ -487,14 +507,14 @@ namespace vcpkg::Build
// the order of recursive_directory_iterator is undefined so save the names to sort
std::vector<fs::path> port_files;
- for (auto &port_file : fs::stdfs::recursive_directory_iterator(config.port_dir))
+ for (auto& port_file : fs::stdfs::recursive_directory_iterator(config.port_dir))
{
if (fs::is_regular_file(status(port_file)))
{
port_files.push_back(port_file);
if (port_files.size() > max_port_file_count)
{
- abi_tag_entries.emplace_back(AbiEntry{ "no_hash_max_portfile", "" });
+ abi_tag_entries.emplace_back(AbiEntry{"no_hash_max_portfile", ""});
break;
}
}
@@ -505,17 +525,17 @@ namespace vcpkg::Build
std::sort(port_files.begin(), port_files.end());
int counter = 0;
- for (auto & port_file : port_files)
+ for (auto& port_file : port_files)
{
// When vcpkg takes a dependency on C++17 it can use fs::relative,
// 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");
}
- abi_tag_entries.emplace_back(AbiEntry{ key, vcpkg::Hash::get_file_hash(fs, port_file, "SHA1") });
+ abi_tag_entries.emplace_back(AbiEntry{key, vcpkg::Hash::get_file_hash(fs, port_file, "SHA1")});
}
}
@@ -536,7 +556,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)
@@ -554,7 +574,7 @@ namespace vcpkg::Build
std::error_code ec;
fs.create_directories(paths.buildtrees / name, ec);
const auto abi_file_path = paths.buildtrees / name / (triplet.canonical_name() + ".vcpkg_abi_info.txt");
- fs.write_contents(abi_file_path, full_abi_info);
+ fs.write_contents(abi_file_path, full_abi_info, VCPKG_LINE_INFO);
return AbiTagAndFile{Hash::get_file_hash(fs, abi_file_path, "SHA1"), abi_file_path};
}
@@ -605,8 +625,8 @@ namespace vcpkg::Build
System::cmd_execute_clean(Strings::format(
R"("%s" a "%s" "%s\*" >nul)", seven_zip_exe.u8string(), destination.u8string(), source.u8string()));
#else
- System::cmd_execute_clean(Strings::format(
- R"(cd '%s' && zip --quiet -r '%s' *)", source.u8string(), destination.u8string()));
+ System::cmd_execute_clean(
+ Strings::format(R"(cd '%s' && zip --quiet -r '%s' *)", source.u8string(), destination.u8string()));
#endif
}
@@ -694,7 +714,7 @@ namespace vcpkg::Build
}
}
- System::print2("Could not locate cached archive: ", archive_path.u8string(), "\n");
+ System::printf("Could not locate cached archive: %s\n", archive_path.u8string());
ExtendedBuildResult result = do_build_package_and_clean_buildtrees(
paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
@@ -733,7 +753,7 @@ namespace vcpkg::Build
const auto tmp_failure_zip = paths.buildtrees / spec.name() / "failure_logs.zip";
fs.create_directories(tmp_log_path_destination, ec);
- for (auto &log_file : fs::stdfs::directory_iterator(paths.buildtrees / spec.name()))
+ for (auto& log_file : fs::stdfs::directory_iterator(paths.buildtrees / spec.name()))
{
if (log_file.path().extension() == ".log")
{
diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp
index afef518eb..3cf4dd98f 100644
--- a/toolsrc/src/vcpkg/commands.autocomplete.cpp
+++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp
@@ -90,7 +90,8 @@ namespace vcpkg::Commands::Autocomplete
const auto port_name = match[2].str();
const auto triplet_prefix = match[3].str();
- auto maybe_port = Paragraphs::try_load_port(paths.get_filesystem(), paths.port_dir(port_name));
+ // TODO: Support autocomplete for ports in --overlay-ports
+ auto maybe_port = Paragraphs::try_load_port(paths.get_filesystem(), paths.ports / port_name);
if (maybe_port.error())
{
Checks::exit_success(VCPKG_LINE_INFO);
diff --git a/toolsrc/src/vcpkg/commands.buildexternal.cpp b/toolsrc/src/vcpkg/commands.buildexternal.cpp
index 19b89c2f5..1c3c511c2 100644
--- a/toolsrc/src/vcpkg/commands.buildexternal.cpp
+++ b/toolsrc/src/vcpkg/commands.buildexternal.cpp
@@ -23,7 +23,12 @@ namespace vcpkg::Commands::BuildExternal
std::string(args.command_arguments.at(0)), default_triplet, COMMAND_STRUCTURE.example_text);
Input::check_triplet(spec.package_spec.triplet(), paths);
- const fs::path port_dir = args.command_arguments.at(1);
- Build::Command::perform_and_exit_ex(spec, port_dir, options, paths);
+ auto overlays = args.overlay_ports ? *args.overlay_ports : std::vector<std::string>();
+ overlays.insert(overlays.begin(), args.command_arguments.at(1));
+ Dependencies::PathsPortFileProvider provider(paths, &overlays);
+ auto maybe_scfl = provider.get_control_file(spec.package_spec.name());
+ Checks::check_exit(
+ VCPKG_LINE_INFO, maybe_scfl.has_value(), "could not load control file for %s", spec.package_spec.name());
+ Build::Command::perform_and_exit_ex(spec, maybe_scfl.value_or_exit(VCPKG_LINE_INFO), options, paths);
}
}
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp
index 10cb7d9fe..8cab79504 100644
--- a/toolsrc/src/vcpkg/commands.ci.cpp
+++ b/toolsrc/src/vcpkg/commands.ci.cpp
@@ -55,27 +55,20 @@ namespace vcpkg::Commands::CI
struct XunitTestResults
{
public:
+ XunitTestResults() { m_assembly_run_datetime = Chrono::CTime::get_current_date_time(); }
- XunitTestResults()
+ void add_test_results(const std::string& spec,
+ const Build::BuildResult& build_result,
+ const Chrono::ElapsedTime& elapsed_time,
+ const std::string& abi_tag)
{
- m_assembly_run_datetime = Chrono::CTime::get_current_date_time();
- }
-
- void add_test_results(const std::string& spec, const Build::BuildResult& build_result, const Chrono::ElapsedTime& elapsed_time, const std::string& abi_tag)
- {
- m_collections.back().tests.push_back({ spec, build_result, elapsed_time, abi_tag });
+ m_collections.back().tests.push_back({spec, build_result, elapsed_time, abi_tag});
}
// Starting a new test collection
- void push_collection( const std::string& name)
- {
- m_collections.push_back({name});
- }
+ void push_collection(const std::string& name) { m_collections.push_back({name}); }
- void collection_time(const vcpkg::Chrono::ElapsedTime& time)
- {
- m_collections.back().time = time;
- }
+ void collection_time(const vcpkg::Chrono::ElapsedTime& time) { m_collections.back().time = time; }
const std::string& build_xml()
{
@@ -96,13 +89,9 @@ namespace vcpkg::Commands::CI
return m_xml;
}
- void assembly_time(const vcpkg::Chrono::ElapsedTime& assembly_time)
- {
- m_assembly_time = assembly_time;
- }
+ void assembly_time(const vcpkg::Chrono::ElapsedTime& assembly_time) { m_assembly_time = assembly_time; }
private:
-
struct XunitTest
{
std::string name;
@@ -126,34 +115,33 @@ namespace vcpkg::Commands::CI
auto rawDateTime = m_assembly_run_datetime.get()->to_string();
// The expected format is "yyyy-mm-ddThh:mm:ss.0Z"
// 0123456789012345678901
- datetime = Strings::format(R"(run-date="%s" run-time="%s")",
- rawDateTime.substr(0, 10), rawDateTime.substr(11, 8));
+ datetime = Strings::format(
+ R"(run-date="%s" run-time="%s")", rawDateTime.substr(0, 10), rawDateTime.substr(11, 8));
}
std::string time = Strings::format(R"(time="%lld")", m_assembly_time.as<std::chrono::seconds>().count());
- m_xml += Strings::format(
- R"(<assemblies>)" "\n"
- R"( <assembly name="vcpkg" %s %s>)" "\n"
- , datetime, time);
+ m_xml += Strings::format(R"(<assemblies>)"
+ "\n"
+ R"( <assembly name="vcpkg" %s %s>)"
+ "\n",
+ datetime,
+ time);
}
void xml_finish_assembly()
{
m_xml += " </assembly>\n"
- "</assemblies>\n";
+ "</assemblies>\n";
}
void xml_start_collection(const XunitCollection& collection)
{
m_xml += Strings::format(R"( <collection name="%s" time="%lld">)"
- "\n",
- collection.name,
- collection.time.as<std::chrono::seconds>().count());
- }
- void xml_finish_collection()
- {
- m_xml += " </collection>\n";
+ "\n",
+ collection.name,
+ collection.time.as<std::chrono::seconds>().count());
}
+ void xml_finish_collection() { m_xml += " </collection>\n"; }
void xml_test(const XunitTest& test)
{
@@ -161,23 +149,20 @@ namespace vcpkg::Commands::CI
const char* result_string = "";
switch (test.result)
{
- case BuildResult::POST_BUILD_CHECKS_FAILED:
- case BuildResult::FILE_CONFLICTS:
- case BuildResult::BUILD_FAILED:
- result_string = "Fail";
- message_block = Strings::format("<failure><message><![CDATA[%s]]></message></failure>", to_string(test.result));
- break;
- case BuildResult::EXCLUDED:
- case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES:
- result_string = "Skip";
- message_block = Strings::format("<reason><![CDATA[%s]]></reason>", to_string(test.result));
- break;
- case BuildResult::SUCCEEDED:
- result_string = "Pass";
- break;
- default:
- Checks::exit_fail(VCPKG_LINE_INFO);
- break;
+ case BuildResult::POST_BUILD_CHECKS_FAILED:
+ case BuildResult::FILE_CONFLICTS:
+ case BuildResult::BUILD_FAILED:
+ result_string = "Fail";
+ message_block =
+ Strings::format("<failure><message><![CDATA[%s]]></message></failure>", to_string(test.result));
+ break;
+ case BuildResult::EXCLUDED:
+ case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES:
+ result_string = "Skip";
+ message_block = Strings::format("<reason><![CDATA[%s]]></reason>", to_string(test.result));
+ break;
+ case BuildResult::SUCCEEDED: result_string = "Pass"; break;
+ default: Checks::exit_fail(VCPKG_LINE_INFO); break;
}
std::string traits_block;
@@ -187,13 +172,13 @@ namespace vcpkg::Commands::CI
}
m_xml += Strings::format(R"( <test name="%s" method="%s" time="%lld" result="%s">%s%s</test>)"
- "\n",
- test.name,
- test.name,
- test.time.as<std::chrono::seconds>().count(),
- result_string,
- traits_block,
- message_block);
+ "\n",
+ test.name,
+ test.name,
+ test.time.as<std::chrono::seconds>().count(),
+ result_string,
+ traits_block,
+ message_block);
}
Optional<vcpkg::Chrono::CTime> m_assembly_run_datetime;
@@ -203,7 +188,6 @@ namespace vcpkg::Commands::CI
std::string m_xml;
};
-
struct UnknownCIPortsResults
{
std::vector<FullPackageSpec> unknown;
@@ -212,11 +196,12 @@ namespace vcpkg::Commands::CI
std::map<PackageSpec, std::string> abi_tag_map;
};
- static std::unique_ptr<UnknownCIPortsResults> find_unknown_ports_for_ci(const VcpkgPaths& paths,
- const std::set<std::string>& exclusions,
- const Dependencies::PortFileProvider& provider,
- const std::vector<FeatureSpec>& fspecs,
- const bool purge_tombstones)
+ static std::unique_ptr<UnknownCIPortsResults> find_unknown_ports_for_ci(
+ const VcpkgPaths& paths,
+ const std::set<std::string>& exclusions,
+ const Dependencies::PortFileProvider& provider,
+ const std::vector<FeatureSpec>& fspecs,
+ const bool purge_tombstones)
{
auto ret = std::make_unique<UnknownCIPortsResults>();
@@ -229,6 +214,7 @@ namespace vcpkg::Commands::CI
Build::AllowDownloads::YES,
Build::CleanBuildtrees::YES,
Build::CleanPackages::YES,
+ Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO,
Build::FailOnTombstone::YES,
@@ -246,12 +232,17 @@ namespace vcpkg::Commands::CI
{
// determine abi tag
std::string abi;
- if (auto scf = p->source_control_file.get())
+ if (auto scfl = p->source_control_file_location.get())
{
auto triplet = p->spec.triplet();
- const Build::BuildPackageConfig build_config {
- *scf, triplet, paths.port_dir(p->spec), build_options, p->feature_list};
+ const Build::BuildPackageConfig build_config{
+ *scfl->source_control_file,
+ triplet,
+ static_cast<fs::path>(scfl->source_location),
+ build_options,
+ p->feature_list
+ };
auto dependency_abis =
Util::fmap(p->computed_dependencies, [&](const PackageSpec& spec) -> Build::AbiEntry {
@@ -296,7 +287,7 @@ namespace vcpkg::Commands::CI
bool b_will_build = false;
ret->features.emplace(p->spec,
- std::vector<std::string> {p->feature_list.begin(), p->feature_list.end()});
+ std::vector<std::string>{p->feature_list.begin(), p->feature_list.end()});
if (Util::Sets::contains(exclusions, p->spec.name()))
{
@@ -365,13 +356,15 @@ namespace vcpkg::Commands::CI
}
StatusParagraphs status_db = database_load_check(paths);
- const auto& paths_port_file = Dependencies::PathsPortFileProvider(paths);
+
+ Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get());
const Build::BuildPackageOptions install_plan_options = {
Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::CleanBuildtrees::YES,
Build::CleanPackages::YES,
+ Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO,
Build::FailOnTombstone::YES,
@@ -382,7 +375,10 @@ namespace vcpkg::Commands::CI
XunitTestResults xunitTestResults;
- std::vector<std::string> all_ports = Install::get_all_port_names(paths);
+ std::vector<std::string> all_ports =
+ Util::fmap(provider.load_all_control_files(), [](auto&& scfl) -> std::string {
+ return scfl->source_control_file.get()->core_paragraph->name;
+ });
std::vector<TripletAndSummary> results;
auto timer = Chrono::ElapsedTimer::create_started();
for (const Triplet& triplet : triplets)
@@ -391,13 +387,13 @@ namespace vcpkg::Commands::CI
xunitTestResults.push_collection(triplet.canonical_name());
- Dependencies::PackageGraph pgraph(paths_port_file, status_db);
+ Dependencies::PackageGraph pgraph(provider, status_db);
std::vector<PackageSpec> specs = PackageSpec::to_package_specs(all_ports, triplet);
// Install the default features for every package
auto all_feature_specs = Util::fmap(specs, [](auto& spec) { return FeatureSpec(spec, ""); });
auto split_specs =
- find_unknown_ports_for_ci(paths, exclusions_set, paths_port_file, all_feature_specs, purge_tombstones);
+ find_unknown_ports_for_ci(paths, exclusions_set, provider, all_feature_specs, purge_tombstones);
auto feature_specs = FullPackageSpec::to_feature_specs(split_specs->unknown);
for (auto&& fspec : feature_specs)
@@ -467,21 +463,27 @@ namespace vcpkg::Commands::CI
for (auto&& result : summary.results)
{
split_specs->known.erase(result.spec);
- xunitTestResults.add_test_results(result.spec.to_string(), result.build_result.code, result.timing, split_specs->abi_tag_map.at(result.spec));
+ xunitTestResults.add_test_results(result.spec.to_string(),
+ result.build_result.code,
+ result.timing,
+ split_specs->abi_tag_map.at(result.spec));
}
// Adding results for ports that were not built because they have known states
for (auto&& port : split_specs->known)
{
- xunitTestResults.add_test_results(port.first.to_string(), port.second, Chrono::ElapsedTime{}, split_specs->abi_tag_map.at(port.first));
+ xunitTestResults.add_test_results(port.first.to_string(),
+ port.second,
+ Chrono::ElapsedTime{},
+ split_specs->abi_tag_map.at(port.first));
}
all_known_results.emplace_back(std::move(split_specs->known));
abi_tag_map.insert(split_specs->abi_tag_map.begin(), split_specs->abi_tag_map.end());
- results.push_back({ triplet, std::move(summary)});
+ results.push_back({triplet, std::move(summary)});
- xunitTestResults.collection_time( collection_time_elapsed );
+ xunitTestResults.collection_time(collection_time_elapsed);
}
}
xunitTestResults.assembly_time(timer.elapsed());
@@ -492,11 +494,11 @@ namespace vcpkg::Commands::CI
System::print2("Total elapsed time: ", result.summary.total_elapsed_time, "\n");
result.summary.print();
}
-
+ auto& fs = paths.get_filesystem();
auto it_xunit = options.settings.find(OPTION_XUNIT);
if (it_xunit != options.settings.end())
{
- paths.get_filesystem().write_contents(fs::u8path(it_xunit->second), xunitTestResults.build_xml());
+ fs.write_contents(fs::u8path(it_xunit->second), xunitTestResults.build_xml(), VCPKG_LINE_INFO);
}
Checks::exit_success(VCPKG_LINE_INFO);
diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp
index a6f2c8838..31bf97f30 100644
--- a/toolsrc/src/vcpkg/commands.create.cpp
+++ b/toolsrc/src/vcpkg/commands.create.cpp
@@ -9,8 +9,7 @@
namespace vcpkg::Commands::Create
{
const CommandStructure COMMAND_STRUCTURE = {
- Help::create_example_string(
- R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"),
+ Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"),
2,
3,
{},
diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp
index 92ba15c1f..c0800a4b5 100644
--- a/toolsrc/src/vcpkg/commands.dependinfo.cpp
+++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp
@@ -6,6 +6,9 @@
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/paragraphs.h>
+#include <vcpkg/dependencies.h>
+
+using vcpkg::Dependencies::PathsPortFileProvider;
namespace vcpkg::Commands::DependInfo
{
@@ -16,7 +19,8 @@ namespace vcpkg::Commands::DependInfo
constexpr std::array<CommandSwitch, 3> DEPEND_SWITCHES = {{
{OPTION_DOT, "Creates graph on basis of dot"},
{OPTION_DGML, "Creates graph on basis of dgml"},
- {OPTION_NO_RECURSE, "Computes only immediate dependencies of packages explicitly specified on the command-line"},
+ {OPTION_NO_RECURSE,
+ "Computes only immediate dependencies of packages explicitly specified on the command-line"},
}};
const CommandStructure COMMAND_STRUCTURE = {
@@ -34,7 +38,7 @@ namespace vcpkg::Commands::DependInfo
return output;
}
- std::string create_dot_as_string(const std::vector<std::unique_ptr<SourceControlFile>>& source_control_files)
+ std::string create_dot_as_string(const std::vector<const SourceControlFile*>& source_control_files)
{
int empty_node_count = 0;
@@ -63,7 +67,7 @@ namespace vcpkg::Commands::DependInfo
return s;
}
- std::string create_dgml_as_string(const std::vector<std::unique_ptr<SourceControlFile>>& source_control_files)
+ std::string create_dgml_as_string(const std::vector<const SourceControlFile*>& source_control_files)
{
std::string s;
s.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
@@ -108,7 +112,7 @@ namespace vcpkg::Commands::DependInfo
}
std::string create_graph_as_string(const std::unordered_set<std::string>& switches,
- const std::vector<std::unique_ptr<SourceControlFile>>& source_control_files)
+ const std::vector<const SourceControlFile*>& source_control_files)
{
if (Util::Sets::contains(switches, OPTION_DOT))
{
@@ -123,7 +127,7 @@ namespace vcpkg::Commands::DependInfo
void build_dependencies_list(std::set<std::string>& packages_to_keep,
const std::string& requested_package,
- const std::vector<std::unique_ptr<SourceControlFile>>& source_control_files,
+ const std::vector<const SourceControlFile*>& source_control_files,
const std::unordered_set<std::string>& switches)
{
const auto source_control_file =
@@ -153,7 +157,11 @@ namespace vcpkg::Commands::DependInfo
{
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
- auto source_control_files = Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports);
+ // TODO: Optimize implementation, current implementation needs to load all ports from disk which is too slow.
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
+ auto source_control_files = Util::fmap(provider.load_all_control_files(), [](auto&& scfl) -> const SourceControlFile * {
+ return scfl->source_control_file.get();
+ });
if (args.command_arguments.size() >= 1)
{
@@ -177,7 +185,7 @@ namespace vcpkg::Commands::DependInfo
for (auto&& source_control_file : source_control_files)
{
- const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
+ const SourceParagraph& source_paragraph = *source_control_file->core_paragraph.get();
const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); });
System::print2(source_paragraph.name, ": ", s, "\n");
}
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp
index b2309aa41..f2f0b1569 100644
--- a/toolsrc/src/vcpkg/commands.edit.cpp
+++ b/toolsrc/src/vcpkg/commands.edit.cpp
@@ -19,26 +19,16 @@ namespace vcpkg::Commands::Edit
HKEY root;
StringLiteral subkey;
} REGKEYS[] = {
- {
- HKEY_LOCAL_MACHINE,
- R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)"
- },
- {
- HKEY_LOCAL_MACHINE,
- R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)"
- },
- {
- HKEY_LOCAL_MACHINE,
- R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)"
- },
- {
- HKEY_CURRENT_USER,
- R"(Software\Microsoft\Windows\CurrentVersion\Uninstall\{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1)"
- },
- {
- HKEY_LOCAL_MACHINE,
- R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1)"
- },
+ {HKEY_LOCAL_MACHINE,
+ R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)"},
+ {HKEY_LOCAL_MACHINE,
+ R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)"},
+ {HKEY_LOCAL_MACHINE,
+ R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)"},
+ {HKEY_CURRENT_USER,
+ R"(Software\Microsoft\Windows\CurrentVersion\Uninstall\{771FD6B0-FA20-440A-A002-3B3BAC16DC50}_is1)"},
+ {HKEY_LOCAL_MACHINE,
+ R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1)"},
};
for (auto&& keypath : REGKEYS)
@@ -89,6 +79,7 @@ namespace vcpkg::Commands::Edit
const auto& fs = paths.get_filesystem();
auto packages = fs.get_files_non_recursive(paths.packages);
+ // TODO: Support edit for --overlay-ports
return Util::fmap(ports, [&](const std::string& port_name) -> std::string {
const auto portpath = paths.ports / port_name;
const auto portfile = portpath / "portfile.cmake";
@@ -177,7 +168,8 @@ namespace vcpkg::Commands::Edit
const std::vector<fs::path> from_registry = find_from_registry();
candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend());
#elif defined(__APPLE__)
- candidate_paths.push_back(fs::path{"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code"});
+ candidate_paths.push_back(
+ fs::path{"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code"});
candidate_paths.push_back(fs::path{"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"});
#elif defined(__linux__)
candidate_paths.push_back(fs::path{"/usr/share/code/bin/code"});
diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp
index ba9e28233..f0946110c 100644
--- a/toolsrc/src/vcpkg/commands.exportifw.cpp
+++ b/toolsrc/src/vcpkg/commands.exportifw.cpp
@@ -106,7 +106,8 @@ namespace vcpkg::Export::IFW
create_release_date(),
action.spec.name(),
action.spec.triplet().canonical_name(),
- deps));
+ deps),
+ VCPKG_LINE_INFO);
// Return dir path for export package data
return ifw_packages_dir_path /
@@ -138,7 +139,8 @@ namespace vcpkg::Export::IFW
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
for (const auto& unique_package : unique_packages)
{
@@ -167,7 +169,8 @@ namespace vcpkg::Export::IFW
action.spec.name(),
safe_rich_from_plain_text(binary_paragraph.description),
binary_paragraph.version,
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
}
}
@@ -195,7 +198,8 @@ namespace vcpkg::Export::IFW
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
for (const std::string& triplet : unique_triplets)
{
@@ -217,7 +221,8 @@ namespace vcpkg::Export::IFW
</Package>
)###",
triplet,
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
}
}
@@ -243,7 +248,8 @@ namespace vcpkg::Export::IFW
<ReleaseDate>%s</ReleaseDate>
</Package>
)###",
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
}
void export_config(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths)
@@ -283,7 +289,8 @@ namespace vcpkg::Export::IFW
<TargetDir>@RootDir@/src/vcpkg</TargetDir>%s
</Installer>
)###",
- formatted_repo_url));
+ formatted_repo_url),
+ VCPKG_LINE_INFO);
}
void export_maintenance_tool(const fs::path& ifw_packages_dir_path, const VcpkgPaths& paths)
@@ -325,7 +332,8 @@ namespace vcpkg::Export::IFW
<ForcedInstallation>true</ForcedInstallation>
</Package>
)###",
- create_release_date()));
+ create_release_date()),
+ VCPKG_LINE_INFO);
const fs::path script_source = paths.root / "scripts" / "ifw" / "maintenance.qs";
const fs::path script_destination = ifw_packages_dir_path / "maintenance" / "meta" / "maintenance.qs";
fs.copy_file(script_source, script_destination, fs::copy_options::overwrite_existing, ec);
diff --git a/toolsrc/src/vcpkg/commands.import.cpp b/toolsrc/src/vcpkg/commands.import.cpp
index a2fd5d15d..40f5a434c 100644
--- a/toolsrc/src/vcpkg/commands.import.cpp
+++ b/toolsrc/src/vcpkg/commands.import.cpp
@@ -89,12 +89,11 @@ namespace vcpkg::Commands::Import
place_library_files_in(paths.get_filesystem(), include_directory, project_directory, library_destination_path);
const fs::path control_file_path = library_destination_path / "CONTROL";
- fs.write_contents(control_file_path, Strings::serialize(control_file_data));
+ fs.write_contents(control_file_path, Strings::serialize(control_file_data), VCPKG_LINE_INFO);
}
const CommandStructure COMMAND_STRUCTURE = {
- Help::create_example_string(
- R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"),
+ Help::create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"),
3,
3,
{},
diff --git a/toolsrc/src/vcpkg/commands.integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp
index 026ab3b77..6921a5390 100644
--- a/toolsrc/src/vcpkg/commands.integrate.cpp
+++ b/toolsrc/src/vcpkg/commands.integrate.cpp
@@ -124,7 +124,7 @@ namespace vcpkg::Commands::Integrate
static ElevationPromptChoice elevated_cmd_execute(const std::string& param)
{
- SHELLEXECUTEINFOW sh_ex_info {};
+ SHELLEXECUTEINFOW sh_ex_info{};
sh_ex_info.cbSize = sizeof(sh_ex_info);
sh_ex_info.fMask = SEE_MASK_NOCLOSEPROCESS;
sh_ex_info.hwnd = nullptr;
@@ -209,7 +209,7 @@ namespace vcpkg::Commands::Integrate
if (should_install_system)
{
const fs::path sys_src_path = tmp_dir / "vcpkg.system.targets";
- fs.write_contents(sys_src_path, create_system_targets_shortcut());
+ fs.write_contents(sys_src_path, create_system_targets_shortcut(), VCPKG_LINE_INFO);
const std::string param = Strings::format(R"(/c mkdir "%s" & copy "%s" "%s" /Y > nul)",
SYSTEM_WIDE_TARGETS_FILE.parent_path().string(),
@@ -248,7 +248,8 @@ namespace vcpkg::Commands::Integrate
const fs::path appdata_src_path = tmp_dir / "vcpkg.user.targets";
fs.write_contents(appdata_src_path,
- create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.u8string()));
+ create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.u8string()),
+ VCPKG_LINE_INFO);
auto appdata_dst_path = get_appdata_targets_path();
const auto rc = fs.copy_file(appdata_src_path, appdata_dst_path, fs::copy_options::overwrite_existing, ec);
@@ -268,12 +269,7 @@ namespace vcpkg::Commands::Integrate
const auto pathtxt = get_path_txt_path();
std::error_code ec;
- fs.write_contents(pathtxt, paths.root.generic_u8string(), ec);
- if (ec)
- {
- System::print2(System::Color::error, "Error: Failed to write file: ", pathtxt.u8string(), "\n");
- Checks::exit_fail(VCPKG_LINE_INFO);
- }
+ fs.write_contents(pathtxt, paths.root.generic_u8string(), VCPKG_LINE_INFO);
System::print2(System::Color::success, "Applied user-wide integration for this vcpkg root.\n");
const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake";
@@ -344,9 +340,11 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s"
const std::string nuget_id = get_nuget_id(paths.root);
const std::string nupkg_version = "1.0.0";
- fs.write_contents(targets_file_path, create_nuget_targets_file_contents(paths.buildsystems_msbuild_targets));
- fs.write_contents(props_file_path, create_nuget_props_file_contents());
- fs.write_contents(nuspec_file_path, create_nuspec_file_contents(paths.root, nuget_id, nupkg_version));
+ fs.write_contents(
+ targets_file_path, create_nuget_targets_file_contents(paths.buildsystems_msbuild_targets), VCPKG_LINE_INFO);
+ fs.write_contents(props_file_path, create_nuget_props_file_contents(), VCPKG_LINE_INFO);
+ fs.write_contents(
+ nuspec_file_path, create_nuspec_file_contents(paths.root, nuget_id, nupkg_version), VCPKG_LINE_INFO);
// Using all forward slashes for the command line
const std::string cmd_line = Strings::format(R"("%s" pack -OutputDirectory "%s" "%s" > nul)",
@@ -415,7 +413,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
static void integrate_bash(const VcpkgPaths& paths)
{
const auto home_path = System::get_environment_variable("HOME").value_or_exit(VCPKG_LINE_INFO);
- const fs::path bashrc_path = fs::path {home_path} / ".bashrc";
+ const fs::path bashrc_path = fs::path{home_path} / ".bashrc";
auto& fs = paths.get_filesystem();
const fs::path completion_script_path = paths.scripts / "vcpkg_completion.bash";
@@ -430,7 +428,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
for (auto&& line : bashrc_content)
{
std::smatch match;
- if (std::regex_match(line, match, std::regex {R"###(^source.*scripts/vcpkg_completion.bash$)###"}))
+ if (std::regex_match(line, match, std::regex{R"###(^source.*scripts/vcpkg_completion.bash$)###"}))
{
matches.push_back(line);
}
@@ -439,17 +437,17 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
if (!matches.empty())
{
System::printf("vcpkg bash completion is already imported to your %s file.\n"
- "The following entries were found:\n"
- " %s\n"
- "Please make sure you have started a new bash shell for the changes to take effect.\n",
- bashrc_path.u8string(),
- Strings::join("\n ", matches));
+ "The following entries were found:\n"
+ " %s\n"
+ "Please make sure you have started a new bash shell for the changes to take effect.\n",
+ bashrc_path.u8string(),
+ Strings::join("\n ", matches));
Checks::exit_success(VCPKG_LINE_INFO);
}
System::printf("Adding vcpkg completion entry to %s\n", bashrc_path.u8string());
bashrc_content.push_back(Strings::format("source %s", completion_script_path.u8string()));
- fs.write_contents(bashrc_path, Strings::join("\n", bashrc_content) + '\n');
+ fs.write_contents(bashrc_path, Strings::join("\n", bashrc_content) + '\n', VCPKG_LINE_INFO);
Checks::exit_success(VCPKG_LINE_INFO);
}
#endif
diff --git a/toolsrc/src/vcpkg/commands.search.cpp b/toolsrc/src/vcpkg/commands.search.cpp
index a0afd69e1..3d8387ee1 100644
--- a/toolsrc/src/vcpkg/commands.search.cpp
+++ b/toolsrc/src/vcpkg/commands.search.cpp
@@ -7,6 +7,9 @@
#include <vcpkg/paragraphs.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/vcpkglib.h>
+#include <vcpkg/dependencies.h>
+
+using vcpkg::Dependencies::PathsPortFileProvider;
namespace vcpkg::Commands::Search
{
@@ -63,7 +66,10 @@ namespace vcpkg::Commands::Search
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
const bool full_description = Util::Sets::contains(options.switches, OPTION_FULLDESC);
- auto source_paragraphs = Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports);
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
+ auto source_paragraphs = Util::fmap(provider.load_all_control_files(), [](auto&& port) -> const SourceControlFile * {
+ return port->source_control_file.get();
+ });
if (args.command_arguments.empty())
{
diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp
index 29627db3d..77183ceaf 100644
--- a/toolsrc/src/vcpkg/commands.upgrade.cpp
+++ b/toolsrc/src/vcpkg/commands.upgrade.cpp
@@ -43,7 +43,8 @@ namespace vcpkg::Commands::Upgrade
StatusParagraphs status_db = database_load_check(paths);
- Dependencies::PathsPortFileProvider provider(paths);
+ // Load ports from ports dirs
+ Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get());
Dependencies::PackageGraph graph(provider, status_db);
// input sanitization
@@ -85,12 +86,12 @@ namespace vcpkg::Commands::Upgrade
not_installed.push_back(spec);
}
- auto maybe_scf = provider.get_control_file(spec.name());
- if (auto p_scf = maybe_scf.get())
+ auto maybe_scfl = provider.get_control_file(spec.name());
+ if (auto p_scfl = maybe_scfl.get())
{
if (it != status_db.end())
{
- if (p_scf->core_paragraph->version != (*it)->package.version)
+ if (p_scfl->source_control_file->core_paragraph->version != (*it)->package.version)
{
to_upgrade.push_back(spec);
}
@@ -155,6 +156,7 @@ namespace vcpkg::Commands::Upgrade
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
+ Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO,
Build::FailOnTombstone::NO,
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp
index 8fde28929..df472515f 100644
--- a/toolsrc/src/vcpkg/dependencies.cpp
+++ b/toolsrc/src/vcpkg/dependencies.cpp
@@ -22,7 +22,7 @@ namespace vcpkg::Dependencies
struct ClusterSource
{
- const SourceControlFile* scf = nullptr;
+ const SourceControlFileLocation* scfl = nullptr;
std::unordered_map<std::string, std::vector<FeatureSpec>> build_edges;
};
@@ -92,12 +92,12 @@ namespace vcpkg::Dependencies
if (it == m_graph.end())
{
// Load on-demand from m_provider
- auto maybe_scf = m_provider.get_control_file(spec.name());
+ auto maybe_scfl = m_provider.get_control_file(spec.name());
auto& clust = m_graph[spec];
clust.spec = spec;
- if (auto p_scf = maybe_scf.get())
+ if (auto p_scfl = maybe_scfl.get())
{
- clust.source = cluster_from_scf(*p_scf, clust.spec.triplet());
+ clust.source = cluster_from_scf(*p_scfl, clust.spec.triplet());
}
return clust;
}
@@ -105,15 +105,17 @@ namespace vcpkg::Dependencies
}
private:
- static ClusterSource cluster_from_scf(const SourceControlFile& scf, Triplet t)
+ static ClusterSource cluster_from_scf(const SourceControlFileLocation& scfl, Triplet t)
{
ClusterSource ret;
- ret.build_edges.emplace("core", filter_dependencies_to_specs(scf.core_paragraph->depends, t));
+ ret.build_edges.emplace("core",
+ filter_dependencies_to_specs(scfl.source_control_file->core_paragraph->depends,
+ t));
- for (const auto& feature : scf.feature_paragraphs)
+ for (const auto& feature : scfl.source_control_file->feature_paragraphs)
ret.build_edges.emplace(feature->name, filter_dependencies_to_specs(feature->depends, t));
- ret.scf = &scf;
+ ret.scfl = &scfl;
return ret;
}
@@ -151,12 +153,12 @@ namespace vcpkg::Dependencies
}
InstallPlanAction::InstallPlanAction(const PackageSpec& spec,
- const SourceControlFile& scf,
+ const SourceControlFileLocation& scfl,
const std::set<std::string>& features,
const RequestType& request_type,
std::vector<PackageSpec>&& dependencies)
: spec(spec)
- , source_control_file(scf)
+ , source_control_file_location(scfl)
, plan_type(InstallPlanType::BUILD_AND_INSTALL)
, request_type(request_type)
, build_options{}
@@ -268,37 +270,145 @@ namespace vcpkg::Dependencies
return left->spec.name() < right->spec.name();
}
- MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFile>& map) : ports(map)
- {
- }
+ MapPortFileProvider::MapPortFileProvider(const std::unordered_map<std::string, SourceControlFileLocation>& map)
+ : ports(map)
+ {}
- Optional<const SourceControlFile&> MapPortFileProvider::get_control_file(const std::string& spec) const
+ Optional<const SourceControlFileLocation&> MapPortFileProvider::get_control_file(const std::string& spec) const
{
auto scf = ports.find(spec);
if (scf == ports.end()) return nullopt;
return scf->second;
}
- PathsPortFileProvider::PathsPortFileProvider(const VcpkgPaths& paths) : ports(paths) {}
+ std::vector<const SourceControlFileLocation*> MapPortFileProvider::load_all_control_files() const
+ {
+ return Util::fmap(ports, [](auto&& kvpair) -> const SourceControlFileLocation * { return &kvpair.second; });
+ }
- Optional<const SourceControlFile&> PathsPortFileProvider::get_control_file(const std::string& spec) const
+ PathsPortFileProvider::PathsPortFileProvider(const vcpkg::VcpkgPaths& paths,
+ const std::vector<std::string>* ports_dirs_paths)
+ : filesystem(paths.get_filesystem())
+ {
+ if (ports_dirs_paths)
+ {
+ for (auto&& overlay_path : *ports_dirs_paths)
+ {
+ if (!overlay_path.empty())
+ {
+ auto overlay = fs::stdfs::canonical(fs::u8path(overlay_path));
+
+ Checks::check_exit(VCPKG_LINE_INFO,
+ filesystem.exists(overlay),
+ "Error: Path \"%s\" does not exist",
+ overlay.string());
+
+ Checks::check_exit(VCPKG_LINE_INFO,
+ fs::stdfs::is_directory(overlay),
+ "Error: Path \"%s\" must be a directory",
+ overlay.string());
+
+ ports_dirs.emplace_back(overlay);
+ }
+ }
+ }
+ ports_dirs.emplace_back(paths.ports);
+ }
+
+ Optional<const SourceControlFileLocation&> PathsPortFileProvider::get_control_file(const std::string& spec) const
{
auto cache_it = cache.find(spec);
if (cache_it != cache.end())
{
return cache_it->second;
}
- Parse::ParseExpected<SourceControlFile> source_control_file =
- Paragraphs::try_load_port(ports.get_filesystem(), ports.port_dir(spec));
- if (auto scf = source_control_file.get())
+ for (auto&& ports_dir : ports_dirs)
{
- auto it = cache.emplace(spec, std::move(*scf->get()));
- return it.first->second;
+ // Try loading individual port
+ if (filesystem.exists(ports_dir / "CONTROL"))
+ {
+ auto maybe_scf = Paragraphs::try_load_port(filesystem, ports_dir);
+ if (auto scf = maybe_scf.get())
+ {
+ if (scf->get()->core_paragraph->name == spec)
+ {
+ SourceControlFileLocation scfl{ std::move(*scf), ports_dir };
+ auto it = cache.emplace(spec, std::move(scfl));
+ return it.first->second;
+ }
+ }
+ else
+ {
+ vcpkg::print_error_message(maybe_scf.error());
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Error: Failed to load port from %s",
+ spec, ports_dir.u8string());
+ }
+ }
+
+ auto found_scf = Paragraphs::try_load_port(filesystem, ports_dir / spec);
+ if (auto scf = found_scf.get())
+ {
+ if (scf->get()->core_paragraph->name == spec)
+ {
+ SourceControlFileLocation scfl{ std::move(*scf), ports_dir / spec };
+ auto it = cache.emplace(spec, std::move(scfl));
+ return it.first->second;
+ }
+ }
}
+
return nullopt;
}
+ std::vector<const SourceControlFileLocation*> PathsPortFileProvider::load_all_control_files() const
+ {
+ // Reload cache with ports contained in all ports_dirs
+ cache.clear();
+ std::vector<const SourceControlFileLocation*> ret;
+ for (auto&& ports_dir : ports_dirs)
+ {
+ // Try loading individual port
+ if (filesystem.exists(ports_dir / "CONTROL"))
+ {
+ auto maybe_scf = Paragraphs::try_load_port(filesystem, ports_dir);
+ if (auto scf = maybe_scf.get())
+ {
+ auto port_name = scf->get()->core_paragraph->name;
+ if (cache.find(port_name) == cache.end())
+ {
+ SourceControlFileLocation scfl{ std::move(*scf), ports_dir };
+ auto it = cache.emplace(port_name, std::move(scfl));
+ ret.emplace_back(&it.first->second);
+ }
+ }
+ else
+ {
+ vcpkg::print_error_message(maybe_scf.error());
+ Checks::exit_with_message(VCPKG_LINE_INFO,
+ "Error: Failed to load port from %s",
+ ports_dir.u8string());
+ }
+ continue;
+ }
+
+ // Try loading all ports inside ports_dir
+ auto found_scf = Paragraphs::load_all_ports(filesystem, ports_dir);
+ for (auto&& scf : found_scf)
+ {
+ auto port_name = scf->core_paragraph->name;
+ if (cache.find(port_name) == cache.end())
+ {
+ SourceControlFileLocation scfl{ std::move(scf), ports_dir / port_name };
+ auto it = cache.emplace(port_name, std::move(scfl));
+ ret.emplace_back(&it.first->second);
+ }
+ }
+ }
+ return ret;
+ }
+
std::vector<RemovePlanAction> create_remove_plan(const std::vector<PackageSpec>& specs,
const StatusParagraphs& status_db)
{
@@ -488,16 +598,18 @@ namespace vcpkg::Dependencies
if (plus) return MarkPlusResult::SUCCESS;
plus = true;
- auto p_source = cluster.source.get();
- Checks::check_exit(VCPKG_LINE_INFO,
- p_source != nullptr,
- "Error: Cannot find definition for package `%s`.",
- cluster.spec.name());
+ const auto p_source = cluster.source.get();
+ if (p_source == nullptr)
+ {
+ Checks::exit_with_message(
+ VCPKG_LINE_INFO, "Error: Cannot find definition for package `%s`.", cluster.spec.name());
+ }
+ auto&& control_file = *p_source->scfl->source_control_file.get();
if (feature.empty())
{
// Add default features for this package. This is an exact reference, so ignore prevent_default_features.
- for (auto&& default_feature : p_source->scf->core_paragraph.get()->default_features)
+ for (auto&& default_feature : control_file.core_paragraph.get()->default_features)
{
auto res = mark_plus(default_feature, cluster, graph, graph_plan, prevent_default_features);
if (res != MarkPlusResult::SUCCESS)
@@ -512,7 +624,7 @@ namespace vcpkg::Dependencies
if (feature == "*")
{
- for (auto&& fpgh : p_source->scf->feature_paragraphs)
+ for (auto&& fpgh : control_file.feature_paragraphs)
{
auto res = mark_plus(fpgh->name, cluster, graph, graph_plan, prevent_default_features);
@@ -589,7 +701,8 @@ namespace vcpkg::Dependencies
// Check if any default features have been added
auto& previous_df = p_installed->ipv.core->package.default_features;
- for (auto&& default_feature : p_source->scf->core_paragraph->default_features)
+ auto&& control_file = *p_source->scfl->source_control_file.get();
+ for (auto&& default_feature : control_file.core_paragraph->default_features)
{
if (std::find(previous_df.begin(), previous_df.end(), default_feature) == previous_df.end())
{
@@ -634,7 +747,7 @@ namespace vcpkg::Dependencies
/// <param name="map">Map of all source control files in the current environment.</param>
/// <param name="specs">Feature specifications to resolve dependencies for.</param>
/// <param name="status_db">Status of installed packages in the current environment.</param>
- std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map,
+ std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFileLocation>& map,
const std::vector<FeatureSpec>& specs,
const StatusParagraphs& status_db)
{
@@ -697,7 +810,11 @@ namespace vcpkg::Dependencies
if (p_cluster->transient_uninstalled)
{
// If it will be transiently uninstalled, we need to issue a full installation command
- auto pscf = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scf;
+ auto* pscfl = p_cluster->source.value_or_exit(VCPKG_LINE_INFO).scfl;
+ Checks::check_exit(VCPKG_LINE_INFO,
+ pscfl != nullptr,
+ "Error: Expected a SourceControlFileLocation to exist");
+ auto&& scfl = *pscfl;
auto dep_specs = Util::fmap(m_graph_plan->install_graph.adjacency_list(p_cluster),
[](ClusterPtr const& p) { return p->spec; });
@@ -705,7 +822,7 @@ namespace vcpkg::Dependencies
plan.emplace_back(InstallPlanAction{
p_cluster->spec,
- *pscf,
+ scfl,
p_cluster->to_install_features,
p_cluster->request_type,
std::move(dep_specs),
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp
index 870d2c49e..88c1526c5 100644
--- a/toolsrc/src/vcpkg/export.cpp
+++ b/toolsrc/src/vcpkg/export.cpp
@@ -75,6 +75,7 @@ namespace vcpkg::Export
Build::AllowDownloads::YES,
Build::CleanBuildtrees::NO,
Build::CleanPackages::NO,
+ Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
Build::BinaryCaching::NO,
Build::FailOnTombstone::NO,
@@ -140,12 +141,12 @@ namespace vcpkg::Export
std::error_code ec;
fs.create_directories(paths.buildsystems / "tmp", ec);
- fs.write_contents(targets_redirect, targets_redirect_content);
+ fs.write_contents(targets_redirect, targets_redirect_content, VCPKG_LINE_INFO);
const std::string nuspec_file_content =
create_nuspec_file_contents(raw_exported_dir.string(), targets_redirect.string(), nuget_id, nuget_version);
const fs::path nuspec_file_path = paths.buildsystems / "tmp" / "vcpkg.export.nuspec";
- fs.write_contents(nuspec_file_path, nuspec_file_content);
+ fs.write_contents(nuspec_file_path, nuspec_file_content, VCPKG_LINE_INFO);
// -NoDefaultExcludes is needed for ".vcpkg-root"
const auto cmd_line = Strings::format(R"("%s" pack -OutputDirectory "%s" "%s" -NoDefaultExcludes > nul)",
@@ -228,10 +229,10 @@ namespace vcpkg::Export
{
const std::vector<fs::path> integration_files_relative_to_root = {
{".vcpkg-root"},
- {fs::path {"scripts"} / "buildsystems" / "msbuild" / "applocal.ps1"},
- {fs::path {"scripts"} / "buildsystems" / "msbuild" / "vcpkg.targets"},
- {fs::path {"scripts"} / "buildsystems" / "vcpkg.cmake"},
- {fs::path {"scripts"} / "cmake" / "vcpkg_get_windows_sdk.cmake"},
+ {fs::path{"scripts"} / "buildsystems" / "msbuild" / "applocal.ps1"},
+ {fs::path{"scripts"} / "buildsystems" / "msbuild" / "vcpkg.targets"},
+ {fs::path{"scripts"} / "buildsystems" / "vcpkg.cmake"},
+ {fs::path{"scripts"} / "cmake" / "vcpkg_get_windows_sdk.cmake"},
};
for (const fs::path& file : integration_files_relative_to_root)
@@ -487,7 +488,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
// create the plan
const StatusParagraphs status_db = database_load_check(paths);
- Dependencies::PathsPortFileProvider provider(paths);
+
+ // Load ports from ports dirs
+ Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get());
+
std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(opts.specs, status_db);
Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty");
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<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);
diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp
index 84a054e0f..6ee573dfc 100644
--- a/toolsrc/src/vcpkg/help.cpp
+++ b/toolsrc/src/vcpkg/help.cpp
@@ -111,10 +111,12 @@ namespace vcpkg::Help
" vcpkg contact Display contact information to send feedback\n"
"\n"
"Options:\n"
- " --triplet <t> Specify the target architecture triplet.\n"
+ " --triplet <t> Specify the target architecture triplet\n"
" (default: " ENVVAR(VCPKG_DEFAULT_TRIPLET) //
", see 'vcpkg help triplet')\n"
"\n"
+ " --overlay-ports=<path> Specify directories to be used when searching for ports\n"
+ "\n"
" --vcpkg-root <path> Specify the vcpkg root "
"directory\n"
" (default: " ENVVAR(VCPKG_ROOT) //
@@ -137,7 +139,7 @@ namespace vcpkg::Help
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
if (args.command_arguments.empty())
{
diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp
index 14dfb6fa3..781629236 100644
--- a/toolsrc/src/vcpkg/install.cpp
+++ b/toolsrc/src/vcpkg/install.cpp
@@ -138,7 +138,7 @@ namespace vcpkg::Install
std::sort(output.begin(), output.end());
- fs.write_lines(listfile, output);
+ fs.write_lines(listfile, output, VCPKG_LINE_INFO);
}
static std::vector<file_pack> extract_files_in_triplet(
@@ -156,14 +156,15 @@ namespace vcpkg::Install
const std::string name = t.pgh.package.displayname();
- for (const std::string &file : t.files)
+ for (const std::string& file : t.files)
{
output.emplace_back(file_pack{std::string(file, remove_chars), name});
}
}
- std::sort(output.begin(), output.end(),
- [](const file_pack &lhs, const file_pack &rhs) { return lhs.first < rhs.first; });
+ std::sort(output.begin(), output.end(), [](const file_pack& lhs, const file_pack& rhs) {
+ return lhs.first < rhs.first;
+ });
return output;
}
@@ -180,8 +181,7 @@ namespace vcpkg::Install
}
static SortedVector<file_pack> build_list_of_installed_files(
- const std::vector<StatusParagraphAndAssociatedFiles>& pgh_and_files,
- const Triplet& triplet)
+ const std::vector<StatusParagraphAndAssociatedFiles>& pgh_and_files, const Triplet& triplet)
{
const size_t installed_remove_char_count = triplet.canonical_name().size() + 1; // +1 for the slash
std::vector<file_pack> installed_files =
@@ -198,13 +198,12 @@ namespace vcpkg::Install
const SortedVector<std::string> package_files =
build_list_of_package_files(paths.get_filesystem(), package_dir);
- const SortedVector<file_pack> installed_files =
- build_list_of_installed_files(pgh_and_files, triplet);
+ const SortedVector<file_pack> installed_files = build_list_of_installed_files(pgh_and_files, triplet);
struct intersection_compare
{
- bool operator()(const std::string &lhs, const file_pack &rhs) { return lhs < rhs.first; }
- bool operator()(const file_pack &lhs, const std::string &rhs) { return lhs.first < rhs; }
+ bool operator()(const std::string& lhs, const file_pack& rhs) { return lhs < rhs.first; }
+ bool operator()(const file_pack& lhs, const std::string& rhs) { return lhs.first < rhs; }
};
std::vector<file_pack> intersection;
@@ -216,11 +215,9 @@ namespace vcpkg::Install
std::back_inserter(intersection),
intersection_compare());
- std::sort(intersection.begin(), intersection.end(),
- [](const file_pack &lhs, const file_pack &rhs)
- {
- return lhs.second < rhs.second;
- });
+ std::sort(intersection.begin(), intersection.end(), [](const file_pack& lhs, const file_pack& rhs) {
+ return lhs.second < rhs.second;
+ });
if (!intersection.empty())
{
@@ -231,19 +228,13 @@ namespace vcpkg::Install
bcf.core_paragraph.spec);
auto i = intersection.begin();
- while (i != intersection.end()) {
+ while (i != intersection.end())
+ {
System::print2("Installed by ", i->second, "\n ");
- auto next = std::find_if(i, intersection.end(),
- [i](const auto &val)
- {
- return i->second != val.second;
- });
-
- System::print2(Strings::join("\n ", i, next,
- [](const file_pack &file)
- {
- return file.first;
- }));
+ auto next =
+ std::find_if(i, intersection.end(), [i](const auto& val) { return i->second != val.second; });
+
+ System::print2(Strings::join("\n ", i, next, [](const file_pack& file) { return file.first; }));
System::print2("\n\n");
i = next;
@@ -302,8 +293,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);
@@ -340,9 +330,10 @@ namespace vcpkg::Install
System::printf("Building package %s...\n", display_name_with_features);
auto result = [&]() -> Build::ExtendedBuildResult {
- const Build::BuildPackageConfig build_config{action.source_control_file.value_or_exit(VCPKG_LINE_INFO),
+ const auto& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO);
+ const Build::BuildPackageConfig build_config{*scfl.source_control_file,
action.spec.triplet(),
- paths.port_dir(action.spec),
+ static_cast<fs::path>(scfl.source_location),
action.build_options,
action.feature_list};
return Build::build_package(paths, build_config, status_db);
@@ -368,6 +359,20 @@ namespace vcpkg::Install
fs.remove_all(package_dir, ec);
}
+ if (action.build_options.clean_downloads == Build::CleanDownloads::YES)
+ {
+ auto& fs = paths.get_filesystem();
+ const fs::path download_dir = paths.downloads;
+ std::error_code ec;
+ for (auto& p : fs.get_files_non_recursive(download_dir))
+ {
+ if (!fs.is_directory(p))
+ {
+ fs.remove(p, VCPKG_LINE_INFO);
+ }
+ }
+ }
+
return {code, std::move(bcf)};
}
@@ -464,14 +469,16 @@ namespace vcpkg::Install
static constexpr StringLiteral OPTION_KEEP_GOING = "--keep-going";
static constexpr StringLiteral OPTION_XUNIT = "--x-xunit";
static constexpr StringLiteral OPTION_USE_ARIA2 = "--x-use-aria2";
+ static constexpr StringLiteral OPTION_CLEAN_AFTER_BUILD = "--clean-after-build";
- static constexpr std::array<CommandSwitch, 6> INSTALL_SWITCHES = {{
+ static constexpr std::array<CommandSwitch, 7> INSTALL_SWITCHES = {{
{OPTION_DRY_RUN, "Do not actually build or install"},
{OPTION_USE_HEAD_VERSION, "Install the libraries on the command line using the latest upstream sources"},
{OPTION_NO_DOWNLOADS, "Do not download new sources"},
{OPTION_RECURSE, "Allow removal of packages as part of installation"},
{OPTION_KEEP_GOING, "Continue installing packages on failure"},
{OPTION_USE_ARIA2, "Use aria2 to perform download tasks"},
+ {OPTION_CLEAN_AFTER_BUILD, "Clean buildtrees, packages and downloads after building each package"},
}};
static constexpr std::array<CommandSetting, 1> INSTALL_SETTINGS = {{
{OPTION_XUNIT, "File to output results in XUnit format (Internal use)"},
@@ -532,7 +539,9 @@ namespace vcpkg::Install
while (next != last)
{
auto match = *next;
- library_targets[find_package_name].push_back(match[1]);
+ auto& targets = library_targets[find_package_name];
+ if (std::find(targets.cbegin(), targets.cend(), match[1]) == targets.cend())
+ targets.push_back(match[1]);
++next;
}
}
@@ -615,11 +624,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);
@@ -627,8 +631,11 @@ namespace vcpkg::Install
const bool no_downloads = Util::Sets::contains(options.switches, (OPTION_NO_DOWNLOADS));
const bool is_recursive = Util::Sets::contains(options.switches, (OPTION_RECURSE));
const bool use_aria2 = Util::Sets::contains(options.switches, (OPTION_USE_ARIA2));
+ const bool clean_after_build = Util::Sets::contains(options.switches, (OPTION_CLEAN_AFTER_BUILD));
const KeepGoing keep_going = to_keep_going(Util::Sets::contains(options.switches, OPTION_KEEP_GOING));
+ auto& fs = paths.get_filesystem();
+
// create the plan
StatusParagraphs status_db = database_load_check(paths);
@@ -638,37 +645,21 @@ namespace vcpkg::Install
const Build::BuildPackageOptions install_plan_options = {
Util::Enum::to_enum<Build::UseHeadVersion>(use_head_version),
Util::Enum::to_enum<Build::AllowDownloads>(!no_downloads),
- Build::CleanBuildtrees::NO,
- Build::CleanPackages::NO,
+ clean_after_build ? Build::CleanBuildtrees::YES : Build::CleanBuildtrees::NO,
+ clean_after_build ? Build::CleanPackages::YES : Build::CleanPackages::NO,
+ clean_after_build ? Build::CleanDownloads::YES : Build::CleanDownloads::NO,
download_tool,
GlobalState::g_binary_caching ? Build::BinaryCaching::YES : Build::BinaryCaching::NO,
Build::FailOnTombstone::NO,
};
- auto all_ports = Paragraphs::load_all_ports(paths.get_filesystem(), paths.ports);
- std::unordered_map<std::string, SourceControlFile> scf_map;
- for (auto&& port : all_ports)
- scf_map[port->core_paragraph->name] = std::move(*port);
- MapPortFileProvider provider(scf_map);
+ //// Load ports from ports dirs
+ PathsPortFileProvider provider(paths, args.overlay_ports.get());
- // Note: action_plan will hold raw pointers to SourceControlFiles from this map
+ // Note: action_plan will hold raw pointers to SourceControlFileLocations from this map
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())
@@ -717,7 +708,7 @@ namespace vcpkg::Install
xunit_doc += summary.xunit_results();
xunit_doc += "</collection></assembly></assemblies>\n";
- paths.get_filesystem().write_contents(fs::u8path(it_xunit->second), xunit_doc);
+ fs.write_contents(fs::u8path(it_xunit->second), xunit_doc, VCPKG_LINE_INFO);
}
for (auto&& result : summary.results)
diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp
index 5ca2b056a..9dd520ed6 100644
--- a/toolsrc/src/vcpkg/metrics.cpp
+++ b/toolsrc/src/vcpkg/metrics.cpp
@@ -9,8 +9,10 @@
#include <vcpkg/base/strings.h>
#include <vcpkg/base/system.process.h>
+#if defined(_WIN32)
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
+#endif
namespace vcpkg::Metrics
{
diff --git a/toolsrc/src/vcpkg/packagespecparseresult.cpp b/toolsrc/src/vcpkg/packagespecparseresult.cpp
index c5254f7be..ef078ea28 100644
--- a/toolsrc/src/vcpkg/packagespecparseresult.cpp
+++ b/toolsrc/src/vcpkg/packagespecparseresult.cpp
@@ -19,8 +19,5 @@ namespace vcpkg
}
}
- void to_string(std::string& out, PackageSpecParseResult p)
- {
- out.append(vcpkg::to_string(p).c_str());
- }
+ void to_string(std::string& out, PackageSpecParseResult p) { out.append(vcpkg::to_string(p).c_str()); }
}
diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp
index 45f939afd..21ef2c4d9 100644
--- a/toolsrc/src/vcpkg/paragraphs.cpp
+++ b/toolsrc/src/vcpkg/paragraphs.cpp
@@ -1,9 +1,9 @@
#include "pch.h"
#include <vcpkg/base/files.h>
+#include <vcpkg/base/system.debug.h>
#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
-#include <vcpkg/globalstate.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);
}
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp
index d6581c2b4..c760a034f 100644
--- a/toolsrc/src/vcpkg/postbuildlint.cpp
+++ b/toolsrc/src/vcpkg/postbuildlint.cpp
@@ -857,14 +857,15 @@ namespace vcpkg::PostBuildLint
size_t perform_all_checks(const PackageSpec& spec,
const VcpkgPaths& paths,
const PreBuildInfo& pre_build_info,
- const BuildInfo& build_info)
+ const BuildInfo& build_info,
+ const fs::path& port_dir)
{
System::print2("-- Performing post-build validation\n");
const size_t error_count = perform_all_checks_and_return_error_count(spec, paths, pre_build_info, build_info);
if (error_count != 0)
{
- const fs::path portfile = paths.ports / spec.name() / "portfile.cmake";
+ const fs::path portfile = port_dir / "portfile.cmake";
System::print2(System::Color::error,
"Found ",
error_count,
diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp
index 685cdfdc3..a40b27bd7 100644
--- a/toolsrc/src/vcpkg/remove.cpp
+++ b/toolsrc/src/vcpkg/remove.cpp
@@ -111,7 +111,7 @@ namespace vcpkg::Remove
}
}
- fs.remove(paths.listfile_path(ipv.core->package));
+ fs.remove(paths.listfile_path(ipv.core->package), VCPKG_LINE_INFO);
}
for (auto&& spgh : spghs)
@@ -229,7 +229,8 @@ namespace vcpkg::Remove
Checks::exit_fail(VCPKG_LINE_INFO);
}
- Dependencies::PathsPortFileProvider provider(paths);
+ // Load ports from ports dirs
+ Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get());
specs = Util::fmap(Update::find_outdated_packages(provider, status_db),
[](auto&& outdated) { return outdated.spec; });
diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp
index b495c5f1d..9bc59cbe7 100644
--- a/toolsrc/src/vcpkg/sourceparagraph.cpp
+++ b/toolsrc/src/vcpkg/sourceparagraph.cpp
@@ -24,6 +24,7 @@ namespace vcpkg
static const std::string SOURCE = "Source";
static const std::string SUPPORTS = "Supports";
static const std::string VERSION = "Version";
+ static const std::string HOMEPAGE = "Homepage";
}
static Span<const std::string> get_list_of_valid_fields()
@@ -34,6 +35,7 @@ namespace vcpkg
SourceParagraphFields::DESCRIPTION,
SourceParagraphFields::MAINTAINER,
SourceParagraphFields::BUILD_DEPENDS,
+ SourceParagraphFields::HOMEPAGE,
};
return valid_fields;
@@ -107,6 +109,7 @@ namespace vcpkg
spgh->description = parser.optional_field(SourceParagraphFields::DESCRIPTION);
spgh->maintainer = parser.optional_field(SourceParagraphFields::MAINTAINER);
+ spgh->homepage = parser.optional_field(SourceParagraphFields::HOMEPAGE);
spgh->depends = expand_qualified_dependencies(
parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS)));
spgh->supports = parse_comma_list(parser.optional_field(SourceParagraphFields::SUPPORTS));
diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp
index 7232971c7..4f4b23055 100644
--- a/toolsrc/src/vcpkg/tools.cpp
+++ b/toolsrc/src/vcpkg/tools.cpp
@@ -62,7 +62,7 @@ namespace vcpkg
#if defined(_WIN32) || defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__)
static const std::string XML_VERSION = "2";
static const fs::path XML_PATH = paths.scripts / "vcpkgTools.xml";
- static const std::regex XML_VERSION_REGEX {R"###(<tools[\s]+version="([^"]+)">)###"};
+ static const std::regex XML_VERSION_REGEX{R"###(<tools[\s]+version="([^"]+)">)###"};
static const std::string XML = paths.get_filesystem().read_contents(XML_PATH).value_or_exit(VCPKG_LINE_INFO);
std::smatch match_xml_version;
const bool has_xml_version = std::regex_search(XML.cbegin(), XML.cend(), match_xml_version, XML_VERSION_REGEX);
@@ -78,7 +78,7 @@ namespace vcpkg
XML_VERSION,
match_xml_version[1]);
- const std::regex tool_regex {Strings::format(R"###(<tool[\s]+name="%s"[\s]+os="%s">)###", tool, OS_STRING)};
+ const std::regex tool_regex{Strings::format(R"###(<tool[\s]+name="%s"[\s]+os="%s">)###", tool, OS_STRING)};
std::smatch match_tool_entry;
const bool has_tool_entry = std::regex_search(XML.cbegin(), XML.cend(), match_tool_entry, tool_regex);
if (!has_tool_entry)
@@ -109,13 +109,13 @@ namespace vcpkg
const fs::path tool_dir_path = paths.tools / tool_dir_name;
const fs::path exe_path = tool_dir_path / exe_relative_path;
- return ToolData {*version.get(),
- exe_path,
- url,
- paths.downloads / archive_name.value_or(exe_relative_path).to_string(),
- archive_name.has_value(),
- tool_dir_path,
- sha512};
+ return ToolData{*version.get(),
+ exe_path,
+ url,
+ paths.downloads / archive_name.value_or(exe_relative_path).to_string(),
+ archive_name.has_value(),
+ tool_dir_path,
+ sha512};
#endif
}
@@ -131,7 +131,10 @@ namespace vcpkg
virtual const std::string& exe_stem() const = 0;
virtual std::array<int, 3> default_min_version() const = 0;
- virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const {}
+ virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const
+ {
+ Util::unused(out_candidate_paths);
+ }
virtual Optional<std::string> get_version(const fs::path& path_to_exe) const = 0;
};
@@ -156,7 +159,7 @@ namespace vcpkg
actual_version[2] >= expected_version[2]);
if (!version_acceptable) continue;
- return PathAndVersion {candidate, *version};
+ return PathAndVersion{candidate, *version};
}
return nullopt;
@@ -406,6 +409,7 @@ git version 2.17.1.windows.2
virtual void add_special_paths(std::vector<fs::path>& out_candidate_paths) const override
{
+ Util::unused(out_candidate_paths);
// TODO: Uncomment later
// const std::vector<fs::path> from_path = Files::find_from_PATH("installerbase");
// candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
diff --git a/toolsrc/src/vcpkg/update.cpp b/toolsrc/src/vcpkg/update.cpp
index 344192d59..6320bae5b 100644
--- a/toolsrc/src/vcpkg/update.cpp
+++ b/toolsrc/src/vcpkg/update.cpp
@@ -23,10 +23,10 @@ namespace vcpkg::Update
for (auto&& ipv : installed_packages)
{
const auto& pgh = ipv.core;
- auto maybe_scf = provider.get_control_file(pgh->package.spec.name());
- if (auto p_scf = maybe_scf.get())
+ auto maybe_scfl = provider.get_control_file(pgh->package.spec.name());
+ if (auto p_scfl = maybe_scfl.get())
{
- auto&& port_version = p_scf->core_paragraph->version;
+ auto&& port_version = p_scfl->source_control_file->core_paragraph->version;
auto&& installed_version = pgh->package.version;
if (installed_version != port_version)
{
@@ -52,12 +52,12 @@ namespace vcpkg::Update
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{
- args.parse_arguments(COMMAND_STRUCTURE);
+ Util::unused(args.parse_arguments(COMMAND_STRUCTURE));
System::print2("Using local portfile versions. To update the local portfiles, use `git pull`.\n");
const StatusParagraphs status_db = database_load_check(paths);
- Dependencies::PathsPortFileProvider provider(paths);
+ Dependencies::PathsPortFileProvider provider(paths, args.overlay_ports.get());
const auto outdated_packages = SortedVector<OutdatedPackage>(find_outdated_packages(provider, status_db),
&OutdatedPackage::compare_by_name);
diff --git a/toolsrc/src/vcpkg/userconfig.cpp b/toolsrc/src/vcpkg/userconfig.cpp
index 4945fdaaa..a7c4e2765 100644
--- a/toolsrc/src/vcpkg/userconfig.cpp
+++ b/toolsrc/src/vcpkg/userconfig.cpp
@@ -39,10 +39,7 @@ namespace vcpkg
#endif
}
- static fs::path get_config_path()
- {
- return get_user_dir() / "config";
- }
+ static fs::path get_config_path() { return get_user_dir() / "config"; }
UserConfig UserConfig::try_read_data(const Files::Filesystem& fs)
{
diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp
index 8565c28f9..21bf4d028 100644
--- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp
+++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp
@@ -45,6 +45,45 @@ namespace vcpkg
option_field = new_setting;
}
+ static void parse_multivalue(const std::string* arg_begin,
+ const std::string* arg_end,
+ const std::string& option_name,
+ std::unique_ptr<std::vector<std::string>>& option_field)
+ {
+ if (arg_begin == arg_end)
+ {
+ System::print2(System::Color::error, "Error: expected value after ", option_name, '\n');
+ Metrics::g_metrics.lock()->track_property("error", "error option name");
+ Help::print_usage();
+ Checks::exit_fail(VCPKG_LINE_INFO);
+ }
+
+ if (!option_field)
+ {
+ option_field = std::make_unique<std::vector<std::string>>();
+ }
+ option_field->emplace_back(*arg_begin);
+ }
+
+ static void parse_cojoined_multivalue(std::string new_value,
+ const std::string& option_name,
+ std::unique_ptr<std::vector<std::string>>& option_field)
+ {
+ if (new_value.empty())
+ {
+ System::print2(System::Color::error, "Error: expected value after ", option_name, '\n');
+ Metrics::g_metrics.lock()->track_property("error", "error option name");
+ Help::print_usage();
+ Checks::exit_fail(VCPKG_LINE_INFO);
+ }
+
+ if (!option_field)
+ {
+ option_field = std::make_unique<std::vector<std::string>>();
+ }
+ option_field->emplace_back(std::move(new_value));
+ }
+
VcpkgCmdArguments VcpkgCmdArguments::create_from_command_line(const int argc,
const CommandLineCharType* const* const argv)
{
@@ -117,6 +156,13 @@ namespace vcpkg
parse_value(arg_begin, arg_end, "--triplet", args.triplet);
continue;
}
+ if (Strings::starts_with(arg, "--overlay-ports="))
+ {
+ parse_cojoined_multivalue(arg.substr(sizeof("--overlay-ports=") - 1),
+ "--overlay-ports",
+ args.overlay_ports);
+ continue;
+ }
if (arg == "--debug")
{
parse_switch(true, "debug", args.debug);
@@ -166,7 +212,21 @@ namespace vcpkg
const auto eq_pos = arg.find('=');
if (eq_pos != std::string::npos)
{
- args.optional_command_arguments.emplace(arg.substr(0, eq_pos), arg.substr(eq_pos + 1));
+ const auto& key = arg.substr(0, eq_pos);
+ const auto& value = arg.substr(eq_pos + 1);
+
+ auto it = args.optional_command_arguments.find(key);
+ if (args.optional_command_arguments.end() == it)
+ {
+ args.optional_command_arguments.emplace(key, std::vector<std::string> { value });
+ }
+ else
+ {
+ if (auto* maybe_values = it->second.get())
+ {
+ maybe_values->emplace_back(value);
+ }
+ }
}
else
{
@@ -264,7 +324,51 @@ namespace vcpkg
}
else
{
- output.settings.emplace(option.name, it->second.value_or_exit(VCPKG_LINE_INFO));
+ const auto& value = it->second.value_or_exit(VCPKG_LINE_INFO);
+ if (value.front().empty())
+ {
+ // Fail when not given a value, e.g.: "vcpkg install sqlite3 --additional-ports="
+ System::printf(
+ System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name);
+ failed = true;
+ }
+ else
+ {
+ output.settings.emplace(option.name, value.front());
+ options_copy.erase(it);
+ }
+ }
+ }
+ }
+
+ for (auto&& option : command_structure.options.multisettings)
+ {
+ const auto it = options_copy.find(option.name);
+ if (it != options_copy.end())
+ {
+ if (!it->second.has_value())
+ {
+ // Not having a string value indicates it was passed like '--a'
+ System::printf(
+ System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name);
+ failed = true;
+ }
+ else
+ {
+ const auto& value = it->second.value_or_exit(VCPKG_LINE_INFO);
+ for (auto&& v : value)
+ {
+ if (v.empty())
+ {
+ System::printf(
+ System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name);
+ failed = true;
+ }
+ else
+ {
+ output.multisettings[option.name].emplace_back(v);
+ }
+ }
options_copy.erase(it);
}
}
@@ -306,7 +410,14 @@ namespace vcpkg
{
System::printf(" %-40s %s\n", (option.name + "=..."), option.short_help_text);
}
+ for (auto&& option : command_structure.options.multisettings)
+ {
+ System::printf(" %-40s %s\n", (option.name + "=..."), option.short_help_text);
+ }
System::printf(" %-40s %s\n", "--triplet <t>", "Set the default triplet for unqualified packages");
+ System::printf(" %-40s %s\n",
+ "--overlay-ports=<path>",
+ "Specify directories to be used when searching for ports");
System::printf(" %-40s %s\n",
"--vcpkg-root <path>",
"Specify the vcpkg directory to use instead of current directory or tool directory");
diff --git a/toolsrc/src/vcpkg/vcpkglib.cpp b/toolsrc/src/vcpkg/vcpkglib.cpp
index c8e95dab1..2a52111a6 100644
--- a/toolsrc/src/vcpkg/vcpkglib.cpp
+++ b/toolsrc/src/vcpkg/vcpkglib.cpp
@@ -21,7 +21,7 @@ namespace vcpkg
return StatusParagraphs();
}
- fs.rename(vcpkg_dir_status_file_old, vcpkg_dir_status_file);
+ fs.rename(vcpkg_dir_status_file_old, vcpkg_dir_status_file, VCPKG_LINE_INFO);
}
auto pghs = Paragraphs::get_paragraphs(fs, vcpkg_dir_status_file).value_or_exit(VCPKG_LINE_INFO);
@@ -72,15 +72,15 @@ namespace vcpkg
}
}
- fs.write_contents(status_file_new, Strings::serialize(current_status_db));
+ fs.write_contents(status_file_new, Strings::serialize(current_status_db), VCPKG_LINE_INFO);
- fs.rename(status_file_new, status_file);
+ fs.rename(status_file_new, status_file, VCPKG_LINE_INFO);
for (auto&& file : update_files)
{
if (!fs.is_regular_file(file)) continue;
- fs.remove(file);
+ fs.remove(file, VCPKG_LINE_INFO);
}
return current_status_db;
@@ -95,8 +95,8 @@ namespace vcpkg
const auto tmp_update_filename = paths.vcpkg_dir_updates / "incomplete";
const auto update_filename = paths.vcpkg_dir_updates / Strings::format("%010d", my_update_id);
- fs.write_contents(tmp_update_filename, Strings::serialize(p));
- fs.rename(tmp_update_filename, update_filename);
+ fs.write_contents(tmp_update_filename, Strings::serialize(p), VCPKG_LINE_INFO);
+ fs.rename(tmp_update_filename, update_filename, VCPKG_LINE_INFO);
}
static void upgrade_to_slash_terminated_sorted_format(Files::Filesystem& fs,
@@ -165,8 +165,8 @@ namespace vcpkg
// Replace the listfile on disk
const fs::path updated_listfile_path = listfile_path.generic_string() + "_updated";
- fs.write_lines(updated_listfile_path, *lines);
- fs.rename(updated_listfile_path, listfile_path);
+ fs.write_lines(updated_listfile_path, *lines, VCPKG_LINE_INFO);
+ fs.rename(updated_listfile_path, listfile_path, VCPKG_LINE_INFO);
}
std::vector<InstalledPackageView> get_installed_ports(const StatusParagraphs& status_db)
diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp
index 512bcfc35..562a18c9b 100644
--- a/toolsrc/src/vcpkg/vcpkgpaths.cpp
+++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp
@@ -81,9 +81,6 @@ namespace vcpkg
fs::path VcpkgPaths::package_dir(const PackageSpec& spec) const { return this->packages / spec.dir(); }
- fs::path VcpkgPaths::port_dir(const PackageSpec& spec) const { return this->ports / spec.name(); }
- fs::path VcpkgPaths::port_dir(const std::string& name) const { return this->ports / name; }
-
fs::path VcpkgPaths::build_info_file_path(const PackageSpec& spec) const
{
return this->package_dir(spec) / "BUILD_INFO";