Repository navigation
Resolve a gem's platform build through its artifacts - #147
Conversation
RubyGems lists each platform build of a version as its own entry, and the adapter numbered them <number>-<platform>, so a PURL with a platform qualifier never matched a listed version and fell back to the ruby download URL. The adapter now lists one version per number with each build as an artifact carrying its platform, as Open VSX builds are listed, and the resolver treats a ruby build like a universal one. Fixes git-pkgs#142 Co-authored-by: Claude <noreply@anthropic.com>
|
One more consequence, found after opening this, in git-pkgs/proxy. The proxy path that reads |
Fixes #142
pkg:gem/jruby-launcher@1.1.2?platform=javanow resolves tojruby-launcher-1.1.2-java.gem.The RubyGems adapter lists one version per number, with each platform build as an artifact that carries
platformin its metadata, the wayvscode-extensionlists builds. The version's own fields (integrity, platform, downloads) come from the ruby build when there is one, and from the first build listed otherwise.qualifiersMatchtreats arubybuild like auniversalone: it serves any platform, after a build for the platform asked for.Gems with both kinds of build had the same gap.
pkg:gem/nokogiri@1.13.6?platform=x86_64-linuxresolved to the ruby gemnokogiri-1.13.6.gem, because the listed1.13.6had no artifacts and the resolver fell back to the built URL. It now getsnokogiri-1.13.6-x86_64-linux.gem.Two behaviour changes worth a look:
FetchVersionsno longer returns1.13.6-x86_64-linuxas a version of its own. Platform builds are inArtifactsnow, andTestFetchVersionsis updated for that.checkMetadataURLlike any listed artifact, so it needs https and has to pass the resolver's address policy. A plainhttp://gem mirror asked for a platform build now getsErrUnsafeURLwhere it used to get the built URL.Tests:
TestResolveRubyGemsPlatformcovers a platform-only version, both builds with each platform, a ruby-only version, and a platform with no build. On main 3 of its 6 cases fail: the java-only gem, nokogiri on x86_64-linux, and the no-build case, which returned a URL instead ofErrNoMatchingArtifact. Against rubygems.org, jruby-launcher 1.1.2 (java), nokogiri 1.16.0 (x86_64-linux and ruby) and rake 13.2.1 (x86_64-linux) all resolve to the right file with its sha256.go test ./...,go vetand golangci-lint are clean.Summary by CodeRabbit
rubybuild can be selected as a fallback when no exact match is available.