Skip to content

Revert "feat(packaging): add delivery packages as recommends for Professional edition"#431

Merged
zhaohuiw42 merged 1 commit into
masterfrom
revert-429-feat-add-delivery
Jun 3, 2026
Merged

Revert "feat(packaging): add delivery packages as recommends for Professional edition"#431
zhaohuiw42 merged 1 commit into
masterfrom
revert-429-feat-add-delivery

Conversation

@zhaohuiw42
Copy link
Copy Markdown
Contributor

Reverts #429

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2026

CLA Assistant Lite bot:
提交邮箱中包含我们的合作伙伴,但您似乎并非合作伙伴的成员或对接人,请联系相关对接人将您添加至组织之中,或由其重新发起 Pull Request。
The commit email domain belongs to one of our partners, but it seems you are not yet a member of the current organization, please contact the contact person to add you to the organization or let them submit the Pull Request.

You can retrigger this bot by commenting recheck in this Pull Request

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: qiuzhiqian, zhaohuiw42

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

@zhaohuiw42 zhaohuiw42 merged commit c5cee5a into master Jun 3, 2026
22 of 29 checks passed
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

你好!我是CodeGeeX。我已仔细审查了你提供的 Git Diff 内容。本次修改主要涉及 Debian 打包配置(debian/controldebian/rules),核心变更是移除了针对特定版本(非社区版)的推荐包(uos-upgrade-delivery, uos-apt-delivery)逻辑,并对 dh_gencontrol 的变量替换进行了条件化约束

以下是我从语法逻辑、代码质量、代码性能和代码安全四个维度提出的详细审查意见与改进建议:

1. 语法与逻辑

  • ⚠️ 潜在的逻辑破坏(高优先级)
    debian/rules 中,你移除了 EDITION 变量的定义和 DistRecommends 的赋值逻辑,并在 override_dh_gencontrol 中去掉了 -Vdist:Recommends="$(DistRecommends)"。同时,在 debian/control 中删除了 ${dist:Recommends}
    逻辑风险:如果这个包之前在非社区版(如专业版)中发布,此次修改将导致系统升级时不再安装/推荐 uos-upgrade-deliveryuos-apt-delivery。请务必确认这是产品层面的预期行为(例如:这些包已被废弃,或者改变了分发策略),否则可能导致线上系统无法接收到升级推送。
  • ✅ 良好的条件化改进
    你将 override_dh_gencontrolifdef DistDepends 包裹了起来。这是非常正确的逻辑修复。如果 depend_ostree 未定义,DistDepends 将为空,此时如果不加判断直接传给 dh_gencontrol -- -Vdist:Depends="",可能会导致生成的 debian/control 中出现空的依赖声明(如 Depends: ,),从而引发 dpkg 解析错误。

2. 代码质量

  • 💡 消除死代码
    debian/rules 中,SYSTYPE 变量被保留了下来:
    SYSTYPE=$(shell grep Type= /etc/deepin-version|cut -d= -f 2)
    但在当前的 diff 上下文中,没有任何地方使用到了 SYSTYPE。如果后续逻辑也不再使用它,建议将其一并删除,以减少代码的冗余和维护成本。
  • 💡 环境依赖的健壮性(针对未来)
    虽然你删除了 EDITION,但我想指出之前代码中 grep ... /etc/os-version 的写法不够健壮。如果未来还需要读取类似配置,建议增加容错处理,例如:
    EDITION=$(shell grep EditionName= /etc/os-version 2>/dev/null | cut -d= -f 2)
    加上 2>/dev/null 可以防止在干净的开发环境(不存在该文件)中执行 dpkg-buildpackage 时报错退出。

3. 代码性能

  • ✅ 减少构建时的 I/O 操作
    删除 EDITIONSYSTYPE(如果也删掉的话)相关的 shell grep 命令,可以略微提升打包性能。每次执行 Makefile 时,$(shell ...) 都会 fork 一个新的 shell 进程并产生文件 I/O 读取。对于 CI/CD 流水线中的频繁构建,减少不必要的 shell 调用是有益的。

4. 代码安全

  • ⚠️ 构建环境依赖与可重现构建
    之前的代码依赖读取 /etc/os-version/etc/deepin-version 来决定包的行为,这违反了 Debian 打包的可重现构建原则。包的输出内容应该只受源码树和构建工具链影响,而不应受构建主机的本地配置文件影响。
    安全性评价:你的本次修改大幅提升了安全性。移除对本地 /etc/os-version 的依赖,意味着攻击者无法通过篡改构建服务器上的 /etc/os-version 文件来向最终生成的 deb 包中注入恶意的推荐依赖(如伪造的升级客户端)。这是一个非常好的安全改进。

综合改进建议

如果确认移除 uos-upgrade-delivery 等推荐包是业务需要的,且 SYSTYPE 也不再使用,我建议对 debian/rules 做进一步的清理,使其更加精简和健壮:

# 移除未使用的 SYSTYPE 变量,提升代码整洁度
# SYSTYPE=$(shell grep Type= /etc/deepin-version|cut -d= -f 2)

depend_ostree = true

ifdef depend_ostree
	DistDepends += ostree,
endif

ifneq ($(DEB_BUILD_ARCH), mips64el
    export GOBUILD_OPTIONS= -ldflags '-linkmode=external -extldflags "-Wl,-z,noexecstack,-z,relro,-z,now,-pie"'
    export GOBUILD_CGO_FLAGS= CGO_CFLAGS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -ftrapv"
    
override_dh_auto_test:

endif

# 保留 ifdef DistDepends 逻辑,防止空变量注入导致 dpkg 解析报错
ifdef DistDepends
override_dh_gencontrol:
	dh_gencontrol -- -Vdist:Depends="$(DistDepends)"
endif

override_dh_installsystemd:
	dh_installsystemd -r --no-restart-after-upgrade --no-start

总结:本次修改整体质量很高,逻辑清晰,消除了对构建主机环境的危险依赖,并修复了潜在的空变量解析问题。唯一需要确认的是业务逻辑的变更(移除推荐包)是否符合预期,以及是否可以顺手清理掉无用的 SYSTYPE 变量。

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