-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add option to include whole repository #443
base: main
Are you sure you want to change the base?
Conversation
- Added a section archiver with two options: - method ('git'/'tar'): How to create the tar ball - include_git (boolean): Whether to include .git folder Signed-off-by: Cristian Le <[email protected]>
This one seems to error when running |
Epel 7/8 seem to be using old python version. would really prefer the |
Signed-off-by: Cristian Le <[email protected]>
Oh no, we have to make the code compatible all the way to python 2.7 😢 |
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.
Hello @LecrisUT,
thank you for the PR.
I was finally able to take a look.
if add_git_folder: | ||
tar_append_cmd = f"tar --append -f {initial_tar} --transform 's|^{relative_git_dir}|{prefix}/|' {relative_git_dir}/.git" | ||
run_command(tar_append_cmd) | ||
elif method == 'tar': |
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 have some issues when using
[archiver]
method = tar
Traceback:
Traceback (most recent call last):
File "/home/jkadlcik/git/tito/src/tito/cli.py", line 919, in <module>
main()
File "/home/jkadlcik/git/tito/src/tito/cli.py", line 910, in main
CLI().main(sys.argv[1:])
File "/home/jkadlcik/git/tito/src/tito/cli.py", line 209, in main
return module.main(argv)
^^^^^^^^^^^^^^^^^
File "/home/jkadlcik/git/tito/src/tito/cli.py", line 392, in main
return builder.run(self.options)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jkadlcik/git/tito/src/tito/builder/main.py", line 160, in run
self.tgz()
File "/home/jkadlcik/git/tito/src/tito/builder/main.py", line 577, in tgz
self._setup_sources()
File "/home/jkadlcik/git/tito/src/tito/builder/main.py", line 610, in _setup_sources
create_tgz(self.git_root, self.tgz_dir, self.git_commit_id,
File "/home/jkadlcik/git/tito/src/tito/common.py", line 895, in create_tgz
tarfixer.fix()
File "/home/jkadlcik/git/tito/src/tito/tar.py", line 325, in fix
self.process_chunk(chunk)
File "/home/jkadlcik/git/tito/src/tito/tar.py", line 292, in process_chunk
chunk_props[member] = int(chunk_props[member], 8)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 8: ''
Reproducible when you run tito build --tgz
within this project.
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.
Indeed, that's where I wanted some help because I don't understand what the tarfixer does and why it fails like that.
@@ -427,6 +427,10 @@ def __init__(self, name=None, tag=None, build_dir=None, | |||
self.tgz_dir = tgz_base | |||
self.artifacts = [] | |||
|
|||
# Details of how to make the tar repo |
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.
Can you please explain these options in man tito.props
?
@@ -427,6 +427,10 @@ def __init__(self, name=None, tag=None, build_dir=None, | |||
self.tgz_dir = tgz_base | |||
self.artifacts = [] | |||
|
|||
# Details of how to make the tar repo | |||
self.tgz_method = self.config.get('archiver', 'method', fallback='git') | |||
self.tgz_include_git = self.config.getboolean('archiver', 'include_git', fallback=False) |
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 understand the situations when
- building a tarball from the last commit is useful
- building a tarball from the code as is, even with uncommitted changes, is useful
but I can't imagine a situation when using a tarball from the last commit but also containing the .git
directory is needed. Do you have a use-case for this?
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.
Well, this was my problems when building scikit-build-core
. It uses setuptools_scm
that can detect the tags from the .git
folder. They offer an alternative via .gitattributes
and generating a .git_archival.txt
file, but that also fails without #445. There could be similar projects, in which case that would be the easiest for prototyping or quickly setting up a build system.
Of course these would be discouraged for production releases.
Yeah, that's always fun 😄 But in your case it looks like an easyfix
IIRC Python 2.7 doesn't have f-strings yet. |
Please take a look here |
Yeah, I've understood the basics that it is to fix the timestamps so that the tars are identical. But I don't quite understand why it would depend if the tar ball was created via Although, wouldn't this be irrelevant if we include the whole |
Still needs to be exposed to CLI as well. Please help me on that part.
Closes: #441