From e9f8cc67a5e5541973e53ac03f88adb45cc1b21b Mon Sep 17 00:00:00 2001 From: Victor Romero Date: Mon, 26 Oct 2020 10:24:30 -0700 Subject: [vcpkg] Implement versions db generator (#13777) * [vcpkg] Add script to generate ports versions history * [vcpkg] Fix formatting * Fetch port versions from commit ID * Use global --x-json switch * Use --no-checkout when cloning secondary instance * Clone from local repository instead of from GitHub * Use CmdLineBuilder to build git commands * Use CmdLineBuilder and reduce repeated code * Fetch version at baseline and code cleanup * Guess version scheme from old CONTROL files * Rename version db generator script * Simplify x-history json output * Use CONTROL/manifest parsers on x-history * Use git-tree instaed of commit-id * Remove 'ports' field from root object * Clean up code * More code cleanup * Improve port version detection * Improve generator logging * Do not ignore parsing errors in CONTROL files * PR review comments in Python script * Fix subprocess.run() calls * Make `canonicalize()` return error instead of terminating * [vcpkg] Add tests for new test_parse_control_file paths * Remove unnecessary std::move() calls * Fix formatting * Python formatting Co-authored-by: Robert Schumacher --- toolsrc/include/vcpkg/paragraphs.h | 6 ++++++ toolsrc/include/vcpkg/sourceparagraph.h | 5 ++++- toolsrc/include/vcpkg/versions.h | 6 ++---- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'toolsrc/include') diff --git a/toolsrc/include/vcpkg/paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index f4ea36ede..0293f0733 100644 --- a/toolsrc/include/vcpkg/paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -17,12 +17,18 @@ namespace vcpkg::Paragraphs ExpectedS parse_single_paragraph(const std::string& str, const std::string& origin); ExpectedS get_single_paragraph(const Files::Filesystem& fs, const fs::path& control_path); + ExpectedS> get_paragraphs(const Files::Filesystem& fs, const fs::path& control_path); + ExpectedS> get_paragraphs_text(const std::string& text, const std::string& origin); + ExpectedS> parse_paragraphs(const std::string& str, const std::string& origin); bool is_port_directory(const Files::Filesystem& fs, const fs::path& path); Parse::ParseExpected try_load_port(const Files::Filesystem& fs, const fs::path& path); + Parse::ParseExpected try_load_port_text(const std::string& text, + const std::string& origin, + bool is_manifest); ExpectedS try_load_cached_package(const VcpkgPaths& paths, const PackageSpec& spec); diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index 21e5a4ef9..d88c0b0fd 100644 --- a/toolsrc/include/vcpkg/sourceparagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -91,11 +91,14 @@ namespace vcpkg return ret; } + static Parse::ParseExpected parse_manifest_object(const std::string& origin, + const Json::Object& object); + static Parse::ParseExpected parse_manifest_file(const fs::path& path_to_manifest, const Json::Object& object); static Parse::ParseExpected parse_control_file( - const fs::path& path_to_control, std::vector&& control_paragraphs); + const std::string& origin, std::vector&& control_paragraphs); // Always non-null in non-error cases std::unique_ptr core_paragraph; diff --git a/toolsrc/include/vcpkg/versions.h b/toolsrc/include/vcpkg/versions.h index f0304c788..331bf7f8b 100644 --- a/toolsrc/include/vcpkg/versions.h +++ b/toolsrc/include/vcpkg/versions.h @@ -1,14 +1,12 @@ #pragma once -#include - namespace vcpkg::Versions { enum class Scheme { - String, Relaxed, Semver, - Date + Date, + String }; } -- cgit v1.2.3