Discussion:
[LyX/master] pass git commit hash within CPPFLAGS to add it to version info
Stephan Witt
2014-08-28 06:36:57 UTC
Permalink
commit f2aeca65b491f4a2396ec2b8834713e5c156c5ef
Date: Thu Aug 28 08:30:45 2014 +0200
pass git commit hash within CPPFLAGS to add it to version info
diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh
index 4fb7547..45adfd8 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -303,6 +303,11 @@ if [ -z "${LyXVersion}" ]; then
LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()")
fi
LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
+case "${LyXVersion}" in
+*dev*)
+ LyXGitCommitHash=$(cd "${LyxSourceDir}" ; git log -1 --pretty=format:%H)
+ ;;
+esac
LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}"
@@ -627,6 +632,10 @@ build_lyx() {
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
+ if [ -n "${LyXGitCommitHash}" ]; then
+ CPPFLAGS="${CPPFLAGS} -DLYX_GIT_COMMIT_HASH='${LyXGitCommitHash}'"
+ fi
+
if [ "$configure_qt_frameworks" = "yes" ]; then
export QT_CORE_CFLAGS="-FQtCore"
export QT_CORE_LIBS="-framework QtCore"
Richard, may I backport it to 2.1.x?

Stephan
Richard Heck
2014-08-28 15:30:29 UTC
Permalink
Post by Stephan Witt
commit f2aeca65b491f4a2396ec2b8834713e5c156c5ef
Date: Thu Aug 28 08:30:45 2014 +0200
pass git commit hash within CPPFLAGS to add it to version info
diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh
index 4fb7547..45adfd8 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -303,6 +303,11 @@ if [ -z "${LyXVersion}" ]; then
LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()")
fi
LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
+case "${LyXVersion}" in
+*dev*)
+ LyXGitCommitHash=$(cd "${LyxSourceDir}" ; git log -1 --pretty=format:%H)
+ ;;
+esac
LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}"
@@ -627,6 +632,10 @@ build_lyx() {
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
+ if [ -n "${LyXGitCommitHash}" ]; then
+ CPPFLAGS="${CPPFLAGS} -DLYX_GIT_COMMIT_HASH='${LyXGitCommitHash}'"
+ fi
+
if [ "$configure_qt_frameworks" = "yes" ]; then
export QT_CORE_CFLAGS="-FQtCore"
export QT_CORE_LIBS="-framework QtCore"
Richard, may I backport it to 2.1.x?
Do you want this in 2.1.2, or can it wait?

rh
Stephan Witt
2014-08-29 07:00:59 UTC
Permalink
Post by Richard Heck
Post by Stephan Witt
commit f2aeca65b491f4a2396ec2b8834713e5c156c5ef
Date: Thu Aug 28 08:30:45 2014 +0200
pass git commit hash within CPPFLAGS to add it to version info
diff --git a/development/LyX-Mac-binary-release.sh b/development/LyX-Mac-binary-release.sh
index 4fb7547..45adfd8 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -303,6 +303,11 @@ if [ -z "${LyXVersion}" ]; then
LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2 | tr -d " ()")
fi
LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d. -f1-2)}
+case "${LyXVersion}" in
+*dev*)
+ LyXGitCommitHash=$(cd "${LyxSourceDir}" ; git log -1 --pretty=format:%H)
+ ;;
+esac
LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}"
@@ -627,6 +632,10 @@ build_lyx() {
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
+ if [ -n "${LyXGitCommitHash}" ]; then
+ CPPFLAGS="${CPPFLAGS} -DLYX_GIT_COMMIT_HASH='${LyXGitCommitHash}'"
+ fi
+
if [ "$configure_qt_frameworks" = "yes" ]; then
export QT_CORE_CFLAGS="-FQtCore"
export QT_CORE_LIBS="-framework QtCore"
Richard, may I backport it to 2.1.x?
Do you want this in 2.1.2, or can it wait?
It can wait. The question was if I can use it for my "early disk image" for 2.1.2dev.
But I did it without this change many times. One more doesn't matter.

Stephan
Jean-Marc Lasgouttes
2014-08-30 08:42:26 UTC
Permalink
commit f2aeca65b491f4a2396ec2b8834713e5c156c5ef
Date: Thu Aug 28 08:30:45 2014 +0200
pass git commit hash within CPPFLAGS to add it to version info
diff --git a/development/LyX-Mac-binary-release.sh
b/development/LyX-Mac-binary-release.sh
index 4fb7547..45adfd8 100644
--- a/development/LyX-Mac-binary-release.sh
+++ b/development/LyX-Mac-binary-release.sh
@@ -303,6 +303,11 @@ if [ -z "${LyXVersion}" ]; then
LyXVersion=$(grep AC_INIT "${LyxSourceDir}"/configure.ac | cut -d, -f2
| tr -d " ()")
fi
LyXVersionSuffix=${LyXVersionSuffix:-$(echo "${LyXVersion}" | cut -d.
-f1-2)}
+case "${LyXVersion}" in
+*dev*)
+ LyXGitCommitHash=$(cd "${LyxSourceDir}" ; git log -1
--pretty=format:%H)
+ ;;
+esac
LyxName="LyX"
LyxBase="${LyxName}-${LyXVersion}"
@@ -627,6 +632,10 @@ build_lyx() {
CPPFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
LDFLAGS="${SDKROOT:+-isysroot ${SDKROOT}} -arch ${arch} ${MYCFLAGS}"
+ if [ -n "${LyXGitCommitHash}" ]; then
+ CPPFLAGS="${CPPFLAGS} -DLYX_GIT_COMMIT_HASH='${LyXGitCommitHash}'"
+ fi
+
if [ "$configure_qt_frameworks" = "yes" ]; then
export QT_CORE_CFLAGS="-FQtCore"
export QT_CORE_LIBS="-framework QtCore"
Nice. This will be handled by autotools as soon as I find time.

JMarc
Stephan Witt
2014-10-09 20:38:16 UTC
Permalink
commit f2aeca65b491f4a2396ec2b8834713e5c156c5ef
Date: Thu Aug 28 08:30:45 2014 +0200
pass git commit hash within CPPFLAGS to add it to version info
Stephan, I was about to add this to autotools and then I wonder: where is this used???
It ends up in the 4th tab of the About dialog - the build info.
I've made a little patch to place it into the start screen.
I'm not sure if it's worth to apply. But this would be easier to see.

Stephan
Jean-Marc Lasgouttes
2014-10-09 21:07:06 UTC
Permalink
Post by Stephan Witt
It ends up in the 4th tab of the About dialog - the build info.
Sorry if I am a bit dense this evening, but where is the code that makes
it happen?
Post by Stephan Witt
I've made a little patch to place it into the start screen.
I'm not sure if it's worth to apply. But this would be easier to see.
I am not sure whether it is worth having it in the start screen. This is
rather specialized information.

JMarc
Stephan Witt
2014-10-10 05:08:08 UTC
Permalink
Post by Stephan Witt
It ends up in the 4th tab of the About dialog - the build info.
Sorry if I am a bit dense this evening, but where is the code that makes it happen?
Sorry, I was off-line already yesterday.
It's in lyx_version_info. GuiAbout::buildinfo() returns it.

Stephan
Post by Stephan Witt
I've made a little patch to place it into the start screen.
I'm not sure if it's worth to apply. But this would be easier to see.
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
JMarc
Jean-Marc Lasgouttes
2014-10-10 08:12:46 UTC
Permalink
Post by Stephan Witt
Sorry, I was off-line already yesterday.
It's in lyx_version_info. GuiAbout::buildinfo() returns it.
You mean that it is visible only because it is par of the command line?

JMarc
Stephan Witt
2014-10-10 08:17:17 UTC
Permalink
Post by Jean-Marc Lasgouttes
Post by Stephan Witt
Sorry, I was off-line already yesterday.
It's in lyx_version_info. GuiAbout::buildinfo() returns it.
You mean that it is visible only because it is par of the command line?
JMarc
Yes, exactly.

Stephan
Jean-Marc Lasgouttes
2014-10-10 10:17:54 UTC
Permalink
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?

Note that it needs a cmake counterpart, to define the new
LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.

JMarc
Stephan Witt
2014-10-10 10:32:00 UTC
Permalink
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
I'm fine with it. Thanks. I'm ok with the wording too.

To avoid redefinitions I removed it from the Mac build script.

Stephan
Post by Jean-Marc Lasgouttes
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
JMarc
Stephan Witt
2014-10-10 11:04:32 UTC
Permalink
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?

Stephan
Jean-Marc Lasgouttes
2014-10-10 12:07:24 UTC
Permalink
Post by Stephan Witt
Cmake patch proposal: Ok to commit?
What happens if git is not installed or the build is done from tar.gz
archive instead of a git clone?

JMarc
Stephan Witt
2014-10-10 20:23:28 UTC
Permalink
Post by Stephan Witt
Cmake patch proposal: Ok to commit?
What happens if git is not installed or the build is done from tar.gz archive instead of a git clone?
LYX_GIT_COMMIT_HASH is "none" in this case.
To request the real hash one has to pass -DLYX_LOCALVERSIONING=ON …

Stephan
Kornel Benko
2014-10-10 13:22:20 UTC
Permalink
Post by Stephan Witt
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?
Stephan
I was already working on a cmake patch :(

Kornel
Kornel Benko
2014-10-10 13:31:33 UTC
Permalink
Post by Kornel Benko
Post by Stephan Witt
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?
Stephan
I was already working on a cmake patch :(
1.) Missing in patch:
if(LYX_GIT_VERSION)
before use of "EXECUTE_PROCESS".
2.) use temporary variable for output of EXECUTE_PROCESS, like this

set(LYX_GIT_COMMIT_HASH "none")
...

EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
endif


Kornel
Kornel Benko
2014-10-10 13:39:49 UTC
Permalink
Post by Kornel Benko
Post by Kornel Benko
Post by Stephan Witt
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?
Stephan
I was already working on a cmake patch :(
if(LYX_GIT_VERSION)
before use of "EXECUTE_PROCESS".
2.) use temporary variable for output of EXECUTE_PROCESS, like this
set(LYX_GIT_COMMIT_HASH "none")
...
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
endif
How about this

Kornel
Stephan Witt
2014-10-10 20:09:30 UTC
Permalink
Post by Kornel Benko
Post by Kornel Benko
Post by Kornel Benko
Post by Stephan Witt
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?
Stephan
I was already working on a cmake patch :(
if(LYX_GIT_VERSION)
before use of "EXECUTE_PROCESS".
2.) use temporary variable for output of EXECUTE_PROCESS, like this
set(LYX_GIT_COMMIT_HASH "none")
...
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
endif
How about this
Kornel
<cmake_git_commit_hash.pach>
This works too. Please commit it.

I made the patch because without it the project didn't compile anymore.

Point 1) of your concerns was wrong - EXECUTE_PROCESS is nested inside a if(LYX_GIT_VERSION) block.
Point 2) I didn't understand. You fear "git log" command doesn't print the hash?

Stephan
Kornel Benko
2014-10-11 09:16:21 UTC
Permalink
Post by Stephan Witt
Post by Kornel Benko
Post by Kornel Benko
Post by Kornel Benko
Post by Stephan Witt
Post by Jean-Marc Lasgouttes
I am not sure whether it is worth having it in the start screen. This is rather specialized information.
What about the patch I just commited?
Note that it needs a cmake counterpart, to define the new LYX_GIT_COMMIT_HASH macro. I am also open to changing the wording.
Cmake patch proposal: Ok to commit?
Stephan
I was already working on a cmake patch :(
if(LYX_GIT_VERSION)
before use of "EXECUTE_PROCESS".
2.) use temporary variable for output of EXECUTE_PROCESS, like this
set(LYX_GIT_COMMIT_HASH "none")
...
EXECUTE_PROCESS(COMMAND ${LYX_GITVERSION} log -1 "--pretty=format:%H"
WORKING_DIRECTORY "${TOP_SRC_DIR}" OUTPUT_VARIABLE lyxgitcommit OUTPUT_STRIP_TRAILING_WHITESPACE)
if (lyxgitcommit MATCHES "^[0-9a-f]+$")
set(LYX_GIT_COMMIT_HASH ${lyxgitcommit})
endif
How about this
Kornel
<cmake_git_commit_hash.pach>
This works too. Please commit it.
Thanks, will do.
Post by Stephan Witt
I made the patch because without it the project didn't compile anymore.
Point 1) of your concerns was wrong - EXECUTE_PROCESS is nested inside a if(LYX_GIT_VERSION) block.
True, I did not check exactly :(
Still taking it out of 'if (LYX_LOCALVERSIONING)' feels better.
LYX_LOCALVERSIONING was meant for the package naming, while LYX_GIT_COMMIT_HASH
Post by Stephan Witt
Point 2) I didn't understand. You fear "git log" command doesn't print the hash?
Yes, having the command 'git' does not imply that the sources are copy of the repo.
E.g.
#git log -1 "--pretty=format:%H"
fatal: Not a git repository (or any of the parent directories): .git
Post by Stephan Witt
Stephan
Kornel

Loading...