在 debian 软件包中应用补丁 - 第 2 部分

shi*_*ish 3 compiling debian patch package-management

我曾询问过如何在这里应用补丁。我今天尝试在不同的源包上使用相同的过程,但失败了。分享-

\n\n
~/games $ mkdir decopy\n\n~/games/decopy $ apt-get source decopy\n\nReading package lists... Done\nNOTICE: \'decopy\' packaging is maintained in the \'Git\' version control system at:\nhttps://anonscm.debian.org/git/collab-maint/decopy.git\nPlease use:\ngit clone https://anonscm.debian.org/git/collab-maint/decopy.git\nto retrieve the latest (possibly unreleased) updates to the package.\nNeed to get 46.9 kB of source archives.\nGet:1 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy\n0.2-1 (dsc) [1,943 B]\nGet:2 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy\n0.2-1 (tar) [43.2 kB]\nGet:3 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy\n0.2-1 (diff) [1,760 B]\nFetched 46.9 kB in 42s (1,103 B/s)\ndpkg-source: info: extracting decopy in decopy-0.2\ndpkg-source: info: unpacking decopy_0.2.orig.tar.gz\ndpkg-source: info: unpacking decopy_0.2-1.debian.tar.xz\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后列出——

\n\n
~/games/decopy $  ls                                                             \n\ndecopy-0.2  decopy_0.2-1.debian.tar.xz  decopy_0.2-1.dsc  decopy_0.2.orig.tar.gz\n
Run Code Online (Sandbox Code Playgroud)\n\n

显然 decopy-0.2 就是事情所在。

\n\n

/games/decopy/decopy$ wget https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=854052;filename=use_tqdm_progress.patch;msg=10

\n\n
~/games/decopy/ $ \xe2\x94\x80[$] ls\n\ndecopy-0.2  decopy_0.2-1.debian.tar.xz  decopy_0.2-1.dsc\ndecopy_0.2.orig.tar.gz use_tqdm_progress.patch\n\n~/games/decopy $ cd decopy-0.2\n\n~/games/decopy/decopy-0.2 $ patch -p1 < ../use_tqdm_progress.patch\n\n (Stripping trailing CRs from patch; use --binary to disable.)\npatching file decopy/cmdoptions.py\n(Stripping trailing CRs from patch; use --binary to disable.)\npatching file decopy/tree.py\nHunk #2 succeeded at 190 (offset -6 lines).\nHunk #3 succeeded at 201 (offset -6 lines).\nHunk #4 succeeded at 303 (offset -6 lines).\nHunk #5 succeeded at 364 (offset -6 lines).\n
Run Code Online (Sandbox Code Playgroud)\n\n

修补了它,现在使用 dch 进行另一次尝试 -

\n\n
  ~/games/decopy/decopy-0.2 $ dch -n "Apply patch given in #854052".\n\n  ~/games/decopy/decopy-0.2 $\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在目录没有改变,显然是因为这个包不是像 dpkg is/was 这样的本机包。

\n\n

这里推荐的步骤是什么?

\n\n

Also is there a way to know which package is a debian native package and which are not ? Any tests or something ?

\n

Ste*_*itt 5

This is a "3.0 (quilt)" package (see debian/source/format), so you'll need to use quilt to manage the patch. Revert the patch:

patch -R -p1 < ../use_tqdm_progress.patch
Run Code Online (Sandbox Code Playgroud)

then create the appropriate structure:

mkdir -p debian/patches
cp ../use_tqdm_progress.patch debian/patches
echo use_tqdm_progress.patch >> debian/patches/series
Run Code Online (Sandbox Code Playgroud)

You should refresh the patch:

quilt push
quilt refresh
Run Code Online (Sandbox Code Playgroud)

Your dch is fine, as is the fact that the directory name didn't change. You can build the package now:

dpkg-buildpackage -us -uc
Run Code Online (Sandbox Code Playgroud)

As far as native packages go, you can spot a native package by the fact that it doesn't have a hyphen in its version (generally speaking). Here, the version is 0.2-1, so it's not a native package. Inside the package, debian/source/format would be "3.0 (native)" for a native package.