Skip to contentSkip to conversation

configure.ac: Resolve GIT_SHA even if repository is a submodule

PATCH Superseded Niklas Söderlund 2 participants 4 messages Apr 19, 2021 Media (V4L/DVB)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure.ac: Resolve GIT_SHA even if repository is a submodule

If the v4l-utils repository is a git submodule the $(top_srcdir)/.git is a file and not a directory. Update the shell check to allow the test to pass in both cases.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index f144a50d034fbda0..4ac4195cd6e4747e 100644
@@ -588,7 +588,7 @@ fi
 CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
 
 # Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
 
 # Obtain git commit count of HEAD
 AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])
Signature · 1 line
2.31.1
#1 lore raw
Quoted 14 lines · Niklas Söderlund

If the v4l-utils repository is a git submodule the $(top_srcdir)/.git is a file and not a directory. Update the shell check to allow the test to pass in both cases.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +0 -0
index f144a50d034fbda0..4ac4195cd6e4747e 100644

configure.ac fi · line 594

Quoted 8 lines
configure.ac +1 -1
@@ -588,7 +588,7 @@ fi
 CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
 
 # Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
 
 # Obtain git commit count of HEAD
 AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])

Isn't the same change needed here and in GIT_COMMIT_DATE as well?

Regards,

Hans

Quoted 1 line
#2 lore raw

Hi Hans,

Quoted 17 lines · Hans Verkuil
Quoted 16 lines · Niklas Söderlund

If the v4l-utils repository is a git submodule the $(top_srcdir)/.git is a file and not a directory. Update the shell check to allow the test to pass in both cases.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +0 -0
index f144a50d034fbda0..4ac4195cd6e4747e 100644
@@ -588,7 +588,7 @@ fi
 CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
 
Quoted 8 lines

configure.ac fi · line 594

Quoted 6 lines
configure.ac +1 -1
 # Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
 
 # Obtain git commit count of HEAD
 AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])

Isn't the same change needed here and in GIT_COMMIT_DATE as well?

Wops, you are correct. I noticed the problem in an older branch where version.h was generated in different utilities and this is a bad conflict fix of that.

Do you want me to resend?

Quoted 7 lines

Regards,

Hans

Quoted 1 line
Signature · 2 lines
Regards,
Niklas Söderlund
#3 lore raw
Quoted 29 lines · Niklas Söderlund

Hi Hans,

Quoted 17 lines · Hans Verkuil
Quoted 16 lines · Niklas Söderlund

If the v4l-utils repository is a git submodule the $(top_srcdir)/.git is a file and not a directory. Update the shell check to allow the test to pass in both cases.

---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +0 -0
index f144a50d034fbda0..4ac4195cd6e4747e 100644
@@ -588,7 +588,7 @@ fi
 CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
 
Quoted 8 lines

configure.ac fi · line 594

Quoted 6 lines
configure.ac +1 -1
 # Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
 
 # Obtain git commit count of HEAD
 AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])

Isn't the same change needed here and in GIT_COMMIT_DATE as well?

Quoted 5 lines

Wops, you are correct. I noticed the problem in an older branch where version.h was generated in different utilities and this is a bad conflict fix of that.

Do you want me to resend?

Yes please!

Thanks,

Hans