Skip to content

Use only named packages from extra registries#35

Merged
ras0219-msft merged 1 commit intomicrosoft:mainfrom
dg0yt:registry-packages
Mar 24, 2021
Merged

Use only named packages from extra registries#35
ras0219-msft merged 1 commit intomicrosoft:mainfrom
dg0yt:registry-packages

Conversation

@dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Mar 20, 2021

This change resolves errors from RegistryEntry::get_path_to_version() when the default registry doesn't have a port for a name which is part of some extra registry but not listed in that registry's "packages" configuration field.
This is consistent with RegistrySet::registry_for_port() which only considers the the named packages from the extra registries.

Use case:

{
  "default-registry": {
    "kind": "filesystem",
    "path": "/my/tiny/repository"
  },
  "registries": [
    {
      "kind": "git",
      "repository": "https://github.com/microsoft/vcpkg",
      "packages": [ "vcpkg-cmake", "vcpkg-cmake-config" ]
    }
  ]
}

This change prevents errors from RegistryEntry::get_path_to_version()
when the default registry doesn't have a port for a name which is
part of some extra registry but not listed that registry's "packages"
configuration field.
This is consistent with RegistrySet::registry_for_port() which only
considers the the named packages from the extra registries.
@ras0219-msft
Copy link
Collaborator

Thanks for the PR! This change looks generally good to me, however could you go into more detail about what the precise error is and what the expected result was?

@strega-nil
Copy link
Contributor

@dg0yt
Copy link
Contributor Author

dg0yt commented Mar 23, 2021

is there a reason that you're making this change?

I want to combine

  • a custom registry of ports ("default-registry")
  • selected ports from the main vcpkg repository ("registries"[0]).

could you go into more detail about what the precise error is and what the expected result was?

vcpkg commands fail like this:

$ vcpkg search internal
Error: Couldn't find the versions database file: /tmp/test/versions/3-/3fd.json
Note: Updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

where 3fd.json neither exists in default-registry (/tmp/test) nor is listed in registries[0].packages.

Reproducer (bash, but modeled after azure-pipelines/end-to-end-tests-dir/registries.ps1):

test -d vcpkg-tool || git clone https://github.com/microsoft/vcpkg-tool.git

mkdir -p ports
cp -R vcpkg-tool/azure-pipelines/e2e_ports/vcpkg-internal-e2e-test-port ports/

mkdir -p versions/v-
cp vcpkg-tool/azure-pipelines/e2e_ports/versions/baseline.json versions/
cat > versions/v-/vcpkg-internal-e2e-test-port.json <<END_PORT
{
  "versions" : {
    "version-string": "1.0.0",
    "path": "$PWD/ports/vcpkg-internal-e2e-test-port"
  }
}
END_PORT

test -d vcpkg || git clone https://github.com/microsoft/vcpkg.git
cat > vcpkg/vcpkg-configuration.json <<END_CONFIG
{
  "default-registry": {
    "kind": "filesystem",
    "path": "$PWD"
  },
  "registries": [
    {
      "kind": "git",
      "repository": "https://github.com/microsoft/vcpkg",
      "packages": [ "vcpkg-cmake", "vcpkg-cmake-config" ]
    }
  ]
}
END_CONFIG

export VCPKG_ROOT=$PWD/vcpkg
export VCPKG_FEATURE_FLAGS=registries

vcpkg --debug search internal

Copy link
Collaborator

@ras0219-msft ras0219-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, loading all registry ports shouldn't enumerate ports beyond default + packages of each other registry. It should exactly match the valid values of RegistrySet::registry_for_port().

@ras0219-msft
Copy link
Collaborator

@strega-nil RegistrySet::registry_for_port() doesn't guarantee that the port name is valid for the registry, so the if (!impl) check doesn't handle @dg0yt's case.

@ras0219-msft ras0219-msft merged commit 0f5cf78 into microsoft:main Mar 24, 2021
strega-nil added a commit that referenced this pull request Apr 15, 2021
The following PRs are included:

* hopefully fix crash in constraints (#60)
* [vcpkg] allow --version to check the version (#50)
* Remove baseline warning (#27)
* [git] always pass autocrlf=false (#58)
* ignore QtCreator CMake project files (#54)
* ignore .DS_store files (#53)
* [vcpkg] x-add-version now also checks if the manifest file is properly formatted (#43)
* hopefully fix ci issue #16773 (#34)
* Add docs to set VCPKG_ROOT to run tests (#45)
* [vcpkg] x-add-version improve speed by calling get_builtin_baseline only once (#44)
* add clang-format version to format-cxxcode (#41)
* [vcpkg] Introduce experimental workaround X_VCPKG_NUGET_ID_PREFIX (#40)
* [supports] Add `native` identifier expression and x-check-support command (#29)
* [metrics] Split reporting of installs into name:triplet (#39)
* [vcpkg] Improve error when accessing missing feature (#38)
* [vcpkg] Allow shallow git registries (#37)
* Disable git autocrlf when archiving tree (#36)
* Use only named packages from extra registries (#35)
* [registries] add metrics (#30)
* Add vcpkg policy cmake helper port support (#17)
* [osx] add support for rosetta (#23)
* don't build tls12-download unless it's needed (#33)
* Add new telemetry points for versioning (#21)
* add cmake_minimum_required to vcpkg_tags (#25)
* [x-add-versions] Perform atomic replacement of versioning files (#28)
* [tools] support gsutil (#19)
* add CUDA 11.1 and 11.2 to KEEP_ENV_VARS defaults (#26)
* Add finite timeout on CURL metrics endpoint. (#22)
* fix UB in make_error_code(utf8_errc) (#18)
@dg0yt dg0yt deleted the registry-packages branch May 18, 2025 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants