[vcpkg] Rename port_versions to versions (#15784)

This commit is contained in:
nicole mazzuca 2021-01-21 09:53:22 -08:00 committed by GitHub
parent bedeaa639c
commit 68a74950d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1613 changed files with 73 additions and 74 deletions

View File

@ -204,16 +204,16 @@ For Example:
See our [manifest files document](manifest-files.md#port-version) for a full explanation of our conventions. See our [manifest files document](manifest-files.md#port-version) for a full explanation of our conventions.
### Update the version files in `port_versions/` of any modified ports ### Update the version files in `versions/` of any modified ports
Vcpkg uses a set of metadata files to power its versioning feature. Vcpkg uses a set of metadata files to power its versioning feature.
These files are located in the following locations: These files are located in the following locations:
* `${VCPKG_ROOT}/port_versions/baseline.json`, (this file is common to all ports) and * `${VCPKG_ROOT}/versions/baseline.json`, (this file is common to all ports) and
* `${VCPKG_ROOT}/port_versions/${first-letter-of-portname}-/${portname}.json` (one per port). * `${VCPKG_ROOT}/versions/${first-letter-of-portname}-/${portname}.json` (one per port).
For example, for `zlib` the relevant files are: For example, for `zlib` the relevant files are:
* `${VCPKG_ROOT}/port_versions/baseline.json` * `${VCPKG_ROOT}/versions/baseline.json`
* `${VCPKG_ROOT}/port_versions/z-/zlib.json` * `${VCPKG_ROOT}/versions/z-/zlib.json`
We expect that each time you update a port, you also update its version files. We expect that each time you update a port, you also update its version files.

View File

@ -171,7 +171,7 @@ Baselines are used to set lower boundaries on package versions. A baseline effec
But what is a baseline? But what is a baseline?
In the main registry, the baseline is a file located in `${VCPKG_ROOT}/port_versions/baseline.json`. This file contains a version declaration for each package in vcpkg. The format of this file is the following: In the main registry, the baseline is a file located in `${VCPKG_ROOT}/versions/baseline.json`. This file contains a version declaration for each package in vcpkg. The format of this file is the following:
```json ```json
{ {
@ -319,9 +319,9 @@ Although the concept of package versions has always been present in vcpkg, the c
With the introduction of versioning constraints, it is now possible that a package depends on a port version that does not match the one available locally. This raises a problem as vcpkg needs to know how to acquire the port files for the requested version. With the introduction of versioning constraints, it is now possible that a package depends on a port version that does not match the one available locally. This raises a problem as vcpkg needs to know how to acquire the port files for the requested version.
To solve this problem, a new set of metadata needs to be introduced. This specification proposes a that a new “port_versions” folder is added as part of a registry. In the main vcpkg registry, this means a new root level port_versions directory. To solve this problem, a new set of metadata needs to be introduced. This specification proposes a that a new "versions" folder is added as part of a registry. In the main vcpkg registry, this means a new root level versions directory.
The port_versions directory, from here on referred as the versions database, will contain JSON files for each one of the ports available in the registry. Each file will list all the versions available for a package and contain a Git tree-ish object that vcpkg can check out to obtain that versions portfiles. The versions directory, from here on referred as the versions database, will contain JSON files for each one of the ports available in the registry. Each file will list all the versions available for a package and contain a Git tree-ish object that vcpkg can check out to obtain that versions portfiles.
As part of the versioning implementation, a generator for these database files will be implemented. The generator will extract from our repositorys Git history, all the versions of each port that had been available at any moment in time and compile them into these database files. As part of the versioning implementation, a generator for these database files will be implemented. The generator will extract from our repositorys Git history, all the versions of each port that had been available at any moment in time and compile them into these database files.
@ -349,5 +349,5 @@ Example: generated `zlib.json`
} }
``` ```
For each port, its corresponding versions file should be located in `port_versions/{first letter of port name}-/{port name}.json`. For example, zlibs version file will be located in `port_versions/z-/zlib.json`. For each port, its corresponding versions file should be located in `versions/{first letter of port name}-/{port name}.json`. For example, zlibs version file will be located in `versions/z-/zlib.json`.
Aside from port version files, the current baseline file is located in `port_versions/baseline.json`. Aside from port version files, the current baseline file is located in `versions/baseline.json`.

View File

@ -1,12 +1,12 @@
. "$PSScriptRoot/../end-to-end-tests-prelude.ps1" . "$PSScriptRoot/../end-to-end-tests-prelude.ps1"
$builtinRegistryArgs = $commonArgs + @("--x-builtin-port-versions-dir=$PSScriptRoot/../../e2e_ports/port_versions") $builtinRegistryArgs = $commonArgs + @("--x-builtin-registry-versions-dir=$PSScriptRoot/../../e2e_ports/versions")
Run-Vcpkg install @builtinRegistryArgs 'vcpkg-internal-e2e-test-port' Run-Vcpkg install @builtinRegistryArgs 'vcpkg-internal-e2e-test-port'
Throw-IfNotFailed Throw-IfNotFailed
# We should not look into the port_versions directory unless we have a baseline, # We should not look into the versions directory unless we have a baseline,
# even if we pass the registries feature flag # even if we pass the registries feature flag
Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'vcpkg-internal-e2e-test-port' Run-Vcpkg install @builtinRegistryArgs --feature-flags=registries 'vcpkg-internal-e2e-test-port'
Throw-IfNotFailed Throw-IfNotFailed
@ -28,13 +28,13 @@ Copy-Item -Recurse `
-LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" ` -LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" `
-Destination "$filesystemRegistry" -Destination "$filesystemRegistry"
New-Item ` New-Item `
-Path "$filesystemRegistry/port_versions" ` -Path "$filesystemRegistry/versions" `
-ItemType Directory -ItemType Directory
Copy-Item ` Copy-Item `
-LiteralPath "$PSScriptRoot/../../e2e_ports/port_versions/baseline.json" ` -LiteralPath "$PSScriptRoot/../../e2e_ports/versions/baseline.json" `
-Destination "$filesystemRegistry/port_versions/baseline.json" -Destination "$filesystemRegistry/versions/baseline.json"
New-Item ` New-Item `
-Path "$filesystemRegistry/port_versions/v-" ` -Path "$filesystemRegistry/versions/v-" `
-ItemType Directory -ItemType Directory
$vcpkgInternalE2eTestPortJson = @{ $vcpkgInternalE2eTestPortJson = @{
@ -46,7 +46,7 @@ $vcpkgInternalE2eTestPortJson = @{
) )
} }
New-Item ` New-Item `
-Path "$filesystemRegistry/port_versions/v-/vcpkg-internal-e2e-test-port.json" ` -Path "$filesystemRegistry/versions/v-/vcpkg-internal-e2e-test-port.json" `
-ItemType File ` -ItemType File `
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgInternalE2eTestPortJson) -Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgInternalE2eTestPortJson)
@ -68,7 +68,7 @@ try
$CurrentTest = 'git init .' $CurrentTest = 'git init .'
git @gitConfigOptions init . git @gitConfigOptions init .
Throw-IfFailed Throw-IfFailed
Copy-Item -Recurse -LiteralPath "$PSScriptRoot/../../e2e_ports/port_versions" -Destination . Copy-Item -Recurse -LiteralPath "$PSScriptRoot/../../e2e_ports/versions" -Destination .
Copy-Item -Recurse -LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" -Destination . Copy-Item -Recurse -LiteralPath "$PSScriptRoot/../../e2e_ports/vcpkg-internal-e2e-test-port" -Destination .
$CurrentTest = 'git add -A' $CurrentTest = 'git add -A'

View File

@ -2,16 +2,16 @@
# Test verify versions # Test verify versions
mkdir $VersionFilesRoot mkdir $VersionFilesRoot
Copy-Item -Recurse "scripts/testing/version-files/port_versions_incomplete" $VersionFilesRoot Copy-Item -Recurse "scripts/testing/version-files/versions_incomplete" $VersionFilesRoot
$portsRedirectArgsOK = @( $portsRedirectArgsOK = @(
"--feature-flags=versions", "--feature-flags=versions",
"--x-builtin-ports-root=scripts/testing/version-files/ports", "--x-builtin-ports-root=scripts/testing/version-files/ports",
"--x-builtin-port-versions-dir=scripts/testing/version-files/port_versions" "--x-builtin-registry-versions-dir=scripts/testing/version-files/versions"
) )
$portsRedirectArgsIncomplete = @( $portsRedirectArgsIncomplete = @(
"--feature-flags=versions", "--feature-flags=versions",
"--x-builtin-ports-root=scripts/testing/version-files/ports_incomplete", "--x-builtin-ports-root=scripts/testing/version-files/ports_incomplete",
"--x-builtin-port-versions-dir=$VersionFilesRoot/port_versions_incomplete" "--x-builtin-registry-versions-dir=$VersionFilesRoot/versions_incomplete"
) )
$CurrentTest = "x-verify-ci-versions (All files OK)" $CurrentTest = "x-verify-ci-versions (All files OK)"
Write-Host $CurrentTest Write-Host $CurrentTest
@ -77,7 +77,7 @@ foreach ($opt_registries in @("",",registries"))
./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install ` ./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install `
"--dry-run" ` "--dry-run" `
"--x-manifest-root=scripts/testing/version-files/without-default-baseline-2" ` "--x-manifest-root=scripts/testing/version-files/without-default-baseline-2" `
"--x-builtin-port-versions-dir=scripts/testing/version-files/default-baseline-2/port_versions" "--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
Throw-IfFailed Throw-IfFailed
Require-FileNotExists $buildtreesRoot/versioning Require-FileNotExists $buildtreesRoot/versioning
@ -85,7 +85,7 @@ foreach ($opt_registries in @("",",registries"))
./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install ` ./vcpkg $commonArgs "--feature-flags=versions$opt_registries" install `
"--dry-run" ` "--dry-run" `
"--x-manifest-root=scripts/testing/version-files/default-baseline-2" ` "--x-manifest-root=scripts/testing/version-files/default-baseline-2" `
"--x-builtin-port-versions-dir=scripts/testing/version-files/default-baseline-2/port_versions" "--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
Throw-IfFailed Throw-IfFailed
Require-FileExists $buildtreesRoot/versioning Require-FileExists $buildtreesRoot/versioning
@ -93,6 +93,6 @@ foreach ($opt_registries in @("",",registries"))
./vcpkg $commonArgs "--feature-flags=-versions$opt_registries" install ` ./vcpkg $commonArgs "--feature-flags=-versions$opt_registries" install `
"--dry-run" ` "--dry-run" `
"--x-manifest-root=scripts/testing/version-files/default-baseline-2" ` "--x-manifest-root=scripts/testing/version-files/default-baseline-2" `
"--x-builtin-port-versions-dir=scripts/testing/version-files/default-baseline-2/port_versions" "--x-builtin-registry-versions-dir=scripts/testing/version-files/default-baseline-2/versions"
Throw-IfNotFailed Throw-IfNotFailed
} }

View File

@ -8,7 +8,7 @@ from pathlib import Path
SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
PORTS_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../ports') PORTS_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../ports')
VERSIONS_DB_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../port_versions') VERSIONS_DB_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../versions')
def get_version_tag(version): def get_version_tag(version):

View File

@ -13,7 +13,7 @@ from pathlib import Path
MAX_PROCESSES = multiprocessing.cpu_count() MAX_PROCESSES = multiprocessing.cpu_count()
SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) SCRIPT_DIRECTORY = os.path.dirname(os.path.abspath(__file__))
PORTS_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../ports') PORTS_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../ports')
VERSIONS_DB_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../port_versions') VERSIONS_DB_DIRECTORY = os.path.join(SCRIPT_DIRECTORY, '../versions')
def get_current_git_ref(): def get_current_git_ref():
@ -26,7 +26,7 @@ def get_current_git_ref():
return None return None
def generate_port_versions_file(port_name): def generate_versions_file(port_name):
containing_dir = os.path.join(VERSIONS_DB_DIRECTORY, f'{port_name[0]}-') containing_dir = os.path.join(VERSIONS_DB_DIRECTORY, f'{port_name[0]}-')
os.makedirs(containing_dir, exist_ok=True) os.makedirs(containing_dir, exist_ok=True)
@ -43,7 +43,7 @@ def generate_port_versions_file(port_name):
output.stdout.strip(), file=sys.stderr) output.stdout.strip(), file=sys.stderr)
def generate_port_versions_db(revision): def generate_versions_db(revision):
start_time = time.time() start_time = time.time()
# Assume each directory in ${VCPKG_ROOT}/ports is a different port # Assume each directory in ${VCPKG_ROOT}/ports is a different port
@ -54,7 +54,7 @@ def generate_port_versions_db(revision):
concurrency = MAX_PROCESSES / 2 concurrency = MAX_PROCESSES / 2
print(f'Running {concurrency:.0f} parallel processes') print(f'Running {concurrency:.0f} parallel processes')
process_pool = multiprocessing.Pool(MAX_PROCESSES) process_pool = multiprocessing.Pool(MAX_PROCESSES)
for i, _ in enumerate(process_pool.imap_unordered(generate_port_versions_file, port_names), 1): for i, _ in enumerate(process_pool.imap_unordered(generate_versions_file, port_names), 1):
sys.stderr.write( sys.stderr.write(
f'\rProcessed: {i}/{total_count} ({(i / total_count):.2%})') f'\rProcessed: {i}/{total_count} ({(i / total_count):.2%})')
process_pool.close() process_pool.close()
@ -80,7 +80,7 @@ def main():
print(f'Database files already exist for commit {revision}') print(f'Database files already exist for commit {revision}')
sys.exit(0) sys.exit(0)
generate_port_versions_db(revision) generate_versions_db(revision)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -1 +0,0 @@
execute_process(COMMAND "bash" "-c" "echo \$TEST_ENV_VAR")

View File

@ -134,8 +134,8 @@ namespace vcpkg
std::unique_ptr<std::string> scripts_root_dir; std::unique_ptr<std::string> scripts_root_dir;
constexpr static StringLiteral BUILTIN_PORTS_ROOT_DIR_ARG = "x-builtin-ports-root"; constexpr static StringLiteral BUILTIN_PORTS_ROOT_DIR_ARG = "x-builtin-ports-root";
std::unique_ptr<std::string> builtin_ports_root_dir; std::unique_ptr<std::string> builtin_ports_root_dir;
constexpr static StringLiteral BUILTIN_PORT_VERSIONS_DIR_ARG = "x-builtin-port-versions-dir"; constexpr static StringLiteral BUILTIN_REGISTRY_VERSIONS_DIR_ARG = "x-builtin-registry-versions-dir";
std::unique_ptr<std::string> builtin_port_versions_dir; std::unique_ptr<std::string> builtin_registry_versions_dir;
constexpr static StringLiteral DEFAULT_VISUAL_STUDIO_PATH_ENV = "VCPKG_VISUAL_STUDIO_PATH"; constexpr static StringLiteral DEFAULT_VISUAL_STUDIO_PATH_ENV = "VCPKG_VISUAL_STUDIO_PATH";
std::unique_ptr<std::string> default_visual_studio_path; std::unique_ptr<std::string> default_visual_studio_path;

View File

@ -92,7 +92,7 @@ namespace vcpkg
fs::path scripts; fs::path scripts;
fs::path prefab; fs::path prefab;
fs::path builtin_ports; fs::path builtin_ports;
fs::path builtin_port_versions; fs::path builtin_registry_versions;
fs::path tools; fs::path tools;
fs::path buildsystems; fs::path buildsystems;

View File

@ -15,7 +15,7 @@ TEST_CASE ("VcpkgCmdArguments from lowercase argument sequence", "[arguments]")
"C:\\vcpkg", "C:\\vcpkg",
"--x-scripts-root=C:\\scripts", "--x-scripts-root=C:\\scripts",
"--x-builtin-ports-root=C:\\ports", "--x-builtin-ports-root=C:\\ports",
"--x-builtin-port-versions-dir=C:\\port_versions", "--x-builtin-registry-versions-dir=C:\\versions",
"--debug", "--debug",
"--sendmetrics", "--sendmetrics",
"--printmetrics", "--printmetrics",
@ -28,7 +28,7 @@ TEST_CASE ("VcpkgCmdArguments from lowercase argument sequence", "[arguments]")
REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg"); REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg");
REQUIRE(*v.scripts_root_dir == "C:\\scripts"); REQUIRE(*v.scripts_root_dir == "C:\\scripts");
REQUIRE(*v.builtin_ports_root_dir == "C:\\ports"); REQUIRE(*v.builtin_ports_root_dir == "C:\\ports");
REQUIRE(*v.builtin_port_versions_dir == "C:\\port_versions"); REQUIRE(*v.builtin_registry_versions_dir == "C:\\versions");
REQUIRE(v.debug); REQUIRE(v.debug);
REQUIRE(*v.debug.get()); REQUIRE(*v.debug.get());
REQUIRE(v.send_metrics); REQUIRE(v.send_metrics);
@ -51,7 +51,7 @@ TEST_CASE ("VcpkgCmdArguments from uppercase argument sequence", "[arguments]")
"C:\\vcpkg", "C:\\vcpkg",
"--X-SCRIPTS-ROOT=C:\\scripts", "--X-SCRIPTS-ROOT=C:\\scripts",
"--X-BUILTIN-PORTS-ROOT=C:\\ports", "--X-BUILTIN-PORTS-ROOT=C:\\ports",
"--X-BUILTIN-PORT-VERSIONS-DIR=C:\\port_versions", "--X-BUILTIN-REGISTRY-VERSIONS-DIR=C:\\versions",
"--DEBUG", "--DEBUG",
"--SENDMETRICS", "--SENDMETRICS",
"--PRINTMETRICS", "--PRINTMETRICS",
@ -64,7 +64,7 @@ TEST_CASE ("VcpkgCmdArguments from uppercase argument sequence", "[arguments]")
REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg"); REQUIRE(*v.vcpkg_root_dir == "C:\\vcpkg");
REQUIRE(*v.scripts_root_dir == "C:\\scripts"); REQUIRE(*v.scripts_root_dir == "C:\\scripts");
REQUIRE(*v.builtin_ports_root_dir == "C:\\ports"); REQUIRE(*v.builtin_ports_root_dir == "C:\\ports");
REQUIRE(*v.builtin_port_versions_dir == "C:\\port_versions"); REQUIRE(*v.builtin_registry_versions_dir == "C:\\versions");
REQUIRE(v.debug); REQUIRE(v.debug);
REQUIRE(*v.debug.get()); REQUIRE(*v.debug.get());
REQUIRE(v.send_metrics); REQUIRE(v.send_metrics);

View File

@ -334,7 +334,7 @@ namespace vcpkg::Commands::AddVersion
const bool verbose = Util::Sets::contains(parsed_args.switches, OPTION_VERBOSE); const bool verbose = Util::Sets::contains(parsed_args.switches, OPTION_VERBOSE);
auto& fs = paths.get_filesystem(); auto& fs = paths.get_filesystem();
auto baseline_path = paths.builtin_port_versions / fs::u8path("baseline.json"); auto baseline_path = paths.builtin_registry_versions / fs::u8path("baseline.json");
if (!fs.exists(VCPKG_LINE_INFO, baseline_path)) if (!fs.exists(VCPKG_LINE_INFO, baseline_path))
{ {
System::printf( System::printf(
@ -400,8 +400,8 @@ namespace vcpkg::Commands::AddVersion
} }
const auto& git_tree = git_tree_it->second; const auto& git_tree = git_tree_it->second;
auto port_versions_path = auto port_versions_path = paths.builtin_registry_versions / fs::u8path({port_name[0], '-'}) /
paths.builtin_port_versions / Strings::concat(port_name[0], '-') / Strings::concat(port_name, ".json"); fs::u8path(Strings::concat(port_name, ".json"));
update_version_db_file( update_version_db_file(
paths, port_name, schemed_version, git_tree, port_versions_path, overwrite_version, verbose, add_all); paths, port_name, schemed_version, git_tree, port_versions_path, overwrite_version, verbose, add_all);
update_baseline_version(paths, port_name, schemed_version.versiont, baseline_path, verbose); update_baseline_version(paths, port_name, schemed_version.versiont, baseline_path, verbose);
@ -413,4 +413,4 @@ namespace vcpkg::Commands::AddVersion
{ {
AddVersion::perform_and_exit(args, paths); AddVersion::perform_and_exit(args, paths);
} }
} }

View File

@ -367,8 +367,8 @@ namespace vcpkg::Commands::CIVerifyVersions
continue; continue;
} }
auto versions_file_path = auto versions_file_path = paths.builtin_registry_versions / fs::u8path({port_name[0], '-'}) /
paths.builtin_port_versions / Strings::concat(port_name[0], '-') / Strings::concat(port_name, ".json"); fs::u8path(Strings::concat(port_name, ".json"));
if (!fs.exists(versions_file_path)) if (!fs.exists(versions_file_path))
{ {
System::printf(System::Color::error, "FAIL: %s\n", port_name); System::printf(System::Color::error, "FAIL: %s\n", port_name);
@ -415,4 +415,4 @@ namespace vcpkg::Commands::CIVerifyVersions
{ {
CIVerifyVersions::perform_and_exit(args, paths); CIVerifyVersions::perform_and_exit(args, paths);
} }
} }

View File

@ -19,7 +19,7 @@ namespace
using Baseline = std::map<std::string, VersionT, std::less<>>; using Baseline = std::map<std::string, VersionT, std::less<>>;
static fs::path port_versions_dir = fs::u8path("port_versions"); static const fs::path registry_versions_dir_name = fs::u8path("versions");
// this class is an implementation detail of `BuiltinRegistryEntry`; // this class is an implementation detail of `BuiltinRegistryEntry`;
// when `BuiltinRegistryEntry` is using a port versions file for a port, // when `BuiltinRegistryEntry` is using a port versions file for a port,
@ -72,12 +72,12 @@ namespace
{ {
return m_versions_tree.get([this, &paths]() -> fs::path { return m_versions_tree.get([this, &paths]() -> fs::path {
auto maybe_tree = paths.git_find_object_id_for_remote_registry_path(get_commit_of_repo(paths), auto maybe_tree = paths.git_find_object_id_for_remote_registry_path(get_commit_of_repo(paths),
fs::u8path("port_versions")); registry_versions_dir_name);
if (!maybe_tree) if (!maybe_tree)
{ {
Checks::exit_with_message( Checks::exit_with_message(
VCPKG_LINE_INFO, VCPKG_LINE_INFO,
"Error: could not find the git tree for `port_versions` in repo `%s` at commit `%s`: %s", "Error: could not find the git tree for `versions` in repo `%s` at commit `%s`: %s",
m_repo, m_repo,
get_commit_of_repo(paths), get_commit_of_repo(paths),
maybe_tree.error()); maybe_tree.error());
@ -218,9 +218,9 @@ namespace
const fs::path& path_to_baseline, const fs::path& path_to_baseline,
StringView identifier = {}); StringView identifier = {});
void load_all_port_names_from_port_versions(std::vector<std::string>& out, void load_all_port_names_from_registry_versions(std::vector<std::string>& out,
const VcpkgPaths& paths, const VcpkgPaths& paths,
const fs::path& port_versions_path) const fs::path& port_versions_path)
{ {
for (auto super_directory : fs::directory_iterator(port_versions_path)) for (auto super_directory : fs::directory_iterator(port_versions_path))
{ {
@ -247,11 +247,11 @@ namespace
// { BuiltinRegistry::RegistryImplementation // { BuiltinRegistry::RegistryImplementation
std::unique_ptr<RegistryEntry> BuiltinRegistry::get_port_entry(const VcpkgPaths& paths, StringView port_name) const std::unique_ptr<RegistryEntry> BuiltinRegistry::get_port_entry(const VcpkgPaths& paths, StringView port_name) const
{ {
auto versions_path = paths.builtin_port_versions / relative_path_to_versions(port_name); auto versions_path = paths.builtin_registry_versions / relative_path_to_versions(port_name);
if (!m_baseline_identifier.empty() && paths.get_filesystem().exists(versions_path)) if (!m_baseline_identifier.empty() && paths.get_filesystem().exists(versions_path))
{ {
auto maybe_version_entries = auto maybe_version_entries = load_versions_file(
load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_port_versions, port_name); paths.get_filesystem(), VersionDbType::Git, paths.builtin_registry_versions, port_name);
Checks::check_maybe_upgrade( Checks::check_maybe_upgrade(
VCPKG_LINE_INFO, maybe_version_entries.has_value(), "Error: " + maybe_version_entries.error()); VCPKG_LINE_INFO, maybe_version_entries.has_value(), "Error: " + maybe_version_entries.error());
auto version_entries = std::move(maybe_version_entries).value_or_exit(VCPKG_LINE_INFO); auto version_entries = std::move(maybe_version_entries).value_or_exit(VCPKG_LINE_INFO);
@ -300,7 +300,7 @@ namespace
ExpectedS<Baseline> try_parse_builtin_baseline(const VcpkgPaths& paths, StringView baseline_identifier) ExpectedS<Baseline> try_parse_builtin_baseline(const VcpkgPaths& paths, StringView baseline_identifier)
{ {
if (baseline_identifier.size() == 0) return Baseline{}; if (baseline_identifier.size() == 0) return Baseline{};
auto path_to_baseline = paths.builtin_port_versions / fs::u8path("baseline.json"); auto path_to_baseline = paths.builtin_registry_versions / fs::u8path("baseline.json");
auto res_baseline = load_baseline_versions(paths, path_to_baseline, baseline_identifier); auto res_baseline = load_baseline_versions(paths, path_to_baseline, baseline_identifier);
if (!res_baseline.has_value()) if (!res_baseline.has_value())
@ -384,9 +384,9 @@ namespace
void BuiltinRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const void BuiltinRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const
{ {
if (!m_baseline_identifier.empty() && paths.get_filesystem().exists(paths.builtin_port_versions)) if (!m_baseline_identifier.empty() && paths.get_filesystem().exists(paths.builtin_registry_versions))
{ {
load_all_port_names_from_port_versions(out, paths, paths.builtin_port_versions); load_all_port_names_from_registry_versions(out, paths, paths.builtin_registry_versions);
} }
for (auto port_directory : fs::directory_iterator(paths.builtin_ports_directory())) for (auto port_directory : fs::directory_iterator(paths.builtin_ports_directory()))
@ -402,7 +402,7 @@ namespace
// { FilesystemRegistry::RegistryImplementation // { FilesystemRegistry::RegistryImplementation
Baseline parse_filesystem_baseline(const VcpkgPaths& paths, const fs::path& root, StringView baseline_identifier) Baseline parse_filesystem_baseline(const VcpkgPaths& paths, const fs::path& root, StringView baseline_identifier)
{ {
auto path_to_baseline = root / port_versions_dir / fs::u8path("baseline.json"); auto path_to_baseline = root / registry_versions_dir_name / fs::u8path("baseline.json");
auto res_baseline = load_baseline_versions(paths, path_to_baseline, baseline_identifier); auto res_baseline = load_baseline_versions(paths, path_to_baseline, baseline_identifier);
if (auto opt_baseline = res_baseline.get()) if (auto opt_baseline = res_baseline.get())
{ {
@ -445,9 +445,9 @@ namespace
StringView port_name) const StringView port_name) const
{ {
auto maybe_version_entries = load_versions_file( auto maybe_version_entries = load_versions_file(
paths.get_filesystem(), VersionDbType::Filesystem, m_path / port_versions_dir, port_name, m_path); paths.get_filesystem(), VersionDbType::Filesystem, m_path / registry_versions_dir_name, port_name, m_path);
Checks::check_maybe_upgrade( Checks::check_maybe_upgrade(
VCPKG_LINE_INFO, maybe_version_entries.has_value(), "Error: " + maybe_version_entries.error()); VCPKG_LINE_INFO, maybe_version_entries.has_value(), "Error: %s", maybe_version_entries.error());
auto version_entries = std::move(maybe_version_entries).value_or_exit(VCPKG_LINE_INFO); auto version_entries = std::move(maybe_version_entries).value_or_exit(VCPKG_LINE_INFO);
auto res = std::make_unique<FilesystemRegistryEntry>(port_name.to_string()); auto res = std::make_unique<FilesystemRegistryEntry>(port_name.to_string());
@ -461,7 +461,7 @@ namespace
void FilesystemRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const void FilesystemRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const
{ {
load_all_port_names_from_port_versions(out, paths, m_path / port_versions_dir); load_all_port_names_from_registry_versions(out, paths, m_path / registry_versions_dir_name);
} }
// } FilesystemRegistry::RegistryImplementation // } FilesystemRegistry::RegistryImplementation
@ -526,7 +526,7 @@ namespace
m_repo, m_repo,
explicit_hash.error()); explicit_hash.error());
} }
auto path_to_baseline = fs::u8path("port_versions") / fs::u8path("baseline.json"); auto path_to_baseline = registry_versions_dir_name / fs::u8path("baseline.json");
auto maybe_contents = paths.git_show_from_remote_registry(*explicit_hash.get(), path_to_baseline); auto maybe_contents = paths.git_show_from_remote_registry(*explicit_hash.get(), path_to_baseline);
if (!maybe_contents.has_value()) if (!maybe_contents.has_value())
{ {
@ -573,7 +573,7 @@ namespace
void GitRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const void GitRegistry::get_all_port_names(std::vector<std::string>& out, const VcpkgPaths& paths) const
{ {
auto versions_path = get_versions_tree_path(paths); auto versions_path = get_versions_tree_path(paths);
load_all_port_names_from_port_versions(out, paths, versions_path); load_all_port_names_from_registry_versions(out, paths, versions_path);
} }
// } GitRegistry::RegistryImplementation // } GitRegistry::RegistryImplementation
@ -616,7 +616,7 @@ namespace
auto& name = scfl->source_control_file->core_paragraph->name; auto& name = scfl->source_control_file->core_paragraph->name;
return Strings::format( return Strings::format(
"Error: no version entry for %s at version %s.\n" "Error: no version entry for %s at version %s.\n"
"We are currently using the version in the ports tree (%s), since no %s.json was found in /port_versions.", "We are currently using the version in the ports tree (%s), since no %s.json was found in /versions.",
name, name,
version.to_string(), version.to_string(),
scfl->to_versiont().to_string(), scfl->to_versiont().to_string(),
@ -958,7 +958,7 @@ namespace
ExpectedS<std::vector<VersionDbEntry>> load_versions_file(Files::Filesystem& fs, ExpectedS<std::vector<VersionDbEntry>> load_versions_file(Files::Filesystem& fs,
VersionDbType type, VersionDbType type,
const fs::path& port_versions, const fs::path& registry_versions,
StringView port_name, StringView port_name,
const fs::path& registry_root) const fs::path& registry_root)
{ {
@ -966,7 +966,7 @@ namespace
!(type == VersionDbType::Filesystem && registry_root.empty()), !(type == VersionDbType::Filesystem && registry_root.empty()),
"Bug in vcpkg; type should never = Filesystem when registry_root is empty."); "Bug in vcpkg; type should never = Filesystem when registry_root is empty.");
auto versions_file_path = port_versions / relative_path_to_versions(port_name); auto versions_file_path = registry_versions / relative_path_to_versions(port_name);
if (!fs.exists(versions_file_path)) if (!fs.exists(versions_file_path))
{ {
@ -1180,7 +1180,7 @@ namespace vcpkg
StringView port_name) StringView port_name)
{ {
auto maybe_versions = auto maybe_versions =
load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_port_versions, port_name); load_versions_file(paths.get_filesystem(), VersionDbType::Git, paths.builtin_registry_versions, port_name);
if (auto pversions = maybe_versions.get()) if (auto pversions = maybe_versions.get())
{ {
return Util::fmap( return Util::fmap(

View File

@ -277,7 +277,7 @@ namespace vcpkg
{PACKAGES_ROOT_DIR_ARG, &VcpkgCmdArguments::packages_root_dir}, {PACKAGES_ROOT_DIR_ARG, &VcpkgCmdArguments::packages_root_dir},
{SCRIPTS_ROOT_DIR_ARG, &VcpkgCmdArguments::scripts_root_dir}, {SCRIPTS_ROOT_DIR_ARG, &VcpkgCmdArguments::scripts_root_dir},
{BUILTIN_PORTS_ROOT_DIR_ARG, &VcpkgCmdArguments::builtin_ports_root_dir}, {BUILTIN_PORTS_ROOT_DIR_ARG, &VcpkgCmdArguments::builtin_ports_root_dir},
{BUILTIN_PORT_VERSIONS_DIR_ARG, &VcpkgCmdArguments::builtin_port_versions_dir}, {BUILTIN_REGISTRY_VERSIONS_DIR_ARG, &VcpkgCmdArguments::builtin_registry_versions_dir},
}; };
constexpr static std::pair<StringView, std::vector<std::string> VcpkgCmdArguments::*> constexpr static std::pair<StringView, std::vector<std::string> VcpkgCmdArguments::*>
@ -630,7 +630,7 @@ namespace vcpkg
table.format(opt(SCRIPTS_ROOT_DIR_ARG, "=", "<path>"), "(Experimental) Specify the scripts root directory"); table.format(opt(SCRIPTS_ROOT_DIR_ARG, "=", "<path>"), "(Experimental) Specify the scripts root directory");
table.format(opt(BUILTIN_PORTS_ROOT_DIR_ARG, "=", "<path>"), table.format(opt(BUILTIN_PORTS_ROOT_DIR_ARG, "=", "<path>"),
"(Experimental) Specify the packages root directory"); "(Experimental) Specify the packages root directory");
table.format(opt(BUILTIN_PORT_VERSIONS_DIR_ARG, "=", "<path>"), table.format(opt(BUILTIN_REGISTRY_VERSIONS_DIR_ARG, "=", "<path>"),
"(Experimental) Specify the versions root directory"); "(Experimental) Specify the versions root directory");
table.format(opt(JSON_SWITCH, "", ""), "(Experimental) Request JSON output"); table.format(opt(JSON_SWITCH, "", ""), "(Experimental) Request JSON output");
} }
@ -920,7 +920,7 @@ namespace vcpkg
constexpr StringLiteral VcpkgCmdArguments::PACKAGES_ROOT_DIR_ARG; constexpr StringLiteral VcpkgCmdArguments::PACKAGES_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::SCRIPTS_ROOT_DIR_ARG; constexpr StringLiteral VcpkgCmdArguments::SCRIPTS_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::BUILTIN_PORTS_ROOT_DIR_ARG; constexpr StringLiteral VcpkgCmdArguments::BUILTIN_PORTS_ROOT_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::BUILTIN_PORT_VERSIONS_DIR_ARG; constexpr StringLiteral VcpkgCmdArguments::BUILTIN_REGISTRY_VERSIONS_DIR_ARG;
constexpr StringLiteral VcpkgCmdArguments::DEFAULT_VISUAL_STUDIO_PATH_ENV; constexpr StringLiteral VcpkgCmdArguments::DEFAULT_VISUAL_STUDIO_PATH_ENV;

View File

@ -349,8 +349,8 @@ If you wish to silence this error and use classic mode, you can:
scripts = process_input_directory(filesystem, root, args.scripts_root_dir.get(), "scripts", VCPKG_LINE_INFO); scripts = process_input_directory(filesystem, root, args.scripts_root_dir.get(), "scripts", VCPKG_LINE_INFO);
builtin_ports = builtin_ports =
process_output_directory(filesystem, root, args.builtin_ports_root_dir.get(), "ports", VCPKG_LINE_INFO); process_output_directory(filesystem, root, args.builtin_ports_root_dir.get(), "ports", VCPKG_LINE_INFO);
builtin_port_versions = process_output_directory( builtin_registry_versions = process_output_directory(
filesystem, root, args.builtin_port_versions_dir.get(), "port_versions", VCPKG_LINE_INFO); filesystem, root, args.builtin_registry_versions_dir.get(), "versions", VCPKG_LINE_INFO);
prefab = root / fs::u8path("prefab"); prefab = root / fs::u8path("prefab");
if (args.default_visual_studio_path) if (args.default_visual_studio_path)
@ -653,7 +653,7 @@ If you wish to silence this error and use classic mode, you can:
if (!fs.exists(destination)) if (!fs.exists(destination))
{ {
const fs::path destination_tmp = destination_parent / fs::u8path("baseline.json.tmp"); const fs::path destination_tmp = destination_parent / fs::u8path("baseline.json.tmp");
auto treeish = Strings::concat(commit_sha, ":port_versions/baseline.json"); auto treeish = Strings::concat(commit_sha, ":versions/baseline.json");
auto maybe_contents = git_show(treeish, this->root / fs::u8path(".git")); auto maybe_contents = git_show(treeish, this->root / fs::u8path(".git"));
if (auto contents = maybe_contents.get()) if (auto contents = maybe_contents.get())
{ {

Some files were not shown because too many files have changed in this diff Show More