Skip to contentSkip to conversation

msvc: add branch name and commit hash to version output

PATCH New Lev Stipakov 3 participants 7 messages Sep 22, 2022 – Sep 26, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 msvc: add branch name and commit hash to version output

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

---
 build/msvc/msvc-generate/Makefile.mak         | 33 +++++++++++++-
 build/msvc/msvc-generate/git-version.py       | 45 +++++++++++++++++++
 .../msvc/msvc-generate/msvc-generate.vcxproj  |  2 +-
 config-msvc.h                                 |  2 +
 4 files changed, 79 insertions(+), 3 deletions(-)
 create mode 100644 build/msvc/msvc-generate/git-version.py
build/msvc/msvc-generate/Makefile.mak +31 -2
index 1cb43102..ae8b0842 100644
@@ -1,4 +1,27 @@
-# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#
+#  OpenVPN -- An application to securely tunnel IP networks
+#             over a single UDP port, with support for SSL/TLS-based
+#             session authentication and key exchange,
+#             packet encryption, packet authentication, and
+#             packet compression.
+#
+#  Copyright (C) 2002-2022 OpenVPN Inc <[email protected]...>
+#  Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#  Copyright (C) 2022-2022 Lev Stipakov <[email protected]...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
 
 CONFIG=$(SOLUTIONDIR)/version.m4
 
@@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
 OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
+OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 $(OUTPUT_MAN): $(INPUT_MAN)
     -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
 
+$(OUTPUT_MSVC_GIT_CONFIG):
+    python git-version.py $(SOLUTIONDIR)
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
 	-del "$(OUTPUT_MAN)"
+	-del "$(OUTPUT_MSVC_GIT_CONFIG)"
build/msvc/msvc-generate/git-version.py new file +45 -0

45 lines not on this page · raw message

build/msvc/msvc-generate/msvc-generate.vcxproj +1 -1
index dda8b051..eae94709 100644
@@ -150,7 +150,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="Makefile.mak" />
-    <None Include="msc-generate.js" />
+    <None Include="msvc-generate.js" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
config-msvc.h +2 -0
index b621f3fb..a3c687ed 100644
@@ -89,3 +89,5 @@ typedef uint16_t in_port_t;
 #endif
 
 #define ENABLE_DCO 1
+
+#define HAVE_CONFIG_VERSION_H 1
Signature · 1 line
2.23.0.windows.1
#1 lore raw

PATCH 1/1 msvc: add branch name and commit hash to version output

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

---
v2:

- fix copyright year 2002 -> 2022
- change "not-a-git-repo" to "unknown"

 build/msvc/msvc-generate/Makefile.mak         | 33 +++++++++++++-
 build/msvc/msvc-generate/git-version.py       | 45 +++++++++++++++++++
 .../msvc/msvc-generate/msvc-generate.vcxproj  |  2 +-
 config-msvc.h                                 |  2 +
 4 files changed, 79 insertions(+), 3 deletions(-)
 create mode 100644 build/msvc/msvc-generate/git-version.py
build/msvc/msvc-generate/Makefile.mak +31 -2
index 1cb43102..ae8b0842 100644
@@ -1,4 +1,27 @@
-# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#
+#  OpenVPN -- An application to securely tunnel IP networks
+#             over a single UDP port, with support for SSL/TLS-based
+#             session authentication and key exchange,
+#             packet encryption, packet authentication, and
+#             packet compression.
+#
+#  Copyright (C) 2002-2022 OpenVPN Inc <[email protected]...>
+#  Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#  Copyright (C) 2022-2022 Lev Stipakov <[email protected]...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
 
 CONFIG=$(SOLUTIONDIR)/version.m4
 
@@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
 OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
+OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 $(OUTPUT_MAN): $(INPUT_MAN)
     -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
 
+$(OUTPUT_MSVC_GIT_CONFIG):
+    python git-version.py $(SOLUTIONDIR)
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
 	-del "$(OUTPUT_MAN)"
+	-del "$(OUTPUT_MSVC_GIT_CONFIG)"
build/msvc/msvc-generate/git-version.py new file +45 -0

45 lines not on this page · raw message

build/msvc/msvc-generate/msvc-generate.vcxproj +1 -1
index dda8b051..eae94709 100644
@@ -150,7 +150,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="Makefile.mak" />
-    <None Include="msc-generate.js" />
+    <None Include="msvc-generate.js" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
config-msvc.h +2 -0
index b621f3fb..a3c687ed 100644
@@ -89,3 +89,5 @@ typedef uint16_t in_port_t;
 #endif
 
 #define ENABLE_DCO 1
+
+#define HAVE_CONFIG_VERSION_H 1
Signature · 1 line
2.23.0.windows.1
#2 lore raw

Hi,

Quoted 8 lines · Lev Stipakov

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

Quoted 8 lines

---
v2:

- fix copyright year 2002 -> 2022
- change "not-a-git-repo" to "unknown"

...

--

Quoted 1 line

2.23.0.windows.1

I have only tested that the script generates config-version.h matching what ./configure builds.
Based on that, the patch looks good to me.

I'm assuming release openvpn.exe is built from a named branch within openvpn git-repo. Checking out a tag (detached head) and building will get unknown/unknown. We could probably improve that by using the commit-id even when the branch name is not available.

Selva

#3 lore raw

PATCH v3 1/1 msvc: add branch name and commit hash to version output

In reply to Lev Stipakov

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

---

v3:
- properly handle branchnames like release/2.5
and detached HEAD state
- property handle "not in git repo" case

v2:
- fix copyright year 2002 -> 2022
- change "not-a-git-repo" to "unknown"

 build/msvc/msvc-generate/Makefile.mak         | 33 +++++++++++-
 build/msvc/msvc-generate/git-version.py       | 50 +++++++++++++++++++
 .../msvc/msvc-generate/msvc-generate.vcxproj  |  2 +-
 config-msvc.h                                 |  2 +
 4 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 build/msvc/msvc-generate/git-version.py
build/msvc/msvc-generate/Makefile.mak +31 -2
index 1cb43102..ae8b0842 100644
@@ -1,4 +1,27 @@
-# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#
+#  OpenVPN -- An application to securely tunnel IP networks
+#             over a single UDP port, with support for SSL/TLS-based
+#             session authentication and key exchange,
+#             packet encryption, packet authentication, and
+#             packet compression.
+#
+#  Copyright (C) 2002-2022 OpenVPN Inc <[email protected]...>
+#  Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#  Copyright (C) 2022-2022 Lev Stipakov <[email protected]...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
 
 CONFIG=$(SOLUTIONDIR)/version.m4
 
@@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
 OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
+OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 $(OUTPUT_MAN): $(INPUT_MAN)
     -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
 
+$(OUTPUT_MSVC_GIT_CONFIG):
+    python git-version.py $(SOLUTIONDIR)
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
 	-del "$(OUTPUT_MAN)"
+	-del "$(OUTPUT_MSVC_GIT_CONFIG)"
build/msvc/msvc-generate/git-version.py new file +50 -0

50 lines not on this page · raw message

build/msvc/msvc-generate/msvc-generate.vcxproj +1 -1
index dda8b051..eae94709 100644
@@ -150,7 +150,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="Makefile.mak" />
-    <None Include="msc-generate.js" />
+    <None Include="msvc-generate.js" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
config-msvc.h +2 -0
index b621f3fb..a3c687ed 100644
@@ -89,3 +89,5 @@ typedef uint16_t in_port_t;
 #endif
 
 #define ENABLE_DCO 1
+
+#define HAVE_CONFIG_VERSION_H 1
Signature · 1 line
2.23.0.windows.1
#4 lore raw

PATCH v4 1/1 msvc: add branch name and commit hash to version output

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

---

v4:

- replace backslash with slash - instead of

git:msvc-version-release\2.5/b5df0fadf0fdad98

we display

git:msvc-version-release/2.5/b5df0fadf0fdad98

v3:
- properly handle branchnames like release/2.5
and detached HEAD state
- property handle "not in git repo" case

v2:
- fix copyright year 2002 -> 2022
- change "not-a-git-repo" to "unknown"

 build/msvc/msvc-generate/Makefile.mak         | 33 +++++++++++-
 build/msvc/msvc-generate/git-version.py       | 50 +++++++++++++++++++
 .../msvc/msvc-generate/msvc-generate.vcxproj  |  2 +-
 config-msvc.h                                 |  2 +
 4 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 build/msvc/msvc-generate/git-version.py
build/msvc/msvc-generate/Makefile.mak +31 -2
index 1cb43102..ae8b0842 100644
@@ -1,4 +1,27 @@
-# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#
+#  OpenVPN -- An application to securely tunnel IP networks
+#             over a single UDP port, with support for SSL/TLS-based
+#             session authentication and key exchange,
+#             packet encryption, packet authentication, and
+#             packet compression.
+#
+#  Copyright (C) 2002-2022 OpenVPN Inc <[email protected]...>
+#  Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#  Copyright (C) 2022-2022 Lev Stipakov <[email protected]...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
 
 CONFIG=$(SOLUTIONDIR)/version.m4
 
@@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
 OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
+OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 $(OUTPUT_MAN): $(INPUT_MAN)
     -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
 
+$(OUTPUT_MSVC_GIT_CONFIG):
+    python git-version.py $(SOLUTIONDIR)
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
 	-del "$(OUTPUT_MAN)"
+	-del "$(OUTPUT_MSVC_GIT_CONFIG)"
build/msvc/msvc-generate/git-version.py new file +50 -0

50 lines not on this page · raw message

build/msvc/msvc-generate/msvc-generate.vcxproj +1 -1
index dda8b051..eae94709 100644
@@ -150,7 +150,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="Makefile.mak" />
-    <None Include="msc-generate.js" />
+    <None Include="msvc-generate.js" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
config-msvc.h +2 -0
index b621f3fb..a3c687ed 100644
@@ -89,3 +89,5 @@ typedef uint16_t in_port_t;
 #endif
 
 #define ENABLE_DCO 1
+
+#define HAVE_CONFIG_VERSION_H 1
Signature · 1 line
2.23.0.windows.1
#5 lore raw

PATCH v5 1/1 msvc: add branch name and commit hash to version output

From: Lev Stipakov <[email protected]...>

Add a simple python script which generates header with branch name and commit hash #defines.

While on it, fix filename in msvc-generate.vcxproj and add proper copyright header to Makefile.mak.

---
v5:
- replace "detached" with "none"
("none" if not on a branch, "unknown" if cannot be determined)

v4:

- replace backslash with slash - instead of

git:msvc-version-release\2.5/b5df0fadf0fdad98

we display

git:msvc-version-release/2.5/b5df0fadf0fdad98

v3:
- properly handle branchnames like release/2.5
and detached HEAD state
- property handle "not in git repo" case

v2:
- fix copyright year 2002 -> 2022
- change "not-a-git-repo" to "unknown"

 build/msvc/msvc-generate/Makefile.mak         | 33 +++++++++++-
 build/msvc/msvc-generate/git-version.py       | 50 +++++++++++++++++++
 .../msvc/msvc-generate/msvc-generate.vcxproj  |  2 +-
 config-msvc.h                                 |  2 +
 4 files changed, 84 insertions(+), 3 deletions(-)
 create mode 100644 build/msvc/msvc-generate/git-version.py
build/msvc/msvc-generate/Makefile.mak +31 -2
index 1cb43102..ae8b0842 100644
@@ -1,4 +1,27 @@
-# Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#
+#  OpenVPN -- An application to securely tunnel IP networks
+#             over a single UDP port, with support for SSL/TLS-based
+#             session authentication and key exchange,
+#             packet encryption, packet authentication, and
+#             packet compression.
+#
+#  Copyright (C) 2002-2022 OpenVPN Inc <[email protected]...>
+#  Copyright (C) 2008-2012 Alon Bar-Lev <[email protected]...>
+#  Copyright (C) 2022-2022 Lev Stipakov <[email protected]...>
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License version 2
+#  as published by the Free Software Foundation.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
 
 CONFIG=$(SOLUTIONDIR)/version.m4
 
@@ -14,7 +37,9 @@ OUTPUT_PLUGIN_CONFIG=version.m4
 INPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.rst
 OUTPUT_MAN=$(SOLUTIONDIR)/doc/openvpn.8.html
 
-all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN)
+OUTPUT_MSVC_GIT_CONFIG=$(SOLUTIONDIR)/config-version.h
+
+all:	$(OUTPUT_MSVC_VER) $(OUTPUT_PLUGIN) $(OUTPUT_MAN) $(OUTPUT_MSVC_GIT_CONFIG)
 
 $(OUTPUT_MSVC_VER): $(INPUT_MSVC_VER) $(CONFIG)
 	cscript //nologo msvc-generate.js --config="$(CONFIG)" --input="$(INPUT_MSVC_VER)" --output="$(OUTPUT_MSVC_VER)"
@@ -28,8 +53,12 @@ $(OUTPUT_PLUGIN): $(INPUT_PLUGIN) $(OUTPUT_PLUGIN_CONFIG)
 $(OUTPUT_MAN): $(INPUT_MAN)
     -FOR /F %i IN ('where rst2html.py') DO python %i "$(INPUT_MAN)" "$(OUTPUT_MAN)"
 
+$(OUTPUT_MSVC_GIT_CONFIG):
+    python git-version.py $(SOLUTIONDIR)
+
 clean:
 	-del "$(OUTPUT_MSVC_VER)"
 	-del "$(OUTPUT_PLUGIN)"
 	-del "$(OUTPUT_PLUGIN_CONFIG)"
 	-del "$(OUTPUT_MAN)"
+	-del "$(OUTPUT_MSVC_GIT_CONFIG)"
build/msvc/msvc-generate/git-version.py new file +50 -0

50 lines not on this page · raw message

build/msvc/msvc-generate/msvc-generate.vcxproj +1 -1
index dda8b051..eae94709 100644
@@ -150,7 +150,7 @@
   </ItemDefinitionGroup>
   <ItemGroup>
     <None Include="Makefile.mak" />
-    <None Include="msc-generate.js" />
+    <None Include="msvc-generate.js" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
config-msvc.h +2 -0
index b621f3fb..a3c687ed 100644
@@ -89,3 +89,5 @@ typedef uint16_t in_port_t;
 #endif
 
 #define ENABLE_DCO 1
+
+#define HAVE_CONFIG_VERSION_H 1
Signature · 1 line
2.23.0.windows.1
Acked-by on v5 1/1
#6 lore raw

This is a useful feature, and after some polishing, I think this is about as good as it will get now :-) - thanks.

I have not tested this at all, as I have no MSVC build environment and it will not manifest on MinGW builds. From my understanding it looks reasonable.

Your patch has been applied to the master branch.

commit b9d91c38843076a03b6b5fc123a386ef3c2bc564

Author: Lev Stipakov
Date:   Mon Sep 26 09:43:10 2022 +0300
     msvc: add branch name and commit hash to version output

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg25311.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering