[debrepatch] 01/01: debpatch: Add a man page and tweak some docstrings
Ximin Luo
infinity0 at debian.org
Fri Nov 25 17:39:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository debrepatch.
commit 52d75b377dc8b1bc2ae452c7a62fbf08466c32a3
Author: Ximin Luo <infinity0 at debian.org>
Date: Fri Nov 25 18:02:25 2016 +0100
debpatch: Add a man page and tweak some docstrings
---
debpatch | 30 ++++++++++++-----
debpatch.1 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 130 insertions(+), 8 deletions(-)
diff --git a/debpatch b/debpatch
index 71b410d..fd861e3 100755
--- a/debpatch
+++ b/debpatch
@@ -1,7 +1,20 @@
#!/usr/bin/python3
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# See file /usr/share/common-licenses/GPL-3 for more details.
+#
"""
-Apply a debdiff, but more smartly to avoid conflicts
-Specifically, it's smarter in how it applies updates to d/changelog.
+Apply a debdiff to a Debian source package.
+
+It handles d/changelog hunks specially, to avoid conflicts.
Depends on dpkg-dev, devscripts, python3-unidiff, quilt.
"""
@@ -189,18 +202,18 @@ def debpatch(patch, patch_name, args):
print(new_version)
return
- if args.interactive:
+ if args.repl:
import code
code.interact(local=locals())
def main(args):
parser = argparse.ArgumentParser(
- description='Apply a debdiff, but more smartly to avoid conflicts.')
+ description='Apply a debdiff to a Debian source package')
parser.add_argument('-v', '--verbose', action="store_true",
help='Output more information')
parser.add_argument('-c', '--changelog', default='debian/changelog',
help='Path to debian/changelog; default: %(default)s')
- parser.add_argument('-i', '--interactive', action="store_true",
+ parser.add_argument('--repl', action="store_true",
help="Run the python REPL after processing.")
parser.add_argument('--source-version', action="store_true",
help="Don't apply the patch; instead print out the version of the "
@@ -209,7 +222,7 @@ def main(args):
parser.add_argument('--target-version', action="store_true",
help="Don't apply the patch; instead print out the new version of the "
"package debpatch(1) would generate, when the patch is applied to the "
- "the given target package specified by the other arguments.")
+ "the given target package, as specified by the other arguments.")
parser.add_argument('orig_dsc_or_dir', nargs='?', default=".",
help="Target to apply the patch to. This can either be an unpacked "
"source tree, or a .dsc file. In the former case, the directory is "
@@ -226,8 +239,9 @@ def main(args):
help="If the building of the new source package fails, try to refresh "
"patches using quilt(1) then try building it again.")
group1.add_argument('-d', '--directory', default=None,
- help="Extract the .dsc into this directory. If not given, then it will "
- "be extracted to a temporary directory.")
+ help="Extract the .dsc into this directory, which won't be cleaned up "
+ "after debpatch(1) exits. If not given, then it will be extracted to a "
+ "temporary directory.")
args = parser.parse_args(args)
#print(args)
diff --git a/debpatch.1 b/debpatch.1
new file mode 100644
index 0000000..8af6fb7
--- /dev/null
+++ b/debpatch.1
@@ -0,0 +1,108 @@
+.\" Copyright (c) 2016, Ximin Luo <infinity0 at debian.org>
+.\"
+.\" This program is free software; you can redistribute it and/or
+.\" modify it under the terms of the GNU General Public License
+.\" as published by the Free Software Foundation; either version 3
+.\" of the License, or (at your option) any later version.
+.\"
+.\" This program is distributed in the hope that it will be useful,
+.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
+.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.\" GNU General Public License for more details.
+.\"
+.\" See file /usr/share/common-licenses/GPL-3 for more details.
+.\"
+.TH DEBPATCH 1 "Debian Utilities" "DEBIAN"
+
+.SH NAME
+debpatch \- apply a debdiff to a Debian source package
+
+.SH SYNOPSIS
+.B debpatch
+[options] [orig_dsc_or_dir] [patch_file]
+.br
+.B debpatch
+[options] < [patch_file]
+
+.SH DESCRIPTION
+.B debpatch
+takes a \fIpatchfile\fR that describes the differences between two Debian
+source packages \fIold\fR and \fInew\fR, and applies it to a target Debian
+source package \fIorig\fR.
+.PP
+\fIorig\fR could either be the same as \fIold\fR or it could be different.
+\fIpatchfile\fR is expected to be a unified diff between two Debian source
+trees, as what
+.BR debdiff (1)
+normally generates.
+.PP
+Any changes to \fIdebian/changelog\fR are dealt with specially, to avoid the
+conflicts that changelog diffs typically produce when applied naively. The
+exact behaviour may be tweaked in the future, so one should not rely on it.
+.PP
+If \fIpatchfile\fR does not apply to \fIorig\fR, even after the special-casing
+of \fIdebian/changelog\fR, no changes are made and
+.BR debpatch (1)
+will exit with a non-zero error code.
+
+.SH ARGUMENTS
+.TP
+orig_dsc_or_dir
+Target to apply the patch to. This can either be an unpacked source tree, or a
+\[char46]dsc file. In the former case, the directory is modified in\-place; in
+the latter case, a second .dsc is created. Default: \fI.\fP
+.TP
+patch_file
+Patch file to apply, in the format output by
+.BR debdiff (1).
+Default:
+\fI\,/dev/stdin\/\fP
+
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+show this help message and exit
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Output more information
+.TP
+\fB\-c\fR CHANGELOG, \fB\-\-changelog\fR CHANGELOG
+Path to debian/changelog; default: debian/changelog
+.TP
+\fB\-\-repl\fR
+Run the python REPL after processing.
+.TP
+\fB\-\-source\-version\fR
+Don't apply the patch; instead print out the version of the package that it is
+supposed to be applied to, or nothing if the patch does not specify a source
+version.
+.TP
+\fB\-\-target\-version\fR
+Don't apply the patch; instead print out the new version of the package
+.BR debpatch (1)
+would generate, when the patch is applied to the the given target
+package, as specified by the other arguments.
+.SS "For .dsc patch targets:"
+.TP
+\fB\-\-no\-clean\fR
+Don't clean temporary directories after a failure, so you can examine what
+failed.
+.TP
+\fB\-\-quilt\-refresh\fR
+If the building of the new source package fails, try to refresh patches using
+.BR quilt (1)
+then try building it again.
+.TP
+\fB\-d\fR DIRECTORY, \fB\-\-directory\fR DIRECTORY
+Extract the .dsc into this directory, which won't be cleaned up after
+.BR debpatch (1)
+exits. If not given, then it will be extracted to a temporary directory.
+
+.SH AUTHORS
+\fBdebpatch\fR and this manual page were written by Ximin Luo
+<infinity0 at debian.org>
+.PP
+Both are released under the GNU General Public License, version 3 or later.
+
+.SH SEE ALSO
+.BR debdiff (1)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debrepatch.git
More information about the Reproducible-commits
mailing list