Add Gentoo distfiles proxy support with cache exclude feature#125
Merged
Add Gentoo distfiles proxy support with cache exclude feature#125
Conversation
Introduce per-repository `exclude` config field and `"*"` wildcard support in `suffixes` to cache all files except specified exclusions. Add Gentoo repository config, e2e test, and documentation snippets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6d97809 to
6d5b8e8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Gentoo distfiles proxying support to pkgproxy by enabling a “cache everything” mode via a suffixes: ["*"] wildcard, plus a per-repository cache exclude list to prevent caching selected metadata files (e.g., layout.conf). It also introduces a Gentoo end-to-end test and updates user-facing documentation/snippets to reflect the new distro support.
Changes:
- Add
excludesupport to repository/cache configuration and apply it in cache candidacy decisions (with"*"wildcard semantics). - Add Gentoo repository configuration and landing-page/README configuration snippets.
- Add Gentoo e2e coverage (stage3 container +
emerge --fetchonly) and supporting test script.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/test-gentoo.sh | New Gentoo e2e script that bootstraps Portage, fetches via proxy, and exercises “not cached” path for layout.conf. |
| test/e2e/e2e_test.go | Adds Gentoo e2e test and a helper to assert files are not cached. |
| README.md | Documents Gentoo GENTOO_MIRRORS configuration and updates supported DISTRO list. |
| pkg/pkgproxy/repository.go | Adds Exclude to repo config and logs a warning for redundant suffix config when "*" is present. |
| pkg/pkgproxy/repository_test.go | Unit tests validating the new wildcard redundancy warning behavior. |
| pkg/pkgproxy/proxy.go | Wires repository Exclude config into cache construction. |
| pkg/pkgproxy/landing.go | Adds Gentoo snippet for the landing page repository list. |
| pkg/cache/cache.go | Implements exclude-first logic and "*" wildcard cache candidacy. |
| pkg/cache/cache_test.go | Adds unit tests for exclude/wildcard behavior in IsCacheCandidate. |
| openspec/changes/gentoo-distfiles-proxy/tasks.md | Implementation task checklist for the change. |
| openspec/changes/gentoo-distfiles-proxy/specs/gentoo-distfiles/spec.md | Spec requirements for Gentoo distfiles support and non-caching of layout.conf. |
| openspec/changes/gentoo-distfiles-proxy/specs/e2e-multi-distro/spec.md | Spec requirements for Gentoo e2e coverage. |
| openspec/changes/gentoo-distfiles-proxy/specs/cache-exclude/spec.md | Spec requirements for wildcard caching and exclude semantics. |
| openspec/changes/gentoo-distfiles-proxy/proposal.md | Proposal describing motivation and intended changes. |
| openspec/changes/gentoo-distfiles-proxy/design.md | Design notes and trade-offs for wildcard+exclude and Gentoo e2e approach. |
| openspec/changes/gentoo-distfiles-proxy/.openspec.yaml | Openspec metadata for the change set. |
| Makefile | Adds gentoo mapping to make e2e DISTRO=gentoo. |
| configs/pkgproxy.yaml | Adds gentoo repository entry (wildcard suffix + exclude list + mirrors). |
| CHANGELOG.md | Documents the added Gentoo support and cache exclude feature under Unreleased. |
Comments suppressed due to low confidence (1)
test/e2e/e2e_test.go:180
- In assertCachedFiles, filepath.Walk's returned error is ignored and walk errors are swallowed in the callback. This can make failures look like 'no cached files' rather than surfacing the underlying filesystem issue. Capture the error from filepath.Walk and fail the test when it's non-nil (and consider propagating callback errors).
func assertCachedFiles(t *testing.T, cacheDir string, repoPrefix string, suffix string) {
t.Helper()
var matches []string
filepath.Walk(filepath.Join(cacheDir, repoPrefix), func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil
}
if !info.IsDir() && strings.HasSuffix(path, suffix) {
matches = append(matches, path)
}
return nil
})
assert.NotEmpty(t, matches, "expected %s files under %s/%s", suffix, cacheDir, repoPrefix)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Propagate filepath.Walk callback errors and check the returned error with require.NoError to prevent false-passing tests on walk failures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Save and restore the global slog default via t.Cleanup to prevent leaking a custom logger into other tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.