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

fos*_*dom 10 package-management packaging

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

第1步:

apt-get source [foo-package]
cd [foo-package]
Run Code Online (Sandbox Code Playgroud)

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

第 3 步 - 更新变更日志:

dch -i
Run Code Online (Sandbox Code Playgroud)

第 4 步 - 创建补丁

dpkg-source --commit
Run Code Online (Sandbox Code Playgroud)

第 5 步 - 创建一个源包

debuild -S 
Run Code Online (Sandbox Code Playgroud)

第 6 步 - 上传到启动板

cd ..
dput [myppa]/[foo_source.changes]
Run Code Online (Sandbox Code Playgroud)

但是,我现在需要向现有包添加一个新的图标文件(一个 .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
Run Code Online (Sandbox Code Playgroud)

如果我尝试转到第 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
Run Code Online (Sandbox Code Playgroud)

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


更多信息

通过运行:

debuild -S --source-option=--include-binaries
Run Code Online (Sandbox Code Playgroud)

然后,这允许构建源包,并且步骤 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
Run Code Online (Sandbox Code Playgroud)

Rob*_*ans 8

我做了什么:

apt-get source rhythmbox-plugin-llyrics
cd rhythmbox-plugin-llyrics-0.1/
echo '#Junk commit' >> llyrics/ChartlyricsParser.py
sed -i 's/Maintainer: fossfreedom <somewhere@xmail.com>/Maintainer: Andrew King (No comment) <newplace@ymail.com>/g' debian/control
sed -i 's/fossfreedom <somewhere@xmail.com>/Andrew King (No comment) <newplace@ymail.com>/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 e.g. 32x32/myicon.png or whatever
#also note that per packaging guidelines it should be one entry per file, not a wildcard
Run Code Online (Sandbox Code Playgroud)

确认它在 Launchpad fossfreedom上正确推送和构建


ish*_*ish 5

只需获取dpkg-source --commit即可使用extend-diff-ignore开关忽略二进制文件

这是另一种更简单的方法:您基本上告诉dpkg-source忽略它无法理解的内容(即二进制文件),并注意自己的事情;)

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

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

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

跟着:

debuild -S --source-option=--include-binaries
Run Code Online (Sandbox Code Playgroud)

获取您的 PPA 上传。


让我们用rhythmbox-plugin-llyrics来自 fossfreedom 的“playground”PPA的包来测试这个:

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

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

    $ cd rhythmbox-plugin-llyrics-0.1
    $ echo FORCE-A-DIFF >> 歌词/自述文件 
    $ wget -Ollyrics/dancemonkeyboy.png \
       http://www.samrethsingh.com/wp-content/uploads/2009/02/untitled-image.png
    ... `llyrics/dancemonkeyboy.png' 已保存 [243304/243304]
    
  3. 添加到变更日志并增加版本 dch -v 0.1-3ubuntu6~izx1

  4. 在忽略 PNG 的同时提交文本更改:

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

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

还有……瞧!(Launchpad 内置的 deb--注意 ~200k 的大小差异......