From abf4aea1c63b5d4f46fc284dfa317da67d569399 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Jun 16 2017 09:43:07 +0000 Subject: Backport to make osbs optional Backport from upstream. This change is included in future 1.50. After it gets released, remove these two patches. --- diff --git a/0001-make-osbs-dependency-optional.patch b/0001-make-osbs-dependency-optional.patch new file mode 100644 index 0000000..a4b1b16 --- /dev/null +++ b/0001-make-osbs-dependency-optional.patch @@ -0,0 +1,34 @@ +From 00d51625fca26938eab9c1a0f2f7e83227ea3559 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pavel=20=C5=A0imerda?= +Date: Wed, 5 Oct 2016 10:52:37 +0000 +Subject: [PATCH 1/2] make osbs dependency optional +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Pavel Šimerda +--- + pyrpkg/__init__.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py +index 66dd7e2..bdd7f70 100644 +--- a/pyrpkg/__init__.py ++++ b/pyrpkg/__init__.py +@@ -27,8 +27,11 @@ import sys + import tempfile + import koji.ssl.SSLCommon + +-from osbs.api import OSBS +-from osbs.conf import Configuration ++try: ++ from osbs.api import OSBS ++ from osbs.conf import Configuration ++except ImportError: ++ pass + from six.moves import configparser + from six.moves import urllib + +-- +2.7.5 + diff --git a/0002-Make-osbs-support-optional.patch b/0002-Make-osbs-support-optional.patch new file mode 100644 index 0000000..1c10ea5 --- /dev/null +++ b/0002-Make-osbs-support-optional.patch @@ -0,0 +1,45 @@ +From 93b8fe10cec88aa7051a9eb8f7041b7be0edf661 Mon Sep 17 00:00:00 2001 +From: Chenxiong Qi +Date: Wed, 24 May 2017 13:41:26 +0800 +Subject: [PATCH 2/2] Make osbs support optional + +Signed-off-by: Chenxiong Qi +--- + pyrpkg/__init__.py | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py +index bdd7f70..3a1d544 100644 +--- a/pyrpkg/__init__.py ++++ b/pyrpkg/__init__.py +@@ -27,11 +27,6 @@ import sys + import tempfile + import koji.ssl.SSLCommon + +-try: +- from osbs.api import OSBS +- from osbs.conf import Configuration +-except ImportError: +- pass + from six.moves import configparser + from six.moves import urllib + +@@ -2491,6 +2486,15 @@ class Commands(object): + + def osbs_build(self, config_file, config_section, target_override=False, + yum_repourls=[], nowait=False): ++ # Because docker image should be built via Koji not in OSBS directly, ++ # it is not necessary to make osbs as a hard dependency ++ try: ++ from osbs.api import OSBS ++ from osbs.conf import Configuration ++ except ImportError: ++ raise rpkgError('Before building docker image in OSBS directly, ' ++ 'please install python-osbs-client in advance.') ++ + self.check_repo() + os_conf = Configuration(conf_file=config_file, conf_section=config_section) + build_conf = Configuration(conf_file=config_file, conf_section=config_section) +-- +2.7.5 + diff --git a/rpkg.spec b/rpkg.spec index 4430adb..948e12d 100644 --- a/rpkg.spec +++ b/rpkg.spec @@ -3,12 +3,14 @@ Name: rpkg Version: 1.49 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python library for interacting with rpm+git License: GPLv2+ and LGPLv2 URL: https://pagure.io/rpkg Source0: https://pagure.io/releases/rpkg/%{name}-%{version}.tar.gz +Patch0: 0001-make-osbs-dependency-optional.patch +Patch1: 0002-Make-osbs-support-optional.patch BuildArch: noarch Requires: mock @@ -68,6 +70,8 @@ A python library for managing RPM package sources in a git repository. %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build @@ -107,6 +111,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/%{name} %changelog +* Fri Jun 16 2017 Chenxiong Qi - 1.49-3 +- Backport to make osbs optional + * Mon Mar 27 2017 Chenxiong Qi - 1.49-2 - Rebuilt to rename pyrpkg to python2-rpkg