commit: 9d6a1f7e23c91cf495479d7d905ebd8713a49953 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> AuthorDate: Mon Feb 1 21:11:48 2016 +0000 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> CommitDate: Mon Feb 1 21:12:42 2016 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9d6a1f7e
sys-fs/s3ql: patch to support Ceph-RGW usage, approved by upstream but not yet released. Package-Manager: portage-2.2.27 sys-fs/s3ql/files/s3ql-2.14-ceph.patch | 75 ++++++++++++++++++++++++++++++++++ sys-fs/s3ql/s3ql-2.14-r1.ebuild | 59 ++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) diff --git a/sys-fs/s3ql/files/s3ql-2.14-ceph.patch b/sys-fs/s3ql/files/s3ql-2.14-ceph.patch new file mode 100644 index 0000000..f5b4c3b --- /dev/null +++ b/sys-fs/s3ql/files/s3ql-2.14-ceph.patch @@ -0,0 +1,75 @@ +https://bitbucket.org/nikratio/s3ql/issues/190/sq3l-should-not-rely-on-xmlns-declarations +https://bitbucket.org/nikratio/s3ql/pull-requests/5/s3c-be-more-lenient-about-xml-namespaces + +--- s3ql-2.14/src/s3ql/backends/s3c.py 2015-07-20 19:41:07.000000000 -0700 ++++ s3ql-2.14/src/s3ql/backends/s3c.py 2016-01-21 22:41:33.000000000 -0800 +@@ -126,6 +126,15 @@ + conn.timeout = int(self.options.get('tcp-timeout', 20)) + return conn + ++ @staticmethod ++ def _tag_xmlns_uri(elem): ++ '''Extract the XML namespace (xmlns) URI from an element''' ++ if elem.tag[0] == '{': ++ uri, ignore, tag = elem.tag[1:].partition("}") ++ else: ++ uri = None ++ return uri ++ + # This method is also used implicitly for the retry handling of + # `gs.Backend._get_access_token`. When modifying this method, do not forget + # to check if this makes it unsuitable for use by `_get_access_token` (in +@@ -215,7 +224,6 @@ + keys_remaining = True + marker = self.prefix + start_after + prefix = self.prefix + prefix +- ns_p = self.xml_ns_prefix + + while keys_remaining: + log.debug('requesting with marker=%s', marker) +@@ -232,16 +240,27 @@ + try: + itree = iter(ElementTree.iterparse(self.conn, events=("start", "end"))) + (event, root) = next(itree) ++ ++ root_xmlns_uri = self._tag_xmlns_uri(root) ++ if root_xmlns_uri is None: ++ root_xmlns_prefix = '' ++ else: ++ # Validate the XML namespace ++ root_xmlns_prefix = '{%s}' % (root_xmlns_uri, ) ++ if root_xmlns_prefix != self.xml_ns_prefix: ++ log.error('Unexpected server reply to list operation:\n%s', ++ self._dump_response(resp, body=None)) ++ raise RuntimeError('List response has %s as root tag, unknown namespace' % root.tag) + + for (event, el) in itree: + if event != 'end': + continue + +- if el.tag == ns_p + 'IsTruncated': ++ if el.tag == root_xmlns_prefix + 'IsTruncated': + keys_remaining = (el.text == 'true') + +- elif el.tag == ns_p + 'Contents': +- marker = el.findtext(ns_p + 'Key') ++ elif el.tag == root_xmlns_prefix + 'Contents': ++ marker = el.findtext(root_xmlns_prefix + 'Key') + yield marker[len(self.prefix):] + root.clear() + +@@ -404,9 +423,12 @@ + return + body = self.conn.readall() + root = self._parse_xml_response(resp, body) +- if root.tag == self.xml_ns_prefix + 'CopyObjectResult': ++ ++ # Some S3 implemenentations do not have a namespace on ++ # CopyObjectResult. ++ if root.tag in [self.xml_ns_prefix + 'CopyObjectResult', 'CopyObjectResult']: + return +- elif root.tag == 'Error': ++ elif root.tag in [self.xml_ns_prefix + 'Error', 'Error']: + raise get_S3Error(root.findtext('Code'), root.findtext('Message'), + resp.headers) + else: diff --git a/sys-fs/s3ql/s3ql-2.14-r1.ebuild b/sys-fs/s3ql/s3ql-2.14-r1.ebuild new file mode 100644 index 0000000..50dd9cc --- /dev/null +++ b/sys-fs/s3ql/s3ql-2.14-r1.ebuild @@ -0,0 +1,59 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 +PYTHON_COMPAT=( python3_{3,4} ) + +inherit distutils-r1 + +DESCRIPTION="A full-featured file system for online data storage" +HOMEPAGE="https://bitbucket.org/nikratio/s3ql/" +SRC_URI="https://www.bitbucket.org/nikratio/s3ql/downloads/${P}.tar.bz2" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="contrib doc test" + +RDEPEND=">=dev-db/sqlite-3.7.0:3 + dev-python/defusedxml[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] + >=dev-python/apsw-3.7.0[${PYTHON_USEDEP}] + >=dev-python/dugong-3.4[${PYTHON_USEDEP}] + >=dev-python/llfuse-0.39[${PYTHON_USEDEP}] + dev-python/pycrypto[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + sys-fs/fuse" +DEPEND="${RDEPEND} + test? ( + dev-python/pytest[${PYTHON_USEDEP}] + net-misc/rsync[xattr] + )" + +RESTRICT="test" + +python_test() { + addwrite /dev/fuse + py.test -v tests || die "Tests fail with ${EPYTHON}" +} + +src_prepare() { + epatch "${FILESDIR}"/s3ql-2.14-ceph.patch +} + +python_install_all() { + distutils-r1_python_install_all + + if use contrib ; then + exeinto /usr/share/doc/${PF}/contrib + docompress -x /usr/share/doc/${PF}/contrib + doexe contrib/*.{py,sh} + doman contrib/*.1 + fi + + if use doc ; then + dodoc doc/manual.pdf + dohtml -r doc/html/* + fi +}