DPATCH-EDIT-PATCH(1)
π¦ DPATCH-EDIT-PATCH(1) β the dpatch users manual, bestie edition
okay so this is the manual page for dpatch-edit-patch, straight out of the dpatch users manual, section 1. buckle up, she's long but she's worth it π
β¨ NAME β¨
dpatch-edit-patch β the girl who maintains dpatch patches for a Debian source package π
β¨ SYNOPSIS β¨
dpatch-edit-patch [options] command dpatchname [basepatch]
β¨ DESCRIPTION β¨
This manual documents the dpatch-edit-patch command, which is the one holding down the dpatch patches for a dpatch-using Debian source package. π
And like, important vibe: dpatch-edit-patch copies the entire tree to a temporary directory to do its little work in. She does not mess with your actual tree, she makes her own. main character behaviour honestly. β¨
π¨ WARNING π¨
dpatch is deprecated. bestie, please switch to the 3.0 (quilt) Debian source package format instead. there's a short guide on how to do it at http://wiki.debian.org/Projects/DebSrc3.0#FAQ π«Ά
π OPTIONS π
So dpatch-edit-patch takes two forms of arguments: options and commands. And rn the only command that exists is "patch", which is the one that lets you create/edit dpatches. When no command is given, "patch" is just assumed. she reads the room. π
π COMMANDS: π
patchβ This command needs one mandatory argument, and accepts one optional argument under certain circumstances. The mandatory one is dpatchname. It refers to a dpatch, exactly as it would be listed indebian/patches/00list. And no, it is not necessary for dpatchname to already exist before you rundpatch-edit-patch patch dpatchnameβ she'll handle it.
When dpatchname does exist, dpatch-edit-patch sets up a working source tree, applies all the dpatches listed in debian/patches/00list up to and including dpatchname, and then spawns an interactive shell for the developer (that's you, bestie π«Ά). You edit files in this working tree. When you're done, you exit the shell. Then dpatch-edit-patch updates dpatchname to reflect the changes you made. iconic.
And if you want to abort the whole thing from inside the interactive shell? You just need the shell to exit with an exit value of 230. Typically that's done by exiting the shell with the command exit 230. ngl that's a weird number but okay, we respect it. π
Now β if you wanna peek at the patch you're currently working on without leaving the subshell, there are two environment variables exported into the subshell to help you out:
DPEP_SHELL_REFDIRβ set to the reference directory's full nameDPEP_SHELL_WORKDIRβ set to the subshell's working directory
These two can be used to β for example β generate a diff between the reference version and the current tree:
diff -urNa $DPEP_SHELL_REFDIR $DPEP_SHELL_WORKDIR
When dpatchname does not exist, dpatch-edit-patch assumes a new dpatch should be created. Same deal as above: first she creates a working source tree. If the optional argument basepatch is supplied, all dpatches in debian/patches/00list up to and including basepatch get applied to the working tree. If basepatch is not supplied, no dpatches are applied to the working tree. Then when the developer exits the shell, dpatch-edit-patch creates dpatchname. If debian/patches/00template does not exist, a hardcoded dpatch header and shell snippet will be used. If it exists and is not executable, it will be copied verbatim as the header and shell snippet. periodt. π
Its first parameter is the base filename of the to-be-updated or to-be-created dpatch (useful for adding titles to the dpatch header). Its second parameter will be the description of the new patch. πΈ
π OPTIONS π
For the following options, bestie, the precedence goes like this: command-line arguments > environment variables > configuration variables. And the configuration variables are read from debian/patches/00dpatch.conf and ~/.dpatch.conf. π
-s,--sourcedir=valueβ Directory containing the unpacked Debian source package. Configuration variableconf_sourcedir(settable only in~/.dpatch.conf), environment variableDPEP_SOURCEDIR. Defaults to the current working directory. π-o,--outdir=valueβ Directory where the updated or newly-created dpatch will be placed. Configuration variableconf_outdir(~/.dpatch.conf), environment variableDPEP_OUTDIR. Defaults to./debian/patches/β¨-c,--cleanβ Tellsdpatch-edit-patchthat the current work directory can safely be cleaned. If this is not given,dpatch-edit-patchtries to preserve partial or complete builds by first copying the current work directory to a reference directory, and then invokingdebian/rules cleanon the reference directory. If it is given, the current directory is cleaned and then taken as the reference directory. Use this option if your source package is pretty large and no significant work gets destroyed by cleaning. Configuration variableconf_clean(~/.dpatch.conf), environment variableDPEP_CLEAN. π§Ή-b,--debianonly[=path]β Tellsdpatch-edit-patchthat the current work directory only contains adebiansubdirectory, and that an upstream tarball is to be unpacked in the reference directory before copying the current work directory there. The optional argument is the path to the upstream tarball β including the tarball name. If no value is given,dpatch-edit-patchwill use the hook script pointed to byconf_getorigtargz(~/.dpatch.conf) orDPEP_GETORIGTARGZto obtain the upstream tarball. The hook script should take one argument: the destination directory where the fetched archive shall be put. Configuration variables:conf_debianonly(debian/patches/00dpatch.conf) andconf_origtargz(~/.dpatch.conf). Environment variables:DPEP_DEBIANONLYandDPEP_ORIGTARGZ. π¦-P,--origtargzpath=pathβ When-bis in use, specify the path where upstream tarballs should be looked for. path is a colon-separated list of directories. Configuration variables:conf_origtargzpath(~/.dpatch.conf). Environment variables:DPEP_ORIGTARGZPATH. π-r,--rootcmd=valueβ The command used to gain root privileges, used to cleanDPEP_SOURCEDIR. Configuration variableconf_rootcmd, environment variableDPEP_ROOTCMD. Defaults tofakeroot, if installed. If none of the above are specified, andfakerootis not installed,dpatch-edit-patchwill abort. And the dpatch authors strongly recommend the use offakerootfor this purpose. π-d,--description=valueβ The description used for a newly-created patch. Configuration variableconf_newdesc(~/.dpatch.conf), environment variableDPEP_NEWDESC, defaults to "No description." π-k,--keeptemp=valueβ A boolean value, either0or1. Configuration variableconf_keeptemp(~/.dpatch.conf), environment variableDPEP_KEEPTEMP. When set to1, the temporary working tree is not deleted whendpatch-edit-patchis done. π-t,--tmpdir=valueβ The temporary directory within whichdpatch-edit-patchwill create the working source tree. Configuration variableconf_tmpdir(~/.dpatch.conf), environment variableDPEP_TMPDIR. Should none of the above be set,dpatch-edit-patchwill first attempt to use the environment variableTMPDIR, and will fall back to/tmp. ποΈ-p,--stampdir=valueβ The directory dpatch has used for creating patch stamps. Used for checking if the patch to be edited is already applied to the working tree. Configuration variableconf_stampdir(~/.dpatch.conf), environment variableDPEP_STAMPDIR. Should none of the above be set,dpatch-edit-patchwill fall back todebian/patched. π·οΈ-e,--exclude=valuelistβ A space-separated list of file- and directory names thatdpatch-edit-patchwill exclude from being copied and diffed. Configuration variableconf_exclude(~/.dpatch.conf), environment variableDPEP_EXCLUDE. Defaults to"CVS .svn .git .arch .hg _darcs .bzr"β which might cause you trouble if you use files named like that in your package. π¬-O,--diffopts=valuelistβ Extra options to directly pass todiffas-is. Configuration variableconf_diffopts(~/.dpatch.conf), environment variableDPEP_DIFF_OPTIONS. It is empty by default. π«§-l,--shell=shellβ Tellsdpatch-edit-patchwhich shell to invoke. Configuration variableconf_shell(~/.dpatch.conf), environment variableDPEP_SHELL, defaulting to$SHELLand the user's default shell. π-n,--notimestampβ Tellsdpatch-edit-patchto remove timestamps from the diffs it generates. Can also be set indebian/patches/00options, with theDPEP_OMIT_TIMESTAMPSvariable. β°-0,--add2listβ add the new patch to the00listfile. π-a,--applyallβ apply all available patches. π₯
to be continued, bestie β more of this page is coming π
β¨ EXAMPLES β¨ π
Real talk, examples are where it all clicks, so here's the whole vibe in action π
πΈ Create a new patch to be applied after an existing patch πΈ
Okay so bestie, you wanna make a brand new patch that sits on top of an existing one, 90_ctrlkeyfix. Here's literally exactly how that goes:
$ dpatch-edit-patch patch 95_newupstreamfix 90_ctrlkeyfix
dpatch-edit-patch: * debian/patches/95_newupstreamfix.dpatch does not exist, it will be created as a new dpatch.
dpatch-edit-patch: * Cleaning /home/david/temp/sopwith-1.6.0
...
dpatch-edit-patch: * Applying patches
dpatch-edit-patch: ** Applying patch 90_ctrlkeyfix ... applied cleanly.
dpatch-edit-patch: * Copying /home/david/temp/sopwith-1.6.0 to work directory.
...
$ editor files
$ exit 0
dpatch-edit-patch: * Creating new patch debian/patches/95_newupstreamfix.dpatch
dpatch-edit-patch: Warning: debian/patches/00template does not exist, using hardcoded default.
dpatch-edit-patch: debian/patches/95_newupstreamfix.dpatch created.
See how it announces the new patch doesn't exist yet and is like "it will be created as a new dpatch"? Iconic. Then it cleans, applies your base patch, copies stuff to the work dir, and you get to go in with your editor, do your thing, and exit 0. Boom, new patch, created. π¦
π¦ Create a new patch not depending on existing patches π¦
Now if you want a patch that gets applied before any other patches (or, same energy, a patch that genuinely doesn't need anything else applied first), you just skip the base-patch argument entirely:
$ dpatch-edit-patch 10_debianstrings
dpatch-edit-patch: * debian/patches/10_debianstrings.dpatch does not exist, it will be created as a new dpatch.
dpatch-edit-patch: * Cleaning /home/david/temp/sopwith-1.6.0
...
dpatch-edit-patch: Warning: * No base-patch supplied, not applying any patches.
dpatch-edit-patch: * Copying /home/david/temp/sopwith-1.6.0 to work directory.
...
$ editor files
$ exit 0
...
dpatch-edit-patch: * Creating new patch debian/patches/10_debianstrings.dpatch
dpatch-edit-patch: Warning: debian/patches/00template does not exist, using hardcoded default.
dpatch-edit-patch: debian/patches/10_debianstrings.dpatch created.
Notice that little heads-up β Warning: * No base-patch supplied, not applying any patches. β that's just it being honest with you, no cap. Same deal otherwise: edit, exit 0, patch gets made. β¨
π Edit an existing patch π
And finally, the glow-up scenario: there's already a patch, and you just wanna tweak it.
$ dpatch-edit-patch 10_debianstrings
dpatch-edit-patch: * debian/patches/10_debianstrings.dpatch exists, this patch will be updated.
dpatch-edit-patch: * Cleaning /home/david/temp/sopwith-1.6.0
...
dpatch-edit-patch: * Applying patches
dpatch-edit-patch: * Copying /home/david/temp/sopwith-1.6.0 to work directory.
dpatch-edit-patch: * Applying current 10_debianstrings for editing.
...
$ editor files
$ exit 0
dpatch-edit-patch: Updating patch debian/patches/10_debianstrings.dpatch
dpatch-edit-patch: @DPATCH@ tag found, preserving dpatch header.
dpatch-edit-patch: debian/patches/10_debianstrings.dpatch updated.
It tells you the patch exists and "this patch will be updated", applies the current one so you're editing on top of what's already there, and when you're done it keeps your dpatch header intact because it found that @DPATCH@ tag. Chef's kiss. π
π NOTES π
Okay, the fine print, but make it cute:
dpatch-edit-patch uses the DEBFULLNAME environment variable as the author's name. If it's unset, the author name is just left blank. Ngl, set it. π
For new patches, dpatch-edit-patch figures out the author's email address like this:
- If the
DEBEMAILenvironment variable exists, it is always used. Periodt. - If the
EMAILenvironment variable exists, it gets used wheneverDEBEMAILdoesn't exist. - And if neither of those first two worked out? The email gets constructed from the login name of the user running
dpatch-edit-patch, combined with the output ofhostname -f.
Heads up, this part matters: when dpatch-edit-patch sets up a reference or a working directory, it dereferences all symlinks in the source. That means relative links keep working, and it means changes land on a single file rather than on both the linked file and the link target. But β and this is the dramatic part β if you run dpatch-edit-patch on source trees that have symbolic links, you might end up with a patch that is unapplyable to the original tree. π So like, be aware.
Lowkey a trap. Highkey worth knowing before you ship.
π FILES π
debian/patches/00dpatch.conf~/.dpatch.conf
π SEE ALSO π
Go read these too, bestie, they're the whole friend group:
Also, files live in /usr/share/doc/dpatch/ π
π AUTHOR π
This manual page was written by David B. Harris <david@eelf.ddts.net> and modified in the course of development by Gergely Nagy <algernon@debian.org>, Marc Haber <mh+debian-packages@zugschlus.de>, Stefano Zacchiroli <zack@debian.org>, and Junichi Uekawa <dancer@debian.org>.
That's the whole page, bestie!! π This one came from the DPATCH source, dated 23 Oct 2011, and it's DPATCH-EDIT-PATCH(1) β go forth and make beautiful patches. Slay. β¨π
π¦
π¦ where this page comes from
- ubuntu jammy: dpatch 2.0.41 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms