为 Debian 打包时如何访问原始 tarball?
我正在打包一个使用 DistUtilsExtra 的 Python 软件。在我的 debian/rules 中运行 python setup.py install 时,DistUtilsExtra 会自动重新编译翻译模板 .pot 文件并直接在源代码中更新它存储库。因此,当我第二次执行打包命令(无论是使用 debuild
或 pdebuild
)时,都会创建一个自动补丁文件(因为它认为我已经手动更新) .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
严格来说,这并不是问题的答案如何在打包 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 todpkg-source
in thedebian/source/options
file. I have thus removed the proposed command fromoverride_dh_clean
, and the unwanted automatic patch is not created anymore.对于自动生成的文件,通常的解决方案是在清理期间删除它们。
The usual solution for automatically generated files is to delete them during clean.