【问题标题】:Share debian package maintainer scripts and conffiles from existing package to a new package将 debian 包维护者脚本和配置文件从现有包共享到新包
【发布时间】:2020-06-17 14:20:50
【问题描述】:

我已经为 python2 和 python3 创建了两个 debian 包的变体。我已经创建了 com.python2.package1,所有这些都是维护者脚本。现在我尝试添加 com.python3.package2 所以我的 debian/control 文件就像

Package: com.python2.package1
Name: Example Package1
Description: An example package1.
This longer description will load when a depiction URL is not specified.
Author: Ms. Example <example@example.com>
Maintainer: Example, Inc. <example-inc@example.com>
Version: 1.0-1
Section: Addons (SpringBoard)
Pre-Depends: com.example.system
Depends: com.example.library

Package: com.python3.package2
Name: Example Package2
Description: An example package2.
This longer description will load when a depiction URL is not specified.
Author: Ms. Example <example@example.com>
Maintainer: Example, Inc. <example-inc@example.com>
Version: 1.0-2
Section: Addons (SpringBoard)
Pre-Depends: com.example.system
Depends: com.example.library

现在 com.python2.package1 在 debian 目录中已经有了维护者脚本和配置文件。如何让 com.python3.package2 使用相同的文件,这样我就不必为每个变体创建额外的副本?

可能是 override_dh_installdeb 用于执行此操作,但它如何完​​成此任务?

【问题讨论】:

  • 相同的源包?每个包都必须有维护者脚本:你永远不知道包的安装顺序。您可以require 其他包,并从您的脚本中调用维护者脚本。
  • 我想在 debian/ 目录中有脚本,然后 override_dh_installdeb 应该为两个包安装相同的脚本。因此,这两个包在构建后都有自己的脚本,但它们是从相同的源文件中收集的......

标签: debian packaging dpkg


【解决方案1】:

你可以在debian/rules中尝试这样的事情:

override_dh_install:
        dh_install
        install debian/source/update.py debian/com.python2.package1/usr/lib/python2/dist-packages/my-package/

我假设您已将脚本包含在 debian/com.python3.package2.install 文件中,只需再次将其复制到 com.python2.package1 包中。

我还假设“维护脚本”是指 Python 鸡蛋/模块维护脚本(__init__.py 之类的东西),而不是 Debian 软件包维护脚本(*.postinst)。

【讨论】:

  • 谢谢。 com.python2.package1 已经创建我只是添加 com.python3.package2 到它。维护者脚本是指 debian 维护者脚本。所以简而言之,我已经有了一个 com.python2.package1,我只是想创建它的 com.python3.package2 变体,它与现有的共享相同的 conffiles 和 debian 维护者脚本。
  • 对于com.python3.package2.postinst 之类的东西,不要这样做。您可以尝试在 debian 目录中使用符号链接或硬链接,但这将无法在 git 中生存,或者 dpkg-buildpackage 会阻塞它,或者其他东西会破坏。您可以查看最终的debian/&lt;pkgname&gt;/DEBIAN 目录并尝试将文件复制到那里,但这是在 debhelper 的背后。你最好只是制作一个副本并继续前进。我试图在这里向 DRY 致敬,但这种努力是不值得的。最好的选择是停止支持 python2。 :)
  • 我已经可以使用 git 符号链接,但我想使用构建过程本身来获得更好的解决方案。我同意最好的选择是停止支持 python2,但在更大的系统中,删除支持并不是那么简单,因此需要有一个过渡期
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-04
  • 1970-01-01
  • 1970-01-01
  • 2016-03-15
  • 2016-07-31
相关资源
最近更新 更多