Skip to content

Commit 934e28a

Browse files
committed
Fix ConfigVersion failure in release archive
#483 (comment).
1 parent 9e4901a commit 934e28a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
(target configVersion.ml)
8686
(mode (promote (until-clean) (only configVersion.ml))) ; replace existing file in source tree, even if releasing (only overrides)
8787
(deps (universe)) ; do not cache, always regenerate
88-
(action (pipe-stdout (run git describe --all --long --dirty) (with-stdout-to %{target} (bash "xargs printf '(* Automatically regenerated, changes do not persist! *)\nlet version = \"%s\"'")))))
88+
(action (pipe-stdout (bash "git describe --all --long --dirty || echo \"n/a\"") (with-stdout-to %{target} (bash "xargs printf '(* Automatically regenerated, changes do not persist! *)\nlet version = \"%s\"'")))))
8989

9090
(rule
9191
(target configProfile.ml)

src/version.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
let release = "%%VERSION_NUM%%"
2+
let release_commit = "%%VCS_COMMIT_ID%%"
23

34
let goblint =
45
let commit = ConfigVersion.version in
56
if BatString.starts_with release "%" then
67
commit
7-
else
8+
else (
9+
let commit =
10+
if commit = "n/a" then (* released archive has no .git *)
11+
release_commit
12+
else
13+
commit
14+
in
815
Format.sprintf "%s (%s)" release commit
16+
)

0 commit comments

Comments
 (0)