Repository navigation
Conversation
When running a sync with optimize=true on a existing deb remote, pulp compares the new package index with the previous version. When there is no previous version to compare to, the sync fails. This can happen when a actual remote only came into existance after a initial sync already has happened When a Release file had not changed, the sync added back the previous indices by matching the distribution name against the index path. For flat repos the stored name "flat-repo" never matches, so the index was dropped and the next upstream change hit the error above. A name that is a prefix of another distribution, such as "jammy" and "jammy-updates", matched the wrong indices and failed with "Paths are duplicated". The indices are now matched by the directory of the Release file. Closes: pulp#719 Assisted-by: Claude Opus 5.5
This branch has not been deployed
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.
Why
Optimized syncs (
optimize=True, the default) fail with'NoneType' object has no attribute 'artifact_set_sha256'when the previous repository version lacks a package index that the current sync processes. Every new repository version starts without metadata (AptRepository.initialize_new_version), and_handle_package_indexcompares with the previous index without aNonecheck. Two cases reach it:Releasefile has not changed,_readd_previous_package_indicesadds back the previous indices withrelative_path__contains=distribution. For flat reposdistributionis the literal"flat-repo", which never occurs in an index path such asbinary/Packages. So an unchanged sync drops the index, and the next upstream change crashes. This matches the reports in 'NoneType' object has no attribute 'artifact_set_sha256' when syncing a recently updated deb remote #719, including the Jenkins flat repo.The same filter also breaks distributions whose name is a prefix of another, for example
jammyandjammy-updates. If onlyjammy-updateschanges, the unchangedjammyadds back the previousjammy-updatesindices too, and the new version fails withPaths are duplicated. It keeps failing on every later sync.What
_handle_package_index, a missing previousPackageIndexnow counts as "changed", so the index is processed instead of compared._readd_previous_package_indices, indices are matched by the directory of theReleasefile instead of by the distribution name. That fixes both the flat repo case and the prefix case.Benefit
Optimized syncs no longer crash when upstream adds an architecture, component or flat-repo release, and an unchanged sync of a flat repo no longer creates an empty-metadata version. Users no longer need the
optimize=Falseworkaround.Testing
test_sync_optimize.py: fails onmainwith theAttributeError, passes with the fix.test_sync_optimize_flat_repo_keeps_package_index: onmainthe unchanged resync creates version 2, with the fix it stays at version 1.apt-ftparchiverepos: flat repo, new component, andtest/test-updates.Notes
ReleaseFilecomparison in_handle_distributionhas the same unguarded pattern, but I found no reachable case. A version from a content modify has no sync info, so optimize turns off. A missingReleasefails the sync withDEB0001. So I left it unchanged.Checklist
🤖 Generated with Claude Code
closes: #719
Assisted-by: Claude Opus 5.5