Skip to content

Commit

Permalink
Swapped to custom version string detection
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Jan 24, 2023
1 parent 3917401 commit a307054
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@
timedesc-tzlocal.utc
fmt
yojson
dune-build-info
))
7 changes: 1 addition & 6 deletions bin/stramon.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bin/version_string.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let s = "0.2.1"
1 change: 0 additions & 1 deletion containers/old-ocaml/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion containers/static-build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
14 changes: 14 additions & 0 deletions update-stramon-version-string.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a307054

Please sign in to comment.