为 Debian 打包时如何访问原始 tarball?

发布于 2024-11-02 02:44:22 字数 826 浏览 5 评论 0原文

我正在打包一个使用 DistUtilsExtra 的 Python 软件。在我的 debian/rules 中运行 python setup.py install 时,DistUtilsExtra 会自动重新编译翻译模板 .pot 文件并直接在源代码中更新它存储库。因此,当我第二次执行打包命令(无论是使用 debuildpdebuild)时,都会创建一个自动补丁文件(因为它认为我已经手动更新) .pot 文件)。这个补丁在 Debian 软件包中显然是不需要的,我正在寻找一种不生成它的方法。

一种解决方案是 DistUtilsExtra 不更改源存储库中的 .pot 文件,但目前这是不可能的。因此,我正在测试另一个解决方案:为 clean 指令创建一个覆盖,该指令从 .orig.tar.gz tarball 中提取原始 .pot 文件,在 < code>debian/rules:

override_dh_clean:
    tar -zxvf ../<projname>_*.orig.tar.gz --wildcards --strip-components=1 <projname>-*/po/<projname>.pot
    dh_clean

但是 debian-mentors 邮件列表上告诉我原始 tarball 不能保证位于 ../ 中。因此,我想知道是否有一种方法可以从 debian/rules 内部可靠地访问 .orig.tar.gz tarball,就像包含其位置的“变量”一样?

I am packaging a piece of Python software that uses DistUtilsExtra. When running python setup.py install in my debian/rules, DistUtilsExtra automatically recompiles the translation template .pot file and updates it directly in the source repository. As a result of that, the second time I execute the packaging commands (be it with debuild or pdebuild) an automatic patch file gets created (since it thinks I have manually updated the .pot file). This patch is obviously unwanted in the Debian package and I am searching for a way to not generate it.

One solution would be for DistUtilsExtra to not change the .pot file in the source repository, but for now that's not possible. I am thus testing another solution: create an override for the clean instruction that extracts the original .pot file from the .orig.tar.gz tarball, done like this in debian/rules:

override_dh_clean:
    tar -zxvf ../<projname>_*.orig.tar.gz --wildcards --strip-components=1 <projname>-*/po/<projname>.pot
    dh_clean

However I've been told on the debian-mentors mailing list that the original tarball is not assured to be located in ../. I am thus wondering if there is a way to reliably access the .orig.tar.gz tarball from inside debian/rules, like a "variable" that would contain its location?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧街凉风 2024-11-09 02:44:22

严格来说,这并不是问题的答案如何在打包 Debian 时访问原始 tarball?,但这就是我解决引发我的问题的问题的方法,所以这里是:

我发现了一个有趣的问题Raphaël Hertzog 的博客文章解释了如何在构建 Debian 软件包时忽略自动生成的文件。这是通过将 --extend-diff-ignore 选项传递给 debian/source/options 文件中的 dpkg-source 来完成的。因此,我已从 override_dh_clean 中删除了建议的命令,并且不再创建不需要的自动补丁。

This is not strictly speaking an answer to the question How to access the original tarball when packaging for Debian?, but that's how I solved the problem that provoqued my question, so here it is:

I found an interesting blog post by Raphaël Hertzog that explains how to ignore autogenerated files when building a Debian package. This is done by passing the --extend-diff-ignore option to dpkg-source in the debian/source/options file. I have thus removed the proposed command from override_dh_clean, and the unwanted automatic patch is not created anymore.

月亮坠入山谷 2024-11-09 02:44:22

对于自动生成的文件,通常的解决方案是在清理期间删除它们。

The usual solution for automatically generated files is to delete them during clean.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文