Skip to content
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

Project is not buildable from git archive #509

Open
LecrisUT opened this issue Sep 27, 2024 · 4 comments
Open

Project is not buildable from git archive #509

LecrisUT opened this issue Sep 27, 2024 · 4 comments

Comments

@LecrisUT
Copy link

Small suggestion, how about using .gitattributes in order to save the commit reference instead of using git format command in:

ble.sh/ble.pp

Line 79 in 32f290d

#%[commit_hash = system("git show -s --format=%h")]

You can see an example in:
https://github.com/scikit-build/scikit-build-core/blob/main/.git_archival.txt
https://github.com/scikit-build/scikit-build-core/blob/main/.gitattributes

I think one option would be to package a similar .git_archival.txt and read the file for the commit hash, and if that fails use the git format approach (or vice-versa)

@akinomyoga
Copy link
Owner

akinomyoga commented Sep 27, 2024

Thanks for the hint, but I'm wondering how this should be used.

As far as I read the documentation of the export-subst attributes at export_subst - gitattributes and export_subst - git-archive, it affects the result of git archive. However, even if the git commit hash is solved with the suggested export-subst, the git archive still doesn't build because it is missing the contents of the submodule.

Is there a way to use export-subst other than git archive (where the contents of the submodules can also be included)? Or is there a way to make git archive include the contents of the submodule recursively?

@LecrisUT
Copy link
Author

Re: submodules, one recommendation was to use git-archive-all. It's been a while since I've looked into these, but I remember there being some nuance regarding reproducible archiving.

Original this issue regards Fedora packaging where we would get the git archive of each submodule and then just move them inplace where they are expected.

Regarding how to use export-subst, basically any text under $...$ will be replaced using the format flags, but it is sufficient to consider only $Format:%H$ which expands to the git commit, although quite a useful one is $Format:%(describe:tags=true,match=*[0-9]*)$ which expands to the git describe text. Using this within ble.pp would be a bit too much, but if you keep a .git_archival.txt file than you can simply query the info there and substitute it manually in the makefile.

@akinomyoga
Copy link
Owner

The use cases seem minor (compared to git archive if it were working), but I'll consider it as a fallback of the commit_hash resolution.

@LecrisUT
Copy link
Author

I'll consider it as a fallback of the commit_hash resolution.

That would be perfect for us. For reference, here are the changes I am proposing in the Fedora review to make it buildable:

$ rm -rf contrib
$ tar -xf %{SOURCE1}
$ mv blesh-contrib-* contrib
$ sed -ie 's/| \.git.*//' GNUmakefile
$ sed -ie 's/#%%\[commit_hash =.*/#%%[commit_hash = "fedora"]/' ble.pp

(SOURCE1 is the path to blesh-contrib git archive, we need to remove the .git requirement in the GNUmakefile, and we are changing the commit_hash calculation (here I was considering "fedora" just because I was thinking it is only used for display and it would be a better indicator))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants