Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-osc-tiny for openSUSE:Factory checked in at 2022-05-18 13:13:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-osc-tiny (Old) and /work/SRC/openSUSE:Factory/.python-osc-tiny.new.1538 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-osc-tiny" Wed May 18 13:13:22 2022 rev:12 rq:977829 version:0.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-osc-tiny/python-osc-tiny.changes 2022-01-21 01:26:15.858239976 +0100 +++ /work/SRC/openSUSE:Factory/.python-osc-tiny.new.1538/python-osc-tiny.changes 2022-05-18 13:13:29.506678560 +0200 @@ -1,0 +2,9 @@ +Tue May 17 13:03:24 UTC 2022 - Andreas Hasenkopf <ahasenk...@suse.com> + +- Release 0.5.0 + * Added capability to log API requests (without headers!) and responses + * Make it possible to add a comment when pushing files + * Added method to get build history + + +------------------------------------------------------------------- Old: ---- osc-tiny-0.4.2.tar.gz New: ---- osc-tiny-0.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-osc-tiny.spec ++++++ --- /var/tmp/diff_new_pack.W0j2vY/_old 2022-05-18 13:13:30.070679057 +0200 +++ /var/tmp/diff_new_pack.W0j2vY/_new 2022-05-18 13:13:30.078679064 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-osc-tiny -Version: 0.4.2 +Version: 0.5.0 Release: 0 Summary: Client API for openSUSE BuildService License: MIT ++++++ osc-tiny-0.4.2.tar.gz -> osc-tiny-0.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/PKG-INFO new/osc-tiny-0.5.0/PKG-INFO --- old/osc-tiny-0.4.2/PKG-INFO 2022-01-20 11:42:50.830566000 +0100 +++ new/osc-tiny-0.5.0/PKG-INFO 2022-05-17 14:54:34.581646200 +0200 @@ -1,13 +1,12 @@ Metadata-Version: 2.1 Name: osc-tiny -Version: 0.4.2 +Version: 0.5.0 Summary: Client API for openSUSE BuildService Home-page: http://github.com/crazyscientist/osc-tiny +Download-URL: http://github.com/crazyscientist/osc-tiny/tarball/master Author: Andreas Hasenkopf Author-email: ahasenk...@suse.com License: MIT -Download-URL: http://github.com/crazyscientist/osc-tiny/tarball/master -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators @@ -65,5 +64,3 @@ * https://osc-tiny.readthedocs.io/en/latest/ * https://openbuildservice.org/ * https://build.opensuse.org/apidocs/index - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osc_tiny.egg-info/PKG-INFO new/osc-tiny-0.5.0/osc_tiny.egg-info/PKG-INFO --- old/osc-tiny-0.4.2/osc_tiny.egg-info/PKG-INFO 2022-01-20 11:42:50.000000000 +0100 +++ new/osc-tiny-0.5.0/osc_tiny.egg-info/PKG-INFO 2022-05-17 14:54:33.000000000 +0200 @@ -1,13 +1,12 @@ Metadata-Version: 2.1 Name: osc-tiny -Version: 0.4.2 +Version: 0.5.0 Summary: Client API for openSUSE BuildService Home-page: http://github.com/crazyscientist/osc-tiny +Download-URL: http://github.com/crazyscientist/osc-tiny/tarball/master Author: Andreas Hasenkopf Author-email: ahasenk...@suse.com License: MIT -Download-URL: http://github.com/crazyscientist/osc-tiny/tarball/master -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators @@ -65,5 +64,3 @@ * https://osc-tiny.readthedocs.io/en/latest/ * https://openbuildservice.org/ * https://build.opensuse.org/apidocs/index - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osctiny/__init__.py new/osc-tiny-0.5.0/osctiny/__init__.py --- old/osc-tiny-0.4.2/osctiny/__init__.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/osctiny/__init__.py 2022-05-17 14:54:21.000000000 +0200 @@ -6,4 +6,4 @@ __all__ = ['Osc', 'bs_requests', 'buildresults', 'comments', 'packages', 'projects', 'search', 'users'] -__version__ = "0.4.2" +__version__ = "0.5.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osctiny/extensions/buildresults.py new/osc-tiny-0.5.0/osctiny/extensions/buildresults.py --- old/osc-tiny-0.4.2/osctiny/extensions/buildresults.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/osctiny/extensions/buildresults.py 2022-05-17 14:54:21.000000000 +0200 @@ -45,6 +45,30 @@ return self.osc.get_objectified_xml(response) + def get_history(self, project, package, repo, arch="x86_64", **params): + """ + Get build history + + :param project: Project name + :param package: Package name + :param repo: Repository name + :param arch: Architecture name + :param params: Additional parameters + :return: Objectified XML element + :rtype: lxml.objectify.ObjectifiedElement + + .. versionadded:: 0.5.0 + """ + + response = self.osc.request( + method="GET", + url=urljoin(self.osc.url, "{}/{}/{}/{}/{}/_history".format(self.base_path, + project,repo,arch,package)), + params=params + ) + + return self.osc.get_objectified_xml(response) + def get_package_list(self, project, repo, arch): """ Get a list of packages for which build results exist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osctiny/extensions/packages.py new/osc-tiny-0.5.0/osctiny/extensions/packages.py --- old/osc-tiny-0.4.2/osctiny/extensions/packages.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/osctiny/extensions/packages.py 2022-05-17 14:54:21.000000000 +0200 @@ -228,7 +228,7 @@ return abspath_filename - def push_file(self, project, package, filename, data): + def push_file(self, project, package, filename, data, comment=None): """ Upload a file to package @@ -237,13 +237,20 @@ :param filename: Name of file :param data: content of file :type data: str or open file handle + :param comment: Optional comment to use as commit message + + .. versionchanged:: 0.5.0 + + Added an optional ``comment`` argument to be used as the commit message when writing the + file. """ path = [self.base_path, project, package, filename] self.osc.request( url=urljoin(self.osc.url, "/".join(path)), method="PUT", - data=data + data=data, + params={"comment": comment} ) def get_attribute(self, project, package, attribute=None): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osctiny/osc.py new/osc-tiny-0.5.0/osctiny/osc.py --- old/osc-tiny-0.4.2/osctiny/osc.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/osctiny/osc.py 2022-05-17 14:54:21.000000000 +0200 @@ -5,6 +5,7 @@ from __future__ import unicode_literals from io import BufferedReader, BytesIO, StringIO import gc +import logging import re from ssl import get_default_verify_paths import time @@ -188,8 +189,10 @@ Retry sending the request, if the remote host disconnects .. versionadded:: 0.1.7 + Added parameter `params` - * Added parameter `params` + .. versionchanged:: {{ NEXT_RELEASE }} + Added logging of request/response :param url: Full URL :param method: HTTP method @@ -234,15 +237,30 @@ if timeout: settings["timeout"] = timeout + logger = logging.getLogger("osctiny.request") + for i in range(self.default_connection_retries, -1, -1): + logger.info("Requested URL: %s", prepped_req.url) + logger.debug("Sent data:\n%s\n---", + "\n".join(f"{k}: {v}" for k, v in req.data.items()) + if isinstance(req.data, dict) else req.data) + logger.debug("Sent parameters:\n%s\n---", + "\n".join(f"{k}: {v}" for k, v in req.params.items())) try: response = session.send(prepped_req, **settings) except _ConnectionError as error: warnings.warn("Problem connecting to server: {}".format(error)) + log_method = logger.error if i < 1 else logger.warning + log_method("Request failed: %s", error) if i < 1: raise + logger.debug("Retrying request in %d seconds", self.default_retry_timeout) time.sleep(self.default_retry_timeout) else: + logger.info("Server replied with status %d", response.status_code) + logger.debug("Response headers:\n%s\n---", + "\n".join(f"{k}: {v}" for k, v in response.headers.items())) + logger.debug("Response content:\n%s\n---", response.text) if raise_for_status: response.raise_for_status() return response diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/osctiny/tests/test_packages.py new/osc-tiny-0.5.0/osctiny/tests/test_packages.py --- old/osc-tiny-0.4.2/osctiny/tests/test_packages.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/osctiny/tests/test_packages.py 2022-05-17 14:54:21.000000000 +0200 @@ -347,6 +347,7 @@ ???(?????????)??? ???(?????????)??? """ bodies = [] + received_params = [] def callback(headers, params, request): if isinstance(request.body, IOBase): @@ -355,6 +356,7 @@ else: bodies.append(request.body) status, body = 200, "" + received_params.append(params) return status, headers, body @@ -386,6 +388,13 @@ BytesIO(content.encode('utf-8'))) self.assertEqual(bodies[-1], content.encode('utf-8')) + with self.subTest("with comment"): + the_comment = "This is a comment" + self.osc.packages.push_file("prj", "pkg", "readme.txt", content, + comment=the_comment) + self.assertEqual(received_params[-1]["comment"], [the_comment]) + + @responses.activate def test_aggregate(self): put_called = [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/osc-tiny-0.4.2/setup.py new/osc-tiny-0.5.0/setup.py --- old/osc-tiny-0.4.2/setup.py 2022-01-20 11:42:40.000000000 +0100 +++ new/osc-tiny-0.5.0/setup.py 2022-05-17 14:54:21.000000000 +0200 @@ -19,7 +19,7 @@ setup( name='osc-tiny', - version='0.4.2', + version='0.5.0', description='Client API for openSUSE BuildService', long_description=long_description, long_description_content_type="text/markdown",