-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Submodules may contain other submodules. Do process and add those to the source tar. #457
Conversation
Thank you for the PR @arcivanov, |
Yes. https://github.com/karellen/karellen-sysbox |
@FrostyX |
f9f72fb
to
5b21da9
Compare
@FrostyX fixed |
Thank you for the CI fixes and so on :-) The PR works for me. I only found one issue, when I did
And forgot to pull the submodules first. It fails with a traceback:
It probably failed with a traceback even before your PR, but since you are touching that part of the code, could you please catch the exception and print some reasonable error message? Ideally, showing users the command to pull the submodules? |
Hello @t0fik, you recently did some coding on |
Also @areese, do you want to take a look, please? |
I had the exactly same issue a couple of times 😄 Please let me know what you think. BTW, this is running on Fedora COPR already. |
submodule_commit, | ||
submodule_tar_file, | ||
submodule, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, maybe you can run the self.run_git_archive(...)
inside of a try-except block and if you find something like "not a valid object name" in the exception, you can create some user-friendly message and do raise TitoException(msg)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but the failure could be something else like out of disk space etc. to blindly try-catch or I'd have to parse the error.
There is no situation where the submodule is checked out recursively but there is no .git
sub-directory though, i.e. it's a sure way to check if it was correctly pulled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work for you?
$ tito build --srpm --debug
Creating output directory: /tmp/tito
Added lib dir to PYTHONPATH: /home/arcivanov/Documents/src/karellen/karellen-sysbox/.tito/libs
---- Builder class is None
Importing karellen.tito.SubmoduleAwareBuilder
Using builder class: <class 'karellen.tito.submodule_aware_builder.SubmoduleAwareBuilder'>
Building in temp dir: /tmp/tito/rpmbuild-karellen-sysbox2l092siv
Getting latest package info from: /home/arcivanov/Documents/src/karellen/karellen-sysbox/.tito/packages/karellen-sysbox
Command: awk '{ print $1 ; exit }' /home/arcivanov/Documents/src/karellen/karellen-sysbox/.tito/packages/karellen-sysbox
Status code: 0
Command output: 0.6.1.17-3
Command: git ls-remote ./. --tag karellen-sysbox-0.6.1.17-3 | awk '{ print $1 ; exit }'
Status code: 0
Command output: 559a13650b1241d37cff335b5b2df0d36d3d2d39
Local tag SHA1: 559a13650b1241d37cff335b5b2df0d36d3d2d39
Command: git config remote.origin.url
Status code: 0
Command output: ssh://git@github.com/karellen/karellen-sysbox
Command: git config remote.origin.url
Status code: 0
Command output: ssh://git@github.com/karellen/karellen-sysbox
Checking for tag [karellen-sysbox-0.6.1.17-3] in git repo [ssh://git@github.com/karellen/karellen-sysbox]
Command: git ls-remote ssh://git@github.com/karellen/karellen-sysbox --tag karellen-sysbox-0.6.1.17-3 | awk '{ print $1 ; exit }'
Status code: 0
Command output: 559a13650b1241d37cff335b5b2df0d36d3d2d39
Remote tag SHA1: 559a13650b1241d37cff335b5b2df0d36d3d2d39
Command: git ls-remote ./. --tag karellen-sysbox-0.6.1.17-3 | awk '{ print $1 ; exit }'
Status code: 0
Command output: 559a13650b1241d37cff335b5b2df0d36d3d2d39
Command: git rev-list --max-count=1 559a13650b1241d37cff335b5b2df0d36d3d2d39
Status code: 0
Command output: a270b8ed4363962ec55efd2d41788fc2fc30dad4
Got package metadata: ['0.6.1.17-3', './']
Building package [karellen-sysbox-0.6.1.17-3]
Creating karellen-sysbox-0.6.1.17.tar.gz from git tag: a270b8ed4363962ec55efd2d41788fc2fc30dad4...
Command: git rev-list --timestamp --max-count=1 a270b8ed4363962ec55efd2d41788fc2fc30dad4 | awk '{print $1}'
Status code: 0
Command output: 1682902338
Command: git archive --format=tar --prefix=karellen-sysbox-0.6.1.17/ a270b8ed4363962ec55efd2d41788fc2fc30dad4: --output=/tmp/tito/rpmbuild-karellen-sysbox2l092siv/SOURCES/karellen-sysbox-0.6.1.17.tar.initial
Status code: 0
Command output:
Command: git config --file .gitmodules --get-regexp path
Status code: 0
Command output: submodule.sysbox.path sysbox
Cleaning up /tmp/tito/rpmbuild-karellen-sysbox2l092siv
ERROR: '/home/arcivanov/Documents/src/karellen/karellen-sysbox/sysbox/.git' path does not contain '.git' directory. Have you cloned the repository recursively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
...karellen/karellen-sysbox/sysbox/.git' path does not contain '.git'
I am nitpicking: This is a bit confusing, I would drop the .git
from the path.
Have you cloned the repository recursively?
Maybe suggesting the git submodule update --init --recursive
command so that we don't have to search for it on stack overflow? 😄
But at this point, this PR has +1 from me anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind. I have to go by the .git
file, not .git
directory. Fixing now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, the check is now that there is a file .git
(directory or file) and that is checked.
The build passed no problem: https://copr.fedorainfracloud.org/coprs/karellen/karellen-sysbox/build/5865413/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect, thank you very much @arcivanov.
Works for me, and the error message is now super helpful.
I'll leave the PR open for a couple of days so that anybody else has enough time to review if they want to. Then I'll merge on Monday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, it's two weeks already? Sorry about that.
a3d9b72
to
f9efca7
Compare
to the source tar. fixes rpm-software-management#456
fixes #456