Opam: fix some dependencies and add some scripts/opam-*.sh
.
Installation: `./scripts/opam-pin.sh && opam install tezos-node tezos-client` Upgrade installed packages after a `git pull` (opam2 only): `./scripts/opam-upgrade.sh` Remove and cleanup every from the opam repo: `./scripts/opam-unpin.sh`
This commit is contained in:
parent
2471232766
commit
d2708740c8
@ -6,6 +6,8 @@ tezos-node
|
|||||||
tezos-protocol-compiler
|
tezos-protocol-compiler
|
||||||
tezos-client
|
tezos-client
|
||||||
|
|
||||||
|
scripts/opam-test-all.sh.DONE
|
||||||
|
|
||||||
**/.merlin
|
**/.merlin
|
||||||
|
|
||||||
**/*~
|
**/*~
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,6 +6,8 @@
|
|||||||
/tezos-protocol-compiler
|
/tezos-protocol-compiler
|
||||||
/tezos-client
|
/tezos-client
|
||||||
|
|
||||||
|
/scripts/opam-test-all.sh.DONE
|
||||||
|
|
||||||
.merlin
|
.merlin
|
||||||
|
|
||||||
*~
|
*~
|
||||||
|
@ -10,6 +10,9 @@ depends: [
|
|||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
|
"tezos-embedded-client-genesis"
|
||||||
|
"tezos-embedded-client-alpha"
|
||||||
|
"tezos-client-base"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
tezos-embedded-protocol-genesis
|
tezos-embedded-protocol-genesis
|
||||||
tezos-embedded-protocol-demo
|
tezos-embedded-protocol-demo
|
||||||
tezos-embedded-protocol-alpha
|
tezos-embedded-protocol-alpha
|
||||||
cmdliner))
|
cmdliner
|
||||||
|
ssl))
|
||||||
(flags (:standard -w -9+27-30-32-40@8
|
(flags (:standard -w -9+27-30-32-40@8
|
||||||
-safe-string
|
-safe-string
|
||||||
-open Tezos_base__TzPervasives
|
-open Tezos_base__TzPervasives
|
||||||
|
@ -14,6 +14,7 @@ depends: [
|
|||||||
"tezos-embedded-protocol-demo"
|
"tezos-embedded-protocol-demo"
|
||||||
"tezos-embedded-protocol-alpha"
|
"tezos-embedded-protocol-alpha"
|
||||||
"cmdliner"
|
"cmdliner"
|
||||||
|
"ssl"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,14 +9,14 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-stdlib"
|
"tezos-stdlib"
|
||||||
"tezos-stdlib-lwt"
|
"tezos-stdlib-lwt"
|
||||||
"tezos-crypto"
|
"tezos-crypto"
|
||||||
"tezos-data-encoding"
|
"tezos-data-encoding"
|
||||||
"tezos-error-monad"
|
"tezos-error-monad"
|
||||||
"ezjsonm"
|
"ezjsonm" { >= "0.5.0" }
|
||||||
"calendar"
|
"calendar"
|
||||||
|
"mtime" { >= "1.0.0" }
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -201,7 +201,7 @@ class type rpc_sig = object
|
|||||||
RPC.meth ->
|
RPC.meth ->
|
||||||
string list ->
|
string list ->
|
||||||
Data_encoding.json ->
|
Data_encoding.json ->
|
||||||
('a * Cohttp.Code.status_code * Cohttp_lwt_body.t)
|
('a * Cohttp.Code.status_code * Cohttp_lwt.Body.t)
|
||||||
Error_monad.tzresult Lwt.t
|
Error_monad.tzresult Lwt.t
|
||||||
method parse_answer :
|
method parse_answer :
|
||||||
(unit, 'b, 'c, 'd) RPC.service ->
|
(unit, 'b, 'c, 'd) RPC.service ->
|
||||||
@ -220,7 +220,7 @@ class rpc config = object (self)
|
|||||||
RPC.meth ->
|
RPC.meth ->
|
||||||
string list ->
|
string list ->
|
||||||
Data_encoding.json ->
|
Data_encoding.json ->
|
||||||
(a * Cohttp.Code.status_code * Cohttp_lwt_body.t)
|
(a * Cohttp.Code.status_code * Cohttp_lwt.Body.t)
|
||||||
Error_monad.tzresult Lwt.t =
|
Error_monad.tzresult Lwt.t =
|
||||||
fun log_request meth service json ->
|
fun log_request meth service json ->
|
||||||
let scheme = if config.tls then "https" else "http" in
|
let scheme = if config.tls then "https" else "http" in
|
||||||
@ -229,7 +229,7 @@ class rpc config = object (self)
|
|||||||
Uri.make ~scheme ~host:config.host ~port:config.port ~path () in
|
Uri.make ~scheme ~host:config.host ~port:config.port ~path () in
|
||||||
let reqbody = Data_encoding_ezjsonm.to_string json in
|
let reqbody = Data_encoding_ezjsonm.to_string json in
|
||||||
Lwt.catch begin fun () ->
|
Lwt.catch begin fun () ->
|
||||||
let body = Cohttp_lwt_body.of_string reqbody in
|
let body = Cohttp_lwt.Body.of_string reqbody in
|
||||||
Cohttp_lwt_unix.Client.call
|
Cohttp_lwt_unix.Client.call
|
||||||
(meth :> Cohttp.Code.meth) ~body uri >>= fun (code, ansbody) ->
|
(meth :> Cohttp.Code.meth) ~body uri >>= fun (code, ansbody) ->
|
||||||
log_request uri json >>= fun reqid ->
|
log_request uri json >>= fun reqid ->
|
||||||
@ -249,7 +249,7 @@ class rpc config = object (self)
|
|||||||
meth service json >>=? fun (reqid, code, ansbody) ->
|
meth service json >>=? fun (reqid, code, ansbody) ->
|
||||||
match code with
|
match code with
|
||||||
| #Cohttp.Code.success_status ->
|
| #Cohttp.Code.success_status ->
|
||||||
let ansbody = Cohttp_lwt_body.to_stream ansbody in
|
let ansbody = Cohttp_lwt.Body.to_stream ansbody in
|
||||||
let json_st = Data_encoding_ezjsonm.from_stream ansbody in
|
let json_st = Data_encoding_ezjsonm.from_stream ansbody in
|
||||||
let parsed_st, push = Lwt_stream.create () in
|
let parsed_st, push = Lwt_stream.create () in
|
||||||
let rec loop () =
|
let rec loop () =
|
||||||
@ -271,7 +271,7 @@ class rpc config = object (self)
|
|||||||
Lwt.async loop ;
|
Lwt.async loop ;
|
||||||
return parsed_st
|
return parsed_st
|
||||||
| err ->
|
| err ->
|
||||||
Cohttp_lwt_body.to_string ansbody >>= fun ansbody ->
|
Cohttp_lwt.Body.to_string ansbody >>= fun ansbody ->
|
||||||
logger.log_error reqid code ansbody >>= fun () ->
|
logger.log_error reqid code ansbody >>= fun () ->
|
||||||
fail config (Request_failed (service, err))
|
fail config (Request_failed (service, err))
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ class rpc config = object (self)
|
|||||||
let Logger logger = config.logger in
|
let Logger logger = config.logger in
|
||||||
self#make_request logger.log_request
|
self#make_request logger.log_request
|
||||||
meth service json >>=? fun (reqid, code, ansbody) ->
|
meth service json >>=? fun (reqid, code, ansbody) ->
|
||||||
Cohttp_lwt_body.to_string ansbody >>= fun ansbody ->
|
Cohttp_lwt.Body.to_string ansbody >>= fun ansbody ->
|
||||||
match code with
|
match code with
|
||||||
| #Cohttp.Code.success_status -> begin
|
| #Cohttp.Code.success_status -> begin
|
||||||
if ansbody = "" then
|
if ansbody = "" then
|
||||||
@ -331,7 +331,7 @@ let make_request config log_request meth service json =
|
|||||||
Uri.make ~scheme ~host:config.host ~port:config.port ~path () in
|
Uri.make ~scheme ~host:config.host ~port:config.port ~path () in
|
||||||
let reqbody = Data_encoding_ezjsonm.to_string json in
|
let reqbody = Data_encoding_ezjsonm.to_string json in
|
||||||
Lwt.catch begin fun () ->
|
Lwt.catch begin fun () ->
|
||||||
let body = Cohttp_lwt_body.of_string reqbody in
|
let body = Cohttp_lwt.Body.of_string reqbody in
|
||||||
Cohttp_lwt_unix.Client.call
|
Cohttp_lwt_unix.Client.call
|
||||||
(meth :> Cohttp.Code.meth)
|
(meth :> Cohttp.Code.meth)
|
||||||
~body uri >>= fun (code, ansbody) ->
|
~body uri >>= fun (code, ansbody) ->
|
||||||
|
@ -39,7 +39,7 @@ class type rpc_sig = object
|
|||||||
RPC.meth ->
|
RPC.meth ->
|
||||||
string list ->
|
string list ->
|
||||||
Data_encoding.json ->
|
Data_encoding.json ->
|
||||||
('a * Cohttp.Code.status_code * Cohttp_lwt_body.t)
|
('a * Cohttp.Code.status_code * Cohttp_lwt.Body.t)
|
||||||
Error_monad.tzresult Lwt.t
|
Error_monad.tzresult Lwt.t
|
||||||
method parse_answer :
|
method parse_answer :
|
||||||
(unit, 'b, 'c, 'd) RPC.service ->
|
(unit, 'b, 'c, 'd) RPC.service ->
|
||||||
|
@ -9,9 +9,13 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-stdlib"
|
||||||
"tezos-base"
|
"tezos-stdlib-lwt"
|
||||||
"lwt"
|
"tezos-data-encoding"
|
||||||
|
"tezos-error-monad"
|
||||||
|
"nocrypto"
|
||||||
|
"sodium"
|
||||||
|
"zarith"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,7 +9,6 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-stdlib"
|
"tezos-stdlib"
|
||||||
"ocplib-json-typed"
|
"ocplib-json-typed"
|
||||||
"ocplib-endian"
|
"ocplib-endian"
|
||||||
|
@ -11,7 +11,7 @@ depends: [
|
|||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"tezos-embedded-protocol-alpha"
|
"tezos-embedded-protocol-alpha"
|
||||||
"tezos-embedded-protocol-alpha.raw"
|
"tezos-node-services"
|
||||||
"tezos-client-base"
|
"tezos-client-base"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
@ -11,9 +11,8 @@ depends: [
|
|||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"tezos-embedded-protocol-genesis"
|
"tezos-embedded-protocol-genesis"
|
||||||
"tezos-embedded-protocol-genesis.raw"
|
"tezos-embedded-protocol-alpha"
|
||||||
"tezos-embedded-protocol-alpha.environment"
|
"tezos-node-services"
|
||||||
"tezos-embedded-protocol-alpha.raw"
|
|
||||||
"tezos-client-base"
|
"tezos-client-base"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
@ -9,11 +9,14 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
"tezos-node-updater"
|
||||||
"uutf"
|
"tezos-node-shell"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_embedded_protocol_template" "src/jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"alpha\"/" "src/jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,11 +9,12 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
|
||||||
"uutf"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_protocol_template" "jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"alpha\"/" "jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,11 +9,14 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
"tezos-node-updater"
|
||||||
"uutf"
|
"tezos-node-shell"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_embedded_protocol_template" "src/jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"demo\"/" "src/jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,11 +9,12 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
|
||||||
"uutf"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_protocol_template" "jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"demo\"/" "jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,11 +9,14 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
"tezos-node-updater"
|
||||||
"uutf"
|
"tezos-node-shell"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_embedded_protocol_template" "src/jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"genesis\"/" "src/jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,11 +9,12 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-protocol-compiler"
|
||||||
"tezos-base"
|
|
||||||
"uutf"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
[ "rm" "jbuild" "src/jbuild" ]
|
||||||
|
[ "cp" "%{tezos-protocol-compiler:share}%/jbuild_protocol_template" "jbuild" ]
|
||||||
|
[ "sed" "-i" "s/let predefined_version = None/let predefined_version = Some \"genesis\"/" "jbuild" ]
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
]
|
]
|
||||||
build-test: [
|
build-test: [
|
||||||
|
@ -9,9 +9,9 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-stdlib"
|
"tezos-stdlib"
|
||||||
"tezos-data-encoding"
|
"tezos-data-encoding"
|
||||||
|
"lwt"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,7 +9,6 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"uutf"
|
"uutf"
|
||||||
]
|
]
|
||||||
|
@ -9,8 +9,9 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-base"
|
||||||
"mtime.clock.os"
|
"tezos-node-services"
|
||||||
|
"ocplib-resto-directory"
|
||||||
"ocplib-resto-cohttp"
|
"ocplib-resto-cohttp"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
@ -9,9 +9,8 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-base"
|
||||||
"mtime.clock.os"
|
"tezos-node-p2p-base"
|
||||||
"ocplib-resto-cohttp"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,9 +9,7 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-base"
|
||||||
"mtime.clock.os"
|
|
||||||
"ocplib-resto-cohttp"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,9 +9,9 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
"tezos-base"
|
||||||
"mtime.clock.os"
|
"tezos-node-p2p-base"
|
||||||
"ocplib-resto-cohttp"
|
"ocplib-resto"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,12 +9,12 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"tezos-micheline"
|
"tezos-storage"
|
||||||
"tezos-protocol-compiler"
|
"tezos-node-services"
|
||||||
"tezos-node-net"
|
"tezos-node-p2p-base"
|
||||||
"tezos-node-db"
|
"tezos-node-p2p"
|
||||||
|
"tezos-node-updater"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,9 +9,13 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"uutf"
|
"tezos-micheline"
|
||||||
|
"tezos-protocol-compiler"
|
||||||
|
"tezos-storage"
|
||||||
|
"tezos-node-services"
|
||||||
|
"tezos-node-p2p-base"
|
||||||
|
"tezos-node-http"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -3,7 +3,12 @@
|
|||||||
let prefix = "lib_embedded_protocol_"
|
let prefix = "lib_embedded_protocol_"
|
||||||
let dirname = Filename.basename @@ Filename.dirname @@ Sys.getcwd ()
|
let dirname = Filename.basename @@ Filename.dirname @@ Sys.getcwd ()
|
||||||
|
|
||||||
|
let predefined_version = None (* to be substituted in opam packages *)
|
||||||
|
|
||||||
let version =
|
let version =
|
||||||
|
match predefined_version with
|
||||||
|
| Some version -> version
|
||||||
|
| None ->
|
||||||
let x = String.length prefix in
|
let x = String.length prefix in
|
||||||
let n = String.length dirname in
|
let n = String.length dirname in
|
||||||
if not (n >= x && String.sub dirname 0 x = prefix) then
|
if not (n >= x && String.sub dirname 0 x = prefix) then
|
||||||
|
@ -12,13 +12,23 @@
|
|||||||
let prefix = "lib_embedded_protocol_"
|
let prefix = "lib_embedded_protocol_"
|
||||||
let dirname = Filename.basename @@ Sys.getcwd ()
|
let dirname = Filename.basename @@ Sys.getcwd ()
|
||||||
|
|
||||||
|
let predefined_version = None (* to be substituted in opam packages *)
|
||||||
|
|
||||||
let version =
|
let version =
|
||||||
|
match predefined_version with
|
||||||
|
| Some version -> version
|
||||||
|
| None ->
|
||||||
let x = String.length prefix in
|
let x = String.length prefix in
|
||||||
let n = String.length dirname in
|
let n = String.length dirname in
|
||||||
if not (n >= x && String.sub dirname 0 x = prefix) then
|
if not (n >= x && String.sub dirname 0 x = prefix) then
|
||||||
failwith "unexpected directory name" ;
|
failwith "unexpected directory name" ;
|
||||||
String.sub dirname x (n - x)
|
String.sub dirname x (n - x)
|
||||||
|
|
||||||
|
let path =
|
||||||
|
match predefined_version with
|
||||||
|
| None -> "lib_embedded_protocol_" ^ version
|
||||||
|
| Some _ -> "."
|
||||||
|
|
||||||
let () = Format.kasprintf Jbuild_plugin.V1.send {|
|
let () = Format.kasprintf Jbuild_plugin.V1.send {|
|
||||||
|
|
||||||
(jbuild_version 1)
|
(jbuild_version 1)
|
||||||
@ -38,8 +48,7 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
|
|||||||
(library
|
(library
|
||||||
((name tezos_protocol_%s)
|
((name tezos_protocol_%s)
|
||||||
(public_name tezos-protocol-%s)
|
(public_name tezos-protocol-%s)
|
||||||
(library_flags (:standard -linkall
|
(library_flags (:standard -linkall %s/tezos_protocol_%s.cmx))
|
||||||
lib_embedded_protocol_%s/tezos_protocol_%s.cmx))
|
|
||||||
(wrapped false)
|
(wrapped false)
|
||||||
(modes (native))
|
(modes (native))
|
||||||
(modules (Tezos_protocol_%s_dummy))))
|
(modules (Tezos_protocol_%s_dummy))))
|
||||||
@ -55,4 +64,5 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
|
|||||||
|
|
||||||
|}
|
|}
|
||||||
version version version version version version version version
|
version version version version version version version version
|
||||||
version version version version
|
path
|
||||||
|
version version version
|
||||||
|
@ -9,14 +9,12 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
|
"base-unix"
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"tezos-protocol-environment-sigs"
|
"tezos-protocol-environment-sigs"
|
||||||
"compiler-libs"
|
"lwt"
|
||||||
"compiler-libs.optcomp"
|
|
||||||
"lwt.unix"
|
|
||||||
"ocplib-endian"
|
"ocplib-endian"
|
||||||
"ocplib-ocamlres"
|
"ocp-ocamlres" { >= "dev" }
|
||||||
"unix"
|
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,9 +9,8 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"cstruct"
|
"cstruct"
|
||||||
"ocplib-endian.bigstring"
|
"ocplib-endian"
|
||||||
"stringext"
|
"stringext"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
|
@ -9,12 +9,11 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-stdlib"
|
"tezos-stdlib"
|
||||||
"tezos-data-encoding"
|
"tezos-data-encoding"
|
||||||
"tezos-error-monad"
|
"tezos-error-monad"
|
||||||
"lwt.unix"
|
"lwt" { >= "3.0.0" }
|
||||||
"ipaddr.unix"
|
"ipaddr"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
@ -9,10 +9,9 @@ license: "unreleased"
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" { build }
|
"ocamlfind" { build }
|
||||||
"jbuilder" { build & >= "1.0+beta15" }
|
"jbuilder" { build & >= "1.0+beta15" }
|
||||||
"base-bigarray"
|
|
||||||
"tezos-base"
|
"tezos-base"
|
||||||
"leveldb"
|
"leveldb"
|
||||||
"irmin-unix"
|
"irmin-leveldb"
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
[ "jbuilder" "build" "-p" name "-j" jobs ]
|
||||||
|
21
scripts/opam-pin.sh
Executable file
21
scripts/opam-pin.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
|
||||||
|
opams=$(find "$src_dir" -name tezos-deps.opam -prune -or -name \*.opam -print)
|
||||||
|
|
||||||
|
export OPAMYES=yes
|
||||||
|
|
||||||
|
packages=
|
||||||
|
for opam in $opams; do
|
||||||
|
dir=$(dirname $opam)
|
||||||
|
file=$(basename $opam)
|
||||||
|
package=${file%.opam}
|
||||||
|
packages="$packages $package"
|
||||||
|
opam pin add --no-action $package $dir
|
||||||
|
done
|
||||||
|
|
||||||
|
packages=$(opam list --short --all --sort $packages)
|
20
scripts/opam-remove.sh
Executable file
20
scripts/opam-remove.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
|
||||||
|
opams=$(find "$src_dir" -name \*.opam)
|
||||||
|
packages=
|
||||||
|
|
||||||
|
for opam in $opams; do
|
||||||
|
dir=$(dirname $opam)
|
||||||
|
file=$(basename $opam)
|
||||||
|
package=${file%.opam}
|
||||||
|
packages="$packages $package"
|
||||||
|
done
|
||||||
|
|
||||||
|
installed=$(opam list --short --installed $packages)
|
||||||
|
|
||||||
|
opam remove $installed
|
74
scripts/opam-test-all.sh
Executable file
74
scripts/opam-test-all.sh
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
cd "$src_dir"
|
||||||
|
|
||||||
|
cleanup () {
|
||||||
|
set +e
|
||||||
|
if [ -f LOG ]; then
|
||||||
|
echo "failed."
|
||||||
|
echo
|
||||||
|
cat LOG
|
||||||
|
rm LOG
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap cleanup EXIT INT
|
||||||
|
|
||||||
|
silent () {
|
||||||
|
"$@" > LOG 2>&1
|
||||||
|
rm LOG
|
||||||
|
}
|
||||||
|
|
||||||
|
requested_packages="$@"
|
||||||
|
|
||||||
|
export OPAMYES=yes
|
||||||
|
|
||||||
|
echo -n "Cleanup state and pin packages..."
|
||||||
|
silent ./scripts/opam-unpin.sh
|
||||||
|
silent . ./scripts/opam-pin.sh
|
||||||
|
echo " OK."
|
||||||
|
|
||||||
|
if ! [ -z "$requested_packages" ]; then
|
||||||
|
packages="$requested_packages"
|
||||||
|
fi
|
||||||
|
|
||||||
|
okfile="$0.DONE"
|
||||||
|
touch $okfile
|
||||||
|
ok=$(cat "$okfile")
|
||||||
|
|
||||||
|
ignore() {
|
||||||
|
for i in $ok; do
|
||||||
|
if [ $i = $1 ]; then return 0; fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for package in $packages; do
|
||||||
|
|
||||||
|
if ignore $package; then
|
||||||
|
echo "Ignoring: $package."
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "Installing: $package..."
|
||||||
|
silent opam install $package
|
||||||
|
echo " OK."
|
||||||
|
|
||||||
|
echo -n "Removing: $package..."
|
||||||
|
silent opam remove -a $package
|
||||||
|
echo " OK."
|
||||||
|
|
||||||
|
echo $package >> "$okfile"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Successfully installed the following packages: "
|
||||||
|
echo
|
||||||
|
cat $okfile | sed 's/^/- /'
|
||||||
|
rm $okfile
|
11
scripts/opam-unpin.sh
Executable file
11
scripts/opam-unpin.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
|
||||||
|
. "$script_dir"/opam-remove.sh
|
||||||
|
|
||||||
|
opam pin remove $packages
|
||||||
|
|
35
scripts/opam-upgrade.sh
Executable file
35
scripts/opam-upgrade.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
cd "$src_dir"
|
||||||
|
|
||||||
|
cleanup () {
|
||||||
|
set +e
|
||||||
|
if [ -f LOG ]; then
|
||||||
|
echo "Failure"
|
||||||
|
echo
|
||||||
|
cat LOG
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
trap cleanup EXIT INT
|
||||||
|
|
||||||
|
silent () {
|
||||||
|
"$@" > LOG 2>&1
|
||||||
|
rm LOG
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Updating package description..."
|
||||||
|
silent . ./scripts/opam-pin.sh
|
||||||
|
|
||||||
|
upgradables=$(opam list --short --installed $packages)
|
||||||
|
|
||||||
|
if [ -z "$upgradables" ]; then
|
||||||
|
echo "No previously installed package. Nothing to do."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
opam upgrade $upgradables
|
@ -13,13 +13,10 @@ depends: [
|
|||||||
"base-threads"
|
"base-threads"
|
||||||
"conf-libev"
|
"conf-libev"
|
||||||
"calendar"
|
"calendar"
|
||||||
"cohttp" { >= "0.21" }
|
"cohttp" { >= "1.0.0" }
|
||||||
"conduit"
|
"conduit"
|
||||||
"ezjsonm" { >= "0.5.0" }
|
"ezjsonm" { >= "0.5.0" }
|
||||||
"git"
|
|
||||||
"git-unix"
|
|
||||||
"irmin" { >= "1.3" }
|
"irmin" { >= "1.3" }
|
||||||
"irmin-unix" { >= "1.3" }
|
|
||||||
"lwt" { >= "3.0.0" }
|
"lwt" { >= "3.0.0" }
|
||||||
"lwt_ssl"
|
"lwt_ssl"
|
||||||
"menhir"
|
"menhir"
|
||||||
|
2
vendors/irmin-leveldb/irmin-leveldb.opam
vendored
2
vendors/irmin-leveldb/irmin-leveldb.opam
vendored
@ -15,7 +15,7 @@ build-test: ["jbuilder" "runtest" "-p" name]
|
|||||||
|
|
||||||
depends: [
|
depends: [
|
||||||
"jbuilder" {build & >= "1.0+beta10"}
|
"jbuilder" {build & >= "1.0+beta10"}
|
||||||
"irmin" {>= "1.2.0"}
|
"irmin" {>= "1.3.0"}
|
||||||
"leveldb" {>= "1.1.1"}
|
"leveldb" {>= "1.1.1"}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
2
vendors/irmin-leveldb/jbuild
vendored
2
vendors/irmin-leveldb/jbuild
vendored
@ -3,4 +3,4 @@
|
|||||||
(library
|
(library
|
||||||
((name irmin_leveldb)
|
((name irmin_leveldb)
|
||||||
(public_name irmin-leveldb)
|
(public_name irmin-leveldb)
|
||||||
(libraries (irmin leveldb git))))
|
(libraries (irmin leveldb))))
|
||||||
|
@ -19,6 +19,6 @@ build-test: [
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" {build}
|
"ocamlfind" {build}
|
||||||
"jbuilder" {build}
|
"jbuilder" {build}
|
||||||
"ocplib-ezresto"
|
"ocplib-ezresto" {= "dev" }
|
||||||
"ocplib-resto-directory"
|
"ocplib-resto-directory" {= "dev" }
|
||||||
]
|
]
|
||||||
|
@ -19,6 +19,6 @@ build-test: [
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" {build}
|
"ocamlfind" {build}
|
||||||
"jbuilder" {build}
|
"jbuilder" {build}
|
||||||
"ocplib-resto"
|
"ocplib-resto" {= "dev" }
|
||||||
"ocplib-resto-json"
|
"ocplib-resto-json" {= "dev" }
|
||||||
]
|
]
|
||||||
|
@ -19,6 +19,6 @@ build-test: [
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" {build}
|
"ocamlfind" {build}
|
||||||
"jbuilder" {build}
|
"jbuilder" {build}
|
||||||
"ocplib-resto-directory"
|
"ocplib-resto-directory" {= "dev" }
|
||||||
"cohttp-lwt-unix"
|
"cohttp-lwt-unix" { >= "1.0.0" }
|
||||||
]
|
]
|
||||||
|
@ -215,10 +215,10 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
end >>=? fun query ->
|
end >>=? fun query ->
|
||||||
let output = output_media_type.construct s.types.output
|
let output = output_media_type.construct s.types.output
|
||||||
and error = function
|
and error = function
|
||||||
| None -> Cohttp_lwt_body.empty, Transfer.Fixed 0L
|
| None -> Cohttp_lwt.Body.empty, Transfer.Fixed 0L
|
||||||
| Some e ->
|
| Some e ->
|
||||||
let s = output_media_type.construct s.types.error e in
|
let s = output_media_type.construct s.types.error e in
|
||||||
Cohttp_lwt_body.of_string s,
|
Cohttp_lwt.Body.of_string s,
|
||||||
Transfer.Fixed (Int64.of_int (String.length s)) in
|
Transfer.Fixed (Int64.of_int (String.length s)) in
|
||||||
let headers = Header.init () in
|
let headers = Header.init () in
|
||||||
let headers =
|
let headers =
|
||||||
@ -228,7 +228,7 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
| Service.No_input ->
|
| Service.No_input ->
|
||||||
s.handler query () >>= Lwt.return_ok
|
s.handler query () >>= Lwt.return_ok
|
||||||
| Service.Input input ->
|
| Service.Input input ->
|
||||||
Cohttp_lwt_body.to_string body >>= fun body ->
|
Cohttp_lwt.Body.to_string body >>= fun body ->
|
||||||
match
|
match
|
||||||
input_media_type.destruct input body
|
input_media_type.destruct input body
|
||||||
with
|
with
|
||||||
@ -243,13 +243,13 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
Transfer.Fixed (Int64.of_int (String.length body)) in
|
Transfer.Fixed (Int64.of_int (String.length body)) in
|
||||||
Lwt.return_ok
|
Lwt.return_ok
|
||||||
(Response.make ~status:`OK ~encoding ~headers (),
|
(Response.make ~status:`OK ~encoding ~headers (),
|
||||||
Cohttp_lwt_body.of_string body)
|
Cohttp_lwt.Body.of_string body)
|
||||||
| `OkStream o ->
|
| `OkStream o ->
|
||||||
let body = create_stream server con output o in
|
let body = create_stream server con output o in
|
||||||
let encoding = Transfer.Chunked in
|
let encoding = Transfer.Chunked in
|
||||||
Lwt.return_ok
|
Lwt.return_ok
|
||||||
(Response.make ~status:`OK ~encoding ~headers (),
|
(Response.make ~status:`OK ~encoding ~headers (),
|
||||||
Cohttp_lwt_body.of_stream body)
|
Cohttp_lwt.Body.of_stream body)
|
||||||
| `Created s ->
|
| `Created s ->
|
||||||
let headers = Header.init () in
|
let headers = Header.init () in
|
||||||
let headers =
|
let headers =
|
||||||
@ -258,11 +258,11 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
| Some s -> Header.add headers "location" s in
|
| Some s -> Header.add headers "location" s in
|
||||||
Lwt.return_ok
|
Lwt.return_ok
|
||||||
(Response.make ~status:`Created ~headers (),
|
(Response.make ~status:`Created ~headers (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| `No_content ->
|
| `No_content ->
|
||||||
Lwt.return_ok
|
Lwt.return_ok
|
||||||
(Response.make ~status:`No_content (),
|
(Response.make ~status:`No_content (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| `Unauthorized e ->
|
| `Unauthorized e ->
|
||||||
let body, encoding = error e in
|
let body, encoding = error e in
|
||||||
let status = `Unauthorized in
|
let status = `Unauthorized in
|
||||||
@ -322,7 +322,7 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
let headers = Cors.add_headers headers server.cors origin_header in
|
let headers = Cors.add_headers headers server.cors origin_header in
|
||||||
Lwt.return_ok
|
Lwt.return_ok
|
||||||
(Response.make ~flush:true ~status:`OK ~headers (),
|
(Response.make ~flush:true ~status:`OK ~headers (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| _ ->
|
| _ ->
|
||||||
Lwt.return_error `Not_implemented
|
Lwt.return_error `Not_implemented
|
||||||
end >>= function
|
end >>= function
|
||||||
@ -330,7 +330,7 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
| Error `Not_implemented ->
|
| Error `Not_implemented ->
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Not_implemented (),
|
(Response.make ~status:`Not_implemented (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| Error `Method_not_allowed methods ->
|
| Error `Method_not_allowed methods ->
|
||||||
let headers = Header.init () in
|
let headers = Header.init () in
|
||||||
let headers =
|
let headers =
|
||||||
@ -338,14 +338,14 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
(List.map Resto.string_of_meth methods) in
|
(List.map Resto.string_of_meth methods) in
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Method_not_allowed ~headers (),
|
(Response.make ~status:`Method_not_allowed ~headers (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| Error `Cannot_parse_path (context, arg, value) ->
|
| Error `Cannot_parse_path (context, arg, value) ->
|
||||||
let headers = Header.init () in
|
let headers = Header.init () in
|
||||||
let headers =
|
let headers =
|
||||||
Header.add headers "content-type" "text/plain" in
|
Header.add headers "content-type" "text/plain" in
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Bad_request ~headers (),
|
(Response.make ~status:`Bad_request ~headers (),
|
||||||
Format.kasprintf Cohttp_lwt_body.of_string
|
Format.kasprintf Cohttp_lwt.Body.of_string
|
||||||
"Failed to parsed an argument in path. After \"%s\", \
|
"Failed to parsed an argument in path. After \"%s\", \
|
||||||
the value \"%s\" is not acceptable for type \"%s\""
|
the value \"%s\" is not acceptable for type \"%s\""
|
||||||
(String.concat "/" context) value arg.name)
|
(String.concat "/" context) value arg.name)
|
||||||
@ -355,7 +355,7 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
Header.add headers "content-type" "text/plain" in
|
Header.add headers "content-type" "text/plain" in
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Bad_request ~headers (),
|
(Response.make ~status:`Bad_request ~headers (),
|
||||||
Format.kasprintf Cohttp_lwt_body.of_string
|
Format.kasprintf Cohttp_lwt.Body.of_string
|
||||||
"Failed to parse the request body: %s" s)
|
"Failed to parse the request body: %s" s)
|
||||||
| Error `Cannot_parse_query s ->
|
| Error `Cannot_parse_query s ->
|
||||||
let headers = Header.init () in
|
let headers = Header.init () in
|
||||||
@ -363,7 +363,7 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
Header.add headers "content-type" "text/plain" in
|
Header.add headers "content-type" "text/plain" in
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Bad_request ~headers (),
|
(Response.make ~status:`Bad_request ~headers (),
|
||||||
Format.kasprintf Cohttp_lwt_body.of_string
|
Format.kasprintf Cohttp_lwt.Body.of_string
|
||||||
"Failed to parse the query string: %s" s)
|
"Failed to parse the query string: %s" s)
|
||||||
| Error `Not_acceptable ->
|
| Error `Not_acceptable ->
|
||||||
let accepted_encoding =
|
let accepted_encoding =
|
||||||
@ -372,15 +372,15 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
server.media_types) in
|
server.media_types) in
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Not_acceptable (),
|
(Response.make ~status:`Not_acceptable (),
|
||||||
Cohttp_lwt_body.of_string accepted_encoding)
|
Cohttp_lwt.Body.of_string accepted_encoding)
|
||||||
| Error `Unsupported_media_type _ ->
|
| Error `Unsupported_media_type _ ->
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Unsupported_media_type (),
|
(Response.make ~status:`Unsupported_media_type (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
| Error `Not_found ->
|
| Error `Not_found ->
|
||||||
Lwt.return
|
Lwt.return
|
||||||
(Response.make ~status:`Not_found (),
|
(Response.make ~status:`Not_found (),
|
||||||
Cohttp_lwt_body.empty)
|
Cohttp_lwt.Body.empty)
|
||||||
|
|
||||||
(* Promise a running RPC server. *)
|
(* Promise a running RPC server. *)
|
||||||
|
|
||||||
@ -402,9 +402,8 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
stopper ;
|
stopper ;
|
||||||
worker = Lwt.return_unit ;
|
worker = Lwt.return_unit ;
|
||||||
} in
|
} in
|
||||||
let open Cohttp_lwt_unix in
|
|
||||||
Conduit_lwt_unix.init ~src:host () >>= fun ctx ->
|
Conduit_lwt_unix.init ~src:host () >>= fun ctx ->
|
||||||
let ctx = Cohttp_lwt_unix_net.init ~ctx () in
|
let ctx = Cohttp_lwt_unix.Net.init ~ctx () in
|
||||||
server.worker <- begin
|
server.worker <- begin
|
||||||
let conn_closed (_, con) =
|
let conn_closed (_, con) =
|
||||||
log_info "connection closed %s" (Connection.to_string con) ;
|
log_info "connection closed %s" (Connection.to_string con) ;
|
||||||
@ -426,12 +425,12 @@ module Make (Encoding : Resto.ENCODING)(Log : LOGGING) = struct
|
|||||||
let headers =
|
let headers =
|
||||||
Header.add headers "content-type" "text/ocaml.exception" in
|
Header.add headers "content-type" "text/ocaml.exception" in
|
||||||
let status = `Internal_server_error in
|
let status = `Internal_server_error in
|
||||||
let body = Cohttp_lwt_body.of_string (Printexc.to_string exn) in
|
let body = Cohttp_lwt.Body.of_string (Printexc.to_string exn) in
|
||||||
Lwt.return (Response.make ~status ~headers (), body)
|
Lwt.return (Response.make ~status ~headers (), body)
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
Server.create ~stop ~ctx ~mode ~on_exn
|
Cohttp_lwt_unix.Server.create ~stop ~ctx ~mode ~on_exn
|
||||||
(Server.make ~callback ~conn_closed ())
|
(Cohttp_lwt_unix.Server.make ~callback ~conn_closed ())
|
||||||
end ;
|
end ;
|
||||||
Lwt.return server
|
Lwt.return server
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ build-test: [
|
|||||||
depends: [
|
depends: [
|
||||||
"ocamlfind" {build}
|
"ocamlfind" {build}
|
||||||
"jbuilder" {build}
|
"jbuilder" {build}
|
||||||
"ocplib-resto"
|
"ocplib-resto" {= "dev" }
|
||||||
"ocplib-json-typed" { >= "0.4" }
|
"ocplib-json-typed" { >= "0.4" }
|
||||||
|
"ocplib-endian" ## for `ocplib-json-typed.bson` to be built
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user