commit:     1733e574716d2e904dcd9b0338a61fbfe0a798e7
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  7 00:32:43 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Apr  7 01:42:01 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1733e574

ResolverPlayground: create ${EPREFIX}/usr/share/repoman

This solves the following issue when running the tests with
an installed instance of repoman like we do in travis:

testSimple (repoman.tests.simple.test_simple.SimpleRepomanTestCase) ... 
Traceback (most recent call last):
  File "/usr/bin/repoman", line 44, in <module>
    repoman_main(sys.argv[1:])
  File 
"/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/repoman/main.py",
 line 95, in repoman_main
    repoman_settings, vcs_settings, options, qadata)
  File 
"/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/repoman/repos.py",
 line 56, in __init__
    if not self.qadata.load_repo_config(self.masters_list, options, 
repoman_settings.valid_versions):
  File 
"/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/repoman/qa_data.py",
 line 46, in load_repo_config
    repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in 
os.listdir(cnfdir)]
OSError: [Errno 2] No such file or directory: 
'/tmp/tmpWkrEvP/usr/share/repoman/qa_data'

 pym/portage/tests/resolver/ResolverPlayground.py | 10 ++++++++++
 repoman/pym/repoman/tests/__init__.py            |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py 
b/pym/portage/tests/resolver/ResolverPlayground.py
index d3a5d8092..e2e061669 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -26,6 +26,11 @@ from _emerge.create_depgraph_params import 
create_depgraph_params
 from _emerge.depgraph import backtrack_depgraph
 from _emerge.RootConfig import RootConfig
 
+try:
+       from repoman.tests import cnf_path_repoman
+except ImportError:
+       cnf_path_repoman = None
+
 if sys.hexversion >= 0x3000000:
        # pylint: disable=W0622
        basestring = str
@@ -457,6 +462,11 @@ class ResolverPlayground(object):
                                for line in lines:
                                        f.write("%s\n" % line)
 
+               if cnf_path_repoman is not None:
+                       #Create /usr/share/repoman
+                       repoman_share_dir = os.path.join(self.eroot, 'usr', 
'share', 'repoman')
+                       os.symlink(cnf_path_repoman, repoman_share_dir)
+
        def _create_world(self, world, world_sets):
                #Create /var/lib/portage/world
                var_lib_portage = os.path.join(self.eroot, "var", "lib", 
"portage")

diff --git a/repoman/pym/repoman/tests/__init__.py 
b/repoman/pym/repoman/tests/__init__.py
index 3421493f4..d57ca9b10 100644
--- a/repoman/pym/repoman/tests/__init__.py
+++ b/repoman/pym/repoman/tests/__init__.py
@@ -33,11 +33,14 @@ from portage.const import EPREFIX, GLOBAL_CONFIG_PATH, 
PORTAGE_BIN_PATH
 
 if repoman._not_installed:
        cnf_path = os.path.join(REPOMAN_BASE_PATH, 'cnf')
+       cnf_path_repoman = cnf_path
        cnf_etc_path = cnf_path
        cnf_bindir = os.path.join(REPOMAN_BASE_PATH, 'bin')
        cnf_sbindir = cnf_bindir
 else:
        cnf_path = os.path.join(EPREFIX or '/', GLOBAL_CONFIG_PATH)
+       cnf_path_repoman = os.path.join(EPREFIX or '/',
+               sys.prefix.lstrip(os.sep), 'share', 'repoman')
        cnf_etc_path = os.path.join(EPREFIX or '/', 'etc')
        cnf_eprefix = EPREFIX
        cnf_bindir = os.path.join(EPREFIX or '/', 'usr', 'bin')

Reply via email to