Debian – Applying patches in debian packages – Part 2

compilingdebianpackage-managementpatch

I had asked about applying patches here . I tried today using the same procedure on a different source-package and it failed. Sharing –

~/games $ mkdir decopy

~/games/decopy $ apt-get source decopy

Reading package lists... Done
NOTICE: 'decopy' packaging is maintained in the 'Git' version control system at:
https://anonscm.debian.org/git/collab-maint/decopy.git
Please use:
git clone https://anonscm.debian.org/git/collab-maint/decopy.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 46.9 kB of source archives.
Get:1 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy
0.2-1 (dsc) [1,943 B]
Get:2 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy
0.2-1 (tar) [43.2 kB]
Get:3 http://debian-mirror.sakura.ne.jp/debian unstable/main decopy
0.2-1 (diff) [1,760 B]
Fetched 46.9 kB in 42s (1,103 B/s)
dpkg-source: info: extracting decopy in decopy-0.2
dpkg-source: info: unpacking decopy_0.2.orig.tar.gz
dpkg-source: info: unpacking decopy_0.2-1.debian.tar.xz

Then listing –

~/games/decopy $  ls                                                             

decopy-0.2  decopy_0.2-1.debian.tar.xz  decopy_0.2-1.dsc  decopy_0.2.orig.tar.gz

Obviously decopy-0.2 is where things are.

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

~/games/decopy/ $ ─[$] ls

decopy-0.2  decopy_0.2-1.debian.tar.xz  decopy_0.2-1.dsc
decopy_0.2.orig.tar.gz use_tqdm_progress.patch

~/games/decopy $ cd decopy-0.2

~/games/decopy/decopy-0.2 $ patch -p1 < ../use_tqdm_progress.patch

 (Stripping trailing CRs from patch; use --binary to disable.)
patching file decopy/cmdoptions.py
(Stripping trailing CRs from patch; use --binary to disable.)
patching file decopy/tree.py
Hunk #2 succeeded at 190 (offset -6 lines).
Hunk #3 succeeded at 201 (offset -6 lines).
Hunk #4 succeeded at 303 (offset -6 lines).
Hunk #5 succeeded at 364 (offset -6 lines).

Patched it, and now using dch to have another go –

  ~/games/decopy/decopy-0.2 $ dch -n "Apply patch given in #854052".

  ~/games/decopy/decopy-0.2 $

Now the directory didn't change, apparently because this package is not a native package like dpkg is/was .

What are the recommended steps here ?

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

Best Answer

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

then create the appropriate structure:

mkdir -p debian/patches
cp ../use_tqdm_progress.patch debian/patches
echo use_tqdm_progress.patch >> debian/patches/series

You should refresh the patch:

quilt push
quilt refresh

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

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.

Related Question