Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 08d1c1159ebbe2d1ac35f3df5ebdbc5e65966eed
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Oct 23 23:25:13 2014 +0200
[backend] createrepo: provides correct path for `dest_dir` option
---------------------------------------------------------------
backend/backend/createrepo.py | 2 +-
backend/tests/test_createrepo.py | 41 +++++++++++++++++++------------------
2 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/backend/backend/createrepo.py b/backend/backend/createrepo.py
index fc6f5c7..5d73436 100644
--- a/backend/backend/createrepo.py
+++ b/backend/backend/createrepo.py
@@ -33,8 +33,8 @@ def createrepo_unsafe(path, lock=None, dest_dir=None, base_url=None):
comm.extend(['-s', 'sha', '--checksum', 'md5'])
if dest_dir:
- comm.extend(['--outputdir', dest_dir])
dest_dir_path = os.path.join(path, dest_dir)
+ comm.extend(['--outputdir', dest_dir_path])
if not os.path.exists(dest_dir_path):
os.makedirs(dest_dir_path)
diff --git a/backend/tests/test_createrepo.py b/backend/tests/test_createrepo.py
index ea6b2b4..bd6db31 100644
--- a/backend/tests/test_createrepo.py
+++ b/backend/tests/test_createrepo.py
@@ -128,10 +128,12 @@ class TestCreaterepoUnsafe(object):
path_epel_5 = os.path.join(self.tmp_dir_name, "epel-5")
expected_epel_5 = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
'-s', 'sha', '--checksum',
'md5',
- '--outputdir', 'devel', '--baseurl',
'../', path_epel_5]
+ '--outputdir', os.path.join(path_epel_5,
"devel"),
+ '--baseurl', '../', path_epel_5]
path_fedora = os.path.join(self.tmp_dir_name, "fedora-21")
expected_fedora = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
- '--outputdir', 'devel', '--baseurl',
'../', path_fedora]
+ '--outputdir', os.path.join(path_fedora,
"devel"),
+ '--baseurl', '../', path_fedora]
for path, expected in [(path_epel_5, expected_epel_5), (path_fedora,
expected_fedora)]:
os.makedirs(path)
@@ -149,28 +151,27 @@ class TestCreaterepoUnsafe(object):
path_epel_5 = os.path.join(self.tmp_dir_name, "epel-5")
expected_epel_5 = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
'-s', 'sha', '--checksum',
'md5',
- '--outputdir', 'devel', '--baseurl',
'../', path_epel_5]
+ '--outputdir', os.path.join(path_epel_5,
"devel"),
+ '--baseurl', '../', path_epel_5]
path_fedora = os.path.join(self.tmp_dir_name, "fedora-21")
expected_fedora = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
- '--outputdir', 'devel', '--baseurl',
'../', path_fedora]
- for path, expected in [(path_epel_5, expected_epel_5), (path_fedora,
expected_fedora)]:
- os.makedirs(path)
-
- createrepo_unsafe(path, lock=None, base_url="../",
dest_dir="devel")
- assert mc_popen.call_args == mock.call(expected, stderr=-1, stdout=-1)
-
- def test_createrepo_devel_creates_folder(self, mc_popen):
-
- mc_popen.return_value.communicate.return_value = ("", "")
- path_epel_5 = os.path.join(self.tmp_dir_name, "epel-5")
- expected_epel_5 = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
- '-s', 'sha', '--checksum',
'md5',
- '--outputdir', 'devel', '--baseurl',
'../', path_epel_5]
- path_fedora = os.path.join(self.tmp_dir_name, "fedora-21")
- expected_fedora = ['/usr/bin/createrepo_c', '--database',
'--ignore-lock',
- '--outputdir', 'devel', '--baseurl',
'../', path_fedora]
+ '--outputdir', os.path.join(path_fedora,
"devel"),
+ '--baseurl', '../', path_fedora]
for path, expected in [(path_epel_5, expected_epel_5), (path_fedora,
expected_fedora)]:
os.makedirs(path)
createrepo_unsafe(path, lock=None, base_url="../",
dest_dir="devel")
assert os.path.exists(os.path.join(path, "devel"))
+ assert mc_popen.call_args == mock.call(expected, stderr=-1, stdout=-1)
+ #
+ # def test_createrepo_devel_creates_folder(self, mc_popen):
+ #
+ # mc_popen.return_value.communicate.return_value = ("", "")
+ # path_epel_5 = os.path.join(self.tmp_dir_name, "epel-5")
+ # path_fedora = os.path.join(self.tmp_dir_name, "fedora-21")
+ #
+ # for path in [path_epel_5, path_fedora]:
+ # os.makedirs(path)
+ #
+ # createrepo_unsafe(path, lock=None, base_url="../",
dest_dir="devel")
+ # assert os.path.exists(os.path.join(path, "devel"))