From b8eb009cfa5289437a0bbb058a17f99719b1cbbe3112de8c9f22ed0d08953300 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Wed, 31 Oct 2012 10:14:47 +0000 Subject: [PATCH] Accepting request 139813 from Virtualization:Cloud:OpenStack:SUSE We want that OBS-URL: https://build.opensuse.org/request/show/139813 OBS-URL: https://build.opensuse.org/package/show/Cloud:OpenStack:Essex/python-glanceclient?expand=0&rev=1 --- .gitattributes | 23 ++++ .gitignore | 1 + _service | 22 ++++ add-handler-for-logger.patch | 61 ++++++++++ glanceclient-setup-no-requires.patch | 10 ++ honor-insecure-flag-keystone.patch | 23 ++++ ...lient-2012.1+git.1342772282.71a0cae.tar.gz | 3 + python-glanceclient.changes | 52 +++++++++ python-glanceclient.spec | 104 ++++++++++++++++++ rpmlintrc | 2 + 10 files changed, 301 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 _service create mode 100644 add-handler-for-logger.patch create mode 100644 glanceclient-setup-no-requires.patch create mode 100644 honor-insecure-flag-keystone.patch create mode 100644 python-glanceclient-2012.1+git.1342772282.71a0cae.tar.gz create mode 100644 python-glanceclient.changes create mode 100644 python-glanceclient.spec create mode 100644 rpmlintrc diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/_service b/_service new file mode 100644 index 0000000..d3675b4 --- /dev/null +++ b/_service @@ -0,0 +1,22 @@ + + + git://github.com/openstack/python-glanceclient.git + git + .git + .gitreview + git-master + 2012.1+git.%at.%h + + + 71a0caece87727e07bc34ae265dda58ca3e1e6d2 + + + + python-*git*.tar + gz + + + + python-glanceclient + + diff --git a/add-handler-for-logger.patch b/add-handler-for-logger.patch new file mode 100644 index 0000000..bfef3ca --- /dev/null +++ b/add-handler-for-logger.patch @@ -0,0 +1,61 @@ +Index: python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/common/http.py +=================================================================== +--- python-glanceclient-2012.1+git.1342772282.71a0cae.orig/glanceclient/common/http.py ++++ python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/common/http.py +@@ -41,11 +41,7 @@ class HTTPClient(httplib2.Http): + self.disable_ssl_certificate_validation = insecure + + def http_log(self, args, kwargs, resp, body): +- if os.environ.get('GLANCECLIENT_DEBUG', False): +- ch = logging.StreamHandler() +- logger.setLevel(logging.DEBUG) +- logger.addHandler(ch) +- elif not logger.isEnabledFor(logging.DEBUG): ++ if not logger.isEnabledFor(logging.DEBUG): + return + + string_parts = ['curl -i'] +@@ -84,7 +80,7 @@ class HTTPClient(httplib2.Http): + self.http_log((url, method,), kwargs, resp, body) + + if 400 <= resp.status < 600: +- logger.exception("Request returned failure status.") ++ logger.error("Request returned failure status.") + raise exc.from_response(resp, body) + elif resp.status in (301, 302, 305): + # Redirected. Reissue the request to the new location. +Index: python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/shell.py +=================================================================== +--- python-glanceclient-2012.1+git.1342772282.71a0cae.orig/glanceclient/shell.py ++++ python-glanceclient-2012.1+git.1342772282.71a0cae/glanceclient/shell.py +@@ -19,6 +19,7 @@ Command-line interface to the OpenStack + + import argparse + import httplib2 ++import logging + import re + import sys + +@@ -48,9 +49,9 @@ class OpenStackImagesShell(object): + ) + + parser.add_argument('--debug', +- default=False, ++ default=bool(utils.env('GLANCECLIENT_DEBUG')), + action='store_true', +- help=argparse.SUPPRESS) ++ help='Defaults to env[GLANCECLIENT_DEBUG]') + + parser.add_argument('--insecure', + default=False, +@@ -239,6 +240,10 @@ class OpenStackImagesShell(object): + if args.debug: + httplib2.debuglevel = 1 + ++ LOG = logging.getLogger('glanceclient') ++ LOG.addHandler(logging.StreamHandler()) ++ LOG.setLevel(logging.DEBUG if args.debug else logging.INFO) ++ + # Short-circuit and deal with help command right away. + if args.func == self.do_help: + self.do_help(args) diff --git a/glanceclient-setup-no-requires.patch b/glanceclient-setup-no-requires.patch new file mode 100644 index 0000000..7221a2e --- /dev/null +++ b/glanceclient-setup-no-requires.patch @@ -0,0 +1,10 @@ +--- python-glanceclient-2012.1+git.1342772282.71a0cae/setup.py.orig 2012-08-02 14:22:43.000000000 +0200 ++++ python-glanceclient-2012.1+git.1342772282.71a0cae/setup.py 2012-08-02 14:22:52.000000000 +0200 +@@ -38,7 +38,6 @@ + 'Programming Language :: Python', + ], + cmdclass=setup.get_cmdclass(), +- install_requires=requires, + dependency_links=dependency_links, + tests_require=tests_require, + setup_requires=['setuptools-git>=0.4'], diff --git a/honor-insecure-flag-keystone.patch b/honor-insecure-flag-keystone.patch new file mode 100644 index 0000000..e233b49 --- /dev/null +++ b/honor-insecure-flag-keystone.patch @@ -0,0 +1,23 @@ +diff -ruN a/glanceclient/shell.py b/glanceclient/shell.py +--- a/glanceclient/shell.py 2012-07-26 16:27:05.393086964 +0200 ++++ b/glanceclient/shell.py 2012-07-26 16:41:07.376042262 +0200 +@@ -206,7 +206,8 @@ + password=kwargs.get('password'), + tenant_id=kwargs.get('tenant_id'), + tenant_name=kwargs.get('tenant_name'), +- auth_url=kwargs.get('auth_url')) ++ auth_url=kwargs.get('auth_url'), ++ insecure=kwargs.get('insecure')) + service_type = kwargs.get('service_type') or 'image' + endpoint_type = kwargs.get('endpoint_type') or 'publicURL' + endpoint = _ksclient.service_catalog.url_for( +@@ -272,7 +273,8 @@ + 'tenant_name': args.os_tenant_name, + 'auth_url': args.os_auth_url, + 'service_type': args.os_service_type, +- 'endpoint_type': args.os_endpoint_type ++ 'endpoint_type': args.os_endpoint_type, ++ 'insecure': args.insecure + } + endpoint, token = self._authenticate(**kwargs) + diff --git a/python-glanceclient-2012.1+git.1342772282.71a0cae.tar.gz b/python-glanceclient-2012.1+git.1342772282.71a0cae.tar.gz new file mode 100644 index 0000000..7501b12 --- /dev/null +++ b/python-glanceclient-2012.1+git.1342772282.71a0cae.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cda8260d6283c360b644de19b1ea4951bf292488036b36eb2dc38005b8689c10 +size 35701 diff --git a/python-glanceclient.changes b/python-glanceclient.changes new file mode 100644 index 0000000..acfce2c --- /dev/null +++ b/python-glanceclient.changes @@ -0,0 +1,52 @@ +------------------------------------------------------------------- +Thu Sep 13 09:18:30 UTC 2012 - vuntz@suse.com + +- Add add-handler-for-logger.patch: remove cryptic "No handlers + could be found for logger" error message. Fix bnc#780048. + +------------------------------------------------------------------- +Tue Aug 14 11:37:34 UTC 2012 - bwiedemann@suse.com + +- Do not conflict with openstack-glance + +------------------------------------------------------------------- +Thu Aug 2 14:26:54 CEST 2012 - iartarisi@suse.cz + +- Add patch to remove strict dependency checks in setup.py + +------------------------------------------------------------------- +Fri Jul 27 10:12:09 UTC 2012 - saschpe@suse.de + +- Add requirement on python-warlock + +------------------------------------------------------------------- +Thu Jul 26 14:25:39 UTC 2012 - saschpe@suse.de + +- Honor '--insecure' commandline flag also for keystone authentication + +------------------------------------------------------------------- +Thu Jul 26 10:37:47 UTC 2012 - saschpe@suse.de + +- Require python-distribute, /usr/bin/glance needs it + +------------------------------------------------------------------- +Mon Jul 23 09:34:05 UTC 2012 - bwiedemann@suse.com + +- Require python-keystoneclient + +------------------------------------------------------------------- +Tue Jul 10 13:11:34 UTC 2012 - saschpe@suse.de + +- Add '--insecure' commandline argument to ignore (amongst others) + self-signed certificate errors + +------------------------------------------------------------------- +Tue Jul 3 11:41:55 UTC 2012 - saschpe@suse.de + +- Conflict on openstack-glance, it also ships /usr/bin/glance + +------------------------------------------------------------------- +Fri Jun 29 13:40:46 UTC 2012 - saschpe@suse.de + +- Initial version + diff --git a/python-glanceclient.spec b/python-glanceclient.spec new file mode 100644 index 0000000..1694628 --- /dev/null +++ b/python-glanceclient.spec @@ -0,0 +1,104 @@ +# +# spec file for package python-glanceclient +# +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Option to (forcefully) build without tarballs from VCS: +%bcond_without from_vcs + +Name: python-glanceclient +%if %{with from_vcs} +# set_version source service will automatically change this to +# the version detected within the checked out git repo: +Version: 2012.1+git.1342772282.71a0cae +%else +Version: 2012.1 +%endif +Release: 0 +License: Apache-2.0 +Summary: Openstack Image (Glance) API Client Library +Url: https://github.com/openstack/python-glanceclient +Group: Development/Languages/Python +# Please note that the official release tarball has to be downloaded once, +# but the URL can be used to verify it later on: +Source: https://launchpad.net/glance/essex/%{version}/+download/%{name}-%{version}.tar.gz +# Patch-FIX-UPSTREAM: '--insecure' flag should be checked when talking to keystone +Patch0: honor-insecure-flag-keystone.patch +# Don't specify requires in setup.py +# https://bugs.launchpad.net/python-glanceclient/+bug/1032155 +Patch1: glanceclient-setup-no-requires.patch +# PATCH-FIX-UPSTREAM add-handler-for-logger.patch bnc#780048 vuntz@suse.com -- Remove cryptic "No handlers could be found for logger" error message +Patch2: add-handler-for-logger.patch +BuildRequires: python-devel +BuildRequires: python-distribute +Requires: python >= 2.6.8 +# /usr/bin/glance uses pkg_resources, thus: +Requires: python-distribute +Requires: python-httplib2 +Requires: python-prettytable +Requires: python-keystoneclient +Requires: python-warlock +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%if 0%{?suse_version} && 0%{?suse_version} <= 1110 +%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%else +BuildArch: noarch +%endif + +%description +This is a client for the Glance which uses the OpenStack Image API. There's +a Python API (the glanceclient module), and a command-line script (glance). + +%package test +Summary: Openstack Image (Glance) API Client Library - Testsuite +Group: System/Management +Requires: %{name} = %{version} +Requires: python-mock +Requires: python-mox +Requires: python-nose +Requires: python-unittest2 + +%description test +The %{name} testsuite. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +sed -i "s/setuptools-git>=0.4//" setup.py # We don't need that + +%build +python setup.py build +cd docs && sphinx-build -b html . build/html + +%install +python setup.py install --prefix=%{_prefix} --root=%{buildroot} + +# test package +install -d -m 755 %{buildroot}%{_localstatedir}/lib/%{name}-test +cp -av tests run_tests.sh %{buildroot}%{_localstatedir}/lib/%{name}-test +ln -s %{python_sitelib}/glanceclient %{buildroot}%{_localstatedir}/lib/%{name}-test/glanceclient + +%files +%defattr(-,root,root,-) +%doc LICENSE README.rst +%{_bindir}/glance +%{python_sitelib}/glanceclient/ +%{python_sitelib}/python_glanceclient-*.egg-info + +%files test +%defattr(-,root,root,-) +%doc HACKING.rst +%{_localstatedir}/lib/%{name}-test + +%changelog diff --git a/rpmlintrc b/rpmlintrc new file mode 100644 index 0000000..c44ee7b --- /dev/null +++ b/rpmlintrc @@ -0,0 +1,2 @@ +# This symling is for the -test package and can be ignored: +addFilter("dangling-symlink /var/lib/python-glanceclient-test/glanceclient")