Skip to content

deps: migrate from p7zip-full to 7zip package#377

Merged
lzwind merged 1 commit intolinuxdeepin:masterfrom
dengzhongyuan365-dev:master
Apr 9, 2026
Merged

deps: migrate from p7zip-full to 7zip package#377
lzwind merged 1 commit intolinuxdeepin:masterfrom
dengzhongyuan365-dev:master

Conversation

@dengzhongyuan365-dev
Copy link
Copy Markdown
Contributor

@dengzhongyuan365-dev dengzhongyuan365-dev commented Apr 8, 2026

Replace p7zip-full dependency with official 7zip package for better maintainability and active development support.

Changes:

  • Update CLI plugin regex to support both p7zip Version and 7-Zip formats
  • Replace dependency: p7zip-full → 7zip in debian/control files
  • Update plugin name from 'P7zip plugin' to '7-Zip plugin' in all languages
  • Update documentation and comments referencing p7zip
  • Add unit tests for backward compatibility with p7zip format

Maintains full backward compatibility with p7zip-created archives while leveraging the official 7zip package for future updates.

Log: 从p7zip-full迁移到official 7zip包

TASK: https://pms.uniontech.com/task-view-388177.html

Summary by Sourcery

Migrate the CLI 7z integration and packaging from the p7zip-full dependency to the official 7zip package while preserving compatibility with existing archives.

Bug Fixes:

  • Ensure the CLI 7z plugin correctly parses both legacy p7zip and new 7-Zip version output formats.

Enhancements:

  • Update CLI plugin logic and comments to treat the 7zip-based CLI plugin generically rather than as a p7zip-specific plugin.
  • Rename user-visible references from "P7zip plugin" to a generic/7-Zip plugin naming across code and documentation to reflect the new backend.

Build:

  • Switch runtime Debian dependency from p7zip-full to 7zip in control and README packaging metadata.

Documentation:

  • Update English and Chinese README files and related docs to reference the 7zip dependency instead of p7zip.

Tests:

  • Add unit tests covering both 7-Zip and p7zip-style version lines to verify backward-compatible parsing.

Replace p7zip-full dependency with official 7zip package for better
maintainability and active development support.

Changes:
- Update CLI plugin regex to support both p7zip Version and 7-Zip formats
- Replace dependency: p7zip-full → 7zip in debian/control files
- Update plugin name from 'P7zip plugin' to '7-Zip plugin' in all languages
- Update documentation and comments referencing p7zip
- Add unit tests for backward compatibility with p7zip format

Maintains full backward compatibility with p7zip-created archives while
leveraging the official 7zip package for future updates.

Log: 从p7zip-full迁移到official 7zip包

TASK: https://pms.uniontech.com/task-view-388177.html
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 8, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Migrates runtime dependency from p7zip-full to the official 7zip package while keeping the CLI 7z plugin fully compatible with both p7zip and 7-Zip version output formats, updating related comments, metadata, and docs, and adding unit tests for the new parsing behavior.

Sequence diagram for cli7z version detection with p7zip and 7-Zip outputs

sequenceDiagram
    participant DeepinCompressor
    participant Cli7zPlugin
    participant SevenZBinary

    DeepinCompressor->>Cli7zPlugin: listArchive(filePath)
    Cli7zPlugin->>SevenZBinary: 7z l filePath
    SevenZBinary-->>Cli7zPlugin: text output (multiple lines)

    loop for each output line
        Cli7zPlugin->>Cli7zPlugin: readListLine(line)
        alt version line (p7zip format)
            Note over Cli7zPlugin: line matches regex
            Cli7zPlugin->>Cli7zPlugin: extract version from "p7zip Version X.YZ"
        else version line (7-Zip format)
            Note over Cli7zPlugin: line matches same regex
            Cli7zPlugin->>Cli7zPlugin: extract version from "7-Zip X.YZ"
        else other lines
            Cli7zPlugin->>Cli7zPlugin: handle file listing or ignore
        end
    end

    Cli7zPlugin-->>DeepinCompressor: parsed archive contents and metadata
Loading

File-Level Changes

Change Details Files
Extend CLI 7z plugin version line parsing to support both p7zip and official 7-Zip output formats and cover this with unit tests.
  • Generalize the version line QRegularExpression in Cli7zPlugin::readListLine to match either the legacy 'p7zip Version' or new '7-Zip' banner formats while still capturing the version number.
  • Add a new unit test case that validates parsing of a typical 7-Zip version header line and ensures the parse state transitions to header.
  • Rename and isolate the existing unit test for p7zip output to explicitly test backward compatibility with the p7zip version line format.
3rdparty/cli7zplugin/cli7zplugin.cpp
tests/UnitTest/3rdparty/cli7zplugin/ut_cli7zplugin.cpp
Adjust plugin-related comments and naming to reflect a generic CLI 7z plugin instead of specifically P7zip.
  • Update comments in UiTools::createInterface to refer to the cli7z plugin instead of the P7zip plugin when describing tar.lzo handling and plugin removal conditions.
  • Align comment wording around skipping the 7zip plugin when the remove flag is set to refer to cli7z rather than P7zip.
src/source/common/uitools.cpp
Migrate runtime package dependency and documentation references from p7zip-full to 7zip.
  • Change Execute Depends entries in both English and Chinese READMEs from p7zip-full to 7zip.
  • Update Debian control files to depend on 7zip instead of p7zip-full for the deepin-compressor package.
  • Ensure ancillary project files that describe or reference the dependency (e.g., docs or metadata) are consistent with the new 7zip dependency.
README.md
README.zh_CN.md
debian/control
debian/control.1
docs/compressor_cmd.txt
3rdparty/cli7zplugin/kerfuffle_cli7z.json
.gitignore

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!

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
Copy Markdown

@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 - I've left some high level feedback:

  • The version line regex ^(?:p7zip Version|7-Zip) ([\d\.]+) .*$ assumes only digits and dots in the version; if 7-Zip or p7zip introduces suffixes (e.g. beta tags), this will fail—consider relaxing the capture group to something like ([^ ]+) or similar.
  • In UiTools::createInterface, the comment says "删除cli7z插件" while the code still checks plugin->metaData().name().contains("7zip", Qt::CaseInsensitive); verify the plugin metadata name and update either the condition or the comment to match the actual identifier being filtered.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The version line regex `^(?:p7zip Version|7-Zip) ([\d\.]+) .*$` assumes only digits and dots in the version; if 7-Zip or p7zip introduces suffixes (e.g. beta tags), this will fail—consider relaxing the capture group to something like `([^ ]+)` or similar.
- In `UiTools::createInterface`, the comment says "删除cli7z插件" while the code still checks `plugin->metaData().name().contains("7zip", Qt::CaseInsensitive)`; verify the plugin metadata name and update either the condition or the comment to match the actual identifier being filtered.

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.

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengzhongyuan365-dev, liujianqiang-niu, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dengzhongyuan365-dev
Copy link
Copy Markdown
Contributor Author

/merge

@dengzhongyuan365-dev
Copy link
Copy Markdown
Contributor Author

/forcemerge

@lzwind lzwind merged commit 1d92532 into linuxdeepin:master Apr 9, 2026
16 checks passed
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.

4 participants