1 |
commit: 9dca59fef3c9605b7a3a419bdd53d8be11fc947c |
2 |
Author: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 26 17:36:22 2020 +0000 |
4 |
Commit: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 26 17:37:34 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9dca59fe |
7 |
|
8 |
app-portage/distpatch: python3 support. drop python2. bug #694576 |
9 |
|
10 |
Package-Manager: Portage-2.3.79, Repoman-2.3.16 |
11 |
Signed-off-by: Rafael Martins <rafaelmartins <AT> gentoo.org> |
12 |
|
13 |
...h-0.1.2-r1.ebuild => distpatch-0.1.2-r2.ebuild} | 13 +- |
14 |
.../files/distpatch-python3-support.patch | 420 +++++++++++++++++++++ |
15 |
2 files changed, 427 insertions(+), 6 deletions(-) |
16 |
|
17 |
diff --git a/app-portage/distpatch/distpatch-0.1.2-r1.ebuild b/app-portage/distpatch/distpatch-0.1.2-r2.ebuild |
18 |
similarity index 73% |
19 |
rename from app-portage/distpatch/distpatch-0.1.2-r1.ebuild |
20 |
rename to app-portage/distpatch/distpatch-0.1.2-r2.ebuild |
21 |
index f54a6163105..1a7f003bbd1 100644 |
22 |
--- a/app-portage/distpatch/distpatch-0.1.2-r1.ebuild |
23 |
+++ b/app-portage/distpatch/distpatch-0.1.2-r2.ebuild |
24 |
@@ -1,9 +1,10 @@ |
25 |
-# Copyright 1999-2018 Gentoo Foundation |
26 |
+# Copyright 1999-2020 Gentoo Authors |
27 |
# Distributed under the terms of the GNU General Public License v2 |
28 |
|
29 |
-EAPI=6 |
30 |
+EAPI=7 |
31 |
|
32 |
-PYTHON_COMPAT=( python2_7 ) |
33 |
+PYTHON_COMPAT=( python3_{6,7} ) |
34 |
+DISTUTILS_USE_SETUPTOOLS=bdepend |
35 |
|
36 |
inherit distutils-r1 |
37 |
|
38 |
@@ -16,10 +17,10 @@ SLOT="0" |
39 |
KEYWORDS="~amd64 ~x86" |
40 |
IUSE="" |
41 |
|
42 |
-CDEPEND=" |
43 |
+PATCHES=( "${FILESDIR}/${PN}-python3-support.patch" ) |
44 |
+ |
45 |
+DEPEND=" |
46 |
>=sys-apps/portage-2.1.8.3[${PYTHON_USEDEP}] |
47 |
dev-python/snakeoil[${PYTHON_USEDEP}]" |
48 |
-DEPEND="${CDEPEND} |
49 |
- dev-python/setuptools[${PYTHON_USEDEP}]" |
50 |
RDEPEND="${CDEPEND} |
51 |
>=dev-util/diffball-1.0.1" |
52 |
|
53 |
diff --git a/app-portage/distpatch/files/distpatch-python3-support.patch b/app-portage/distpatch/files/distpatch-python3-support.patch |
54 |
new file mode 100644 |
55 |
index 00000000000..eec335633d7 |
56 |
--- /dev/null |
57 |
+++ b/app-portage/distpatch/files/distpatch-python3-support.patch |
58 |
@@ -0,0 +1,420 @@ |
59 |
+From 0274956acf4479b7346ac441fe09f2e56d575c47 Mon Sep 17 00:00:00 2001 |
60 |
+From: "Rafael G. Martins" <rafael@×××××××××××××××××.br> |
61 |
+Date: Wed, 26 Feb 2020 18:22:06 +0100 |
62 |
+Subject: [PATCH] python3 support |
63 |
+ |
64 |
+--- |
65 |
+ distdiffer | 46 ++++++++++++++++++++++---------------------- |
66 |
+ distpatch/chksums.py | 12 ++++++------ |
67 |
+ distpatch/deltadb.py | 4 ++-- |
68 |
+ distpatch/diff.py | 12 ++++++------ |
69 |
+ distpatch/package.py | 6 +++--- |
70 |
+ distpatch/patch.py | 4 ++-- |
71 |
+ distpatch/stats.py | 6 +++--- |
72 |
+ distpatcher | 32 +++++++++++++++--------------- |
73 |
+ distpatchq | 28 +++++++++++++-------------- |
74 |
+ 9 files changed, 75 insertions(+), 75 deletions(-) |
75 |
+ |
76 |
+diff --git a/distdiffer b/distdiffer |
77 |
+index a2b933d..6975b5c 100755 |
78 |
+--- a/distdiffer |
79 |
++++ b/distdiffer |
80 |
+@@ -73,39 +73,39 @@ def main(): |
81 |
+ return |
82 |
+ |
83 |
+ if args.verbose: |
84 |
+- print '>>> Starting distdiffer ...\n' |
85 |
++ print('>>> Starting distdiffer ...\n') |
86 |
+ |
87 |
+ for package in packages: |
88 |
+ if args.verbose: |
89 |
+- print '>>> Package: %s' % package |
90 |
++ print('>>> Package: %s' % package) |
91 |
+ pkg = Package(db) |
92 |
+ try: |
93 |
+ pkg.diff(package) |
94 |
+- except Exception, err: |
95 |
+- print >> sys.stderr, str(err) |
96 |
++ except Exception as err: |
97 |
++ print(str(err), file=sys.stderr) |
98 |
+ if args.verbose: |
99 |
+- print ' >>> Versions:' |
100 |
++ print(' >>> Versions:') |
101 |
+ for cpv in pkg.ebuilds: |
102 |
+- print ' %s' % cpv |
103 |
+- print ' >>> Deltas:' |
104 |
++ print(' %s' % cpv) |
105 |
++ print(' >>> Deltas:') |
106 |
+ if len(pkg.diffs) == 0: |
107 |
+- print ' None\n' |
108 |
++ print(' None\n') |
109 |
+ else: |
110 |
+ for diff in pkg.diffs: |
111 |
+- print ' %s -> %s' % (diff.src.fname, |
112 |
+- diff.dest.fname) |
113 |
++ print(' %s -> %s' % (diff.src.fname, |
114 |
++ diff.dest.fname)) |
115 |
+ if len(pkg.diffs) == 0: |
116 |
+ continue |
117 |
+ if args.verbose: |
118 |
+- print ' >>> Fetching distfiles:' |
119 |
++ print(' >>> Fetching distfiles:') |
120 |
+ try: |
121 |
+ pkg.fetch_distfiles() |
122 |
+- except Exception, err: |
123 |
+- print >> sys.stderr, str(err) |
124 |
+- print |
125 |
++ except Exception as err: |
126 |
++ print(str(err), file=sys.stderr) |
127 |
++ print() |
128 |
+ continue |
129 |
+ if args.verbose: |
130 |
+- print ' >>> Generating deltas:' |
131 |
++ print(' >>> Generating deltas:') |
132 |
+ for diff in pkg.diffs: |
133 |
+ if args.verbose: |
134 |
+ sys.stdout.write(' %s -> %s ... ' % (diff.src.fname, |
135 |
+@@ -116,20 +116,20 @@ def main(): |
136 |
+ not args.no_compress, args.force) |
137 |
+ except DiffExists: |
138 |
+ if args.verbose: |
139 |
+- print 'up2date!' |
140 |
+- print ' %s' % os.path.basename(diff.diff_file) |
141 |
+- except Exception, err: |
142 |
++ print('up2date!') |
143 |
++ print(' %s' % os.path.basename(diff.diff_file)) |
144 |
++ except Exception as err: |
145 |
+ if args.verbose: |
146 |
+- print 'failed!' |
147 |
+- print ' %s: %s' % (err.__class__.__name__, str(err)) |
148 |
++ print('failed!') |
149 |
++ print(' %s: %s' % (err.__class__.__name__, str(err))) |
150 |
+ else: |
151 |
+ if args.verbose: |
152 |
+- print 'done!' |
153 |
+- print ' %s' % os.path.basename(diff.diff_file) |
154 |
++ print('done!') |
155 |
++ print(' %s' % os.path.basename(diff.diff_file)) |
156 |
+ db.add(diff.dbrecord) |
157 |
+ diff.cleanup() |
158 |
+ if args.verbose: |
159 |
+- print |
160 |
++ print() |
161 |
+ |
162 |
+ if __name__ == '__main__': |
163 |
+ main() |
164 |
+diff --git a/distpatch/chksums.py b/distpatch/chksums.py |
165 |
+index 808dc59..d3dffab 100644 |
166 |
+--- a/distpatch/chksums.py |
167 |
++++ b/distpatch/chksums.py |
168 |
+@@ -26,16 +26,16 @@ class ChksumValue(object): |
169 |
+ self._handler = get_handler(algorithm) |
170 |
+ |
171 |
+ def to_str(self): |
172 |
+- if isinstance(self.value, basestring): |
173 |
++ if isinstance(self.value, str): |
174 |
+ return self.value |
175 |
+- elif isinstance(self.value, long): |
176 |
++ elif isinstance(self.value, int): |
177 |
+ return self._handler.long2str(self.value) |
178 |
+ raise ChksumException('Invalid value: %s' % self.value) |
179 |
+ |
180 |
+ def to_long(self): |
181 |
+- if isinstance(self.value, long): |
182 |
++ if isinstance(self.value, int): |
183 |
+ return self.value |
184 |
+- elif isinstance(self.value, basestring): |
185 |
++ elif isinstance(self.value, str): |
186 |
+ return self._handler.str2long(self.value) |
187 |
+ raise ChksumException('Invalid value: %s' % self.value) |
188 |
+ |
189 |
+@@ -69,11 +69,11 @@ class Chksum(object): |
190 |
+ raise ChksumException('File not found: %s' % fname) |
191 |
+ |
192 |
+ values = get_chksums(fname, *self.algorithms) |
193 |
+- chksums = zip(self.algorithms, values) |
194 |
++ chksums = list(zip(self.algorithms, values)) |
195 |
+ |
196 |
+ # if provided checksums, use them |
197 |
+ else: |
198 |
+- chksums = chksums.items() |
199 |
++ chksums = list(chksums.items()) |
200 |
+ |
201 |
+ # validate checksums, and set attributes |
202 |
+ tmp_algorithms = list(self.algorithms) |
203 |
+diff --git a/distpatch/deltadb.py b/distpatch/deltadb.py |
204 |
+index 77d8c21..345077d 100644 |
205 |
+--- a/distpatch/deltadb.py |
206 |
++++ b/distpatch/deltadb.py |
207 |
+@@ -40,7 +40,7 @@ import os |
208 |
+ |
209 |
+ from collections import OrderedDict |
210 |
+ from fcntl import lockf, LOCK_EX, LOCK_UN |
211 |
+-from itertools import izip |
212 |
++ |
213 |
+ from shutil import rmtree |
214 |
+ from snakeoil.chksum import get_handler |
215 |
+ from snakeoil.fileutils import AtomicWriteFile |
216 |
+@@ -171,7 +171,7 @@ class DeltaDB(list): |
217 |
+ pieces = line.split() |
218 |
+ chksums = OrderedDict() |
219 |
+ uchksums = OrderedDict() |
220 |
+- for key, value in izip(pieces[::2], pieces[1::2]): |
221 |
++ for key, value in zip(pieces[::2], pieces[1::2]): |
222 |
+ key = key.lower()[:] |
223 |
+ mykey = key[0] == 'u' and key[1:] or key |
224 |
+ myvalue = get_handler(mykey).str2long(value.strip()) |
225 |
+diff --git a/distpatch/diff.py b/distpatch/diff.py |
226 |
+index d5818f1..eeaf8a6 100644 |
227 |
+--- a/distpatch/diff.py |
228 |
++++ b/distpatch/diff.py |
229 |
+@@ -37,11 +37,11 @@ class DiffUnsupported(Exception): |
230 |
+ |
231 |
+ |
232 |
+ _supported_formats = [ |
233 |
+- u'.tar', |
234 |
+- u'.tar.gz', u'.tgz', u'.gz', |
235 |
+- u'.tar.bz2', u'.tbz2', u'.bz2', |
236 |
+- u'.tar.xz', u'.xz', |
237 |
+- u'.tar.lzma', u'.ĺzma', |
238 |
++ '.tar', |
239 |
++ '.tar.gz', '.tgz', '.gz', |
240 |
++ '.tar.bz2', '.tbz2', '.bz2', |
241 |
++ '.tar.xz', '.xz', |
242 |
++ '.tar.lzma', '.ĺzma', |
243 |
+ ] |
244 |
+ |
245 |
+ |
246 |
+@@ -152,7 +152,7 @@ class Diff(object): |
247 |
+ try: |
248 |
+ patch = Patch(self.dbrecord) |
249 |
+ patch.reconstruct(output_dir, tmp_dir, False) |
250 |
+- except PatchException, err: |
251 |
++ except PatchException as err: |
252 |
+ if clean_sources: |
253 |
+ os.unlink(self.diff_file) |
254 |
+ raise DiffException('Delta reconstruction failed: %s' % str(err)) |
255 |
+diff --git a/distpatch/package.py b/distpatch/package.py |
256 |
+index 553fc18..3c834cc 100644 |
257 |
+--- a/distpatch/package.py |
258 |
++++ b/distpatch/package.py |
259 |
+@@ -35,17 +35,17 @@ class Package(object): |
260 |
+ diffs = [] |
261 |
+ taken = {} |
262 |
+ for ebuild_id in range(len(self.ebuilds) - 1): |
263 |
+- cpvs = self.ebuilds.keys() |
264 |
++ cpvs = list(self.ebuilds.keys()) |
265 |
+ src_cpv = cpvs[ebuild_id] |
266 |
+ dest_cpv = cpvs[ebuild_id + 1] |
267 |
+ src_ebuild = self.ebuilds[src_cpv] |
268 |
+ dest_ebuild = self.ebuilds[dest_cpv] |
269 |
+- for src_distfile in src_ebuild.src_uri_map.keys(): |
270 |
++ for src_distfile in list(src_ebuild.src_uri_map.keys()): |
271 |
+ avg_distfile = None |
272 |
+ avg_ebuild = None |
273 |
+ max_avg = 0.0 |
274 |
+ avgs = {} |
275 |
+- for dest_distfile in dest_ebuild.src_uri_map.keys(): |
276 |
++ for dest_distfile in list(dest_ebuild.src_uri_map.keys()): |
277 |
+ prefix = '' |
278 |
+ suffix = '' |
279 |
+ for i in range(min(len(src_distfile), len(dest_distfile))): |
280 |
+diff --git a/distpatch/patch.py b/distpatch/patch.py |
281 |
+index c210a5e..83eb3d6 100644 |
282 |
+--- a/distpatch/patch.py |
283 |
++++ b/distpatch/patch.py |
284 |
+@@ -14,7 +14,7 @@ import portage |
285 |
+ import posixpath |
286 |
+ import re |
287 |
+ |
288 |
+-from itertools import izip |
289 |
++ |
290 |
+ from portage.package.ebuild.fetch import fetch |
291 |
+ from shutil import move |
292 |
+ from subprocess import call |
293 |
+@@ -96,7 +96,7 @@ class Patch(object): |
294 |
+ if self.src != DeltaDBFile(src): |
295 |
+ raise PatchException('Bad checksum for source: %s' % \ |
296 |
+ self.src.fname) |
297 |
+- for delta, delta_record in izip(deltas, self.dbrecords): |
298 |
++ for delta, delta_record in zip(deltas, self.dbrecords): |
299 |
+ if delta_record.delta != DeltaDBFile(delta): |
300 |
+ raise PatchException('Bad checksum for delta: %s' % \ |
301 |
+ delta_record.delta.fname) |
302 |
+diff --git a/distpatch/stats.py b/distpatch/stats.py |
303 |
+index 187f926..7716e07 100644 |
304 |
+--- a/distpatch/stats.py |
305 |
++++ b/distpatch/stats.py |
306 |
+@@ -48,7 +48,7 @@ class Stats(object): |
307 |
+ delta = float(record.delta.chksums['size']) |
308 |
+ dest = float(record.dest.chksums['size']) |
309 |
+ ratio.append(100 - ((delta / dest) * 100)) |
310 |
+- pyplot.plot(range(1, len(ratio) + 1), sorted(ratio)) |
311 |
++ pyplot.plot(list(range(1, len(ratio) + 1)), sorted(ratio)) |
312 |
+ pyplot.axes() |
313 |
+ pyplot.xlabel('Deltas (total: %i)' % len(ratio)) |
314 |
+ pyplot.ylabel('Percentage of savings (for compressed files)') |
315 |
+@@ -60,6 +60,6 @@ class Stats(object): |
316 |
+ for record in self.deltadb: |
317 |
+ dest.append(int(record.dest.chksums['size'])) |
318 |
+ delta.append(int(record.delta.chksums['size'])) |
319 |
+- pyplot.plot(range(len(dest)), dest) |
320 |
+- pyplot.plot(range(len(delta)), delta) |
321 |
++ pyplot.plot(list(range(len(dest))), dest) |
322 |
++ pyplot.plot(list(range(len(delta))), delta) |
323 |
+ pyplot.show() |
324 |
+diff --git a/distpatcher b/distpatcher |
325 |
+index 05980e2..984e4c2 100755 |
326 |
+--- a/distpatcher |
327 |
++++ b/distpatcher |
328 |
+@@ -69,35 +69,35 @@ def main(): |
329 |
+ return |
330 |
+ |
331 |
+ if args.verbose: |
332 |
+- print '>>> Starting distpatcher ...\n' |
333 |
++ print('>>> Starting distpatcher ...\n') |
334 |
+ |
335 |
+ for cpv in cpv_list: |
336 |
+ if args.verbose: |
337 |
+ if args.distfile: |
338 |
+- print '>>> Distfile: %s' % cpv |
339 |
++ print('>>> Distfile: %s' % cpv) |
340 |
+ else: |
341 |
+- print '>>> CPV: %s' % cpv |
342 |
++ print('>>> CPV: %s' % cpv) |
343 |
+ pkg = Package(db) |
344 |
+ if args.distfile: |
345 |
+ pkg.patch_distfile(cpv, args.output_dir) |
346 |
+ else: |
347 |
+ pkg.patch(cpv, args.output_dir) |
348 |
+ if args.verbose: |
349 |
+- print ' >>> Deltas:' |
350 |
++ print(' >>> Deltas:') |
351 |
+ if len(pkg.patches) == 0: |
352 |
+- print ' None\n' |
353 |
++ print(' None\n') |
354 |
+ else: |
355 |
+ for patch in pkg.patches: |
356 |
+- print ' %s' % '\n -> '.join( |
357 |
+- [i.delta.fname for i in patch.dbrecords]) |
358 |
++ print(' %s' % '\n -> '.join( |
359 |
++ [i.delta.fname for i in patch.dbrecords])) |
360 |
+ if len(pkg.patches) == 0: |
361 |
+ continue |
362 |
+ if args.verbose: |
363 |
+- print ' >>> Fetching deltas:' |
364 |
++ print(' >>> Fetching deltas:') |
365 |
+ for patch in pkg.patches: |
366 |
+ patch.fetch_deltas(args.root_url, args.input_dir) |
367 |
+ if args.verbose: |
368 |
+- print ' >>> Reconstructing distfiles:' |
369 |
++ print(' >>> Reconstructing distfiles:') |
370 |
+ for patch in pkg.patches: |
371 |
+ if args.verbose: |
372 |
+ sys.stdout.write(' %s ... ' % '\n -> '.join( |
373 |
+@@ -106,17 +106,17 @@ def main(): |
374 |
+ try: |
375 |
+ patch.reconstruct(args.input_dir, args.output_dir, |
376 |
+ not args.no_compress) |
377 |
+- except PatchException, err: |
378 |
++ except PatchException as err: |
379 |
+ if args.verbose: |
380 |
+- print 'failed!' |
381 |
+- print ' %s' % str(err) |
382 |
++ print('failed!') |
383 |
++ print(' %s' % str(err)) |
384 |
+ else: |
385 |
+ if args.verbose: |
386 |
+- print 'done!' |
387 |
+- print ' %s' % \ |
388 |
+- os.path.basename(patch.dest.fname) |
389 |
++ print('done!') |
390 |
++ print(' %s' % \ |
391 |
++ os.path.basename(patch.dest.fname)) |
392 |
+ if args.verbose: |
393 |
+- print |
394 |
++ print() |
395 |
+ |
396 |
+ if __name__ == '__main__': |
397 |
+ main() |
398 |
+diff --git a/distpatchq b/distpatchq |
399 |
+index 902f6c0..e6bcebe 100755 |
400 |
+--- a/distpatchq |
401 |
++++ b/distpatchq |
402 |
+@@ -48,7 +48,7 @@ def delta_fetch_size(pkg, filename, distfiles_dir=None, deltas_dir=None): |
403 |
+ except OSError: |
404 |
+ pass |
405 |
+ if filename in distfiles: |
406 |
+- print 0 |
407 |
++ print(0) |
408 |
+ return 0 |
409 |
+ pkg.patch_distfile(filename, distfiles_dir) |
410 |
+ if len(pkg.patches) == 0: |
411 |
+@@ -62,7 +62,7 @@ def delta_fetch_size(pkg, filename, distfiles_dir=None, deltas_dir=None): |
412 |
+ if dbrecord.delta.fname in deltas: |
413 |
+ continue |
414 |
+ fetch_size += int(dbrecord.delta.chksums.size.to_long()) |
415 |
+- print fetch_size |
416 |
++ print(fetch_size) |
417 |
+ |
418 |
+ |
419 |
+ def delta_verify_checksums(pkg, filename, distfiles_dir=None): |
420 |
+@@ -96,20 +96,20 @@ def delta_verify_checksums(pkg, filename, distfiles_dir=None): |
421 |
+ return 0 if dest_record.uchksums == _Chksum(usrc) else 4 |
422 |
+ |
423 |
+ |
424 |
+-commands = sorted(i for i in globals().keys() if not i.startswith('_')) |
425 |
++commands = sorted(i for i in list(globals().keys()) if not i.startswith('_')) |
426 |
+ |
427 |
+ |
428 |
+ def usage(argv): |
429 |
+- print '>>> distpatch information query tool' |
430 |
+- print '>>> Usage: distpatchq <command> [<option> ...]' |
431 |
+- print |
432 |
+- print 'Available commands:' |
433 |
++ print('>>> distpatch information query tool') |
434 |
++ print('>>> Usage: distpatchq <command> [<option> ...]') |
435 |
++ print() |
436 |
++ print('Available commands:') |
437 |
+ for name in commands: |
438 |
+ function = globals()[name] |
439 |
+ if function.__doc__ is None: |
440 |
+- print ' ' + name |
441 |
+- print ' MISSING DOCUMENTATION!' |
442 |
+- print |
443 |
++ print(' ' + name) |
444 |
++ print(' MISSING DOCUMENTATION!') |
445 |
++ print() |
446 |
+ continue |
447 |
+ |
448 |
+ # introspect command arguments |
449 |
+@@ -120,14 +120,14 @@ def usage(argv): |
450 |
+ args.append('<%s>' % arg) |
451 |
+ for arg in spec.args[-opt:]: |
452 |
+ args.append('[%s]' % arg) |
453 |
+- print ' ' + name + ' ' + ' '.join(args) |
454 |
++ print(' ' + name + ' ' + ' '.join(args)) |
455 |
+ lines = function.__doc__.split('\n') |
456 |
+ if len(argv) > 1: |
457 |
+ for line in lines: |
458 |
+- print " " + line.strip() |
459 |
++ print(" " + line.strip()) |
460 |
+ |
461 |
+ if len(argv) == 1: |
462 |
+- print "\nRun distpatchq with --help for info" |
463 |
++ print("\nRun distpatchq with --help for info") |
464 |
+ |
465 |
+ if __name__ == '__main__': |
466 |
+ if len(_sys.argv) < 2: |
467 |
+@@ -150,7 +150,7 @@ if __name__ == '__main__': |
468 |
+ req = len(spec.args) - opt |
469 |
+ |
470 |
+ if len(_sys.argv) < req + 2: |
471 |
+- print "Invalid number of arguments!!" |
472 |
++ print("Invalid number of arguments!!") |
473 |
+ _sys.exit(2) |
474 |
+ |
475 |
+ dbfile = _sys.argv[2] |
476 |
+-- |
477 |
+2.21.0 |
478 |
+ |