From 377de6afdc31551fcc4096f46ad5c0726b6767c7 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Thu, 15 Apr 2021 16:45:51 +0200 Subject: feat(3p/josh): Import and build josh We've had josh in here previously, but it was kind of immature back then. The repository looks much better now and I'd like to give it another try. Josh is a Rust project, the build here is done with naersk. Change-Id: I3731340d00ce1eb4cef55de114e1915579e47ef3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3017 Reviewed-by: lukegb Tested-by: BuildkiteCI --- third_party/josh/default.nix | 33 ++++++++++++++++++++ third_party/josh/pin-git2-rev.patch | 62 +++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 third_party/josh/default.nix create mode 100644 third_party/josh/pin-git2-rev.patch (limited to 'third_party') diff --git a/third_party/josh/default.nix b/third_party/josh/default.nix new file mode 100644 index 000000000000..a7e4b30b8e76 --- /dev/null +++ b/third_party/josh/default.nix @@ -0,0 +1,33 @@ +# https://github.com/esrlabs/josh +{ depot, pkgs, ... }: + +let + gitSrc = pkgs.fetchFromGitHub { + owner = "esrlabs"; + repo = "josh"; + rev = "1c1965deb0278de92452a597c092f16b531274ae"; + sha256 = "0a0ybx4dqr9gfcn1kqy2nirdsfbdwkfz24ljnri564c5381ccldw"; + }; + + src = pkgs.applyPatches { + name = "josh-src"; + src = gitSrc; + patches = [ + ./pin-git2-rev.patch + ]; + }; +in depot.third_party.naersk.buildPackage { + inherit src; + + buildInputs = with pkgs; [ + libgit2 + openssl + pkgconfig + ]; + + cargoBuildOptions = x: x ++ [ + "-p" "josh" + "-p" "josh-proxy" + "-p" "josh-ui" + ]; +} diff --git a/third_party/josh/pin-git2-rev.patch b/third_party/josh/pin-git2-rev.patch new file mode 100644 index 000000000000..7dd427b49ba4 --- /dev/null +++ b/third_party/josh/pin-git2-rev.patch @@ -0,0 +1,62 @@ +From 1b743ee032fe14836f8b8d49e512f67adfe2440b Mon Sep 17 00:00:00 2001 +From: Vincent Ambo +Date: Thu, 15 Apr 2021 17:05:10 +0200 +Subject: [PATCH] Pin git2 revision in Cargo.toml + +--- + Cargo.lock | 4 ++-- + Cargo.toml | 2 +- + josh-proxy/Cargo.toml | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/Cargo.lock b/Cargo.lock +index 5ee1b34..50139e0 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -636,7 +636,7 @@ checksum = "f6503fe142514ca4799d4c26297c4248239fe8838d827db6bd6065c6ed29a6ce" + [[package]] + name = "git2" + version = "0.13.17" +-source = "git+https://github.com/initcrash/git2-rs.git#758aab9fc08fa59b57b3968a2ef6f0901a2b7007" ++source = "git+https://github.com/initcrash/git2-rs.git?rev=758aab9fc08fa59b57b3968a2ef6f0901a2b7007#758aab9fc08fa59b57b3968a2ef6f0901a2b7007" + dependencies = [ + "bitflags", + "libc", +@@ -1153,7 +1153,7 @@ checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" + [[package]] + name = "libgit2-sys" + version = "0.12.18+1.1.0" +-source = "git+https://github.com/initcrash/git2-rs.git#758aab9fc08fa59b57b3968a2ef6f0901a2b7007" ++source = "git+https://github.com/initcrash/git2-rs.git?rev=758aab9fc08fa59b57b3968a2ef6f0901a2b7007#758aab9fc08fa59b57b3968a2ef6f0901a2b7007" + dependencies = [ + "cc", + "libc", +diff --git a/Cargo.toml b/Cargo.toml +index 4234701..4dcbcd6 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -15,7 +15,7 @@ members = ["josh-proxy", "josh-ui"] + [dependencies] + handlebars = "3.5" + #git2 = {version = "0.13", default-features = false} +-git2 = { git = "https://github.com/initcrash/git2-rs.git", default-features = false} ++git2 = { git = "https://github.com/initcrash/git2-rs.git", default-features = false, rev = "758aab9fc08fa59b57b3968a2ef6f0901a2b7007" } + #git2 = { path="../../git2-rs", default-features = false} + clap = "2" + tracing = "*" +diff --git a/josh-proxy/Cargo.toml b/josh-proxy/Cargo.toml +index 6d1c30d..680af88 100644 +--- a/josh-proxy/Cargo.toml ++++ b/josh-proxy/Cargo.toml +@@ -20,7 +20,7 @@ hyper_cgi = "0.1" + hyper-staticfile = "*" + hyper-tls = "*" + toml = "0.5" +-git2 = { git = "https://github.com/initcrash/git2-rs.git", default-features = false} ++git2 = { git = "https://github.com/initcrash/git2-rs.git", default-features = false, rev = "758aab9fc08fa59b57b3968a2ef6f0901a2b7007" } + tracing = { version = "0.1", features = ["max_level_trace", "release_max_level_trace"] } + tracing-futures = "0.2" + tracing-subscriber = "0.2" +-- +2.31.1.295.g9ea45b61b8-goog + -- cgit 1.4.1