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

[RHELC-1427] Fix rpm -Va parsing and improve speed #1319

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

hosekadam
Copy link
Member

@hosekadam hosekadam commented Jul 24, 2024

Fix rpm -Va parsing to accept also ghosts files. Do not generate message
about invalid output of lines related to ghosts files anymore. Those files
aren't backed up as they are temporary.

Extend rpm -Va command by --nodeps switch. This improves
speed of the command and doesn't generate unimportant info about
unsatisfied dependencies for packages.

Jira Issues:

Checklist

  • PR has been tested manually in a VM (either author or reviewer)
  • Jira issue has been made public if possible
  • [RHELC-] or [HMS-] is part of the PR title
  • GitHub label has been added to help with Release notes
  • PR title explains the change from the user's point of view
  • Code and tests are documented properly
  • The commits are squashed to as few commits as possible (without losing data)
  • When merged: Jira issue has been updated to Release Pending if relevant

@hosekadam hosekadam added kind/bug-fix A bug has been fixed tests/sanity PR ready to run the sanity test suit. Equivalent to `/packit test --labels sanity`. labels Jul 24, 2024
@has-bot
Copy link
Member

has-bot commented Jul 24, 2024

/packit test --labels sanity


Comment generated by an automation.

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.18%. Comparing base (3ee8b8f) to head (265ccc5).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1319   +/-   ##
=======================================
  Coverage   96.18%   96.18%           
=======================================
  Files          58       58           
  Lines        4826     4828    +2     
  Branches      847      848    +1     
=======================================
+ Hits         4642     4644    +2     
  Misses        106      106           
  Partials       78       78           
Flag Coverage Δ
centos-linux-7 91.45% <100.00%> (+<0.01%) ⬆️
centos-linux-8 92.36% <100.00%> (+<0.01%) ⬆️
centos-linux-9 92.41% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@Venefilyn Venefilyn left a comment

Choose a reason for hiding this comment

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

LGTM! But just to lean more on comments and commit messages.

In the commit it says

Fix rpm -Va parsing when backing up package files to accept also ghost
files. Those files aren't backed up, but message about invalid output
was removed by this.

I'd change this around to something along the lines of "Fix invalid output in rpm -Va due to ghost files being incorrectly parsed. Ghost files are not needed by the tool as they relate to x and can be safely skipped" or something in that regard. At least to put the reason for the fix in the beginning and not at the end of the paragraph

Improve speed of rpm -Va command by using --nodeps switch. This improves
speed of the command by 40 % and doesn't generate unimportant info about
unsatisfied dependencies for packages.

If you have a statistic of 40% can you add that to the message. 40% is also very inconvenient by itself. For example, if something took 1.0s and was improved to now only take 0.1s overall, that is a 90% performance increase, but overall you would never notice

@@ -390,7 +390,7 @@ def generate_rpm_va(self, log_filename=PRE_RPM_VA_LOG_FILENAME):
" minutes. It can be disabled by using the"
" --no-rpm-va option."
)
rpm_va, _ = utils.run_subprocess(["rpm", "-Va"], print_output=False)
rpm_va, _ = utils.run_subprocess(["rpm", "-Va", "--nodeps"], print_output=False)
Copy link
Member

Choose a reason for hiding this comment

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

What does --nodeps do? Add a comment here

Comment on lines 156 to 159
# Skip ghost files RHELC-1427
if file["file_type"] == "g":
continue
Copy link
Member

@Venefilyn Venefilyn Jul 26, 2024

Choose a reason for hiding this comment

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

Why are we skipping? Comment explaining why. Imagine the person reading doesn't know what ghost files are used for or why we don't care about it

@hosekadam
Copy link
Member Author

hosekadam commented Jul 31, 2024

@Venefilyn I've improved the comments and commit description. Do you like those changes?

Copy link
Member

@Venefilyn Venefilyn left a comment

Choose a reason for hiding this comment

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

LGTM! Just a small nitpick on the commit message but not a blocker, can be merged

Improve speed of rpm -Va command by using --nodeps switch. This improves
speed of the command and doesn't generate unimportant info about
unsatisfied dependencies for packages.

Improves speed is mentioned twice here

@Venefilyn
Copy link
Member

/packit test --labels sanity

@Venefilyn Venefilyn self-assigned this Jul 31, 2024
convert2rhel/systeminfo.py Outdated Show resolved Hide resolved
@Venefilyn
Copy link
Member

/packit test --labels sanity

@Venefilyn
Copy link
Member

Tests failing due to this:

convert2rhel = <function convert2rhel.<locals>.factory at 0x7fcb34170840>

    def test_analyze_no_rpm_va_option(convert2rhel):
        """
        This test verifies a basic incompatibility of the analyze and --no-rpm-va options.
        The user should be warned that the --no-rpm-va option will be ignored and the command
        will be called.
        """
        with convert2rhel("analyze -y --no-rpm-va --debug") as c2r:
            c2r.expect("We will proceed with ignoring the --no-rpm-va option")
>           c2r.expect_exact("Calling command 'rpm -Va'")

test_basic_sanity_checks.py:297:

@hosekadam
Copy link
Member Author

/packit test --labels sanity

Fix rpm -Va parsing to accept also ghosts files. Do not generate message
about invalid output of lines related to ghosts files anymore. Those files
aren't backed up as they are temporary.

Extend rpm -Va command by  --nodeps switch. This improves
speed of the command and doesn't generate unimportant info about
unsatisfied dependencies for packages.
@hosekadam hosekadam merged commit 4defcdc into oamg:main Aug 12, 2024
21 checks passed
This was referenced Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug-fix A bug has been fixed merge-after-tests-ok tests/sanity PR ready to run the sanity test suit. Equivalent to `/packit test --labels sanity`.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants