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

mock: fix dynamic buildrequires unnecesarry loop #482

Conversation

hrnciar
Copy link
Collaborator

@hrnciar hrnciar commented Feb 20, 2020

per discussion here: rpm-software-management/rpm#963
Mock should accept return code 0 from rpm.

Relates: #434

@hrnciar hrnciar force-pushed the dynamic-buildrequires-unnecessary-loop branch 2 times, most recently from afbb79f to b735e72 Compare February 20, 2020 16:30
@@ -699,7 +699,6 @@ def get_command(mode):
# * it fails
# * installSrpmDeps does nothing
# * or we run out of dynamic_buildrequires_max_loops tries
packages_before = self.buildroot.all_chroot_packages()
Copy link
Member

Choose a reason for hiding this comment

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

Yes, we can drop this (no need to access the RPM db by rpm -qa), but we
need a replacement here. Most likely you need to maintain a set() of
real build requirements across the iteration... in each step you can get
the list from installSrpmDeps with small enhancements.

@hrnciar hrnciar force-pushed the dynamic-buildrequires-unnecessary-loop branch from b735e72 to 13c095e Compare March 2, 2020 08:31
@pep8speaks
Copy link

pep8speaks commented Mar 2, 2020

Hello @hrnciar! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-03-05 13:47:06 UTC

@hrnciar hrnciar force-pushed the dynamic-buildrequires-unnecessary-loop branch from 13c095e to 955fd7b Compare March 2, 2020 08:48
self.installSrpmDeps(*buildreqs)
packages_after = self.buildroot.all_chroot_packages()
if packages_after == packages_before:
new_deps = self.installSrpmDeps(*buildreqs, *deps)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we use just deps argument here, without star?

Copy link
Member

Choose a reason for hiding this comment

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

I'd perhaps use ignored_deps=deps to underline the purpose of the argument.

@@ -180,24 +180,27 @@ def remove(self, *rpms):
self.buildroot.root_log.info(output)

@traceLog()
def installSrpmDeps(self, *srpms):
def installSrpmDeps(self, *srpms, ignored_deps=None):
"""Figure out deps from srpm. Call package manager to install them"""
Copy link
Member

Choose a reason for hiding this comment

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

Please state what ignored_deps means in the method documentation.

@hrnciar hrnciar force-pushed the dynamic-buildrequires-unnecessary-loop branch 3 times, most recently from 9069255 to 84dc7a7 Compare March 4, 2020 11:46
@praiskup
Copy link
Member

praiskup commented Mar 4, 2020

The commit message doesn't correspond to what is really changing.

@@ -708,6 +708,7 @@ def get_command(mode):
except Error as e:
if e.resultcode != 11:
Copy link
Member

Choose a reason for hiding this comment

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

Please document the fact that we accept exit_status 0 and exit_status 11, and why.

@hrnciar
Copy link
Collaborator Author

hrnciar commented Mar 5, 2020

I am sorry, the PR is not yet finished. I forgot to add WIP tag.

praiskup added a commit to praiskup/mock that referenced this pull request Mar 5, 2020
Test that mockchain works, with tmpfs plugin ON (keep_mounted=True),
nocache plugin ON, and dynamic buildrequires package.

Relates: rpm-software-management#482, rpm-software-management#512, rpm-software-management#479
praiskup added a commit to praiskup/mock that referenced this pull request Mar 5, 2020
Test that mockchain works, with tmpfs plugin ON (keep_mounted=True),
nocache plugin ON, and dynamic buildrequires package.

Relates: rpm-software-management#482, rpm-software-management#512, rpm-software-management#479
praiskup added a commit that referenced this pull request Mar 5, 2020
Test that mockchain works, with tmpfs plugin ON (keep_mounted=True),
nocache plugin ON, and dynamic buildrequires package.

Relates: #482, #512, #479
per discussion here: rpm-software-management/rpm#963

Mock should accept return code 0 as well as 11 from rpm.
Later when rpm is fixed, mock will accept just 0.
@hrnciar hrnciar force-pushed the dynamic-buildrequires-unnecessary-loop branch from 84dc7a7 to 30d0230 Compare March 5, 2020 13:47
@hrnciar hrnciar removed the needs work label Mar 5, 2020
@praiskup praiskup closed this in 5c08f5b Mar 5, 2020
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

3 participants