diff --git a/Makefile b/Makefile index 2be2925..404204a 100644 --- a/Makefile +++ b/Makefile @@ -10,10 +10,12 @@ PATCH_OPAMFILES = sed -i 's/"@runtest"\s*{with-test}//g' $(OPAMFILES) .PHONY: all all: + ./update-stramon-version-string.sh dune build @all .PHONY: release-static release-static : + ./update-stramon-version-string.sh OCAMLPARAM='_,ccopt=-static' dune build --release bin/stramon.exe .PHONY: lib-tests diff --git a/bin/dune b/bin/dune index e8cef31..5c2a0e2 100644 --- a/bin/dune +++ b/bin/dune @@ -16,5 +16,4 @@ timedesc-tzlocal.utc fmt yojson - dune-build-info )) diff --git a/bin/stramon.ml b/bin/stramon.ml index 47e234e..f04e1a4 100644 --- a/bin/stramon.ml +++ b/bin/stramon.ml @@ -26,11 +26,6 @@ If provided path PATH is a directory, then output path is PATH/stramon_DATE-TIME ("--", Rest add_to_command, ""); ] -let version_str = - match Build_info.V1.version () with - | None -> "n/a" - | Some v -> Build_info.V1.Version.to_string v - let usage_msg = "stramon [-o JSON_OUTPUT] -- prog arg ..." let pp_file_date_time = @@ -175,7 +170,7 @@ let () = try Arg.parse speclist add_to_command usage_msg; if !print_version then ( - Printf.printf "%s\n" version_str; + Printf.printf "%s\n" Version_string.s; exit 0 ) else ( let command = List.rev !command in diff --git a/bin/version_string.ml b/bin/version_string.ml new file mode 100644 index 0000000..312b9a4 --- /dev/null +++ b/bin/version_string.ml @@ -0,0 +1 @@ +let s = "0.2.1" diff --git a/containers/old-ocaml/Dockerfile b/containers/old-ocaml/Dockerfile index d41648e..441dec6 100644 --- a/containers/old-ocaml/Dockerfile +++ b/containers/old-ocaml/Dockerfile @@ -12,4 +12,3 @@ RUN opam install alcotest qcheck qcheck-alcotest RUN opam install timedesc RUN opam install yojson RUN opam install odoc -RUN opam install dune-build-info diff --git a/containers/static-build/Dockerfile b/containers/static-build/Dockerfile index 9d2f29c..3c2e899 100644 --- a/containers/static-build/Dockerfile +++ b/containers/static-build/Dockerfile @@ -12,4 +12,3 @@ RUN opam install timedesc RUN opam install yojson RUN apk add libexecinfo-static RUN opam install odoc -RUN opam install dune-build-info diff --git a/dune-project b/dune-project index 7acaaa2..0f9e692 100644 --- a/dune-project +++ b/dune-project @@ -42,7 +42,6 @@ or to be used in similar fashion of process monitoring. (package (name stramon) - (version "0.2.1") (synopsis "Process behavior monitoring utility based on strace") (description "") (documentation https://github.com/darrenldl/stramon) diff --git a/update-stramon-version-string.sh b/update-stramon-version-string.sh new file mode 100755 index 0000000..6109f3c --- /dev/null +++ b/update-stramon-version-string.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +path="bin/version_string.ml" + +ver=$(cat CHANGELOG.md \ + | grep '## Stramon' \ + | head -n 1 \ + | sed -n 's/^## Stramon\s*\(\S*\)$/\1/p') + +echo "Detected version for Stramon:" $ver + +echo "Writing to" $path + +echo "let s = "\"$ver\" > $path