Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/varnish/files/, www-servers/varnish/
Date: Mon, 19 Feb 2018 17:11:19
Message-Id: 1519060270.79f6deae86e2473c9db7922e6be38c485c27ad97.blueness@gentoo
1 commit: 79f6deae86e2473c9db7922e6be38c485c27ad97
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 19 17:10:38 2018 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 19 17:11:10 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79f6deae
7
8 www-servers/varnish: fix bug #647984
9
10 Package-Manager: Portage-2.3.19, Repoman-2.3.6
11
12 .../varnish/files/varnish-5.2.0-fix-import.patch | 66 ++++++++++++++++++++++
13 ...arnish-5.2.0.ebuild => varnish-5.2.0-r1.ebuild} | 2 +
14 2 files changed, 68 insertions(+)
15
16 diff --git a/www-servers/varnish/files/varnish-5.2.0-fix-import.patch b/www-servers/varnish/files/varnish-5.2.0-fix-import.patch
17 new file mode 100644
18 index 00000000000..f83385a3f8e
19 --- /dev/null
20 +++ b/www-servers/varnish/files/varnish-5.2.0-fix-import.patch
21 @@ -0,0 +1,66 @@
22 +From 17c92e43fda114bf5341e51d752e882238b8fe8c Mon Sep 17 00:00:00 2001
23 +From: Nils Goroll <nils.goroll@×××××.de>
24 +Date: Thu, 5 Oct 2017 13:39:23 +0200
25 +Subject: [PATCH] hack up vsctool to work with python 2 and 3
26 +
27 +StringIO does not exist any more in python3, yet requiring 2.7 would
28 +not pave the path forward, so try to be compatible with both.
29 +
30 +Works for me on Python 2.7.9 and Python 3.4
31 +
32 +I would appreciate if someone more fluent in serpentinous programming
33 +language reviewed and/or rewrote this.
34 +---
35 + lib/libvcc/vsctool.py | 24 ++++++++++++++++++++----
36 + 1 file changed, 20 insertions(+), 4 deletions(-)
37 +
38 +diff --git a/lib/libvcc/vsctool.py b/lib/libvcc/vsctool.py
39 +index 854968e3b..829c6e518 100644
40 +--- a/lib/libvcc/vsctool.py
41 ++++ b/lib/libvcc/vsctool.py
42 +@@ -37,7 +37,10 @@
43 + import json
44 + import sys
45 + import gzip
46 +-import StringIO
47 ++try:
48 ++ import StringIO
49 ++except ImportError:
50 ++ import io
51 + import collections
52 + import struct
53 +
54 +@@ -54,9 +57,22 @@
55 + "format": [ "integer", FORMATS],
56 + }
57 +
58 ++# http://python3porting.com/problems.html#bytes-strings-and-unicode
59 ++if sys.version_info < (3,):
60 ++ def b(x):
61 ++ return x
62 ++else:
63 ++ import codecs
64 ++ def b(x):
65 ++ return codecs.latin_1_encode(x)[0]
66 ++
67 + def gzip_str(s):
68 +- out = StringIO.StringIO()
69 +- gzip.GzipFile(fileobj=out, mode="w").write(s)
70 ++ try:
71 ++ out = StringIO.StringIO()
72 ++ except NameError:
73 ++ out = io.BytesIO()
74 ++
75 ++ gzip.GzipFile(fileobj=out, mode="w").write(b(s))
76 + out.seek(4)
77 + out.write(struct.pack("<L", 0x12bfd58))
78 + return out.getvalue()
79 +@@ -285,7 +301,7 @@ class rst_vsc(directive):
80 + def __init__(self, s):
81 + super(rst_vsc, self).__init__(s)
82 +
83 +- for i,v in PARAMS.iteritems():
84 ++ for i,v in PARAMS.items():
85 + if v is not True:
86 + self.do_default(i, v[0], v[1])
87 +
88
89 diff --git a/www-servers/varnish/varnish-5.2.0.ebuild b/www-servers/varnish/varnish-5.2.0-r1.ebuild
90 similarity index 97%
91 rename from www-servers/varnish/varnish-5.2.0.ebuild
92 rename to www-servers/varnish/varnish-5.2.0-r1.ebuild
93 index 13a77002584..e1b07932b6d 100644
94 --- a/www-servers/varnish/varnish-5.2.0.ebuild
95 +++ b/www-servers/varnish/varnish-5.2.0-r1.ebuild
96 @@ -53,6 +53,8 @@ src_prepare() {
97 # the original location
98 ln -sf ../varnish.m4 m4/varnish.m4
99
100 + eapply "${FILESDIR}"/"${P}"-fix-import.patch
101 +
102 eapply_user
103
104 eautoreconf