You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RPM spec %files段转换为Debian打包install等配置文件问题咨询

Debian打包对应问题解答

问题1:dh_*工具是否支持变量

  • 完全支持,debhelper会自动导出常用路径变量和语言专用变量:
    • 标准GNU安装路径变量:${bindir}、${mandir}、${datarootdir}、${sysconfdir},直接对应spec里的%{_bindir}等内置变量
    • Perl相关路径可直接使用${perl:VendorLib},对应spec的%perl_vendorlib,该变量由dh_perl自动生成,无需额外配置
  • 变量可直接写在install、manpages、docs等配置文件中,构建时会自动替换为实际路径

问题2:是否允许使用通配符

  • 允许,所有debhelper配置文件均支持标准shell通配符(*、?、[]等),用法和spec中的通配符完全一致,可直接匹配批量文件。

问题3:是否支持配置可选文件

  • 支持,常用实现方式有两种:
    1. 给dh_install添加--ignore-missing参数,文件存在则安装、不存在则跳过,适合依赖可选编译功能的文件
    2. 新版本debhelper支持条件语法,可在配置文件中按架构、发行版、构建profile过滤文件,格式为文件路径 [条件],例如usr/bin/foo [amd64]仅在amd64架构下安装

示例转换结果

对应你提供的%files common段,systemimager-common子包的三个配置文件内容如下:

1. debian/systemimager-common.install

${bindir}/si_lsimage
${perl:VendorLib}/SystemImager/Common.pm
${perl:VendorLib}/SystemImager/Options.pm
${perl:VendorLib}/SystemImager/UseYourOwnKernel.pm
${perl:VendorLib}/SystemImager/JConfig.pm
${datarootdir}/systemimager/conf/config_scheme.json
${sysconfdir}/systemimager/UYOK.modules_to_exclude
${sysconfdir}/systemimager/UYOK.modules_to_include

说明:

  • 配置文件放在${sysconfdir}下会被debhelper自动标记为conffile,和spec中%config的效果一致
  • 上述路径涉及的父目录会被dh_install自动创建,无需单独声明原spec中的%dir条目

2. debian/systemimager-common.manpages

${mandir}/man8/si_lsimage*
${mandir}/man7/autoinstall*

3. debian/systemimager-common.docs

你提供的spec片段中没有声明%doc类文件,该文件可留空,或添加项目通用文档如README、CHANGELOG等。


内容的提问来源于stack exchange,提问作者Olivier LAHAYE

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.29 21:06:02