build: Fix building clboss as a git submodule#250
Conversation
|
@chrisguida I found an alternative which uses git itself to decide (and fails appropriately if git is missing): diff --git a/Makefile.am b/Makefile.am
index 7f31dff..1e3d4b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -679,8 +679,10 @@ create-tarball: create-tarball.in Makefile
BUILT_SOURCES = commit_hash.h
commit_hash.h: FORCE
- @if test -e $(srcdir)/.git/logs/HEAD; then \
- if [ ! -f $(srcdir)/commit_hash.h ] || [ $(srcdir)/.git/logs/HEAD -nt $(srcdir)/commit_hash.h ]; then \
+ @if git -C $(srcdir) rev-parse --is-inside-work-tree > /dev/null 2>&1; then \
+ CURRENT_HASH="$$(git -C $(srcdir) rev-parse HEAD)"; \
+ if [ ! -f $(srcdir)/commit_hash.h ] || \
+ [ "$$(grep -oE '[0-9a-f]{40}' $(srcdir)/commit_hash.h)" != "$$CURRENT_HASH" ]; then \
echo "Regenerating $(srcdir)/commit_hash.h..."; \
$(SHELL) $(srcdir)/generate_commit_hash.sh; \
else \WDYT? |
|
@ksedgwic yes, this works, as long as @Dominion5254 adds the line
I agree that this is the best way to solve the problem, as the way it was previously the commit_hash.h was just a dummy file that is not useful Now with this code (and the modification to the downstream dockerfile) the new commit_hash.h is: I will update the PR shortly. |
70eb725 to
339cc50
Compare
|
@chrisguida using your build-as-submodule branch and adding the suggested line - @ksedgwic if you are good with Chris's PR, would this change be worth a point release of clboss, or would you just include this in the next planned release? I don't really have a preference as I have a working build for cln-startos in either case. |
|
I think a point release could be worth it (or you could just build cln-startos from clboss master), because it looks like, even though the build is succeeding when you call generate_hash.sh manually, the hash is actually not being populated. Fixing this would allow start9 users to provide much more useful data upstream to the clboss team, as they would be able to tell us the exact commit hash they're on. That being said, assuming that the cln-startos release is locked to a particular commit of clboss, this shouldn't really matter as long as users report which version of cln-startos they're using. |
339cc50 to
8263b0f
Compare
When clboss is a git submodule, the current Makefile fails because it assumes that, because the
$(srcdir)/.git/logs/HEADfile does not exist, we must be inside the release zip and therefore already have the commit_hash.h file present.Here we update the Makefile to detect the case where clboss is a git submodule (by detecting that
.gitis a regular file and not a directory), and run generate_commit_hash.sh in that case.Fixes #247