aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2021-01-05 14:17:46 +0100
committertgingold <tgingold@users.noreply.github.com>2021-01-05 21:02:21 +0100
commit0747980c3e8bf101abee2aad730f03da1411d318 (patch)
tree4b924514b63bd19c91fe2824f764893c12137d5e
parent156c2fe69ef9a08084196721cc13df8ea2a694e6 (diff)
downloadghdl-0747980c3e8bf101abee2aad730f03da1411d318.tar.gz
ghdl-0747980c3e8bf101abee2aad730f03da1411d318.tar.bz2
ghdl-0747980c3e8bf101abee2aad730f03da1411d318.zip
version: add Ref and Hash
-rw-r--r--Makefile.in18
-rwxr-xr-xdist/ci-run.sh8
-rw-r--r--src/bug.adb6
-rw-r--r--src/version.in15
4 files changed, 39 insertions, 8 deletions
diff --git a/Makefile.in b/Makefile.in
index c089789d5..d3c2c8190 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -163,9 +163,21 @@ GRTSRCDIR=$(abs_srcdir)/src/grt
include $(srcdir)/src/grt/Makefile.inc
version.tmp: $(srcdir)/src/version.in force
-# Create version.tmp from version.in, using git date/hash, or envvar GHDL_DESC. Defaults to 'tarball'.
- if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty`; then GHDL_DESC="$$desc"; fi; \
- $(SED) -e "s/[(].*[)]/($$GHDL_DESC)/" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \
+# Create version.tmp from version.in, using git date/hash, or envvars.
+ GHDL_VER_DESC=$${GHDL_VER_DESC:-tarball}; \
+ GHDL_VER_REF=$${GHDL_VER_REF:-unknown}; \
+ GHDL_VER_HASH=$${GHDL_VER_HASH:-unknown}; \
+ if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty --long`; then \
+ GHDL_VER_DESC=`echo $$desc | sed -e 's/\([^-]*-g\)/r\1/' -e 's/-/./g' -e 's/^v//g'`; \
+ GHDL_VER_REF=`cd $(srcdir); git rev-parse --abbrev-ref HEAD`; \
+ GHDL_VER_HASH=`cd $(srcdir); git rev-parse HEAD`; \
+ fi; \
+ sed \
+ -e "s#@VER@#$(ghdl_version)#" \
+ -e "s#@DESC@#$${GHDL_VER_DESC}#" \
+ -e "s#@REF@#$${GHDL_VER_REF}#" \
+ -e "s#@HASH@#$${GHDL_VER_HASH}#" \
+ < $< > $@;
version.ads: version.tmp
# Change version.ads only if version.tmp has been modified to avoid
diff --git a/dist/ci-run.sh b/dist/ci-run.sh
index 43e1c8b66..cee5d05e2 100755
--- a/dist/ci-run.sh
+++ b/dist/ci-run.sh
@@ -407,7 +407,13 @@ ci_run () {
gend
printf "$ANSI_BLUE[CI] Build ghdl in docker image ghdl/build:$BUILD_IMAGE_TAG\n"
- $RUN -e GHDL_DESC="$(git describe --dirty)@${BUILD_IMAGE_TAG}" -e CONFIG_OPTS="$CONFIG_OPTS" "ghdl/build:$BUILD_IMAGE_TAG" bash -c "${scriptdir}/ci-run.sh $BUILD_CMD_OPTS build"
+ $RUN \
+ -e GHDL_VER_DESC="$(git describe --dirty)" \
+ -e GHDL_VER_REF="$(git rev-parse --abbrev-ref HEAD)@${BUILD_IMAGE_TAG}" \
+ -e GHDL_VER_HASH="$(git rev-parse HEAD)" \
+ -e CONFIG_OPTS="$CONFIG_OPTS" \
+ ghdl/build:"$BUILD_IMAGE_TAG" \
+ bash -c "${scriptdir}/ci-run.sh $BUILD_CMD_OPTS build"
fi
if [ ! -f build_ok ]; then
diff --git a/src/bug.adb b/src/bug.adb
index 334717399..f16f62d5f 100644
--- a/src/bug.adb
+++ b/src/bug.adb
@@ -19,7 +19,7 @@
with Ada.Command_Line; use Ada.Command_Line;
with GNAT.Directory_Operations;
with Simple_IO; use Simple_IO;
-with Version; use Version;
+with Version;
package body Bug is
-- Declared in the files generated by gnatbind.
@@ -69,7 +69,9 @@ package body Bug is
("******************** GHDL Bug occurred ***************************");
Put_Line_Err
("Please report this bug on https://github.com/ghdl/ghdl/issues");
- Put_Line_Err ("GHDL release: " & Ghdl_Ver & ' ' & Ghdl_Release);
+ Put_Line_Err ( "GHDL release: " &
+ Version.Ghdl_Ver & ' ' & Version.Ghdl_Release
+ );
Put_Line_Err ("Compiled with " & Get_Gnat_Version);
Put_Line_Err ("Target: " & Standard'Target_Name);
Put_Line_Err (GNAT.Directory_Operations.Get_Current_Dir);
diff --git a/src/version.in b/src/version.in
index b12295dab..1d03bc7ea 100644
--- a/src/version.in
+++ b/src/version.in
@@ -1,5 +1,16 @@
package Version is
- Ghdl_Ver : constant String := "@VER@";
+
+ Ghdl_Ver : constant String :=
+ "@VER@";
+
+ Ghdl_Ref : constant String :=
+ "@REF@";
+
+ Ghdl_Hash : constant String :=
+ "@HASH@";
+
Ghdl_Release : constant String :=
- "(tarball) [Dunoon edition]";
+ "(@DESC@)" &
+ " [Dunoon edition]";
+
end Version;