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

dnf history operations that work with comps correctly #1689

Merged
merged 12 commits into from
Jan 7, 2021

Conversation

dmach
Copy link

@dmach dmach commented Nov 23, 2020

@pep8speaks
Copy link

pep8speaks commented Nov 23, 2020

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

Line 66:121: E501 line too long (136 > 120 characters)
Line 231:5: E303 too many blank lines (2)

Comment last updated at 2021-01-07 10:03:46 UTC

@lgtm-com
Copy link

lgtm-com bot commented Nov 23, 2020

This pull request introduces 4 alerts and fixes 3 when merging 5e414e1 into e5b25b8 - view on LGTM.com

new alerts:

  • 2 for Except block handles 'BaseException'
  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2020

This pull request introduces 2 alerts and fixes 3 when merging 12f9677 into e5b25b8 - view on LGTM.com

new alerts:

  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Nov 24, 2020

This pull request introduces 2 alerts and fixes 3 when merging 733bcc4 into e5b25b8 - view on LGTM.com

new alerts:

  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

dnf/transaction_sr.py Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/transaction_sr.py Outdated Show resolved Hide resolved
@@ -220,25 +219,31 @@ def __init__(
self._nevra_reason_cache = {}
self._warnings = []

def load_from_file(self, fn):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure whether it's a better API to have load_from_file() and load_from_dict() methods aor whether it would be better to have an init like __init__(self, base, data=None, filename=None, ...) and then you'd specify one of [data, filename] when instantiating the class? I know there's no RAII in Python 🙂 but the class now requires you to call a load method and if you don't, you'll get a rather unspecific crash (though it's a programmer error).

dnf/transaction_sr.py Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Dec 3, 2020

This pull request introduces 4 alerts and fixes 3 when merging b7f4a62 into d8c71d2 - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Missing call to __init__ during object initialization
  • 1 for First argument to super() is not enclosing class

fixed alerts:

  • 3 for Unreachable code

Copy link
Contributor

@lukash lukash left a comment

Choose a reason for hiding this comment

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

Thanks for restructuring the commits! I still think the code needs to be adjusted for the new usage, particularly the error handling part. I'm not too proud of the errors/warnings code myself and this makes it even more cumbersome, I think it still deserves some work.

dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/transaction_sr.py Outdated Show resolved Hide resolved
@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

⚠️ Please note that our current plans include removal of these comments in the near future (at least 2 weeks after including this disclaimer), if you have serious concerns regarding their removal or would like to continue receiving them please reach out to us. ⚠️

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/rpm-software-management-dnf-1689
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@lgtm-com
Copy link

lgtm-com bot commented Dec 10, 2020

This pull request introduces 2 alerts and fixes 3 when merging 73575e5 into b73d813 - view on LGTM.com

new alerts:

  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2020

This pull request introduces 8 alerts and fixes 3 when merging fcdef43 into 11ce84b - view on LGTM.com

new alerts:

  • 6 for Unused local variable
  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

):
"""
:param base: the dnf base
:param fn: the filename to load the transaction from
:param ignore_extras: whether to ignore extra package pulled into the transaction
:param ignore_installed: whether to ignore installed versions of packages
:param skip_unavailable: whether to skip transaction packages that aren't available
:param history_mode: enable a more permissive behavior for `dnf history {undo|redo|rollback}` commands
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks a bit like a rudimentary brace. The description of the new argument doesn't say anything about its effect, just refers to it being related to history. On this level the switch should be based on its semantics and not on it's usage. The logic around this is again already non-trivial and this muddies up the waters even more.

dnf/transaction_sr.py Outdated Show resolved Hide resolved
dnf/transaction_sr.py Outdated Show resolved Hide resolved
dnf/transaction_sr.py Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
dnf/cli/commands/history.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Dec 17, 2020

This pull request introduces 8 alerts and fixes 3 when merging 32720cc into 11ce84b - view on LGTM.com

new alerts:

  • 6 for Unused local variable
  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@lgtm-com
Copy link

lgtm-com bot commented Jan 6, 2021

This pull request introduces 8 alerts and fixes 3 when merging dc4bedd into 11ce84b - view on LGTM.com

new alerts:

  • 6 for Unused local variable
  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@@ -187,14 +187,16 @@ class TransactionReplay(object):
def __init__(
self,
base,
fn,
fn="",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please just name the argument filename instead of fn? It's a bit more important since it's now mutually exclusive with the data and they both should be self-descriptive, not abbreviated. Otherwise looks good.

Copy link
Author

Choose a reason for hiding this comment

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

Changed. I hope it did not break anything and the tests will pass.

Daniel Mach added 9 commits January 7, 2021 11:02
When _ignore_installed == True, then an exception is raised anyway.
When _ignore_installed == False, get the requested package to the system
regardless the action.
@lgtm-com
Copy link

lgtm-com bot commented Jan 7, 2021

This pull request introduces 8 alerts and fixes 3 when merging 49d8837 into 11ce84b - view on LGTM.com

new alerts:

  • 6 for Unused local variable
  • 2 for Unused import

fixed alerts:

  • 3 for Unreachable code

@lukash lukash merged commit 6697f09 into rpm-software-management:master Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants