Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable syncing without filelists present #3780

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/3777.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make it possible to sync repositories without filelists.xml or other.xml metadata
22 changes: 14 additions & 8 deletions pulp_rpm/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,13 +901,17 @@ async def parse_distribution_tree(self):

async def parse_repository_metadata(self, repomd, metadata_results):
"""Parse repository metadata."""
needed_metadata = set(PACKAGE_REPODATA) - set(metadata_results.keys())

if needed_metadata:
if "primary" not in metadata_results.keys():
raise FileNotFoundError(
_("XML file(s): {filenames} not found").format(filenames=", ".join(needed_metadata))
"Repository doesn't contain required metadata file 'primary.xml'"
)

if "filelists" not in metadata_results.keys():
log.warn("Repository doesn't contain metadata file 'filelists.xml'")

if "other" not in metadata_results.keys():
log.warn("Repository doesn't contain metadata file 'other.xml'")

await self.parse_distribution_tree()

# modularity-parsing MUST COME BEFORE package-parsing!
Expand All @@ -927,9 +931,9 @@ async def parse_repository_metadata(self, repomd, metadata_results):

# **Now** we can successfully parse package-metadata
await self.parse_packages(
metadata_results["primary"],
metadata_results["filelists"],
metadata_results["other"],
metadata_results.get("primary"),
metadata_results.get("filelists"),
metadata_results.get("other"),
modulemd_list=modulemd_list,
)

Expand Down Expand Up @@ -1168,7 +1172,9 @@ async def parse_packages_components(self, comps_result):
async def parse_packages(self, primary_xml, filelists_xml, other_xml, modulemd_list=None):
"""Parse packages from the remote repository."""
parser = cr.RepositoryReader.from_metadata_files(
primary_xml.path, filelists_xml.path, other_xml.path
primary_xml.path,
filelists_xml.path if filelists_xml else None,
other_xml.path if other_xml else None,
)

# skip SRPM if defined
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
createrepo_c~=1.1.2
createrepo_c~=1.2
django_readonly_field~=1.1.1
jsonschema>=4.6,<5.0
libcomps>=0.1.20.post1,<0.2
Expand Down