Gentoo Archives: gentoo-commits

From: Jeroen Roovers <jer@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/difffilter/, dev-util/difffilter/files/
Date: Sun, 04 Nov 2018 14:25:15
Message-Id: 1541341505.801371577000187016850e6930f7ace6112166ce.jer@gentoo
1 commit: 801371577000187016850e6930f7ace6112166ce
2 Author: Jeroen Roovers <jer <AT> gentoo <DOT> org>
3 AuthorDate: Sun Nov 4 14:19:24 2018 +0000
4 Commit: Jeroen Roovers <jer <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 4 14:25:05 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80137157
7
8 dev-util/difffilter: Install man page
9
10 Drop USE=doc as that should not be used for manuals
11 Install a pre-"compiled" version of difffilter(1)
12
13 Fixes: https://bugs.gentoo.org/578048
14 Package-Manager: Portage-2.3.51, Repoman-2.3.12
15 Signed-off-by: Jeroen Roovers <jer <AT> gentoo.org>
16
17 dev-util/difffilter/difffilter-0.3.3-r1.ebuild | 26 ++++
18 dev-util/difffilter/files/difffilter-0.3.3.man1 | 194 ++++++++++++++++++++++++
19 dev-util/difffilter/metadata.xml | 3 +
20 3 files changed, 223 insertions(+)
21
22 diff --git a/dev-util/difffilter/difffilter-0.3.3-r1.ebuild b/dev-util/difffilter/difffilter-0.3.3-r1.ebuild
23 new file mode 100644
24 index 00000000000..9a0c0387ec7
25 --- /dev/null
26 +++ b/dev-util/difffilter/difffilter-0.3.3-r1.ebuild
27 @@ -0,0 +1,26 @@
28 +# Copyright 1999-2018 Gentoo Authors
29 +# Distributed under the terms of the GNU General Public License v2
30 +
31 +EAPI=7
32 +
33 +DESCRIPTION="Filter files out of unified diffs using POSIX extended regular expressions"
34 +HOMEPAGE="http://ohnopub.net/~ohnobinki/difffilter/"
35 +SRC_URI="ftp://mirror.ohnopub.net/mirror/${PN}/${P}.tar.bz2"
36 +
37 +LICENSE="GPL-3"
38 +SLOT="0"
39 +KEYWORDS="~amd64 ~x86 ~amd64-linux"
40 +
41 +RDEPEND="
42 + >=dev-libs/liblist-2.3.1
43 + dev-libs/libstrl
44 + dev-libs/tre
45 +"
46 +DEPEND="
47 + ${RDEPEND}
48 +"
49 +
50 +src_install() {
51 + default
52 + newman "${FILESDIR}"/${PN}-0.3.3.man1 ${PN}.1
53 +}
54
55 diff --git a/dev-util/difffilter/files/difffilter-0.3.3.man1 b/dev-util/difffilter/files/difffilter-0.3.3.man1
56 new file mode 100644
57 index 00000000000..ad7a6331827
58 --- /dev/null
59 +++ b/dev-util/difffilter/files/difffilter-0.3.3.man1
60 @@ -0,0 +1,194 @@
61 +.\" Text automatically generated by txt2man
62 +.TH difffilter 1 "04 November 2018" "difffilter 0.3.3" ""
63 +.SH NAME
64 +\fBdifffilter \fP- Filter diffs out of multi-file patches
65 +.SH SYNOPSIS
66 +.nf
67 +.fam C
68 +\fBdifffilter\fP [\fB-U\fP <lines>] [\fB-hv\fP] [--] [\fB-e\fP <regex>] [\fB-a\fP] [\fB-e\fP <regex>] [\fB-x\fP] [\fB-e\fP <regex>] \.\.\.
69 +.fam T
70 +.fi
71 +.fam T
72 +.fi
73 +.SH DESCRIPTION
74 +\fBdifffilter\fP reads in a series of unified-diffs and filters out any file
75 +which matches one of the passed extended regular expressions. The remaining
76 +diffs are written to standard out. \fBdifffilter\fP is a traditional unix filter,
77 +reading input from standard input and writing the results to standard
78 +output.
79 +.PP
80 +If \fBdifffilter\fP encounters a parsing or input reading error, it will exit
81 +after writing an error message to standard output. In such a case,
82 +\fBdifffilter\fP's return value is non-zero. As the parser is not guaranteed to
83 +be perfect and badly-formatted input may be accepted by commands like
84 +\fBpatch\fP(1), it is advised that scripts use error checking on \fBdifffilter\fP.
85 +.SH OPTIONS
86 +.TP
87 +.B
88 +\fB-h\fP
89 +Displays some amount of helpful or unhelpful information which is intended
90 +to be helpful. \fBdifffilter\fP will exit without performing any filtering.
91 +.TP
92 +.B
93 +\fB-v\fP
94 +Displays \fBdifffilter\fP's version information.
95 +.TP
96 +.B
97 +\fB-e\fP BRE
98 +A POSIX Basic Regular Expression which a filename in the input
99 +diff may be matched against. The default action for a matched regex
100 +is to exclude that portion of the diff from the output.
101 +.TP
102 +.B
103 +\fB-E\fP ERE
104 +Like \fB-e\fP but uses a POSIX Extended Regular Expression.
105 +.TP
106 +.B
107 +\fB-a\fP
108 +Any following \fB-e\fP options will cause files which match the regex to
109 +be included in the output diff. This allows one to preserve selected files
110 +which later patterns will exclude. See EXAMPLE for an application.
111 +.TP
112 +.B
113 +\fB-x\fP
114 +Any following \fB-e\fP options will cause files matching the regex to be excluded
115 +from the output diff. This is the default state of difffilter. I.e.,
116 +$ \fBdifffilter\fP \fB-e\fP 'configure$'
117 +has the same functionality of
118 +$ \fBdifffilter\fP \fB-x\fP \fB-e\fP 'configure$' .
119 +.TP
120 +.B
121 +\fB-b\fP
122 +Attempt to make the patch appear as if it were generated using \fBdiff\fP(1)'s \fB-b\fP
123 +option. This is similar to \fB-w\fP but only removes changes involving changes
124 +in the amount of whitespace. This means that completely removing a block of
125 +whitespace or inserting whitespace between two non-whitespace characters
126 +will still be seen as a change. See \fBdiff\fP(1) for more details.
127 +.TP
128 +.B
129 +\fB-k\fP BRE
130 +A POSIX Basic Regular Expression which will be matched against
131 +the name of a CVS keyword whose effect is to be nullified. For example, if
132 +the CVS keyword looks like $Pizza: I'm hungry$, a regex of `hungry' would
133 +not match but a regex of `Pi.*a$' would.
134 +.TP
135 +.B
136 +\fB-K\fP ERE
137 +Like \fB-k\fP but uses a POSIX Extended Regular Expression.
138 +.TP
139 +.B
140 +\fB-R\fP
141 +Reverse the patch. This is intended to recover from accidents when the
142 +sources used to generate a diff are not available but the reverse diff
143 +is.
144 +.TP
145 +.B
146 +\fB-U\fP lines
147 +Reduce the number of lines of context of the diff to the specified
148 +number of lines. Specify \fB-1\fP or a high number to avoid reducing the number
149 +of lines of context. This is set to \fB-1\fP by default. You should set it to 3 in
150 +most cases so that the effects of \fB-k\fP, \fB-b\fP, \fB-w\fP, and other flags can be more useful.
151 +.TP
152 +.B
153 +\fB-w\fP
154 +Attempt to make the patch as if it had been created by \fBdiff\fP(1) with the
155 +\fB-w\fP option. This removes changes from the input diff for which only whitespace
156 +was added or removed.
157 +.SH EXAMPLES
158 +This command should be adequate to filter out many auto-generated
159 +files that don't belong in a Version Control System. This will
160 +filter out files like config.log, config.status, Makefile, and
161 +Makefile.in. It preserves Makefile.am and sourcecode files. Not that
162 +\fB-E\fP is used instead of \fB-e\fP because the command utilizes Extended
163 +Regular Expressions.
164 +.PP
165 +.nf
166 +.fam C
167 + $ difffilter -E '(^|/)config\.(log|status|guess|rpath|sub)$' -E '(^|/)(install-sh|configure|ac(include|local)\.m4|ltmain\.sh|lt[^/]*\.m4)$' -a -E '(^|/)Makefile\.am$' -x -E '(^|/)Makefile' < dirty.patch > clean.patch
168 +
169 +.fam T
170 +.fi
171 +If a dirty patch is submitted to a bugtracker with random whitespace
172 +changes which should be ignored, the patch may be feed through
173 +\fBdifffilter\fP with the \fB-b\fP or \fB-w\fP options. For most cases, \fB-b\fP is more
174 +reasonable -- and is definitely safer than \fB-w\fP. See the CVS keyword
175 +removal example for information on how \fB-U\fP might apply to this
176 +situation.
177 +.PP
178 +.nf
179 +.fam C
180 + $ difffilter -w < bug-34567-dirty.patch > bug-34567-clean.patch
181 +
182 +.fam T
183 +.fi
184 +If you want to see only changes made to a particular file in a
185 +multifile patch, such as README.txt, you may use the \fB-a\fP and \fB-x\fP flags
186 +to effectively invert the normal filtering convention. Any files
187 +which match expressions following an \fB-a\fP will be accepted if that
188 +rule is processed. To revert \fBdifffilter\fP back to its normal mode of
189 +treating expressions as files to discard, use \fB-x\fP. We use an empty
190 +regular expression after the \fB-x\fP because the empty regular expression
191 +matches everything and we want to discard everything but
192 +README.txt. One can also easily modify this example to extract all
193 +changes to \.c$ or \.h$ files.
194 +.PP
195 +.nf
196 +.fam C
197 + $ difffilter -a -e 'README\.txt$' -x -e '' < changes-bigpatch.patch > README.txt-changes.patch
198 +
199 +.fam T
200 +.fi
201 +To nullify diff lines which are caused by changes in CVS keywords'
202 +content, use the \fB-k\fP and \fB-K\fP options. For example, a diff might catch
203 +changes in an $Id: $ line, which is likely to happen when creating
204 +diffs from tarballs, where CVS control files are not available. If
205 +the $Id: $ line has change in the diff meaning that there are two
206 +versions of the $Id: $, the user is likely going to be applying the
207 +diff to the same file which would have a third value for the $Id: $
208 +line. Thus, applying such a patch would be troublesome (depending on
209 +the method of applying it). With \fB-k\fP and \fB-K\fP, we can get
210 +.PP
211 +.nf
212 +.fam C
213 + $ difffilter -k Id < not-from-cvs.patch > not-from-cvs-fixed.patch
214 +
215 + - /* $Id: binki /var/test/etc/rc.conf.RCS 1.1$ */
216 + + /* $Id: mgorny /var/test/etc/rc.conf.RCS 2.1.5.3$ */
217 +
218 +.fam T
219 +.fi
220 +to be nullified. This means that we end up getting rid of the '+'
221 +and '-' lines and end up with a ' ' line:
222 +.PP
223 +.nf
224 +.fam C
225 + /* $Id: binki /var/test/etc/rc.conf.RCS 1.1$ */
226 +
227 +.fam T
228 +.fi
229 +To most effectively avoid such problems, the change should be first
230 +nullified with \fB-k\fP or \fB-K\fP. Then the \fB-U\fP option should be used. The \fB-U\fP
231 +option is used to reduce the number of lines of context a diff may
232 +have. It would be customary to pass the value 3 to this option. If a
233 +certain block or a portion of the diff has a series of 3 or more
234 +null or noop lines, then \fBdifffilter\fP starts removing these. If a
235 +whole block (or chunk, as \fBpatch\fP(1) calls it) contains no changes,
236 +then \fBdifffilter\fP will completely drop that block from the diff. In
237 +many cases, this may completely remove the block, especially when
238 +(as is often the case) the CVS keyword being nullified is a line in
239 +the header comments of a file where actual edits occur infrequently.
240 +.PP
241 +.nf
242 +.fam C
243 + $ difffilter -k Id -U 3 < not-from-cvs.patch > not-from-cvs-fixed.patch
244 +
245 +.fam T
246 +.fi
247 +.SH SEE ALSO
248 +\fBcolordiff\fP(1), \fBdiff\fP(1), \fBpatch\fP(1), \fBhg\fP(1)
249 +.SH BUGS
250 +There are no known bugs.
251 +.PP
252 +There is a bug tracker at http://ohnopub.net/bugzilla/ .
253 +.SH AUTHOR
254 +Nathan Phillip Brink (binki) <ohnobinki@××××××××××××××.net>
255
256 diff --git a/dev-util/difffilter/metadata.xml b/dev-util/difffilter/metadata.xml
257 index 097975e3adc..fed47a35327 100644
258 --- a/dev-util/difffilter/metadata.xml
259 +++ b/dev-util/difffilter/metadata.xml
260 @@ -1,4 +1,7 @@
261 <?xml version="1.0" encoding="UTF-8"?>
262 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
263 <pkgmetadata>
264 +<maintainer type='person'>
265 +<email>jer@g.o</email>
266 +</maintainer>
267 </pkgmetadata>