Repository navigation
Enable storage retention for gem - #450
Conversation
Gems are stored under the name from the gem filename, and purl keeps gem names as they are, so package rules use the default mapping and match the name as published, case included. Packages that git-pkgs wrote as "rubygems" fall under the gem rules too. The filename parser splits platforms that end in a number (universal-darwin-22) at the wrong hyphen and files those gems under a package like sorbet-static-0.5.11002-universal-darwin, so package rules don't reach them; the docs row says so until the parser is fixed. The mirror can't fetch gems today (it asks the resolver for "rubygems", see git-pkgs#415), so there's no mirror test. Refs git-pkgs#306
andrew
left a comment
There was a problem hiding this comment.
Same as #452: rather than documenting the universal-darwin-22 split as a limitation, please fix parseGemFilename in internal/handler/gem.go. It splits at the last hyphen followed by a digit, so sorbet-static-0.5.11002-universal-darwin-22.gem is stored as package sorbet-static-0.5.11002-universal-darwin, which is wrong for cooldown, policy and listings as well as retention rules. Platforms ending in a number are common (universal-java-17, arm64-darwin-23).
Gem names can contain hyphens, so splitting at the first hyphen followed by a digit is the better heuristic: it handles every platform suffix and only misreads names with a -<digit> segment, which are far rarer. Please add test cases for platform and plain gems.
With that in, the caveat in the gem docs row and the parser sentence in the init comment can go. The fix can be in this PR or a separate one merged first. This will also need rebasing for the docs/configuration.md table once the neighbouring retention PRs are in.
parseGemFilename split at the last hyphen before a digit, so sorbet-static-0.5.11002-universal-darwin-22.gem was stored as package sorbet-static-0.5.11002-universal-darwin. It now splits at the first one, which only misreads gem names with a -<digit> segment. The docs caveat is gone. Refs git-pkgs#306
|
Fixed in 680a2da: |
Refs #306.
Registers gem for
storage.retention.Gems are stored under the name from the gem filename, and purl keeps gem names as written. Package rules match the name as published, case included. Packages that git-pkgs wrote as
rubygemsfall under the gem rules too.The filename parser splits platforms that end in a number (
universal-darwin-22) at the wrong hyphen. It files those gems under a package likesorbet-static-0.5.11002-universal-darwin, so package rules don't reach them. The gem rule anddefaultstill do. The docs row says so until the parser is fixed.The mirror can't fetch gems today (it asks the resolver for
rubygems, see #415), so there's no mirror test.