Skip to content

Commit 550136f

Browse files
authoredJan 15, 2018
ocamlPackages.asn1-combinators: 0.1.3 -> 0.2.0 (#33566)
* ocamlPackages.asn1-combinators: 0.1.3 -> 0.2.0 * ocamlPackages.x509: 0.5.3 -> 0.6.0 * ocamlPackages.x509: 0.6.0 -> 0.6.1 * ocamlPackages.tls: 0.7.1 -> 0.9.0 * jackline: fix build with ocaml-tls ≥ 0.9.0
1 parent 9bbaa2a commit 550136f

File tree

5 files changed

+76
-38
lines changed

5 files changed

+76
-38
lines changed
 

‎pkgs/applications/networking/instant-messengers/jackline/default.nix

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
1313
sha256 = "05z9kvd7gwr59ic7hnmbayhwyyqd41xxz01cvdlcgplk3z7zlwg5";
1414
};
1515

16+
patches = [ ./tls-0.9.0.patch ];
17+
1618
buildInputs = with ocamlPackages; [
1719
ocaml ocamlbuild findlib topkg ppx_sexp_conv
1820
erm_xmpp_0_3 tls nocrypto x509 ocaml_lwt otr astring
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/cli/cli_config.ml b/cli/cli_config.ml
2+
index 991ee77..59a0edb 100644
3+
--- a/cli/cli_config.ml
4+
+++ b/cli/cli_config.ml
5+
@@ -207,7 +207,9 @@ let configure term () =
6+
ask above "CA file: " (fun x -> x) (fun x -> if Sys.file_exists x then `Ok x else `Invalid) term >>= fun trust_anchor ->
7+
Lwt_unix.access trust_anchor [ Unix.F_OK ; Unix.R_OK ] >>= fun () ->
8+
X509_lwt.certs_of_pem trust_anchor >>= fun tas ->
9+
- (match X509.Validation.valid_cas ~time:(Unix.time ()) tas with
10+
+ let time = match Ptime.of_float_s (Unix.time ())
11+
+ with Some time -> time | None -> assert false in
12+
+ (match X509.Validation.valid_cas ~time tas with
13+
| [] -> Lwt.fail (Invalid_argument "trust anchor file is empty!")
14+
| _ -> Lwt.return (`Trust_anchor trust_anchor))
15+
| Some fp -> Lwt.return (`Fingerprint fp) ) >>= fun authenticator ->
16+
diff --git a/cli/cli_state.ml b/cli/cli_state.ml
17+
index d5db502..91540c9 100644
18+
--- a/cli/cli_state.ml
19+
+++ b/cli/cli_state.ml
20+
@@ -262,7 +262,8 @@ module Connect = struct
21+
(match config.Xconfig.authenticator with
22+
| `Trust_anchor x -> X509_lwt.authenticator (`Ca_file x)
23+
| `Fingerprint fp ->
24+
- let time = Unix.gettimeofday () in
25+
+ let time = match Ptime.of_float_s (Unix.gettimeofday ())
26+
+ with Some time -> time | None -> assert false in
27+
let fp =
28+
Nocrypto.Uncommon.Cs.of_hex
29+
(String.map (function ':' -> ' ' | x -> x) fp)

‎pkgs/development/ocaml-modules/asn1-combinators/default.nix

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1-
{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, cstruct, zarith, ounit, result, topkg }:
1+
{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib
2+
, cstruct, zarith, ounit, result, topkg, ptime
3+
}:
4+
5+
let param =
6+
if stdenv.lib.versionAtLeast ocaml.version "4.02" then {
7+
version = "0.2.0";
8+
sha256 = "0yfq4hnyzx6hy05m60007cfpq88wxwa8wqzib19lnk2qrgy772mx";
9+
propagatedBuildInputs = [ ptime ];
10+
} else {
11+
version = "0.1.3";
12+
sha256 = "0hpn049i46sdnv2i6m7r6m6ch0jz8argybh71wykbvcqdby08zxj";
13+
propagatedBuildInputs = [ ];
14+
};
15+
in
216

317
buildOcaml rec {
418
name = "asn1-combinators";
5-
version = "0.1.3";
19+
inherit (param) version;
620

721
minimumSupportedOcamlVersion = "4.01";
822

923
src = fetchFromGitHub {
1024
owner = "mirleft";
1125
repo = "ocaml-asn1-combinators";
1226
rev = "v${version}";
13-
sha256 = "0hpn049i46sdnv2i6m7r6m6ch0jz8argybh71wykbvcqdby08zxj";
27+
inherit (param) sha256;
1428
};
1529

1630
buildInputs = [ ocaml findlib ounit topkg ];
17-
propagatedBuildInputs = [ result cstruct zarith ];
18-
19-
createFindlibDestdir = true;
31+
propagatedBuildInputs = [ result cstruct zarith ] ++ param.propagatedBuildInputs;
2032

2133
buildPhase = "${topkg.run} build --tests true";
2234

‎pkgs/development/ocaml-modules/tls/default.nix

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
{ stdenv, buildOcaml, fetchFromGitHub, findlib, ocamlbuild, ocaml_oasis
1+
{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, topkg
22
, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ppx_cstruct, cstruct-unix, ounit
33
, lwt ? null}:
44

55
with stdenv.lib;
66

77
let withLwt = lwt != null; in
88

9-
buildOcaml rec {
10-
version = "0.7.1";
11-
name = "tls";
12-
13-
minimunSupportedOcamlVersion = "4.02";
9+
stdenv.mkDerivation rec {
10+
version = "0.9.0";
11+
name = "ocaml${ocaml.version}-tls-${version}";
1412

1513
src = fetchFromGitHub {
1614
owner = "mirleft";
1715
repo = "ocaml-tls";
1816
rev = "${version}";
19-
sha256 = "19q2hzxiasz9pzczgb63kikg0mc9mw98dfvch5falf2rincycj24";
17+
sha256 = "0qgw8lq8pk9hss7b5i6fr08pi711i0zqx7yyjgcil47ipjig6c31";
2018
};
2119

22-
buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
20+
buildInputs = [ ocaml ocamlbuild findlib topkg ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
2321
propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
2422
optional withLwt lwt;
2523

26-
configureFlags = [ "--disable-mirage" "--enable-tests" ] ++
27-
optional withLwt ["--enable-lwt"];
28-
29-
configurePhase = "./configure --prefix $out $configureFlags";
24+
buildPhase = "${topkg.run} build --tests true --with-mirage false --with-lwt ${if withLwt then "true" else "false"}";
3025

3126
doCheck = true;
32-
checkTarget = "test";
33-
createFindlibDestdir = true;
27+
checkPhase = "${topkg.run} test";
28+
29+
inherit (topkg) installPhase;
3430

3531
meta = with stdenv.lib; {
3632
homepage = https://github.com/mirleft/ocaml-tls;

‎pkgs/development/ocaml-modules/x509/default.nix

+17-18
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
1-
{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto
2-
, ounit, ocaml_oasis, ppx_sexp_conv, cstruct-unix
1+
{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg
2+
, asn1-combinators, astring, nocrypto, ppx_sexp_conv
3+
, ounit, cstruct-unix
34
}:
45

5-
buildOcaml rec {
6-
name = "x509";
7-
version = "0.5.3";
6+
stdenv.mkDerivation rec {
7+
name = "ocaml${ocaml.version}-x509-${version}";
8+
version = "0.6.1";
89

9-
mininimumSupportedOcamlVersion = "4.02";
10-
11-
src = fetchFromGitHub {
12-
owner = "mirleft";
13-
repo = "ocaml-x509";
14-
rev = "${version}";
15-
sha256 = "07cc3z6h87460z3f4vz8nlczw5jkc4vjhix413z9x6nral876rn7";
10+
src = fetchurl {
11+
url = "https://github.com/mirleft/ocaml-x509/releases/download/${version}/x509-${version}.tbz";
12+
sha256 = "1c62mw9rnzq0rs3ihbhfs18nv4mdzwag7893hlqgji3wmaai70pk";
1613
};
1714

18-
buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv cstruct-unix ];
19-
propagatedBuildInputs = [ asn1-combinators nocrypto ];
15+
unpackCmd = "tar -xjf $curSrc";
16+
17+
buildInputs = [ ocaml findlib ocamlbuild topkg ppx_sexp_conv ounit cstruct-unix ];
18+
propagatedBuildInputs = [ asn1-combinators astring nocrypto ];
2019

21-
configureFlags = "--enable-tests";
22-
configurePhase = "./configure --prefix $out $configureFlags";
20+
buildPhase = "${topkg.run} build --tests true";
2321

2422
doCheck = true;
25-
checkTarget = "test";
26-
createFindlibDestdir = true;
23+
checkPhase = "${topkg.run} test";
24+
25+
inherit (topkg) installPhase;
2726

2827
meta = with stdenv.lib; {
2928
homepage = https://github.com/mirleft/ocaml-x509;

0 commit comments

Comments
 (0)
Please sign in to comment.