diff options
| author | nicole mazzuca <mazzucan@outlook.com> | 2020-04-17 15:49:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-17 15:49:59 -0700 |
| commit | 556325a1f7b6049d91565257c00db2f0bf1eadc5 (patch) | |
| tree | 82485596a6285844862b431e6930c306b33cd484 /toolsrc/include | |
| parent | 71377f69e255414ccf3569a8a772fc89ee9f89ff (diff) | |
| download | vcpkg-556325a1f7b6049d91565257c00db2f0bf1eadc5.tar.gz vcpkg-556325a1f7b6049d91565257c00db2f0bf1eadc5.zip | |
[vcpkg] Add x-set-installed command (#10817)
This command takes a list of ports, and causes the final state of the
installed directory to be as-if one ran the install on an empty
installed directory (removing any unnecessary packages).
This is especially useful with the new `--x-install-root` option, which
allows one to set the `installed` directory for vcpkg to use.
Additionally, as a drive-by, we do some `stdfs` clean-up and add a
`.is_feature()` member function to BinaryParagraph (as opposed to
checking for `.feature().empty()`, which is far less clear to read).
This feature is experimental.
Diffstat (limited to 'toolsrc/include')
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/binaryparagraph.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraphs.h | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgcmdarguments.h | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h | 1 |
6 files changed, 16 insertions, 1 deletions
diff --git a/toolsrc/include/vcpkg/base/files.h b/toolsrc/include/vcpkg/base/files.h index 0bad428c0..8f278cd20 100644 --- a/toolsrc/include/vcpkg/base/files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -22,6 +22,7 @@ namespace fs using stdfs::path; using stdfs::perms; using stdfs::u8path; + using stdfs::directory_iterator; #if defined(_WIN32) enum class file_type @@ -155,9 +156,13 @@ namespace vcpkg::Files fs::file_status status(const fs::path& p, ignore_errors_t) const noexcept; fs::file_status symlink_status(LineInfo li, const fs::path& p) const noexcept; fs::file_status symlink_status(const fs::path& p, ignore_errors_t) const noexcept; + virtual fs::path absolute(const fs::path& path, std::error_code& ec) const = 0; + fs::path absolute(LineInfo li, const fs::path& path) const; virtual fs::path canonical(const fs::path& path, std::error_code& ec) const = 0; fs::path canonical(LineInfo li, const fs::path& path) const; fs::path canonical(const fs::path& path, ignore_errors_t) const; + virtual fs::path current_path(std::error_code&) const = 0; + fs::path current_path(LineInfo li) const; virtual std::vector<fs::path> find_from_PATH(const std::string& name) const = 0; }; diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index edb2b6a13..d556a40c8 100644 --- a/toolsrc/include/vcpkg/binaryparagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -28,6 +28,8 @@ namespace vcpkg std::string dir() const; + bool is_feature() const { return !feature.empty(); } + PackageSpec spec; std::string version; std::string description; diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 9d2d0b6c6..3ce182410 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -139,6 +139,12 @@ namespace vcpkg::Commands void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); } + namespace SetInstalled + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); + } + template<class T> struct PackageNameAndFunction { diff --git a/toolsrc/include/vcpkg/statusparagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index 7fcf0e916..1fda81316 100644 --- a/toolsrc/include/vcpkg/statusparagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -40,7 +40,7 @@ namespace vcpkg std::vector<std::unique_ptr<StatusParagraph>*> find_all(const std::string& name, Triplet triplet); - Optional<InstalledPackageView> find_all_installed(const PackageSpec& spec) const; + Optional<InstalledPackageView> get_installed_package_view(const PackageSpec& spec) const; /// <summary>Find the StatusParagraph for given spec if installed</summary> /// <param name="spec">Package specification to find the status for</param> diff --git a/toolsrc/include/vcpkg/vcpkgcmdarguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index fe7911ae3..e5b26c25a 100644 --- a/toolsrc/include/vcpkg/vcpkgcmdarguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -86,6 +86,7 @@ namespace vcpkg static VcpkgCmdArguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end); std::unique_ptr<std::string> vcpkg_root_dir; + std::unique_ptr<std::string> install_root_dir; std::unique_ptr<std::string> scripts_root_dir; std::unique_ptr<std::string> triplet; std::unique_ptr<std::vector<std::string>> overlay_ports; diff --git a/toolsrc/include/vcpkg/vcpkgpaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index 31d8374f1..c95515aee 100644 --- a/toolsrc/include/vcpkg/vcpkgpaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -58,6 +58,7 @@ namespace vcpkg }; static Expected<VcpkgPaths> create(const fs::path& vcpkg_root_dir, + const Optional<fs::path>& install_root_dir, const Optional<fs::path>& vcpkg_scripts_root_dir, const std::string& default_vs_path, const std::vector<std::string>* triplets_dirs); |
