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

Fix association of unwanted modular rpms [RHELDST-6453] #147

Merged
merged 3 commits into from
Jun 3, 2021

Conversation

rbikar
Copy link
Member

@rbikar rbikar commented May 26, 2021

This fixes a situation when modular packages are selected for output set
of ubi repo but they shouldn't be there because respective modulemd unit
is not selected as a content of ubi repo.

This lead to situations when a repo contained modular rpm from a
modulemd that wasn't associated with repo. This is wrong and could lead
to problems with packages installation from ubi repos.

@rbikar rbikar marked this pull request as ready for review June 1, 2021 09:48
@rbikar rbikar requested review from negillett and rohanpm June 1, 2021 09:55
@rbikar
Copy link
Member Author

rbikar commented Jun 1, 2021

This waits for #148

rohanpm
rohanpm previously approved these changes Jun 2, 2021
ubipop/__init__.py Show resolved Hide resolved
filename="tomcatjss-7.3.6-1.el8+1944+b6c8e16f.noarch.rpm",
)]

mock_ubipop_runner._filter_pkgs_from_modules()
Copy link
Member

Choose a reason for hiding this comment

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

This is OK, but it'd be nice if there was at least one test which tested this at a higher level too in order to show the overall impact. The test here may protect against bugs in _filter_pkgs_from_modules, but it doesn't help ensure that the call to the method is wired up correctly. e.g. a refactor or incorrect resolution of a git conflict which accidentally removes the call to self._filter_pkgs_from_modules(), would not be caught by any test if I understand right.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, no having high level test also lowers the code coverage.

rbikar and others added 2 commits June 3, 2021 07:35
This fixes a situation when modular packages are selected for output set
of ubi repo but they shouldn't be there because respective modulemd unit
is not selected as a content of ubi repo.

This lead to situations when a repo contained modular rpm from a
modulemd that wasn't associated with repo. This is wrong and could lead
to problems with packages installation from ubi repos.
Co-authored-by: Rohan McGovern <rohan@mcgovern.id.au>
rohanpm
rohanpm previously approved these changes Jun 3, 2021
@@ -604,6 +604,18 @@ def _diff_lists_by_attr(self, list_1, list_2, attr):

return diff

def _filter_pkgs_from_modules(self):
regex = r'^\d+:'
Copy link
Member Author

Choose a reason for hiding this comment

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

@rohanpm
Actually the epoch is not the leading thing there, but it's name of the package.
E.g. tomcatjss-0:7.3.6-1.el8+1944+b6c8e16f.noarch
So the anchor breaks the expected behavior now :(

Copy link
Member

Choose a reason for hiding this comment

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

Oops, my mistake. Adding one other minor suggestion about count=1 in re.sub then (because anchor would have ensured it only matched once, now it's not guaranteed).

# name_stream, packages == str, list of _pulp_client.Package

wanted_packages = list(chain.from_iterable([m.packages for m in self.repos.modules[name_stream]]))
wanted_packages = [reg.sub('', rpm_nevra) + '.rpm' for rpm_nevra in wanted_packages]
Copy link
Member

Choose a reason for hiding this comment

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

One other minor suggestion - this reg.sub would be a little safer if you gave it a count of 1 (do max 1 substitution). Since we now remembered that the regex shouldn't be anchored at the beginning.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, but I'll do it in another PR - the same substitution happens also in another place in code, I guess it would be better to fix both and ideally do it at the time when self.repos.modules is populated.
I'll merge this PR, we need to test it and deploy it ASAP, it looks it creates a lot of customer problems.
Travis seems to fail only on pylint issues, I'll fix those also in another PR.

@rbikar rbikar merged commit b225b2b into release-engineering:master Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants