Skip to content

Reverted the removal of force upgrade and improved some code#62

Merged
ericbsd merged 3 commits intomasterfrom
revert-kernel-update-chage
Feb 26, 2025
Merged

Reverted the removal of force upgrade and improved some code#62
ericbsd merged 3 commits intomasterfrom
revert-kernel-update-chage

Conversation

@ericbsd
Copy link
Member

@ericbsd ericbsd commented Feb 26, 2025

Summary by Sourcery

This pull request improves the update station by refactoring the GTK layout code, displaying the number of packages to be upgraded, downgraded, installed, reinstalled, and removed, and fetching package updates in one go.

Enhancements:

  • Refactor the GTK layout code to use Gtk.Box instead of Gtk.VBox and Gtk.HBox for improved flexibility and maintainability.
  • Improve the update process by displaying the number of packages to be upgraded, downgraded, installed, reinstalled, and removed.
  • Improve the update process by fetching package updates in one go.

@ericbsd ericbsd requested review from a team as code owners February 26, 2025 02:25
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 26, 2025

Reviewer's Guide by Sourcery

This pull request reverts the removal of the force upgrade option, improves code readability by refactoring the GUI layout to use Gtk.Box, enhances package upgrade data retrieval, and updates the application's version number.

Sequence diagram for get_pkg_upgrade_data function

sequenceDiagram
    participant Backend
    participant Popen
    participant CompletedProcess

    Backend->Backend: get_pkg_upgrade(option)
    Backend->Popen: Run pkg upgrade command
    activate Popen
    Popen-->Backend: Returns upgrade_verbose
    deactivate Popen
    Backend->Backend: update_pkg.splitlines()
    Backend->Backend: get_packages_list_by_upgrade_type for UPGRADED, DOWNGRADED, INSTALLED, REINSTALLED, REMOVED
    Backend->Backend: Calculate total_of_packages
    Backend-->Backend: Returns pkg_dictionary
Loading

Updated class diagram for Data class

classDiagram
    class Data{
        +major_upgrade: bool
        +kernel_upgrade: bool
        +backup: bool
        +new_abi: str
        +home: str
        +packages_dictionary: dict
        +second_update: bool
        +stop_pkg_refreshing: bool
        +system_tray
        +update_started: bool
        +username: str
    }
    note for Data "total_packages attribute was removed"
Loading

File-Level Changes

Change Details Files
Reverted the removal of force upgrade option and added a check for kernel upgrades.
  • Added the 'f' option to the pkg-static upgrade command when a kernel upgrade is detected.
  • Modified the pkg-static upgrade command to include the force option when a kernel upgrade is detected.
update_station/frontend.py
update_station/backend.py
Refactored the GUI layout using Gtk.Box instead of Gtk.VBox and Gtk.HBox.
  • Replaced Gtk.VBox with Gtk.Box(orientation=Gtk.Orientation.VERTICAL).
  • Replaced Gtk.HBox with Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL).
update_station/frontend.py
update_station/dialog.py
Improved package upgrade data retrieval and display.
  • Added logic to handle package downgrades.
  • Modified the package listing to include the number of packages for each operation type (upgrade, install, remove, reinstall).
  • Refactored the get_pkg_upgrade_data function to improve readability and maintainability.
  • Added a function to get the list of packages by upgrade type.
update_station/frontend.py
update_station/backend.py
update_station/data.py
Updated the version number of the application.
  • Incremented the version number from 6.2 to 6.3.
setup.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @ericbsd - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using more descriptive variable names than box1, box2, etc. - it will improve readability.
  • It looks like you're calculating the total number of packages in multiple places; can you consolidate this logic?
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 2 issues found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericbsd ericbsd added the bug label Feb 26, 2025
@ericbsd ericbsd merged commit 4895c70 into master Feb 26, 2025
@ericbsd ericbsd deleted the revert-kernel-update-chage branch February 26, 2025 12:07
@ericbsd ericbsd self-assigned this Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant