This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
pulp_rpm is a Pulp 3 plugin that provides RPM repository management. It is a Django application that integrates with pulpcore via the Pulp plugin architecture.
pip install -r lint_requirements.txt
black --check --diff .
flake8
sh .ci/scripts/check_pulpcore_imports.sh
sh .ci/scripts/check_gettext.shpip install -r unittest_requirements.txt
# Run all unit tests
pytest -v -r sx --suppress-no-test-exit-code -p no:pulpcore pulp_rpm/tests/unit
# Run a single test
pytest -v pulp_rpm/tests/unit/test_rpm_version.py::TestRpmVersionComparison::test_evr_tostrpip install -r functest_requirements.txt
# Parallel tests
pytest -v --timeout=300 -r sx --suppress-no-test-exit-code pulp_rpm/tests/functional -m parallel -n 8
# Non-parallel tests
pytest -v --timeout=300 -r sx --suppress-no-test-exit-code pulp_rpm/tests/functional -m 'not parallel'# black line-length is 100 (see pyproject.toml)
black .The plugin follows the standard Pulp plugin layout under pulp_rpm/app/:
models/— Django ORM models for all content types and repository componentsviewsets/— DRF API endpoints (CRUD + custom actions like sync, publish, copy, prune)serializers/— DRF serializers for request/response validation (mirrors viewsets structure)tasks/— Async task implementations:synchronizing.py— Sync from remotes using Pulpcore's declarative stages pipelinepublishing.py— Metadata generation usingcreaterepo_ccopy.py— Content copying between repository versionsprune.py— Removal of old/superseded packagessigning.py— Package and metadata signing
The plugin manages these content types (each is a Django model inheriting from Pulpcore's Content):
Package— Individual RPM packagesUpdateRecord— Advisories/errata (security, bugfix, enhancement)Modulemd/ModulemdDefaults— Modular RPM metadataPackageGroup,PackageCategory,PackageEnvironment,PackageLangpacks— COMPS metadataDistributionTree— Installer/distribution tree metadataRepoMetadataFile— Custom repository metadata files
RpmRepository— Repository with prune settings and retain-package-versionsRpmRemote— Remote source (HTTP/HTTPS, with ULN variantUlnRemote)RpmPublication— Published repository (generates repomd.xml and all repodata)RpmDistribution— Serves a publication over HTTPRpmAlternateContentSource— ACS for distributed content sources
Sync uses Pulpcore's declarative content framework:
- Parse remote repodata (primary.xml, filelists.xml, other.xml, modules.yaml, updateinfo.xml, comps.xml)
- Build
DeclarativeContent/DeclarativeArtifactobjects - Pass through stages:
QueryExistingContents→ArtifactDownloader→ArtifactSaver→ContentSaver→ResolveContentFutures→RemoteArtifactSaver - Create new
RepositoryVersionwith the resolved content set
rpm_version.py— RPM EVR (Epoch:Version-Release) parsing and comparison (labelCompare algorithm)advisory.py— Advisory merging and conflict detection logicmodulemd.py— Module metadata YAML parsingcomps.py— COMPS XML parsing vialibcompsconstants.py— Repodata type constants, sync policy enums, checksum typesshared_utils.py— Package formatting utilities
pulpcore>=3.103.0,<3.115— Core framework (models, stages, downloaders, tasks)createrepo_c~=1.2.1— RPM repository metadata generationlibcomps>=0.1.23— COMPS group/category parsingproductmd~=1.33.0— Distribution tree metadatasolv~=0.7.21— Dependency solving
- Models inherit from
pulpcore.plugin.modelsbase classes - Viewsets extend Pulpcore's viewset mixins
- Tasks use
pulpcore.plugin.stagesfor the declarative sync pipeline - Downloaders extend
pulpcore.plugin.download.DownloaderFactory - Plugin registered via
pulpcore.pluginentry point inpyproject.toml
- Unit tests in
pulp_rpm/tests/unit/— pure Python, no server required, use-p no:pulpcoreflag - Functional tests in
pulp_rpm/tests/functional/— require a live Pulp server, use API clients pytest_plugin.pyprovides shared pytest fixtures (API clients, object factories)gen_object_with_cleanuppattern used in functional tests for lifecycle management