#21 diff_module_deps.py fails with traceback
Closed Opened by phracek.

19:59 $ ./diff_module_deps.py --resolve valgrind
Getting module information from mbs cache. Please run mbs-build local with dependency modules you are interested in before running this script.
Traceback (most recent call last):
  File "./diff_module_deps.py", line 7, in <module>
    sys.exit(CliModuleDepsDifferHelper.run())
  File "/home/phracek/work/programming/modularity-tools/modularity/cli.py", line 112, in run
    mdd.run()
  File "/home/phracek/work/programming/modularity-tools/modularity/module_deps_differ.py", line 239, in run
    self._init_repo_bases2()
  File "/home/phracek/work/programming/modularity-tools/modularity/module_deps_differ.py", line 119, in _init_repo_bases2
    base = ModuleDepsDiffer.get_base_from_repo(reponame, repourl)
  File "/home/phracek/work/programming/modularity-tools/modularity/module_deps_differ.py", line 89, in get_base_from_repo
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 817, in load
    if self.metadata or self._try_cache():
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 722, in _try_cache
    handle = self._handle_new_local(self.cachedir)
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 483, in cachedir
    return os.path.join(self.basecachedir, repodir)
  File "/usr/lib64/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'YumConf' object has no attribute 'endswith'

What version of python2-dnf do you have?

I can reproduce this on Fedora 25 with python3-dnf-1.1.10-6.fc25.noarch. Seems like the API changed quite a bit. @ignatenkobrain would you be able to help us here? We are trying to populate a Repo object here like this:

base = dnf.Base()
repo = dnf.repo.Repo(reponame, base.conf)
repo.baseurl = repourl
repo.load()

but it fails with traceback above, or

Traceback (most recent call last):
  File "./diff_module_deps.py", line 7, in <module>
    sys.exit(CliModuleDepsDifferHelper.run())
  File "/app/modularity/cli.py", line 112, in run
    mdd.run()
  File "/app/modularity/module_deps_differ.py", line 240, in run
    self._init_repo_bases2()
  File "/app/modularity/module_deps_differ.py", line 120, in _init_repo_bases2
    base = ModuleDepsDiffer.get_base_from_repo(reponame, repourl)
  File "/app/modularity/module_deps_differ.py", line 90, in get_base_from_repo
    repo.load()
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 817, in load
    if self.metadata or self._try_cache():
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 722, in _try_cache
    handle = self._handle_new_local(self.cachedir)
  File "/usr/lib/python3.5/site-packages/dnf/repo.py", line 483, in cachedir
    return os.path.join(self.basecachedir, repodir)
  File "/usr/lib64/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/usr/lib64/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'YumConf'

This is a sample repourl:

repourl = 'file:///root/modulebuild/cache/koji_tags/module-7571a4830b16a549'

Proposed PR: https://pagure.io/modularity/modularity-tools/pull-request/24

Proposed PR solves the issues.

Metadata