diff --git a/.gitignore b/.gitignore index a390fd6..62ee5a5 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ /rpkg-1.47.tar.gz /rpkg-1.48.tar.gz /rpkg-1.49.tar.gz +/rpkg-1.50.tar.gz diff --git a/0001-Fix-encoding-in-new-command.patch b/0001-Fix-encoding-in-new-command.patch new file mode 100644 index 0000000..566e371 --- /dev/null +++ b/0001-Fix-encoding-in-new-command.patch @@ -0,0 +1,45 @@ +From 983aceeb9c03a02dd22d7ab5cb14246a1d4813dc Mon Sep 17 00:00:00 2001 +From: Chenxiong Qi +Date: Thu, 17 Aug 2017 12:35:44 +0800 +Subject: [PATCH] Fix encoding in new command + +In previous commit, new_diff returned from GitPython API is unicode +string and has to be encoded in encoding UTF-8. That works well with +GitPython>=1.0, but not with version GitPython<1.0 which returns string +in basestring type. This failure case happens in EL6 with +0.3.2-0.6.RC1.el6. + +Signed-off-by: Chenxiong Qi +--- + pyrpkg/cli.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py +index ac6c841..69cc931 100644 +--- a/pyrpkg/cli.py ++++ b/pyrpkg/cli.py +@@ -23,6 +23,7 @@ import time + + import koji + import pyrpkg.utils as utils ++import six + + from pyrpkg import rpkgError, log as rpkgLogger + from six.moves import xmlrpc_client, configparser +@@ -1315,7 +1316,12 @@ see API KEY section of copr-cli(1) man page. + + def new(self): + new_diff = self.cmd.new() +- print(new_diff.encode('utf-8')) ++ # When running rpkg with old version GitPython<1.0 which returns string ++ # in type basestring, no need to encode. ++ if isinstance(new_diff, six.string_types): ++ print(new_diff) ++ else: ++ print(new_diff.encode('utf-8')) + + def new_sources(self): + # Check to see if the files passed exist +-- +2.9.4 + diff --git a/0001-Make-module-name-work-with-namespaces.patch b/0001-Make-module-name-work-with-namespaces.patch deleted file mode 100644 index 87eafa2..0000000 --- a/0001-Make-module-name-work-with-namespaces.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 913b547a0df8433924531739506e1b8975e50b8b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= -Date: Wed, 17 May 2017 15:30:45 +0200 -Subject: [PATCH 1/3] Make --module-name work with namespaces -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Allow the user to specify module name including a namespace, and when no -namespace is included, assume 'rpms'. - -Fixes: #216 -Signed-off-by: Lubomír Sedlář ---- - pyrpkg/cli.py | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py -index 7395fd1..856883a 100644 ---- a/pyrpkg/cli.py -+++ b/pyrpkg/cli.py -@@ -138,7 +138,21 @@ class cliClient(object): - realms=realms - ) - -- self._cmd.module_name = self.args.module_name -+ if self.args.module_name: -+ # Module name was specified via argument -+ if '/' not in self.args.module_name: -+ # No slash, assume rpms namespace -+ self._cmd.module_name = self.args.module_name -+ self._cmd.ns_module_name = 'rpms/%s' % self.args.module_name -+ else: -+ self._cmd.ns_module_name = self.args.module_name -+ try: -+ _, self._cmd.module_name = self.args.module_name.split('/') -+ # Exactly one slash, let's continue on -+ except ValueError: -+ # Too many segments, report an error -+ self.parser.error('Argument to --module-name can contain ' -+ 'at most one / character') - self._cmd.password = self.args.password - self._cmd.runas = self.args.runas - self._cmd.debug = self.args.debug --- -2.9.4 - diff --git a/0001-make-osbs-dependency-optional.patch b/0001-make-osbs-dependency-optional.patch deleted file mode 100644 index a4b1b16..0000000 --- a/0001-make-osbs-dependency-optional.patch +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index 1c10ea5..0000000 --- a/0002-Make-osbs-support-optional.patch +++ /dev/null @@ -1,45 +0,0 @@ -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/0003-Allow-explicit-namespaces-with-slashes.patch b/0003-Allow-explicit-namespaces-with-slashes.patch deleted file mode 100644 index b862523..0000000 --- a/0003-Allow-explicit-namespaces-with-slashes.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 9b2c92ad7a58eefffffcdf35e564993d196b9966 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= -Date: Thu, 18 May 2017 15:02:33 +0200 -Subject: [PATCH 3/3] Allow explicit namespaces with slashes -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -COPR uses module names in the form of user/project/package, so their -namespaces contain multiple slashes. - -Signed-off-by: Lubomír Sedlář ---- - pyrpkg/cli.py | 8 +------- - tests/test_cli.py | 29 +++++++++++++++++++++++++++++ - 2 files changed, 30 insertions(+), 7 deletions(-) - -diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py -index 856883a..34512a9 100644 ---- a/pyrpkg/cli.py -+++ b/pyrpkg/cli.py -@@ -146,13 +146,7 @@ class cliClient(object): - self._cmd.ns_module_name = 'rpms/%s' % self.args.module_name - else: - self._cmd.ns_module_name = self.args.module_name -- try: -- _, self._cmd.module_name = self.args.module_name.split('/') -- # Exactly one slash, let's continue on -- except ValueError: -- # Too many segments, report an error -- self.parser.error('Argument to --module-name can contain ' -- 'at most one / character') -+ _, self._cmd.module_name = self.args.module_name.rsplit('/', 1) - self._cmd.password = self.args.password - self._cmd.runas = self.args.runas - self._cmd.debug = self.args.debug -diff --git a/tests/test_cli.py b/tests/test_cli.py -index 29b1e2e..126b59b 100644 ---- a/tests/test_cli.py -+++ b/tests/test_cli.py -@@ -68,6 +68,35 @@ class CliTestCase(CommandTestCase): - map(lambda cmd: self.run_cmd(cmd, cwd=repo_path), cmds) - - -+class TestModuleNameOption(CliTestCase): -+ -+ def get_cmd(self, module_name): -+ cmd = ['rpkg', '--path', self.cloned_repo_path, '--module-name', module_name, 'verrel'] -+ with patch('sys.argv', new=cmd): -+ cli = self.new_cli() -+ return cli.cmd -+ -+ def test_just_module_name(self): -+ cmd = self.get_cmd('foo') -+ self.assertEqual(cmd._module_name, 'foo') -+ self.assertEqual(cmd._ns_module_name, 'rpms/foo') -+ -+ def test_explicit_default(self): -+ cmd = self.get_cmd('rpms/foo') -+ self.assertEqual(cmd._module_name, 'foo') -+ self.assertEqual(cmd._ns_module_name, 'rpms/foo') -+ -+ def test_with_namespace(self): -+ cmd = self.get_cmd('container/foo') -+ self.assertEqual(cmd._module_name, 'foo') -+ self.assertEqual(cmd._ns_module_name, 'container/foo') -+ -+ def test_with_nested_namespace(self): -+ cmd = self.get_cmd('user/project/foo') -+ self.assertEqual(cmd._module_name, 'foo') -+ self.assertEqual(cmd._ns_module_name, 'user/project/foo') -+ -+ - class TestClog(CliTestCase): - - def setUp(self): --- -2.9.4 - diff --git a/rpkg.spec b/rpkg.spec index 1380976..6becfad 100644 --- a/rpkg.spec +++ b/rpkg.spec @@ -2,25 +2,15 @@ %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} Name: rpkg -Version: 1.49 -Release: 7%{?dist} +Version: 1.50 +Release: 1%{?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 -Patch2: 0001-Make-module-name-work-with-namespaces.patch -Patch3: 0003-Allow-explicit-namespaces-with-slashes.patch BuildArch: noarch - -Requires: mock -Requires: redhat-rpm-config -Requires: rpm-build -Requires: rpmlint - -BuildRequires: rpmlint +Patch0: 0001-Fix-encoding-in-new-command.patch %description @@ -44,17 +34,24 @@ BuildRequires: python-six >= 1.9.0 BuildRequires: python-nose BuildRequires: python-mock +BuildRequires: rpmlint + %if 0%{?rhel} && 0%{?rhel} < 7 BuildRequires: python-argparse %endif +Requires: mock +Requires: redhat-rpm-config +Requires: rpm-build +Requires: rpm-python +Requires: rpmlint + Requires: GitPython >= 0.2.0 -Requires: python2-koji -Requires: python2-cccolutils Requires: python-kitchen Requires: python-pycurl Requires: python-six >= 1.9.0 -Requires: rpm-python +Requires: python2-cccolutils +Requires: python2-koji Conflicts: fedpkg < 1.26 @@ -71,9 +68,6 @@ A python library for managing RPM package sources in a git repository. %prep %setup -q %patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build @@ -106,13 +100,57 @@ rm -rf $RPM_BUILD_ROOT %files -n python2-%{name} -%doc COPYING COPYING-koji LGPL README CHANGELOG.rst +%doc COPYING COPYING-koji LGPL README.rst CHANGELOG.rst # For noarch packages: sitelib %{python_sitelib}/pyrpkg %{python_sitelib}/%{name}-%{version}-py?.?.egg-info %{_datadir}/%{name} %changelog +* Thu Aug 10 2017 Chenxiong Qi - 1.50-1 +- Fix PEP8 error (cqi) +- Spelling fixes (ville.skytta) +- Reword help and description of new-sources and upload commands - rhbz#1248737 + (cqi) +- Set autorebuild enabled by default (bfontecc) +- Add commands to whitelist_externals (cqi) +- Declare Python 3 versions to support in setup.py (cqi) +- Replace unicode with six.text_type (cqi) +- Run tests in both Python 2 and 3 with tox (cqi) +- Make tests and covered code compatible with Py3 (cqi) +- Add requirements files (cqi) +- Do not build srpm in test (cqi) +- Do not actually run git-diff in tests (cqi) +- Remove deprecated modules used in koji (cqi) +- Non-zero exit when rpmbuild fails in local command (cqi) +- Report deprecation of config via logger (lsedlar) +- Print --dist deprecation warning explicitly (lsedlar) +- utils: Avoid DeprecationWarning for messages for users (lsedlar) +- Supply namespace to lookaside (if enabled) (lsedlar) +- Support reading koji config from profile - #187 (cqi) +- Remove kitchen (cqi) +- Fix string format (cqi) +- Recommend --release instead of --dist in mockbuild --help (tmz) +- Allow overriding container build target by downstream (lsedlar) +- Add a separate property for namespace (lsedlar) +- Allow container builds from any namespace (maxamillion) +- Make osbs support optional (cqi) +- make osbs dependency optional (pavlix) +- Allow explicit namespaces with slashes (lsedlar) +- Do not hang indefinitely when lookaside cache server stops sending data + (jkaluza) +- Make --module-name work with namespaces - #216 (lsedlar) +- Include README.rst in dist package (cqi) +- More document in README - #189 (cqi) +- Make new command be able to print unicode - #205 (cqi) +- Allow to specify custom info to a dummy commit (cqi) +- Load module name correctly even if push url ends in slash - #192 (cqi) +- Replace fedorahosted.org with pagure.io - #202 (cqi) +- Fix rpm command to get changelog from SPEC - rhbz#1412224 (cqi) +- Rewrite tests to avoid running rpmbuild and rpmlint (cqi) +- Use fake value to make Command in test (cqi) +- Python 3.6 invalid escape sequence deprecation fixes (ville.skytta) + * Thu Jul 27 2017 Fedora Release Engineering - 1.49-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild diff --git a/sources b/sources index 71074ef..d023d3b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rpkg-1.49.tar.gz) = a3b3ab6ee9124e9ac098f78086e3f188babcce62769fa37d6baccfed8261eea13c0fc93a366f954f7e99ae26c5108b1055206b177825a42b70b18895faca1e73 +SHA512 (rpkg-1.50.tar.gz) = 8b5b5a69d9209b69804280b3ac3f19cd865de0a7803f82193f7727d747589ba408c358d9f86f87f948eaa5c6a414b58fc8d3b02a25b446bd6eb49ece039363da