rpm-software-management / tito

A tool for managing rpm based git projects.
GNU General Public License v2.0
380 stars 128 forks source link

SubmoduleAwareBuilder tries to chdir(None) which fails #413

Open skolpadda opened 2 years ago

skolpadda commented 2 years ago

This line:

self.run_git_archive(relative_git_dir, prefix, commit, initial_tar, None)

calls run_git_archive which tries:

with chdir(subdir) as p:

Since subdir is None here, this raises an exception:

Traceback (most recent call last):
  File "/usr/bin/tito", line 11, in <module>
    load_entry_point('tito==0.6.18', 'console_scripts', 'tito')()
  File "/usr/lib/python3.6/site-packages/tito/cli.py", line 910, in main
    CLI().main(sys.argv[1:])
  File "/usr/lib/python3.6/site-packages/tito/cli.py", line 209, in main
    return module.main(argv)
  File "/usr/lib/python3.6/site-packages/tito/cli.py", line 392, in main
    return builder.run(self.options)
  File "/usr/lib/python3.6/site-packages/tito/builder/main.py", line 161, in run
    self.rpm()
  File "/usr/lib/python3.6/site-packages/tito/builder/main.py", line 559, in rpm
    self.tgz()
  File "/usr/lib/python3.6/site-packages/tito/builder/main.py", line 542, in tgz
    self._setup_sources()
  File "/usr/lib/python3.6/site-packages/tito/builder/submodule_aware_builder.py", line 52, in _setup_sources
    os.path.join(self.rpmbuild_sourcedir, self.tgz_filename))
  File "/usr/lib/python3.6/site-packages/tito/builder/submodule_aware_builder.py", line 112, in create_tgz
    self.run_git_archive(relative_git_dir, prefix, commit, initial_tar, None)
  File "/usr/lib/python3.6/site-packages/tito/builder/submodule_aware_builder.py", line 75, in run_git_archive
    with chdir(subdir) as p:
  File "/usr/lib64/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/lib/python3.6/site-packages/tito/common.py", line 138, in chdir
    os.chdir(path)
TypeError: chdir: path should be string, bytes, os.PathLike or integer, not NoneType

Python: 3.6 OS: CentOS 8 tito: 0.6.18

Expected behaviour: tito builds the RPM without any errors.

belonesox commented 2 years ago

Obvious bug. image

I quickly fixed it, but I see a lot of other «submodule bugs»…

FrostyX commented 10 months ago

This seems to be fixed by PR #427, can we close @skolpadda?