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
Fix URL in catalog entry created for existing package. #995
Conversation
@jortel, thanks for your PR! By analyzing the history of the files in this pull request, we identified @mhrivnak, @ipanova and @barnabycourt to be potential reviewers. |
For expedience, here's a rough, thrown-together, completely-untested and likely incomplete patch that at least illustrates how I think this could work.
|
@@ -517,8 +517,20 @@ def _decide_rpms_to_download(self, metadata_files, catalog): | |||
wanted = self._identify_wanted_versions(package_info_generator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than iterate through primary.xml a third time, which can be costly on large repos, I think we can do this in the identify_wanted_versions
method.
Strictly adhering to its purpose, that method should reasonably return a list or generator of units. But since we need to know the size of each unit, and it's convenient to get the size while iterating there, it returns a dict where the value is the size. I suggest adding the relative path there, alongside the size, so that all the info you need is in the wanted
dict. Then in the call to check_all_and_associate
, you could pass that entire dict as the first argument instead of just its keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much better solution.
Looks great. I'm actually a bit surprised at how much it resembles my patch, since I just threw that together for illustrative purposes. I thought for sure I must have forgotten or screwed up something. :) |
""" | ||
Add the specified content unit to the catalog. | ||
|
||
:param unit: A unit being added. | ||
:type unit: pulp_rpm.plugins.db.models.RpmBase | ||
:param path: The path component of the download URL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is close, but not quite accurate. It's the relative path within the base path of the repo URL, right? Not the entire path component of the URL?
https://pulp.plan.io/issues/2354
Adding catalog entries in 2.8 really just got shoehorned in as best we could but the code organization and procedural flows made it very difficult. This patch is not pretty but resolves the issue.