From bf1dae494bf922c8b7a7d8c9e133dbc5dd2a5111 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Thu, 16 Dec 2021 00:19:07 +0100 Subject: [PATCH] newapkbuild: fetch rust dependencies in prepare phase Fetch all dependencies in the prepare phase and do not access network in the following phases. --- newapkbuild.in | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/newapkbuild.in b/newapkbuild.in index c58d519..0182ad2 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -30,6 +30,12 @@ is_github_url() { return 1 } +prepare_rust() { + cat >>APKBUILD<<__EOF__ + cargo fetch --locked +__EOF__ +} + # Build sections build_make() { cat >>APKBUILD<<__EOF__ @@ -104,7 +110,7 @@ __EOF__ build_rust() { cat >>APKBUILD<<__EOF__ - cargo build --release --locked + cargo build --frozen --release __EOF__ } @@ -150,7 +156,7 @@ __EOF__ check_rust() { cat >>APKBUILD<<__EOF__ - cargo test --release --locked + cargo test --frozen --release __EOF__ } @@ -199,7 +205,7 @@ __EOF__ package_rust() { cat >>APKBUILD<<__EOF__ - cargo install --locked --path . --root="\$pkgdir/usr" + cargo install --frozen --offline --path . --root="\$pkgdir/usr" rm "\$pkgdir"/usr/.crates* __EOF__ } @@ -333,6 +339,21 @@ __EOF__ fi fi + case "$buildtype" in + rust) + cat >>APKBUILD<<__EOF__ +prepare() { + default_prepare + +__EOF__ + prepare_rust + cat >>APKBUILD<<__EOF__ +} + +__EOF__ + ;; + esac + # Create build() function cat >>APKBUILD<<__EOF__ build() {