packit / dist-git-to-source-git

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

'fatal: bad revision 'updates~xxx #74

Open dhodovsk opened 3 years ago

dhodovsk commented 3 years ago

Where xxx is weirdly high, eg. 5200

Packages:

Convert output:

convert(origin='/workdir/rpms/rubygem-rspec-expectations:c8', dest='/workdir/src/rubygem-rspec-expectations:c8')
Running command get_sources.sh in /workdir/rpms/rubygem-rspec-expectations
output = Retrieving https://git.centos.org/sources/rubygem-rspec-expectations/c8/6962a1ca12fd2fd71d7940932ef57559991feabb
Retrieving https://git.centos.org/sources/rubygem-rspec-expectations/c8/f81cdf2d5c175983e873b04df522e42aededf16f

Running rpmbuild in /workdir/rpms/rubygem-rspec-expectations
'%setup -q -T -n %{gem_name}-%{version} -b 1' -> '%autosetup -N -T -n %{gem_name}-%{version} -b 1'
rpmbuild stdout = Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.4YHfTk
Reinitialized existing Git repository in /workdir/rpms/rubygem-rspec-expectations/BUILD/rspec-expectations-3.7.0/.git/
[master 8e56b1d3] rubygem-rspec-expectations-3.7.0 base
Patch #1 (rspec-expectations-3.7.0-aggregator-ruby25.patch):
patching file spec/rspec/expectations/failure_aggregator_spec.rb
[master 17c274d2] Apply patch rspec-expectations-3.7.0-aggregator-ruby25.patch
 1 file changed, 13 insertions(+)

rpmbuild stderr = D: created directory(s) /workdir/rpms/rubygem-rspec-expectations/BUILD mode 0755
D: created directory(s) /workdir/rpms/rubygem-rspec-expectations/RPMS mode 0755
D: created directory(s) /workdir/rpms/rubygem-rspec-expectations/SRPMS mode 0755
D: created directory(s) /workdir/rpms/rubygem-rspec-expectations/BUILDROOT mode 0755
ufdio:       1 reads,       13 total bytes in 0.000004 secs
ufdio:       1 reads,       13 total bytes in 0.000003 secs
+ umask 022
+ cd /workdir/rpms/rubygem-rspec-expectations/BUILD
+ cd /workdir/rpms/rubygem-rspec-expectations/BUILD
+ rm -rf rspec-expectations-3.7.0
+ /usr/bin/gzip -dc /workdir/rpms/rubygem-rspec-expectations/SOURCES/rubygem-rspec-expectations-3.7.0-full.tar.gz
+ /usr/bin/tar -xof -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd rspec-expectations-3.7.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ /usr/bin/git init
+ /usr/bin/git add .
+ /usr/bin/git commit --allow-empty -a -m 'rubygem-rspec-expectations-3.7.0 base'
+ echo 'Patch #1 (rspec-expectations-3.7.0-aggregator-ruby25.patch):'
+ /usr/bin/packitpatch '%{1}' '%{2}' --fuzz=0 --no-backup-if-mismatch --no-backup-if-mismatch -p1 --fuzz=0
+ gem specification /workdir/rpms/rubygem-rspec-expectations/SOURCES/rspec-expectations-3.7.0.gem -l --ruby
+ exit 0
ufdio:       1 reads,    17154 total bytes in 0.000007 secs
ufdio:       1 reads,     5442 total bytes in 0.000002 secs
ufdio:       1 reads,    17154 total bytes in 0.000003 secs
ufdio:       1 reads,    17154 total bytes in 0.000003 secs
ufdio:       1 reads,     5442 total bytes in 0.000002 secs
ufdio:       1 reads,    17154 total bytes in 0.000004 secs

The repo is not dirty, nothing to commit.
Fetch the dist-git %prep branch to source-git branch updates.
Traceback (most recent call last):
  File "/usr/local/bin/dist2src", line 11, in <module>
    load_entry_point('dist-git-to-source-git==0.1.dev143+g585c7a4.d20200916', '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 324, in convert
    from_branch=TEMP_SG_BRANCH, to_branch=dest_branch
  File "/usr/local/lib/python3.6/site-packages/dist2src/core.py", line 150, in cherry_pick_base
    self.repo.git.cherry_pick(f"{from_branch}~{num_commits - 1}")
  File "/usr/local/lib/python3.6/site-packages/git/cmd.py", line 542, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/git/cmd.py", line 1005, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/usr/local/lib/python3.6/site-packages/git/cmd.py", line 822, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git cherry-pick updates~2270
  stderr: 'fatal: bad revision 'updates~2270''
pvalena commented 3 years ago

What does this exactly mean?

git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git cherry-pick updates~2270
  stderr: 'fatal: bad revision 'updates~2270''

Note: some gems use git to create gem file (installable), from gemspec file, which simply calls git ls-files. This shouldn't be needed for rebuilding package though (spec file we use should be static, generated from gem). So it's probably unrelated, but worth noting.

TomasTomecek commented 3 years ago

@pvalena the way this works in d2s is that:

  1. we run %prep
  2. it creates a git repo in BUILD/-/.git
  3. we then create a source-git repo some/path/source-git/
  4. we then fetch refs in the source-git from the git repo in BUILD

when I look at %prep in the rspec package:

%prep
%setup -q -T -n %{gem_name}-%{version} -b 1
gem specification %{SOURCE0} -l --ruby > %{gem_name}.gemspec

it is pretty straightforward

on the other hand, there seem to be 2 tarballs and some "gem" magic happening

we'd need to look into this more thoroughly (unless you can explain to us what's happening behind the scenes :)