diff --git a/.gitignore b/.gitignore index 56ea180..93a5d46 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /osbs-client-49ef2c5d631b8a0c5f82a1d9354e6f7271ba5f12.tar.gz +/osbs-client-a8a926ef34b44a52da42fa07b3847efaaf06b12a.tar.gz diff --git a/osbs-client-3-5.patch b/osbs-client-3-5.patch deleted file mode 100644 index 602c677..0000000 --- a/osbs-client-3-5.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 71b29148c042dfffb22fe9244bcacaccb39bb9d0 Mon Sep 17 00:00:00 2001 -From: Jiri Popelka -Date: Fri, 13 Nov 2015 13:55:06 +0100 -Subject: [PATCH] In Python 3.5 httplib status codes are of enum.IntEnum type. - -We need this to make -tests/test_core.py::TestCheckResponse::test_check_response_bad_[no]stream -PASS ---- - osbs/core.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/osbs/core.py b/osbs/core.py -index e49e95c..17ee8fb 100755 ---- a/osbs/core.py -+++ b/osbs/core.py -@@ -43,7 +43,7 @@ def check_response(response): - else: - content = ''.join(response.iter_lines()) - -- logger.error("[%s] %s", response.status_code, content) -+ logger.error("[%d] %s", response.status_code, content) - raise OsbsResponseException(message=content, status_code=response.status_code) - - --- -2.5.0 - diff --git a/osbs-client-skip-tests.patch b/osbs-client-skip-tests.patch deleted file mode 100644 index 390adc0..0000000 --- a/osbs-client-skip-tests.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 07e0ac510cce0ae922667a1d265c85460168bc87 Mon Sep 17 00:00:00 2001 -From: Jiri Popelka -Date: Thu, 5 Nov 2015 17:50:45 +0100 -Subject: [PATCH] Skip tests that require internet if there's no connection. - ---- - tests/test_http.py | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/tests/test_http.py b/tests/test_http.py -index c6b18ea..674f9eb 100644 ---- a/tests/test_http.py -+++ b/tests/test_http.py -@@ -13,6 +13,7 @@ import pytest - - import osbs.http as osbs_http - from osbs.http import parse_headers, HttpSession, HttpStream -+from osbs.exceptions import OsbsNetworkException - - from tests.fake_api import Connection, ResponseMapping - -@@ -24,6 +25,15 @@ def s(): - return HttpSession(verbose=True) - - -+def has_connection(): -+ # In case we run tests in an environment without internet connection. -+ try: -+ HttpStream("https://httpbin.org/get", "get") -+ return True -+ except OsbsNetworkException: -+ return False -+ -+ - class TestParseHeaders(object): - def test_parse_headers(self): - conn = Connection("0.5.4") -@@ -40,6 +50,8 @@ class TestParseHeaders(object): - assert headers["location"] - - -+@pytest.mark.skipif(not has_connection(), -+ reason="requires internet connection") - class TestHttpSession(object): - def test_single_multi_secure_without_redirs(self, s): - response_single = s.get("https://httpbin.org/get") --- -2.5.0 - diff --git a/osbs-client.spec b/osbs-client.spec index e1dc1bc..75c25dd 100644 --- a/osbs-client.spec +++ b/osbs-client.spec @@ -5,8 +5,16 @@ %{!?python2_version: %global python2_version %(%{__python2} -c "import sys; sys.stdout.write(sys.version[:3])")} %endif +%if 0%{?rhel} && 0%{?rhel} <= 7 +%{!?py2_build: %global py2_build %{__python2} setup.py build} +%{!?py2_install: %global py2_install %{__python2} setup.py install --skip-build --root %{buildroot}} +%endif + %if (0%{?fedora} >= 22 || 0%{?rhel} >= 8) %global with_python3 1 +%global binaries_py_version %{python3_version} +%else +%global binaries_py_version %{python2_version} %endif %if 0%{?fedora} @@ -14,16 +22,16 @@ %global with_check 1 %endif -%global commit 49ef2c5d631b8a0c5f82a1d9354e6f7271ba5f12 +%global commit a8a926ef34b44a52da42fa07b3847efaaf06b12a %global shortcommit %(c=%{commit}; echo ${c:0:7}) # set to 0 to create a normal release %global postrelease 0 -%global release 3 +%global release 1 %global osbs_obsolete_vr 0.14-2 Name: osbs-client -Version: 0.15 +Version: 0.16 %if "x%{postrelease}" != "x0" Release: %{release}.%{postrelease}.git.%{shortcommit}%{?dist} %else @@ -36,12 +44,13 @@ License: BSD URL: https://github.com/projectatomic/osbs-client Source0: https://github.com/projectatomic/osbs-client/archive/%{commit}/osbs-client-%{commit}.tar.gz -Patch0: osbs-client-skip-tests.patch -Patch1: osbs-client-3-5.patch - BuildArch: noarch +%if 0%{?with_python3} +Requires: python3-osbs-client = %{version}-%{release} +%else Requires: python-osbs-client = %{version}-%{release} +%endif BuildRequires: python2-devel BuildRequires: python-setuptools @@ -58,6 +67,7 @@ BuildRequires: python-pycurl BuildRequires: python3-devel BuildRequires: python3-setuptools %if 0%{?with_check} +BuildRequires: python3-dateutil BuildRequires: python3-pytest BuildRequires: python3-pytest-capturelog BuildRequires: python3-flexmock @@ -84,13 +94,13 @@ Requires: python-dockerfile-parse Requires: python-pycurl Requires: python-setuptools Requires: krb5-workstation - %if 0%{?rhel} && 0%{?rhel} <= 6 Requires: python-argparse %endif Provides: python-osbs = %{version}-%{release} Obsoletes: python-osbs < %{osbs_obsolete_vr} +%{?python_provide:%python_provide python-osbs-client} %description -n python-osbs-client It is able to query OpenShift v3 for various stuff related to building images. @@ -110,6 +120,7 @@ Requires: krb5-workstation Provides: python3-osbs = %{version}-%{release} Obsoletes: python3-osbs < %{osbs_obsolete_vr} +%{?python_provide:%python_provide python3-osbs-client} %description -n python3-osbs-client It is able to query OpenShift v3 for various stuff related to building images. @@ -121,39 +132,26 @@ This package contains osbs Python 3 bindings. %prep %setup -qn %{name}-%{commit} -%patch0 -p1 -%patch1 -p1 - -%if 0%{?with_python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif # with_python3 - %build -# build python package -%{__python} setup.py build +%py2_build %if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py build -popd +%py3_build %endif # with_python3 %install %if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py install --skip-build --root %{buildroot} -popd -mv %{buildroot}%{_bindir}/osbs %{buildroot}%{_bindir}/osbs3 +%py3_install +mv %{buildroot}%{_bindir}/osbs %{buildroot}%{_bindir}/osbs-%{python3_version} +ln -s %{_bindir}/osbs-%{python3_version} %{buildroot}%{_bindir}/osbs-3 %endif # with_python3 -%{__python} setup.py install --skip-build --root %{buildroot} -mv %{buildroot}%{_bindir}/osbs %{buildroot}%{_bindir}/osbs2 -ln -s %{_bindir}/osbs2 %{buildroot}%{_bindir}/osbs - +%py2_install +mv %{buildroot}%{_bindir}/osbs %{buildroot}%{_bindir}/osbs-%{python2_version} +ln -s %{_bindir}/osbs-%{python2_version} %{buildroot}%{_bindir}/osbs-2 +ln -s %{_bindir}/osbs-%{binaries_py_version} %{buildroot}%{_bindir}/osbs %if 0%{?with_check} %check @@ -172,9 +170,10 @@ LANG=en_US.utf8 py.test-%{python2_version} -vv tests %files -n python-osbs-client %doc README.md -%{!?_licensedir:%global license %%doc} +%{!?_licensedir:%global license %doc} %license LICENSE -%{_bindir}/osbs2 +%{_bindir}/osbs-%{python2_version} +%{_bindir}/osbs-2 %{python2_sitelib}/osbs* %dir %{_datadir}/osbs %{_datadir}/osbs/*.json @@ -183,15 +182,25 @@ LANG=en_US.utf8 py.test-%{python2_version} -vv tests %if 0%{?with_python3} %files -n python3-osbs-client %doc README.md -%{!?_licensedir:%global license %%doc} +%{!?_licensedir:%global license %doc} %license LICENSE -%{_bindir}/osbs3 +%{_bindir}/osbs-%{python3_version} +%{_bindir}/osbs-3 %{python3_sitelib}/osbs* %dir %{_datadir}/osbs %{_datadir}/osbs/*.json %endif # with_python3 %changelog +* Thu Jan 21 2016 Martin Milata - 0.16-1 +- new upstream release: 0.16 + +* Fri Nov 20 2015 Jiri Popelka - 0.15-4 +- use py_build & py_install macros +- use python_provide macro +- do not use py3dir +- ship executables per packaging guidelines + * Fri Nov 13 2015 Jiri Popelka - 0.15-3 - rebuilt for Python3.5 diff --git a/sources b/sources index ed32ee2..65579a5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -55fb05d302755d17491b2f4a58768462 osbs-client-49ef2c5d631b8a0c5f82a1d9354e6f7271ba5f12.tar.gz +042f39dc41193d19b29f104662c607fd osbs-client-a8a926ef34b44a52da42fa07b3847efaaf06b12a.tar.gz