1 |
commit: 9d6a1f7e23c91cf495479d7d905ebd8713a49953 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 1 21:11:48 2016 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 1 21:12:42 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d6a1f7e |
7 |
|
8 |
sys-fs/s3ql: patch to support Ceph-RGW usage, approved by upstream but not yet released. |
9 |
|
10 |
Package-Manager: portage-2.2.27 |
11 |
|
12 |
sys-fs/s3ql/files/s3ql-2.14-ceph.patch | 75 ++++++++++++++++++++++++++++++++++ |
13 |
sys-fs/s3ql/s3ql-2.14-r1.ebuild | 59 ++++++++++++++++++++++++++ |
14 |
2 files changed, 134 insertions(+) |
15 |
|
16 |
diff --git a/sys-fs/s3ql/files/s3ql-2.14-ceph.patch b/sys-fs/s3ql/files/s3ql-2.14-ceph.patch |
17 |
new file mode 100644 |
18 |
index 0000000..f5b4c3b |
19 |
--- /dev/null |
20 |
+++ b/sys-fs/s3ql/files/s3ql-2.14-ceph.patch |
21 |
@@ -0,0 +1,75 @@ |
22 |
+https://bitbucket.org/nikratio/s3ql/issues/190/sq3l-should-not-rely-on-xmlns-declarations |
23 |
+https://bitbucket.org/nikratio/s3ql/pull-requests/5/s3c-be-more-lenient-about-xml-namespaces |
24 |
+ |
25 |
+--- s3ql-2.14/src/s3ql/backends/s3c.py 2015-07-20 19:41:07.000000000 -0700 |
26 |
++++ s3ql-2.14/src/s3ql/backends/s3c.py 2016-01-21 22:41:33.000000000 -0800 |
27 |
+@@ -126,6 +126,15 @@ |
28 |
+ conn.timeout = int(self.options.get('tcp-timeout', 20)) |
29 |
+ return conn |
30 |
+ |
31 |
++ @staticmethod |
32 |
++ def _tag_xmlns_uri(elem): |
33 |
++ '''Extract the XML namespace (xmlns) URI from an element''' |
34 |
++ if elem.tag[0] == '{': |
35 |
++ uri, ignore, tag = elem.tag[1:].partition("}") |
36 |
++ else: |
37 |
++ uri = None |
38 |
++ return uri |
39 |
++ |
40 |
+ # This method is also used implicitly for the retry handling of |
41 |
+ # `gs.Backend._get_access_token`. When modifying this method, do not forget |
42 |
+ # to check if this makes it unsuitable for use by `_get_access_token` (in |
43 |
+@@ -215,7 +224,6 @@ |
44 |
+ keys_remaining = True |
45 |
+ marker = self.prefix + start_after |
46 |
+ prefix = self.prefix + prefix |
47 |
+- ns_p = self.xml_ns_prefix |
48 |
+ |
49 |
+ while keys_remaining: |
50 |
+ log.debug('requesting with marker=%s', marker) |
51 |
+@@ -232,16 +240,27 @@ |
52 |
+ try: |
53 |
+ itree = iter(ElementTree.iterparse(self.conn, events=("start", "end"))) |
54 |
+ (event, root) = next(itree) |
55 |
++ |
56 |
++ root_xmlns_uri = self._tag_xmlns_uri(root) |
57 |
++ if root_xmlns_uri is None: |
58 |
++ root_xmlns_prefix = '' |
59 |
++ else: |
60 |
++ # Validate the XML namespace |
61 |
++ root_xmlns_prefix = '{%s}' % (root_xmlns_uri, ) |
62 |
++ if root_xmlns_prefix != self.xml_ns_prefix: |
63 |
++ log.error('Unexpected server reply to list operation:\n%s', |
64 |
++ self._dump_response(resp, body=None)) |
65 |
++ raise RuntimeError('List response has %s as root tag, unknown namespace' % root.tag) |
66 |
+ |
67 |
+ for (event, el) in itree: |
68 |
+ if event != 'end': |
69 |
+ continue |
70 |
+ |
71 |
+- if el.tag == ns_p + 'IsTruncated': |
72 |
++ if el.tag == root_xmlns_prefix + 'IsTruncated': |
73 |
+ keys_remaining = (el.text == 'true') |
74 |
+ |
75 |
+- elif el.tag == ns_p + 'Contents': |
76 |
+- marker = el.findtext(ns_p + 'Key') |
77 |
++ elif el.tag == root_xmlns_prefix + 'Contents': |
78 |
++ marker = el.findtext(root_xmlns_prefix + 'Key') |
79 |
+ yield marker[len(self.prefix):] |
80 |
+ root.clear() |
81 |
+ |
82 |
+@@ -404,9 +423,12 @@ |
83 |
+ return |
84 |
+ body = self.conn.readall() |
85 |
+ root = self._parse_xml_response(resp, body) |
86 |
+- if root.tag == self.xml_ns_prefix + 'CopyObjectResult': |
87 |
++ |
88 |
++ # Some S3 implemenentations do not have a namespace on |
89 |
++ # CopyObjectResult. |
90 |
++ if root.tag in [self.xml_ns_prefix + 'CopyObjectResult', 'CopyObjectResult']: |
91 |
+ return |
92 |
+- elif root.tag == 'Error': |
93 |
++ elif root.tag in [self.xml_ns_prefix + 'Error', 'Error']: |
94 |
+ raise get_S3Error(root.findtext('Code'), root.findtext('Message'), |
95 |
+ resp.headers) |
96 |
+ else: |
97 |
|
98 |
diff --git a/sys-fs/s3ql/s3ql-2.14-r1.ebuild b/sys-fs/s3ql/s3ql-2.14-r1.ebuild |
99 |
new file mode 100644 |
100 |
index 0000000..50dd9cc |
101 |
--- /dev/null |
102 |
+++ b/sys-fs/s3ql/s3ql-2.14-r1.ebuild |
103 |
@@ -0,0 +1,59 @@ |
104 |
+# Copyright 1999-2015 Gentoo Foundation |
105 |
+# Distributed under the terms of the GNU General Public License v2 |
106 |
+# $Id$ |
107 |
+ |
108 |
+EAPI=5 |
109 |
+PYTHON_COMPAT=( python3_{3,4} ) |
110 |
+ |
111 |
+inherit distutils-r1 |
112 |
+ |
113 |
+DESCRIPTION="A full-featured file system for online data storage" |
114 |
+HOMEPAGE="https://bitbucket.org/nikratio/s3ql/" |
115 |
+SRC_URI="https://www.bitbucket.org/nikratio/s3ql/downloads/${P}.tar.bz2" |
116 |
+ |
117 |
+LICENSE="GPL-3" |
118 |
+SLOT="0" |
119 |
+KEYWORDS="~amd64 ~x86" |
120 |
+IUSE="contrib doc test" |
121 |
+ |
122 |
+RDEPEND=">=dev-db/sqlite-3.7.0:3 |
123 |
+ dev-python/defusedxml[${PYTHON_USEDEP}] |
124 |
+ dev-python/setuptools[${PYTHON_USEDEP}] |
125 |
+ >=dev-python/apsw-3.7.0[${PYTHON_USEDEP}] |
126 |
+ >=dev-python/dugong-3.4[${PYTHON_USEDEP}] |
127 |
+ >=dev-python/llfuse-0.39[${PYTHON_USEDEP}] |
128 |
+ dev-python/pycrypto[${PYTHON_USEDEP}] |
129 |
+ dev-python/requests[${PYTHON_USEDEP}] |
130 |
+ sys-fs/fuse" |
131 |
+DEPEND="${RDEPEND} |
132 |
+ test? ( |
133 |
+ dev-python/pytest[${PYTHON_USEDEP}] |
134 |
+ net-misc/rsync[xattr] |
135 |
+ )" |
136 |
+ |
137 |
+RESTRICT="test" |
138 |
+ |
139 |
+python_test() { |
140 |
+ addwrite /dev/fuse |
141 |
+ py.test -v tests || die "Tests fail with ${EPYTHON}" |
142 |
+} |
143 |
+ |
144 |
+src_prepare() { |
145 |
+ epatch "${FILESDIR}"/s3ql-2.14-ceph.patch |
146 |
+} |
147 |
+ |
148 |
+python_install_all() { |
149 |
+ distutils-r1_python_install_all |
150 |
+ |
151 |
+ if use contrib ; then |
152 |
+ exeinto /usr/share/doc/${PF}/contrib |
153 |
+ docompress -x /usr/share/doc/${PF}/contrib |
154 |
+ doexe contrib/*.{py,sh} |
155 |
+ doman contrib/*.1 |
156 |
+ fi |
157 |
+ |
158 |
+ if use doc ; then |
159 |
+ dodoc doc/manual.pdf |
160 |
+ dohtml -r doc/html/* |
161 |
+ fi |
162 |
+} |