-
Jakub Jirutka authored
These three patches introduce changes to policies that have been in use in ports for many months and are widely accepted. newapkbuild is long behind the current practice which just makes life harder for everyone.
Jakub Jirutka authoredThese three patches introduce changes to policies that have been in use in ports for many months and are widely accepted. newapkbuild is long behind the current practice which just makes life harder for everyone.
mr128-newapkbuild-fetch-rust-deps-in-prepare.patch 2.30 KiB
Patch-Source: https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/128
--
From 29611f3a6929b4edecd89506e666f963fa25ae52 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 16 Dec 2021 00:19:07 +0100
Subject: [PATCH 1/2] 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() {
--
GitLab
From 0a9374e4ffa8202ba011497ea39fb5443d7ef9a5 Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Thu, 16 Dec 2021 00:23:48 +0100
Subject: [PATCH 2/2] newapkbuild: do not run cargo test with --release
It takes a longer time to compile and, most importantly, it may cause
unnecessary rebuild of everything in the package phase (installation).
---
newapkbuild.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/newapkbuild.in b/newapkbuild.in
index 0182ad2..9e8643d 100644
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -156,7 +156,7 @@ __EOF__
check_rust() {
cat >>APKBUILD<<__EOF__
- cargo test --frozen --release
+ cargo test --frozen
__EOF__
}
--
GitLab