diff -Nru gerritlib-0.4.0+git20150319/debian/changelog gerritlib-0.8.0/debian/changelog --- gerritlib-0.4.0+git20150319/debian/changelog 2015-11-02 20:06:29.000000000 +0000 +++ gerritlib-0.8.0/debian/changelog 2017-12-11 21:21:38.000000000 +0000 @@ -1,3 +1,21 @@ +gerritlib (0.8.0-1) unstable; urgency=medium + + * Adopting orphaned package under DPMT (Closes: #881380) + * d/copyright: add myself for Debian part + * d/compat: update to version 10 + * d/control: + - Remove Mathieu Parent from uploaders + - update standards version to 4.1.2 (no changes) + - Update Build-Depends to match new release + - Enable autopkgtest-pkg-python testsuite + * d/rules: use pkg-info.mk to determine PBR_VERSION + * New upstream release + * Fix python3 compatibility by converting bytes objects to string + Upstream review: https://review.openstack.org/#/c/527704/ + * Fixes unmet build dependency on old python-pbr (Closes: #880230) + + -- Filip Pytloun Mon, 11 Dec 2017 22:21:38 +0100 + gerritlib (0.4.0+git20150319-2) unstable; urgency=medium * Bump max pbr builddep to 1.* (See #803191) diff -Nru gerritlib-0.4.0+git20150319/debian/compat gerritlib-0.8.0/debian/compat --- gerritlib-0.4.0+git20150319/debian/compat 2015-11-02 20:03:49.000000000 +0000 +++ gerritlib-0.8.0/debian/compat 2017-12-11 21:21:38.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru gerritlib-0.4.0+git20150319/debian/control gerritlib-0.8.0/debian/control --- gerritlib-0.4.0+git20150319/debian/control 2015-11-02 20:04:52.000000000 +0000 +++ gerritlib-0.8.0/debian/control 2017-12-11 21:21:38.000000000 +0000 @@ -1,28 +1,43 @@ Source: gerritlib Section: python Priority: optional -Maintainer: Mathieu Parent -Build-Depends: debhelper (>=9), - dh-python, - python-all, - python-paramiko (>=1.8.0), - python-pbr (<< 2.0), - python-pbr (>= 0.8.2), - python-setuptools, - python-six (>=1.7.0), - python3-all, - python3-paramiko (>=1.8.0), - python3-pbr (<< 2.0), - python3-pbr (>= 0.8.2), - python3-setuptools, - python3-six (>=1.7.0) -Standards-Version: 3.9.6 +Maintainer: Debian Python Modules Team +Uploaders: + Filip Pytloun , +Build-Depends: + debhelper (>=10), + dh-python, + python-all, + python-pbr (>= 0.8.2), + python-setuptools, + python3-all, + python3-pbr (>= 0.8.2), + python3-setuptools, +Build-Depends-Indep: + python-hacking, + python-paramiko (>=1.8.0), + python-six (>=1.7.0), + python-subunit, + python-testrepository, + python-testtools, + python3-hacking, + python3-paramiko (>=1.8.0), + python3-six (>=1.7.0), + python3-subunit, + python3-testrepository, + python3-testtools, +Standards-Version: 4.1.2 +Testsuite: autopkgtest-pkg-python Homepage: https://git.openstack.org/cgit/openstack-infra/gerritlib +Vcs-Browser: https://anonscm.debian.org/cgit/python-modules/packages/gerritlib.git/ +Vcs-Git: https://anonscm.debian.org/git/python-modules/packages/gerritlib.git Package: python-gerritlib Architecture: all Multi-Arch: foreign -Depends: ${misc:Depends}, ${python:Depends} +Depends: + ${misc:Depends}, + ${python:Depends}, Description: client library for accessing Gerrit with Python Gerritlib is a Python library for interacting with Gerrit. . @@ -32,7 +47,9 @@ Package: python3-gerritlib Architecture: all Multi-Arch: foreign -Depends: ${misc:Depends}, ${python3:Depends} +Depends: + ${misc:Depends}, + ${python3:Depends}, Description: client library for accessing Gerrit with Python3 Gerritlib is a Python3 library for interacting with Gerrit. . diff -Nru gerritlib-0.4.0+git20150319/debian/copyright gerritlib-0.8.0/debian/copyright --- gerritlib-0.4.0+git20150319/debian/copyright 2015-11-02 20:04:26.000000000 +0000 +++ gerritlib-0.8.0/debian/copyright 2017-12-11 21:21:38.000000000 +0000 @@ -9,6 +9,7 @@ Files: debian/* Copyright: 2015 Mathieu Parent + 2017 Filip Pytloun License: Apache-2.0 License: Apache-2.0 diff -Nru gerritlib-0.4.0+git20150319/debian/gbp.conf gerritlib-0.8.0/debian/gbp.conf --- gerritlib-0.4.0+git20150319/debian/gbp.conf 2015-11-02 20:03:49.000000000 +0000 +++ gerritlib-0.8.0/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -[buildpackage] -ignore-branch = True diff -Nru gerritlib-0.4.0+git20150319/debian/.git-dpm gerritlib-0.8.0/debian/.git-dpm --- gerritlib-0.4.0+git20150319/debian/.git-dpm 1970-01-01 00:00:00.000000000 +0000 +++ gerritlib-0.8.0/debian/.git-dpm 2017-12-11 21:21:38.000000000 +0000 @@ -0,0 +1,8 @@ +# see git-dpm(1) from git-dpm package +83cb9c5e5a85737481128a0b04a5cc15fa0c2e9b +83cb9c5e5a85737481128a0b04a5cc15fa0c2e9b +a5309c26f2878d9d9c0a6c001c14d71750b2c4a6 +a5309c26f2878d9d9c0a6c001c14d71750b2c4a6 +gerritlib_0.8.0.orig.tar.gz +e67135cbad736fa1bd70838497c44b4b59a38349 +15250 diff -Nru gerritlib-0.4.0+git20150319/debian/patches/0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch gerritlib-0.8.0/debian/patches/0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch --- gerritlib-0.4.0+git20150319/debian/patches/0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch 1970-01-01 00:00:00.000000000 +0000 +++ gerritlib-0.8.0/debian/patches/0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch 2017-12-11 21:21:38.000000000 +0000 @@ -0,0 +1,30 @@ +From 83cb9c5e5a85737481128a0b04a5cc15fa0c2e9b Mon Sep 17 00:00:00 2001 +From: Filip Pytloun +Date: Wed, 13 Dec 2017 15:48:15 +0100 +Subject: Fix python3 compatibility by decoding bytes to string + +--- + gerritlib/gerrit.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/gerritlib/gerrit.py b/gerritlib/gerrit.py +index 5730aac..cf3cedf 100644 +--- a/gerritlib/gerrit.py ++++ b/gerritlib/gerrit.py +@@ -408,12 +408,16 @@ class Gerrit(object): + stdin, stdout, stderr = client.exec_command(command) + + out = stdout.read() ++ if type(out) == bytes: ++ out = out.decode() + self.log.debug("SSH received stdout:\n%s" % out) + + ret = stdout.channel.recv_exit_status() + self.log.debug("SSH exit status: %s" % ret) + + err = stderr.read() ++ if type(err) == bytes: ++ err = err.decode() + self.log.debug("SSH received stderr:\n%s" % err) + if ret: + raise Exception("Gerrit error executing %s" % command) diff -Nru gerritlib-0.4.0+git20150319/debian/patches/series gerritlib-0.8.0/debian/patches/series --- gerritlib-0.4.0+git20150319/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ gerritlib-0.8.0/debian/patches/series 2017-12-11 21:21:38.000000000 +0000 @@ -0,0 +1 @@ +0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch diff -Nru gerritlib-0.4.0+git20150319/debian/rules gerritlib-0.8.0/debian/rules --- gerritlib-0.4.0+git20150319/debian/rules 2015-11-02 20:03:49.000000000 +0000 +++ gerritlib-0.8.0/debian/rules 2017-12-11 21:21:38.000000000 +0000 @@ -1,7 +1,8 @@ #!/usr/bin/make -f +include /usr/share/dpkg/pkg-info.mk # Parse version from debian changelog (or pbr will try to use Git commit) -export PBR_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p' | cut -f1 -d '-') +export PBR_VERSION=$(DEB_VERSION_UPSTREAM) export PYBUILD_NAME=gerritlib %: diff -Nru gerritlib-0.4.0+git20150319/gerritlib/gerrit.py gerritlib-0.8.0/gerritlib/gerrit.py --- gerritlib-0.4.0+git20150319/gerritlib/gerrit.py 2015-04-20 20:10:34.000000000 +0000 +++ gerritlib-0.8.0/gerritlib/gerrit.py 2017-09-22 17:24:53.000000000 +0000 @@ -211,6 +211,36 @@ out, err = self._ssh(cmd) return err + def listMembers(self, group, recursive=False): + cmd = 'gerrit ls-members' + if recursive: + cmd = '%s --recursive' % cmd + cmd = '%s "%s"' % (cmd, group) + out, err = self._ssh(cmd) + ret = [] + rows = out.split('\n') + if len(rows) > 1: + keys = rows[0].split('\t') + for row in rows[1:]: + ret.append(dict(zip(keys, row.split('\t')))) + return ret + + def _setMember(self, verb, group, member): + cmd = 'gerrit set-members' + if verb == 'add': + cmd = '%s --add "%s"' % (cmd, member) + elif verb == 'remove': + cmd = '%s --remove "%s"' % (cmd, member) + cmd = '%s "%s"' % (cmd, group) + out, err = self._ssh(cmd) + return err + + def addMember(self, group, member): + self._setMember('add', group, member) + + def removeMember(self, group, member): + self._setMember('remove', group, member) + def createProject(self, project, require_change_id=True, empty_repo=False, description=None): cmd = 'gerrit create-project' @@ -221,7 +251,16 @@ if description: cmd = "%s --description \"%s\"" % \ (cmd, description.replace('"', r'\"')) - cmd = '%s --name %s' % (cmd, project) + version = None + try: + version = self.parseGerritVersion(self.getVersion()) + except Exception: + # If no version then we know version is old and should use --name + pass + if not version or version < (2, 12): + cmd = '%s --name "%s"' % (cmd, project) + else: + cmd = '%s "%s"' % (cmd, project) out, err = self._ssh(cmd) return err @@ -275,6 +314,19 @@ out = out.split(' ')[2] return out.strip('\n') + def parseGerritVersion(self, version): + # Adapted from gertty setRemoteVersion() + base = version.split('-')[0] + parts = base.split('.') + major = minor = micro = 0 + if len(parts) > 0: + major = int(parts[0]) + if len(parts) > 1: + minor = int(parts[1]) + if len(parts) > 2: + micro = int(parts[2]) + return (major, minor, micro) + def replicate(self, project='--all'): cmd = 'replication start %s' % project if self.installed_plugins is None: diff -Nru gerritlib-0.4.0+git20150319/gerritlib/tests/base.py gerritlib-0.8.0/gerritlib/tests/base.py --- gerritlib-0.4.0+git20150319/gerritlib/tests/base.py 1970-01-01 00:00:00.000000000 +0000 +++ gerritlib-0.8.0/gerritlib/tests/base.py 2017-09-22 17:24:53.000000000 +0000 @@ -0,0 +1,5 @@ +import testtools + + +class TestCase(testtools.TestCase): + "Placeholder wrapper for the testtools.TestCase class." diff -Nru gerritlib-0.4.0+git20150319/gerritlib/tests/test_gerritlib.py gerritlib-0.8.0/gerritlib/tests/test_gerritlib.py --- gerritlib-0.4.0+git20150319/gerritlib/tests/test_gerritlib.py 1970-01-01 00:00:00.000000000 +0000 +++ gerritlib-0.8.0/gerritlib/tests/test_gerritlib.py 2017-09-22 17:24:53.000000000 +0000 @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +""" +test_gerritlib +---------------------------------- + +Tests for `gerritlib` module. +""" + +from gerritlib.tests import base + + +class TestGerritlib(base.TestCase): + + def test_something(self): + pass diff -Nru gerritlib-0.4.0+git20150319/requirements.txt gerritlib-0.8.0/requirements.txt --- gerritlib-0.4.0+git20150319/requirements.txt 2015-04-20 20:10:34.000000000 +0000 +++ gerritlib-0.8.0/requirements.txt 2017-09-22 17:24:53.000000000 +0000 @@ -1,3 +1,3 @@ -pbr>=0.8.2,<1.0 -paramiko>=1.8.0 +pbr>=0.11 +paramiko>=1.8.0,<2.0.0 six>=1.7.0 diff -Nru gerritlib-0.4.0+git20150319/.testr.conf gerritlib-0.8.0/.testr.conf --- gerritlib-0.4.0+git20150319/.testr.conf 2015-04-20 20:10:34.000000000 +0000 +++ gerritlib-0.8.0/.testr.conf 2017-09-22 17:24:53.000000000 +0000 @@ -1,4 +1,7 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} ${PYTHON:-python} -m subunit.run discover -t ./ tests $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ + OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ + OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ + ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION test_id_option=--load-list $IDFILE test_list_option=--list diff -Nru gerritlib-0.4.0+git20150319/test-requirements.txt gerritlib-0.8.0/test-requirements.txt --- gerritlib-0.4.0+git20150319/test-requirements.txt 2015-04-20 20:10:34.000000000 +0000 +++ gerritlib-0.8.0/test-requirements.txt 2017-09-22 17:24:53.000000000 +0000 @@ -1,4 +1,5 @@ -hacking>=0.5.6,<0.8 +hacking>=0.5.6,<0.11 sphinx>=1.1.2,<1.2 python-subunit testrepository +testtools diff -Nru gerritlib-0.4.0+git20150319/tox.ini gerritlib-0.8.0/tox.ini --- gerritlib-0.4.0+git20150319/tox.ini 2015-04-20 20:10:34.000000000 +0000 +++ gerritlib-0.8.0/tox.ini 2017-09-22 17:24:53.000000000 +0000 @@ -4,18 +4,15 @@ envlist = pep8, py27, pypy, py33, py34 [testenv] +commands = python setup.py test --slowest --testr-args='{posargs}' setenv = VIRTUAL_ENV={envdir} usedevelop = True install_command = pip install {opts} {packages} -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt +deps = -r{toxinidir}/test-requirements.txt [testenv:pep8] commands = flake8 -[testenv:pyflakes] -commands = flake8 - [testenv:docs] commands = python setup.py build_sphinx