Skip to content

chore: add linglong.yaml for deepin-manual#573

Merged
lzwind merged 1 commit intolinuxdeepin:masterfrom
dengbo11:add-sw64
Oct 16, 2025
Merged

chore: add linglong.yaml for deepin-manual#573
lzwind merged 1 commit intolinuxdeepin:masterfrom
dengbo11:add-sw64

Conversation

@dengbo11
Copy link
Contributor

This change adds a linglong.yaml file for the deepin-manual application.
This file defines the configuration for building and packaging the application within the Linglong ecosystem.
It includes package metadata, dependencies, build instructions, and source URLs for the application.
Adding this file allows for the application to be built and distributed using the Linglong package manager, enabling users to easily install and manage the application.
The linglong.yaml includes deb packages for dependencies required to build deepin-manual.

影响:
deepin-manual 应用程序添加 linglong.yaml 文件。
此文件定义了在灵珑生态系统中构建和打包应用程序的配置。
它包括应用程序的包元数据、依赖项、构建说明和源 URL。
添加此文件允许使用灵珑软件包管理器构建和分发应用程序,从而使用户能够轻松
安装和管理该应用程序。
linglong.yaml 包括构建 deepin-manual 所需依赖的 deb 软件包。

This change adds a `linglong.yaml` file for the `deepin-manual`
application.
This file defines the configuration for building and packaging the
application within the Linglong ecosystem.
It includes package metadata, dependencies, build instructions, and
source URLs for the application.
Adding this file allows for the application to be built and distributed
using the Linglong package manager, enabling users to easily install and
manage the application.
The `linglong.yaml` includes deb packages for dependencies required to
build deepin-manual.

影响:
为 `deepin-manual` 应用程序添加 `linglong.yaml` 文件。
此文件定义了在灵珑生态系统中构建和打包应用程序的配置。
它包括应用程序的包元数据、依赖项、构建说明和源 URL。
添加此文件允许使用灵珑软件包管理器构建和分发应用程序,从而使用户能够轻松
安装和管理该应用程序。
`linglong.yaml` 包括构建 deepin-manual 所需依赖的 deb 软件包。
@deepin-ci-robot
Copy link

deepin pr auto review

这是一个 Linglong 应用打包配置文件(linglong.yaml),用于定义 deepin-manual 应用的构建和打包过程。我来对它进行详细分析:

  1. 基本配置部分:
  • 版本号定义为 "1"
  • 包信息包含 id、name、version、kind 和 description
  • 基于 org.deepin.base/25.2.1/sw64 运行时
  • 使用 org.deepin.runtime.webengine/25.2.1/sw64 作为运行时环境
  • 命令入口为 dman
  1. 构建脚本部分:
build: |
  bash ./install_dep linglong/sources "${PREFIX}"
  
  # 修改路径
  sed -i "s|ExecStart=/usr/bin/dman --dbus|ExecStart=dman --dbus|g" $PWD/misc/deepin-manual.service
  sed -i 's|"/lib|"/runtime/lib|g' $PWD/cmake/translation-generate.cmake
  
  # 构建
  VERSION=$(head -1 debian/changelog | awk -F'[()]' '{print $2}')
  cmake -B build ${conf_args} \
        -DSYSTEMD_USER_UNIT_DIR=${PREFIX}/lib/systemd/user \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
        -DVERSION=${VERSION}
  cmake --build build -j`nproc`
  cmake --build build --target install >install.log 2>&1
  
  # 项目生成应用名和动态隐式加载的依赖库
  LDD_FILES=(
    dman
    dmanHelper
  )
  
  # 生成.install 文件
  bash ./deploy_dep "${LDD_FILES[@]}"

改进建议:

  1. 安全性改进:
  • 添加构建环境的校验,确保在安全的构建环境中执行
  • 对下载的文件进行完整性校验(虽然已有digest,但可以添加更严格的校验机制)
  • 添加构建过程的错误处理机制
  1. 性能优化:
  • 考虑使用并行下载依赖项
  • 添加构建缓存机制,避免重复编译
  • 对于大型依赖项,考虑使用增量构建
  1. 代码质量改进:
  • 将构建脚本拆分为多个独立的步骤,便于维护和调试
  • 添加详细的构建日志记录
  • 使用变量替代硬编码的路径和版本号
  1. 配置管理:
  • 将依赖项列表移到单独的配置文件中
  • 添加环境变量支持,便于在不同环境中部署
  • 考虑添加配置文件版本控制
  1. 错误处理:
  • 添加构建失败时的回滚机制
  • 添加依赖项缺失时的处理逻辑
  • 添加构建超时控制
  1. 维护性改进:
  • 添加注释说明关键步骤
  • 添加构建选项的说明文档
  • 考虑添加自动化测试验证构建结果
  1. 安全加固:
  • 添加运行时权限控制
  • 考虑使用沙箱机制限制构建过程的权限
  • 添加依赖项的安全扫描
  1. 版本管理:
  • 添加版本兼容性检查
  • 考虑使用语义化版本控制
  • 添加版本升级的兼容性处理

具体改进示例:

version: "1"

package:
  id: org.deepin.manual
  name: "deepin-manual"
  version: 6.5.40.1
  kind: app
  description: |
    manual for deepin os.
  # 添加更多元数据
  vendor: "UnionTech Software Technology Co., Ltd."
  homepage: "https://www.deepin.org"
  license: "GPL-3.0-or-later"

base: org.deepin.base/25.2.1/sw64
runtime: org.deepin.runtime.webengine/25.2.1/sw64

command:
  - dman

build: |
  # 设置错误处理
  set -e
  
  # 检查构建环境
  if [ ! -d "linglong/sources" ]; then
    echo "Error: Build environment not properly set up"
    exit 1
  fi
  
  # 安装依赖
  bash ./install_dep linglong/sources "${PREFIX}"
  
  # 验证关键依赖
  if ! command -v cmake &> /dev/null; then
    echo "Error: cmake is required but not installed"
    exit 1
  fi
  
  # 修改路径
  sed -i "s|ExecStart=/usr/bin/dman --dbus|ExecStart=dman --dbus|g" $PWD/misc/deepin-manual.service
  sed -i 's|"/lib|"/runtime/lib|g' $PWD/cmake/translation-generate.cmake
  
  # 构建
  VERSION=$(head -1 debian/changelog | awk -F'[()]' '{print $2}')
  cmake -B build ${conf_args} \
        -DSYSTEMD_USER_UNIT_DIR=${PREFIX}/lib/systemd/user \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX="${PREFIX}" \
        -DVERSION=${VERSION}
  
  # 编译并记录日志
  if ! cmake --build build -j`nproc`; then
    echo "Build failed, check build.log for details"
    exit 1
  fi
  
  # 安装并记录日志
  if ! cmake --build build --target install >install.log 2>&1; then
    echo "Install failed, check install.log for details"
    exit 1
  fi
  
  # 验证安装结果
  if [ ! -f "${PREFIX}/bin/dman" ]; then
    echo "Error: Installation verification failed"
    exit 1
  fi
  
  # 生成依赖关系
  LDD_FILES=(
    dman
    dmanHelper
  )
  
  # 生成安装文件
  bash ./deploy_dep "${LDD_FILES[@]}"
  
  # 清理临时文件
  rm -rf build

# 添加构建超时控制
timeout: 3600  # 1小时超时

# 添加构建缓存
cache:
  - .cache
  - build

这些改进可以提高构建过程的安全性、可靠性和可维护性,同时减少构建失败的风险。建议根据实际需求选择合适的改进方案。

@lzwind lzwind merged commit 4263035 into linuxdeepin:master Oct 16, 2025
17 checks passed
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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