1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
[[patches]]
=== debian/patches/*
The *-p1* patches in the *debian/patches/* directory are applied in the sequence defined in the *debian/patches/series* file to the upstream source tree before the *build* process.
NOTE: The native Debian package (see <<native>>) doesn't use these files.
There are several methods to prepare a series of *-p1* patches.
* The *diff* command
** See <<diff-u>>
** Primitive but versatile method
*** Patches may come from other distros, mailing list postings, or cherry-picked patches from the upstream *git* repository with the ``*git format-patches*'' command
** Missing the *.pc/* directory
** Unmodified upstream source tree
** Manually update the *debian/patches/series* file
* The *dquilt* command
** See <<quilt-setup>>
** Basic convenient method
** Proper generation of the *.pc/* directory data
** Modified upstream source tree
* The ``*dpkg-source --commit*'' command
** See <<dpkg-source-commit>>
** Newer elegant method
** Proper generation of the *.pc/* directory data
** Modified upstream source tree
* The automatic patch generation by the *dpkg-buildpackage*
** See <<alt-vcs>>
** Add *single-debian-patch* in the *debian/source/local-options* file
** Set the *debian/source/local-patch-header* file
** Missing the *.pc/* directory
** Modified upstream source tree in the Debian branch (*master*)
* The *gbp-pq* command
** basic *git* work flow with the *git-buildpackage* package
** Missing the *.pc/* directory
** Modified upstream source tree in the throw-away branch (*patch-queue/master*)
** Unmodified upstream source tree in the Debian branch (*master*)
* The *gbp-dpm* command
** more elaborate *git* work flow with the *git-dpm* package
** Missing the *.pc/* directory
** Modified upstream source tree in the patched branch (*patched/*'whatever')
** Unmodified upstream source tree in the Debian branch (*master/*'whatever')
Wherever these patches come from, it is a good idea to tag them with a http://dep.debian.net/deps/dep3/[DEP-3] compatible header.
TIP: The *dgit* package offers an alternative git integration tool with the Debian package archive.
[[dpkg-source-x]]
==== dpkg-source -x
The ``*dpkg-source -x*'' command unpacks the Debian source package.
It normally applies the patches in the *debian/patches/* directory to the source tree and records the patch state in the *.pc/* directory.
If you wish to keep the source tree unmodified (for example, for use in <<vcs>>), please use the *--skip-patches* option.
[[quilt-dpkg]]
==== dquilt and dpkg-source
The *quilt* command (or its wrapped *dquilt* command) was needed to manage the *-p1* patches in the *debian/patches/* directory before the *--commit* feature was added to the *dpkg-source* command in 1.16.1.
The patches should apply cleanly when using the *dpkg-source* command. Thus you can't just copy the patches to the new packaging of the new upstream release if there are patch offsets, etc.
The *dquilt* command (see <<quilt-setup>>) is more forgiving. You can normalize the patches by the *dquilt* command.
----
$ while dquilt push; do dquilt refresh ; done
$ dquilt pop -a
----
There is one advantage of using the *dpkg-source* command over the *dquilt* command. While the *dquilt* command cannot handle modified binary files automatically, the *dpkg-source* command detects modified binary files and lists them in the *debian/source/include-binaries* file to include them in the Debian tarball.
|