如何将二进制文件添加到现有PPA包中

将修改后的或新的文本文件添加到我的PPA包中非常简单:

步骤1:

apt-get source [foo-package] cd [foo-package] 

第2步:添加或修改包含更改的新文本文件

第3步 – 更新更改日志:

 dch -i 

第4步 – 创建补丁

 dpkg-source --commit 

第5步 – 创建源包

 debuild -S 

第6步 – 上传到启动板

 cd .. dput [myppa]/[foo_source.changes] 

但是,我现在需要将新图标文件(.png文件)添加到现有包中。

所以在第2步 – 刚刚复制到[foo-package]

第4步 – 我收到以下错误:

 dpkg-source: error: cannot represent change to foo-package/foo-icon.png: binary file contents changed dpkg-source: error: unrepresentable changes to source 

如果我尝试转到步骤5,我会得到以下额外错误:

 dpkg-source: error: add foo-package/foo-icon.png in debian/source/include-binaries if you want to store the modified binary in the Debian tar-ball ... dpkg-buildpackage -rfakeroot -d -us -uc -S failed 

任何想法如何将二进制图标文件添加到我现有的PPA包中?


更多信息

通过运行:

 debuild -S --source-option=--include-binaries 

然后,这允许构建源包,并且步骤6是可能的。

然而,这不是真正的答案 – 因为我随后无法进行进一步的代码更改( 第2步 )因为我仍然得到相同的错误。

它看起来不像我可以做dpkg-source --commit --source-option=--include-binaries因为这只会给出错误:

 dpkg-source --commit --source-option=--include-binaries dpkg-source: warning: --source-option=--include-binaries is not a valid option for Dpkg::Source::Package::V3::quilt dpkg-source: error: cannot represent change to foo-package/foo-icon.png: binary file contents changed dpkg-source: error: unrepresentable changes to source 

我做了什么:

 apt-get source rhythmbox-plugin-llyrics cd rhythmbox-plugin-llyrics-0.1/ echo '#Junk commit' >> llyrics/ChartlyricsParser.py sed -i 's/Maintainer: fossfreedom /Maintainer: Andrew King (No comment) /g' debian/control sed -i 's/fossfreedom /Andrew King (No comment) /g' debian/changelog dpkg-source --commit debuild -S -sa mkdir debian/icons cp ~/Pictures/awesome-cat.jpg ./debian/icons/ echo 'debian/icons/awesome-cat.jpg' > debian/source/include-binaries cd .. dpkg-source --include-binaries -b rhythmbox-plugin-llyrics-0.1 cd - debuild -S echo '#Junk commit' >> llyrics/ChartlyricsParser.py dpkg-source --commit #so now it's still allowing commits and in the deb-src...add it to install echo 'debian/icons/* /usr/share/icons/hicolor/' >> debian/install echo '' >> debian/install debuild -S #note that you should have the proper subfolders here eg 32x32/myicon.png or whatever #also note that per packaging guidelines it should be one entry per file, not a wildcard 

确认它正确地推动并构建在Launchpad fossfreedom上

只需使用extend-diff-ignore开关让dpkg-source –commit忽略二进制文件

这是另一种更简单的方法:你基本上告诉dpkg-source忽略它无法理解的东西(即二进制文件),并介意它自己的业务;)

在第一次添加二进制文件之后,关键是使用带有--extend-diff-ignore开关的dpkg-source --commit ,以及要忽略的相应路径/文件名(Perl正则表达式格式)。

例如,假设您在llyrics目录中粘贴了一堆PNG,然后修改了一些文本文件。 正确的提交调用是:

 dpkg-source --commit --extend-diff-ignore="(^|/)(llyrics/.*\.png)$" 

遵循:

 debuild -S --source-option=--include-binaries 

获取PPA上传。


让我们用来自fossfreedom的“游乐场”PPA的rhythmbox-plugin-llyrics包测试一下:

  1. 获取源码: apt-get source rhythmbox-plugin-llyrics

  2. 修改文本文件并添加PNG:

     $ cd rhythmbox-plugin-llyrics-0.1
     $ echo FORCE-A-DIFF >> llyrics / README 
     $ wget -Ollyrics / dancemonkeyboy.png \
        http://ubuntu.miximages.com/package-management/untitled-image.png
     ...`llyrics / dancemonkeyboy.png'已保存[243304/243304]
    
  3. 使用dch -v 0.1-3ubuntu6~izx1添加到changelog并增加版本

  4. 在忽略PNG的情况下提交文本更改:

      $ dpkg-source --commit --extend-diff-ignore =“(^ | /)(llyrics /.* \ .png)$”
     dpkg-source:info:检测到本地更改,修改后的文件为:
    的Rhythmbox-插件-llyrics-0.1 / llyrics /自述
    输入所需的补丁名称:PPABinaryTest
     dpkg-source:info:本地更改已记录在新补丁中:rhythmbox-plugin-llyrics-0.1 / debian / patches / PPABinaryTest
    
  5. 构建源/更改:

     $ debuild -S --source-option =  -  include-binaries
     ...
     dpkg-source:info:使用现有的./rhythmbox-plugin-llyrics_0.1.orig.tar.gz建立rhythmbox-plugin-llyrics
     dpkg-source:info:将llyrics / dancemonkeyboy.png添加到debian / source / include-binaries
     ...
    

还有……瞧! ( Launchpad构建的deb – 请注意~200k大小差异…… )

这比添加文件要困难一些。

首先,您需要使用新源包中包含的二进制文件重建.orig.tar.gz,并且可能需要增加软件版本( package_1.0.0.orig.tar.gz – > package_1.0.1.orig.tar.gz或其他东西)在tar和debian/changelog

使用新文件修改orig.tar.gz后(不包括orig.tar.gz中的debian /文件),然后添加debian/changelog条目,更改版本以增加它,就像你对orig一样增加名为.tar.gz。

然后重建源包( debuild -S ),并将新的源包上传到PPA。 新的源包将覆盖PPA中的“旧”源包。


来自聊天:

 @LordofTime ... wouldnt launchpad complain that its just received a different original source file @fossfreedom not if you increment the version new version, new source @fossfreedom if you don't increment the version it'll explode so you must increment the version also, make individual debian packages for each release of ubuntu and it'll not yell as much (it'll still enforce original version) ie "I am updating the NGINX PPA from 1.2.2 to 1.2.3. I need to get the 1.2.3 source, and work from that." "I change the package, and the .orig.tar.gz, and upload the new package to Launchpad." "If there are no build errors, then i'm done. If there is a build error, then I damned well better fix that error." (then reupload with 1.2.3-2 or something) but generally i do build testing in a staging repo