Skip to content

Add Gentoo distfiles proxy support with cache exclude feature#125

Merged
ganto merged 6 commits intomainfrom
feature/gentoo-proxy
Apr 6, 2026
Merged

Add Gentoo distfiles proxy support with cache exclude feature#125
ganto merged 6 commits intomainfrom
feature/gentoo-proxy

Conversation

@ganto
Copy link
Copy Markdown
Owner

@ganto ganto commented Apr 6, 2026

No description provided.

@ganto ganto requested a review from Copilot April 6, 2026 14:12
@ganto ganto added enhancement New feature or request go Pull requests that update Go code labels Apr 6, 2026
ganto and others added 2 commits April 6, 2026 16:13
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>
@ganto ganto force-pushed the feature/gentoo-proxy branch from 6d97809 to 6d5b8e8 Compare April 6, 2026 14:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 exclude support 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.

ganto and others added 4 commits April 6, 2026 16:21
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>
@ganto ganto merged commit d700aee into main Apr 6, 2026
10 of 11 checks passed
@ganto ganto deleted the feature/gentoo-proxy branch April 6, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants