Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
verimag
synchrone
lutils
Commits
b9832611
Commit
b9832611
authored
May 16, 2019
by
erwan
Browse files
Build: fix the version number for opam releases
parent
d9b3cdf1
Pipeline
#23936
passed with stages
in 3 minutes and 47 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Makefile.version
View file @
b9832611
SHA
:=
$(
shell
git log
-1
--pretty
=
format:
"%h"
)
# Both work. Which one is the best?
VERSION
=
$(
shell
./node_modules/.bin/git-latest-semver-tag
)
VERSION
=
$(
shell
git describe
--tags
)
# if it is not a git version, it has to be an opam version!
SHA
:=
$(
shell
git log
-1
--pretty
=
format:
"%h"
||
echo
"opam"
)
BRANCH
:=
$(
shell
git branch |
grep
"*"
|
cut
-d
' '
-f
2
||
basename
`
pwd
`
|
echo
"opam"
)
VERSION
=
$(
shell
git describe
--tags
||
basename
`
pwd
`
|
cut
-d
'.'
-f2-4
)
del_version
:
rm
-f
src/lutilsVersion.ml
...
...
src/mypervasives.ml
View file @
b9832611
(* Time-stamp: <modified the 1
3
/0
4
/201
8
(at 10:
19
) by Erwan Jahier> *)
(* Time-stamp: <modified the 1
5
/0
5
/201
9
(at 10:
55
) by Erwan Jahier> *)
(* Should rather be named misc or utils *)
...
...
@@ -132,10 +132,11 @@ let entete2 comment_open comment_close version sha =
and
hostname
=
Unix
.
gethostname
()
in
(
comment_open
^
" Automatically generated by "
^
Sys
.
executable_name
^
" version
\"
"
^
version
^
"
\"
(
\"
"
^
sha
^
"
\"
)"
^
comment_close
^
"
\n
"
^
comment_open
^
" on "
^
hostname
^
Sys
.
executable_name
^
" version
\"
"
^
version
^
"
\"
(
\"
"
^
sha
^
"
\"
)"
^
comment_close
^
"
\n
"
^
comment_open
^
" on "
^
hostname
^
" the "
^
date
^
" at "
^
time_str
^
comment_close
^
"
\n
"
^
comment_open
^
(
String
.
concat
" "
(
Array
.
to_list
Sys
.
argv
))
^
comment_close
^
"
\n\n
"
)
comment_open
^
(
String
.
concat
" "
(
Array
.
to_list
Sys
.
argv
))
^
comment_close
^
"
\n\n
"
)
(* for one-line comments *)
let
entete
comment
version
sha
=
entete2
comment
""
version
sha
...
...
@@ -147,76 +148,77 @@ type my_create_process_result =
|
KO
|
PID
of
int
(* if called with ~wait:false *)
let
(
my_create_process
:
?
std_in
:
(
Unix
.
file_descr
)
->
?
std_out
:
(
Unix
.
file_descr
)
->
let
(
my_create_process
:
?
std_in
:
(
Unix
.
file_descr
)
->
?
std_out
:
(
Unix
.
file_descr
)
->
?
std_err
:
(
Unix
.
file_descr
)
->
?
wait
:
(
bool
)
->
string
->
string
list
->
my_create_process_result
)
=
fun
?
(
std_in
=
Unix
.
stdin
)
?
(
std_out
=
Unix
.
stdout
)
?
(
std_err
=
Unix
.
stderr
)
?
(
wait
=
true
)
prog
args
->
try
let
pid
=
List
.
iter
(
fun
x
->
output_string
stderr
(
x
^
" "
))
(
prog
::
args
);
output_string
stderr
"
\n
"
;
flush
stderr
;
Unix
.
create_process
prog
(
Array
.
of_list
(
prog
::
args
))
(
std_in
)
(
std_out
)
(
std_err
)
in
if
not
wait
then
PID
pid
else
let
(
_
,
status
)
=
(
Unix
.
waitpid
[
Unix
.
WUNTRACED
]
pid
)
in
(
match
status
with
Unix
.
WEXITED
i
->
if
i
=
0
||
i
=
1
then
(
output_string
stderr
(
" ... "
^
prog
^
" exited normally.
\n
"
);
flush
stderr
;
OK
)
else
(
output_string
stderr
(
"*** Error: "
^
prog
^
" exited abnormally (return code="
^
(
string_of_int
i
)
^
").
\n
"
);
flush
stderr
;
KO
)
|
Unix
.
WSIGNALED
i
->
output_string
stderr
(
"*** Error: "
^
prog
^
" process was killed by signal "
^
(
string_of_int
i
)
^
"
\n
"
);
flush
stderr
;
KO
|
Unix
.
WSTOPPED
i
->
output_string
stderr
(
"*** Error: "
^
prog
^
" process was stopped by signal "
^
(
string_of_int
i
)
^
"
\n
"
);
flush
stderr
;
KO
)
with
|
Unix
.
Unix_error
(
error
,
name
,
arg
)
->
let
msg
=
(
"*** '"
^
(
Unix
.
error_message
error
)
^
"'in the system call: '"
^
name
^
" "
^
arg
^
"'
\n
"
)
in
output_string
stdout
msg
;
flush
stdout
;
output_string
stderr
msg
;
flush
stderr
;
KO
|
e
->
output_string
stdout
(
Printexc
.
to_string
e
);
flush
stdout
;
output_string
stderr
(
Printexc
.
to_string
e
);
flush
stderr
;
KO
try
let
pid
=
List
.
iter
(
fun
x
->
output_string
stderr
(
x
^
" "
))
(
prog
::
args
);
output_string
stderr
"
\n
"
;
flush
stderr
;
Unix
.
create_process
prog
(
Array
.
of_list
(
prog
::
args
))
(
std_in
)
(
std_out
)
(
std_err
)
in
if
not
wait
then
PID
pid
else
let
(
_
,
status
)
=
(
Unix
.
waitpid
[
Unix
.
WUNTRACED
]
pid
)
in
(
match
status
with
Unix
.
WEXITED
i
->
if
i
=
0
||
i
=
1
then
(
output_string
stderr
(
" ... "
^
prog
^
" exited normally.
\n
"
);
flush
stderr
;
OK
)
else
(
output_string
stderr
(
"*** Error: "
^
prog
^
" exited abnormally (return code="
^
(
string_of_int
i
)
^
").
\n
"
);
flush
stderr
;
KO
)
|
Unix
.
WSIGNALED
i
->
output_string
stderr
(
"*** Error: "
^
prog
^
" process was killed by signal "
^
(
string_of_int
i
)
^
"
\n
"
);
flush
stderr
;
KO
|
Unix
.
WSTOPPED
i
->
output_string
stderr
(
"*** Error: "
^
prog
^
" process was stopped by signal "
^
(
string_of_int
i
)
^
"
\n
"
);
flush
stderr
;
KO
)
with
|
Unix
.
Unix_error
(
error
,
name
,
arg
)
->
let
msg
=
(
"*** '"
^
(
Unix
.
error_message
error
)
^
"'in the system call: '"
^
name
^
" "
^
arg
^
"'
\n
"
)
in
output_string
stdout
msg
;
flush
stdout
;
output_string
stderr
msg
;
flush
stderr
;
KO
|
e
->
output_string
stdout
(
Printexc
.
to_string
e
);
flush
stdout
;
output_string
stderr
(
Printexc
.
to_string
e
);
flush
stderr
;
KO
(* run a cmd and collect the stdout lines into a list (requires sed) *)
let
(
run
:
string
->
(
string
->
string
option
)
->
string
list
)
=
fun
cmd
filter
->
let
proc
=
Unix
.
open_process_in
(
"("
^
cmd
^
" | sed -e 's/^/stdout: /' ) 2>&1"
)
in
let
proc
=
Unix
.
open_process_in
(
"("
^
cmd
^
" | sed -e 's/^/stdout: /' ) 2>&1"
)
in
let
list
=
ref
[]
in
try
while
true
do
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment