commit: 33e0a1db67562877f65076f942f5c9da9787d16f
parent bda1d3ea81885be1d27f13304b1bd60afa477e7f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 3 Sep 2022 14:11:53 +0200
dev-util/rebar: Fix offline build
Diffstat:
2 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dev-util/rebar/files/rebar-3.18.0-bootstrap-vendored.patch b/dev-util/rebar/files/rebar-3.18.0-bootstrap-vendored.patch
@@ -0,0 +1,36 @@
+From 4c4b0d39dba07911a707f8b8f17711900d2ee786 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Viktor=20S=C3=B6derqvist?= <viktor.soderqvist@est.tech>
+Date: Fri, 5 Nov 2021 09:46:29 +0100
+Subject: [PATCH] Make bootstrap use _checkouts
+
+This makes it possible to run the bootstrap offline by placing the deps
+in the using the already documented _checkouts directory in advance.
+---
+ bootstrap | 14 +++++++++++++-
+ 1 file changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/bootstrap b/bootstrap
+index 9632b6c77..18cc46216 100755
+--- a/bootstrap
++++ b/bootstrap
+@@ -92,7 +92,19 @@ fetch_and_compile({Name, ErlFirstFiles}, Deps) ->
+
+ compile(Name, ErlFirstFiles).
+
+-fetch({pkg, Name, Vsn}, App) ->
++fetch(Source, App) ->
++ Dir = filename:join([filename:absname("_checkouts"), App]),
++ case filelib:is_dir(Dir) of
++ false ->
++ fetch_from_hex(Source, App);
++ true ->
++ io:format("Using ~p from ~p~n", [App, Dir]),
++ Dest = filename:absname("_build/default/lib"),
++ ok = filelib:ensure_dir(filename:join([Dest, "dummy"])),
++ cp_r([Dir], Dest)
++ end.
++
++fetch_from_hex({pkg, Name, Vsn}, App) ->
+ Dir = filename:join([filename:absname("_build/default/lib/"), App]),
+ case filelib:is_dir(Dir) of
+ false ->
diff --git a/dev-util/rebar/rebar-3.19.0.ebuild b/dev-util/rebar/rebar-3.19.0.ebuild
@@ -35,6 +35,13 @@ RDEPEND="
"
RDEPEND="${DEPEND}"
+PATCHES=(
+ # The build directory (where dependencies are usually stored) gets
+ # cleared before each build. Make the fetch function first look in
+ # a _checkouts directory before going out over the net.
+ "${FILESDIR}"/${PN}-3.18.0-bootstrap-vendored.patch
+)
+
src_unpack() {
# Unpack the rebar sources like normal, but extract the hex.pm
# dependencies separately. The outer tarball contains another
@@ -81,8 +88,8 @@ src_install() {
newenvd - 98rebar3 <<< 'REBAR3_CMD='${EPREFIX}'/usr/bin/rebar3'
insinto /usr/share/fish/completion
- newins priv/shell-completion/fish/${MY_PN}.fish ${MY_PN}
+ newins priv/shell-completion/fish/rebar3.fish rebar3
insinto /usr/share/zsh/site-functions
- doins priv/shell-completion/zsh/_${MY_PN}
+ doins priv/shell-completion/zsh/_rebar3
}