Skip to content

Revert "deps: migrate from p7zip-full to 7zip package"#391

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

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

Conversation

@dengzhongyuan365-dev
Copy link
Copy Markdown
Contributor

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

由于系统依赖还没有完善,归档管理器的这笔提交先回滚。后续系统依赖处理了再添加进去。

This reverts commit 1d92532.

Summary by Sourcery

Revert the previous migration from the 7zip package back to the legacy p7zip-full tooling and expectations across code, tests, and packaging metadata.

Bug Fixes:

  • Restore CLI 7z plugin version parsing and tests to only support the p7zip output format to match the reverted dependency.

Build:

  • Adjust Debian control metadata to depend on p7zip-full instead of 7zip.

Documentation:

  • Update README files to state p7zip-full as the runtime dependency instead of 7zip.

由于系统依赖还没有完善,归档管理器的这笔提交先回滚。后续系统依赖处理了再添加进去。

This reverts commit 1d92532.
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Apr 16, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Reverts a previous migration from p7zip-full to 7zip by restoring p7zip as the runtime dependency, narrowing CLI plugin version parsing back to p7zip-only, and adjusting tests and comments to match the reverted behavior.

Class diagram for reverted Cli7zPlugin version parsing behavior

classDiagram
    class Cli7zPlugin {
        +bool readListLine(line: QString)
        -int m_parseState
        -QRegularExpression rxVersionLine
        -QRegularExpressionMatch matchVersion
    }
Loading

File-Level Changes

Change Details Files
Revert CLI 7z plugin version-line parsing to support only p7zip output format.
  • Change the version-line regular expression to match only the p7zip format instead of both p7zip and 7-Zip formats.
3rdparty/cli7zplugin/cli7zplugin.cpp
Adjust unit tests for CLI 7z plugin to reflect p7zip-only support.
  • Remove the test that validates parsing of 7-Zip style version lines.
  • Merge remaining expectations into a single test that only checks p7zip-style version output handling.
tests/UnitTest/3rdparty/cli7zplugin/ut_cli7zplugin.cpp
Rebrand comments and plugin-filter logic from generic/cli7z/7zip to explicit P7zip terminology.
  • Update comments describing which plugin handles tar.lzo mime types to refer to the P7zip plugin instead of cli7z/7zip.
  • Clarify that the removal logic applies to the P7zip plugin when certain mime types are detected.
src/source/common/uitools.cpp
Restore p7zip-full as the declared runtime dependency instead of 7zip.
  • Switch Execute Depends / Depends entries from 7zip back to p7zip-full in documentation and packaging metadata.
README.md
README.zh_CN.md
debian/control.1
debian/control
Housekeeping changes related to the revert.
  • Touch or reset ancillary files to match the reverted dependency configuration (e.g., plugin metadata, docs, gitignore).
.gitignore
3rdparty/cli7zplugin/kerfuffle_cli7z.json
docs/compressor_cmd.txt

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:

  • Even though the dependency is reverted to p7zip-full, consider keeping the more general version-line regex that accepts both p7zip and 7-Zip formats to avoid unnecessarily dropping compatibility if 7z is present on some systems.
  • In UiTools::createInterface, the comments refer to removing the “P7zip” plugin while the runtime filter checks plugin->metaData().name().contains("7zip"); ensure the terminology matches the actual plugin metadata to avoid confusion when reading or debugging this logic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Even though the dependency is reverted to p7zip-full, consider keeping the more general version-line regex that accepts both `p7zip` and `7-Zip` formats to avoid unnecessarily dropping compatibility if `7z` is present on some systems.
- In `UiTools::createInterface`, the comments refer to removing the “P7zip” plugin while the runtime filter checks `plugin->metaData().name().contains("7zip")`; ensure the terminology matches the actual plugin metadata to avoid confusion when reading or debugging this logic.

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

deepin pr auto review

代码审查报告

总体概述

这次代码变更主要是将项目从依赖 7zip 切换到 p7zip-full,包括更新依赖项、修改插件名称和调整相关代码逻辑。整体变更逻辑清晰,但存在一些潜在问题需要关注。

详细审查意见

1. cli7zplugin.cpp 中的正则表达式修改

问题:

-    const QRegularExpression rxVersionLine(QStringLiteral("^(?:p7zip Version|7-Zip) ([\\d\\.]+) .*$"));
+    const QRegularExpression rxVersionLine(QStringLiteral("^p7zip Version ([\\d\\.]+) .*$"));

分析:

  • 移除了对 7-Zip 格式的支持,现在只匹配 p7zip 的版本输出格式
  • 这会导致代码无法处理 7-Zip 的版本输出,如果系统安装的是 7-Zip 而不是 p7zip,会导致解析失败

建议:

  1. 如果确定只支持 p7zip,这个修改是合理的
  2. 但应该添加错误处理,当版本解析失败时给出明确的错误信息
  3. 考虑添加版本检查,确保 p7zip 版本符合最低要求

改进代码示例:

const QRegularExpression rxVersionLine(QStringLiteral("^p7zip Version ([\\d\\.]+) .*$"));
QRegularExpressionMatch matchVersion = rxVersionLine.match(line);

if (!matchVersion.hasMatch()) {
    qWarning() << "Failed to parse p7zip version from line:" << line;
    return false;
}

QString version = matchVersion.captured(1);
qDebug() << "Detected p7zip version:" << version;

// 可选:添加版本检查
if (version < "16.00") {
    qWarning() << "p7zip version" << version << "is too old, minimum required is 16.00";
    return false;
}

2. 依赖项变更

变更:

-Depends: ${shlibs:Depends}, ${misc:Depends}, 7zip, deepin-shortcut-viewer, ...
+Depends: ${shlibs:Depends}, ${misc:Depends}, p7zip-full, deepin-shortcut-viewer, ...

分析:

  • 从 7zip 切换到 p7zip-full 是一个重大变更
  • p7zip-full 和 7zip 在某些功能上可能有差异,需要确保所有功能都兼容

建议:

  1. 添加文档说明为什么需要切换到 p7zip-full
  2. 检查 p7zip-full 是否支持所有需要的压缩格式和功能
  3. 考虑添加版本约束,如 p7zip-full (>= 16.02)

3. 插件名称变更

变更:

-"Name": "7-Zip plugin",
+"Name": "P7zip plugin",

分析:

  • 插件名称从 "7-Zip plugin" 改为 "P7zip plugin"
  • 这是一个合理的变更,与实际使用的后端一致

建议:

  1. 确保所有翻译都已更新(看起来已经做了)
  2. 考虑在插件描述中明确说明这是基于 p7zip 的实现

4. 测试代码变更

变更:

-TEST_F(UT_Cli7zPlugin, test_readListLine_002)
-{
-    m_tester->m_parseState = ParseStateTitle;
-    // 兼容p7zip和7z版本格式 - 测试7z版本
-    EXPECT_EQ(m_tester->readListLine("7-Zip 23.01 (x64) : Copyright (c) 1999-2023 Igor Pavlov : 2023-06-20"), true);
-    EXPECT_EQ(m_tester->m_parseState, ParseStateHeader);
-}
-
-TEST_F(UT_Cli7zPlugin, test_readListLine_002_p7zip)
-{
-    m_tester->m_parseState = ParseStateTitle;
-    // 兼容p7zip和7z版本格式 - 测试p7zip版本(向后兼容)
+TEST_F(UT_Cli7zPlugin, test_readListLine_002)
+{
+    m_tester->m_parseState = ParseStateTitle;
     EXPECT_EQ(m_tester->readListLine("p7zip Version 16.02 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz (A0655),ASM,AES-NI)"), true);
     EXPECT_EQ(m_tester->m_parseState, ParseStateHeader);
 }

分析:

  • 移除了对 7-Zip 版本的测试
  • 保留了 p7zip 版本的测试
  • 测试用例名称从 test_readListLine_002_p7zip 改回 test_readListLine_002

建议:

  1. 考虑添加更多边界情况测试,如:
    • 无效版本格式
    • 缺少版本号
    • 非常旧的 p7zip 版本
    • 非常新的 p7zip 版本
  2. 添加测试用例验证错误处理逻辑

改进测试示例:

TEST_F(UT_Cli7zPlugin, test_readListLine_002_valid_p7zip)
{
    m_tester->m_parseState = ParseStateTitle;
    EXPECT_EQ(m_tester->readListLine("p7zip Version 16.02 (locale=zh_CN.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz (A0655),ASM,AES-NI)"), true);
    EXPECT_EQ(m_tester->m_parseState, ParseStateHeader);
}

TEST_F(UT_Cli7zPlugin, test_readListLine_002_invalid_version)
{
    m_tester->m_parseState = ParseStateTitle;
    // 测试无效版本格式
    EXPECT_EQ(m_tester->readListLine("Invalid version string"), false);
    EXPECT_EQ(m_tester->m_parseState, ParseStateTitle); // 状态不应改变
}

TEST_F(UT_Cli7zPlugin, test_readListLine_002_old_version)
{
    m_tester->m_parseState = ParseStateTitle;
    // 测试非常旧的版本
    EXPECT_EQ(m_tester->readListLine("p7zip Version 9.20 (locale=zh_CN.UTF-8)"), false); // 假设拒绝旧版本
    EXPECT_EQ(m_tester->m_parseState, ParseStateTitle); // 状态不应改变
}

5. .gitignore 变更

变更:

-.npm-cache/
\ No newline at end of file

分析:

  • 移除了对 .npm-cache/ 的忽略
  • 这可能是故意的,但需要确认

建议:

  1. 如果这是故意的,应该添加注释说明原因
  2. 如果不是故意的,应该恢复这一行

安全性考虑

  1. 版本解析安全性

    • 当前代码没有对解析出的版本号进行验证
    • 建议添加版本号格式验证,防止恶意构造的版本字符串导致问题
  2. 命令注入风险

    • 虽然这次变更没有直接涉及命令执行,但建议审查所有调用 p7zip 的地方,确保没有命令注入风险

性能考虑

  1. 正则表达式性能
    • 简化后的正则表达式性能会更好
    • 但如果需要处理大量版本解析,考虑预编译正则表达式

总结

这次变更主要是将项目从 7zip 切换到 p7zip-full,整体方向合理,但需要关注以下几点:

  1. 确保所有功能在 p7zip-full 下都能正常工作
  2. 添加更完善的错误处理和版本检查
  3. 增强测试用例,覆盖更多边界情况
  4. 添加文档说明变更原因和影响
  5. 考虑向后兼容性,如果需要支持旧版本

建议在合并前进行全面的测试,确保所有功能在 p7zip-full 下都能正常工作。

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengzhongyuan365-dev, 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

@lzwind lzwind merged commit 83a7524 into linuxdeepin:master Apr 16, 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.

3 participants