packit / dist-git-to-source-git

Converting dist-git to source-git
MIT License
4 stars 9 forks source link

More than one directory found in BUILD #52

Open dhodovsk opened 4 years ago

dhodovsk commented 4 years ago

Packages c8s:

Packages c8:

Convert output:

[dhodovsk@shiny playuground]$ podman run --rm -v $PWD:/workdir:z dist2src dist2src -vv convert /workdir/rpms/$PKG:c8s /workdir/src/$PKG:c8s
convert(origin='/workdir/rpms/file:c8s', dest='/workdir/src/file:c8s')
Running command get_sources.sh in /workdir/rpms/file
output = SOURCES/file-5.33.tar.gz exists. skipping

Running rpmbuild in /workdir/rpms/file
This package uses %autosetup or %autopatch.
[PosixPath('/workdir/rpms/file/BUILD/python3-file-5.33-16.el8'), PosixPath('/workdir/rpms/file/BUILD/file-5.33')]
Traceback (most recent call last):
  File "/usr/local/bin/dist2src", line 11, in <module>
    load_entry_point('dist-git-to-source-git==0.1.dev138+g8e91ba5.d20200910', 'console_scripts', 'dist2src')()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/dist2src/cli.py", line 82, in wrapper
    ret = func(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/dist2src/cli.py", line 208, in convert
    d2s.convert(origin_branch, dest_branch)
  File "/usr/local/lib/python3.6/site-packages/dist2src/core.py", line 317, in convert
    self.run_prep()
  File "/usr/local/lib/python3.6/site-packages/dist2src/core.py", line 277, in run_prep
    if not (get_build_dir(self.dist_git_path).absolute() / ".git").is_dir():
  File "/usr/local/lib/python3.6/site-packages/dist2src/core.py", line 63, in get_build_dir
    raise RuntimeError(f"More than one build directory found in {path}")
RuntimeError: More than one build directory found in /workdir/rpms/file
lachmanfrantisek commented 4 years ago

I've got the same problem when updating podman and it showed up that I've wrongly cleaned the repo and left directory for both versions there. (It's a git inside git and needs two --force options to remove that.)

https://github.com/packit/dist-git-to-source-git/blob/7fcaed00b842e5b694d85fde92db343443f4d20c/dist2src/core.py#L167-L172

But, that should not be a problem for you. You are working always with the clean dist-git, aren't you?

dhodovsk commented 4 years ago

When I rerun the convert for figuring out the issue for specific package I use:

#!/bin/bash
PKG=$1
git clone https://git.centos.org/rpms/$PKG --branch=c8s --depth=1 rpms/$PKG
podman run --rm -v $PWD:/workdir:z dist2src dist2src -vv convert /workdir/rpms/$PKG:c8s /workdir/src/$PKG:c8s
lachmanfrantisek commented 4 years ago

So it's clean environment and unrelated to the one I got. OK.

dhodovsk commented 4 years ago

Use the directory which is a git project - try to make sure the other present directories are not required.