Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds
@ 2023-01-13 19:38 icp1994
  2023-01-13 20:08 ` [PR REVIEW] " Duncaen
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: icp1994 @ 2023-01-13 19:38 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1530 bytes --]

There is a new pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3887 bytes --]

From c394f1085d16881291003a0aae7413de11dc0aff Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh             |  4 ++++
 common/environment/build-style/cargo.sh |  7 +++++++
 common/xbps-src/shutils/chroot.sh       |  4 ++--
 etc/defaults.conf                       |  6 ++++++
 xbps-src                                | 10 +++++++++-
 5 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index 272d03f52607..e5261a7e7cdf 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,10 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ]; then
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+fi
+
 # For cross-compiling rust -sys crates
 export PKG_CONFIG_ALLOW_CROSS=1
 
diff --git a/common/environment/build-style/cargo.sh b/common/environment/build-style/cargo.sh
index 473750c7a359..4f9e00f47f23 100644
--- a/common/environment/build-style/cargo.sh
+++ b/common/environment/build-style/cargo.sh
@@ -4,6 +4,13 @@ if ! [[ "$pkgname" =~ ^cargo-auditable(-bootstrap)?$ ]]; then
 	hostmakedepends+=" cargo-auditable"
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	case "$XBPS_MACHINE" in
+		x86_64*|i686*|arm*|aarch64*) hostmakedepends+=" rust-sccache" ;;
+		*) ;;
+	esac
+fi
+
 if [ "$CROSS_BUILD" ]; then
 	makedepends+=" rust-std"
 fi
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 823705030b97..0708e571558b 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d006..422f85113625 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643..aeed206b8949 100755
--- a/xbps-src
+++ b/xbps-src
@@ -658,7 +658,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
@@ -702,6 +702,14 @@ if [ "$XBPS_CCACHE" ]; then
     mkdir -p $CCACHE_DIR
 fi
 
+#
+# Set up sccache
+#
+if [ "$XBPS_SCCACHE" ]; then
+    export SCCACHE_DIR="$XBPS_HOSTDIR/sccache"
+    mkdir -p $SCCACHE_DIR
+fi
+
 #
 # Set up distcc
 #

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR REVIEW] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
@ 2023-01-13 20:08 ` Duncaen
  2023-01-14  5:52 ` icp1994
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Duncaen @ 2023-01-13 20:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 235 bytes --]

New review comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#discussion_r1069975198

Comment:
I really don't like implicit build-style dependencies, especially with logic like this.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR REVIEW] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
  2023-01-13 20:08 ` [PR REVIEW] " Duncaen
@ 2023-01-14  5:52 ` icp1994
  2023-04-15  1:52 ` github-actions
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2023-01-14  5:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

New review comment by icp1994 on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#discussion_r1070221682

Comment:
I agree it's not the cleanest. But isn't it explicit since XBPS_SCCACHE is opt-in?

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
  2023-01-13 20:08 ` [PR REVIEW] " Duncaen
  2023-01-14  5:52 ` icp1994
@ 2023-04-15  1:52 ` github-actions
  2023-04-23 19:21 ` [PR PATCH] [Updated] " icp1994
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2023-04-15  1:52 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-1509458691

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (2 preceding siblings ...)
  2023-04-15  1:52 ` github-actions
@ 2023-04-23 19:21 ` icp1994
  2023-04-23 19:25 ` [PR REVIEW] " icp1994
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2023-04-23 19:21 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3627 bytes --]

From 62e01bd28a0f35b68bf268386c65136249c367e0 Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh             | 5 +++++
 common/environment/build-style/cargo.sh | 4 ++++
 common/xbps-src/shutils/chroot.sh       | 4 ++--
 etc/defaults.conf                       | 6 ++++++
 xbps-src                                | 2 +-
 5 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index f689f7c7f9d96..3326d5eabf8fc 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,11 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ]; then
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+fi
+
 # For cross-compiling rust -sys crates
 export PKG_CONFIG_ALLOW_CROSS=1
 
diff --git a/common/environment/build-style/cargo.sh b/common/environment/build-style/cargo.sh
index bc836b06cf066..3a610b6993e8a 100644
--- a/common/environment/build-style/cargo.sh
+++ b/common/environment/build-style/cargo.sh
@@ -4,6 +4,10 @@ if ! [[ "$pkgname" =~ ^cargo-auditable(-bootstrap)?$ ]]; then
 	hostmakedepends+=" cargo-auditable"
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+fi
+
 if [ "$CROSS_BUILD" ]; then
 	makedepends+=" rust-std"
 fi
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index d65d8d7e30741..65d1f6d719780 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067..422f851136258 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..49ac4c9b4bd24 100755
--- a/xbps-src
+++ b/xbps-src
@@ -658,7 +658,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR REVIEW] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (3 preceding siblings ...)
  2023-04-23 19:21 ` [PR PATCH] [Updated] " icp1994
@ 2023-04-23 19:25 ` icp1994
  2023-07-23  1:58 ` github-actions
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2023-04-23 19:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

New review comment by icp1994 on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#discussion_r1174631339

Comment:
With ppc support being dropped from void, don't need the arch checking logic - so this is as "clean" as it's going to be.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (4 preceding siblings ...)
  2023-04-23 19:25 ` [PR REVIEW] " icp1994
@ 2023-07-23  1:58 ` github-actions
  2023-07-25 19:08 ` [PR PATCH] [Updated] " icp1994
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2023-07-23  1:58 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-1646721730

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (5 preceding siblings ...)
  2023-07-23  1:58 ` github-actions
@ 2023-07-25 19:08 ` icp1994
  2023-11-08  1:45 ` github-actions
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2023-07-25 19:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3137 bytes --]

From ca7095b51bf3a60520268fbd3d4a10273c7a538c Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh       | 7 +++++++
 common/xbps-src/shutils/chroot.sh | 4 ++--
 etc/defaults.conf                 | 6 ++++++
 xbps-src                          | 2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index f689f7c7f9d96..7566e0f6c11f3 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,13 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+	export SCCACHE_IDLE_TIMEOUT=30
+fi
+
 # For cross-compiling rust -sys crates
 export PKG_CONFIG_ALLOW_CROSS=1
 
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index d65d8d7e30741..65d1f6d719780 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067..422f851136258 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..49ac4c9b4bd24 100755
--- a/xbps-src
+++ b/xbps-src
@@ -658,7 +658,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (6 preceding siblings ...)
  2023-07-25 19:08 ` [PR PATCH] [Updated] " icp1994
@ 2023-11-08  1:45 ` github-actions
  2023-11-13  9:41 ` [PR PATCH] [Updated] " icp1994
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2023-11-08  1:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-1800871073

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (7 preceding siblings ...)
  2023-11-08  1:45 ` github-actions
@ 2023-11-13  9:41 ` icp1994
  2024-02-13  1:44 ` github-actions
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2023-11-13  9:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3137 bytes --]

From cf3965541c26f85d953bc2b13e4441fb51ec3ff2 Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh       | 7 +++++++
 common/xbps-src/shutils/chroot.sh | 4 ++--
 etc/defaults.conf                 | 6 ++++++
 xbps-src                          | 2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index 96ec351d545d9..61430e8d66fe1 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,13 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+	export SCCACHE_IDLE_TIMEOUT=30
+fi
+
 # For cross-compiling rust -sys crates
 export PKG_CONFIG_ALLOW_CROSS=1
 
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index d65d8d7e30741..65d1f6d719780 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067..422f851136258 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index cdb5f8c6d643e..49ac4c9b4bd24 100755
--- a/xbps-src
+++ b/xbps-src
@@ -658,7 +658,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (8 preceding siblings ...)
  2023-11-13  9:41 ` [PR PATCH] [Updated] " icp1994
@ 2024-02-13  1:44 ` github-actions
  2024-02-13 13:51 ` [PR PATCH] [Updated] " icp1994
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2024-02-13  1:44 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-1940152961

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (9 preceding siblings ...)
  2024-02-13  1:44 ` github-actions
@ 2024-02-13 13:51 ` icp1994
  2024-05-14  1:46 ` github-actions
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2024-02-13 13:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3147 bytes --]

From ab97e5aa510f48ce96f2fde8a0e0c5d3bd3a1bee Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh       | 7 +++++++
 common/xbps-src/shutils/chroot.sh | 4 ++--
 etc/defaults.conf                 | 6 ++++++
 xbps-src                          | 2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index 22bfd980ba9e3..ca80e0d74e6cc 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,13 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+	export SCCACHE_IDLE_TIMEOUT=30
+fi
+
 # prevent cargo stripping debug symbols
 export CARGO_PROFILE_RELEASE_STRIP=false
 
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index fc17dae4fdbe9..a85afc5b88cbf 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -96,8 +96,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067..422f851136258 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index 77695b9f510d3..2b1fca4db0c8b 100755
--- a/xbps-src
+++ b/xbps-src
@@ -672,7 +672,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (10 preceding siblings ...)
  2024-02-13 13:51 ` [PR PATCH] [Updated] " icp1994
@ 2024-05-14  1:46 ` github-actions
  2024-05-20  6:35 ` [PR PATCH] [Updated] " icp1994
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2024-05-14  1:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-2109122456

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (11 preceding siblings ...)
  2024-05-14  1:46 ` github-actions
@ 2024-05-20  6:35 ` icp1994
  2024-08-19  1:53 ` github-actions
  2024-08-21 17:01 ` [PR PATCH] [Updated] " icp1994
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2024-05-20  6:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3155 bytes --]

From ddee717cff3c2109b754b92d70b0e54f4b371cac Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh       | 7 +++++++
 common/xbps-src/shutils/chroot.sh | 4 ++--
 etc/defaults.conf                 | 6 ++++++
 xbps-src                          | 2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index df064355f7e00c..1ac014feea1146 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,13 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+	export SCCACHE_IDLE_TIMEOUT=30
+fi
+
 # prevent cargo stripping debug symbols
 export CARGO_PROFILE_RELEASE_STRIP=false
 
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 69ca6b78f5838e..f8cde449ee86d0 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067e..422f8511362585 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index f8c21b3b92738d..8d07e59b5daf3f 100755
--- a/xbps-src
+++ b/xbps-src
@@ -689,7 +689,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (12 preceding siblings ...)
  2024-05-20  6:35 ` [PR PATCH] [Updated] " icp1994
@ 2024-08-19  1:53 ` github-actions
  2024-08-21 17:01 ` [PR PATCH] [Updated] " icp1994
  14 siblings, 0 replies; 16+ messages in thread
From: github-actions @ 2024-08-19  1:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/41617#issuecomment-2295521850

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PR PATCH] [Updated] [RFC] Enable usage of rust-sccache for cargo builds
  2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
                   ` (13 preceding siblings ...)
  2024-08-19  1:53 ` github-actions
@ 2024-08-21 17:01 ` icp1994
  14 siblings, 0 replies; 16+ messages in thread
From: icp1994 @ 2024-08-21 17:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

There is an updated pull request by icp1994 against master on the void-packages repository

https://github.com/icp1994/void-packages enable-sccache
https://github.com/void-linux/void-packages/pull/41617

[RFC] Enable usage of rust-sccache for cargo builds
Reviving https://github.com/void-linux/void-packages/pull/30702 - I tested the changes in this PR: **YES**

I have been using this for almost a week and it has reduced build times for rust packages quite considerably in my laptop. I have addressed some of the questions/suggestions from the reviews of the previous PR.

Although not the most scientific benchmark, I noted the build times from the cargo output while packaging 4 templates across iterations. In the first two iterations, all of them ran without sccache with an older version of the template to get a baseline without the interference of the crates being downloaded. Third iteration was with same old versions but with sccache enabled which created the cache of all 4 packages combined. Finally, last iteration with the full cache and the latest version of the templates - a typical scenario while updating a package. The difference between the second and the fourth iterations are as follows:
```
rust-analyzer | 6m 13s | 4m 49s
gping         | 1m 44s | 40.81s
difftastic    | 1m 32s | 34.80s
streampager   | 1m 14s | 23.25s
```

I will add docs for README later if there is consensus to merge this eventually.

A patch file from https://github.com/void-linux/void-packages/pull/41617.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-enable-sccache-41617.patch --]
[-- Type: text/x-diff, Size: 3155 bytes --]

From 39fd2ae1db910c8a3c11a3c47b7aded43a01768b Mon Sep 17 00:00:00 2001
From: icp <pangolin@vivaldi.net>
Date: Fri, 13 Jan 2023 22:21:19 +0530
Subject: [PATCH] Enable usage of rust-sccache for cargo builds

---
 common/build-helper/rust.sh       | 7 +++++++
 common/xbps-src/shutils/chroot.sh | 4 ++--
 etc/defaults.conf                 | 6 ++++++
 xbps-src                          | 2 +-
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh
index df064355f7e00c..07e31130243e36 100644
--- a/common/build-helper/rust.sh
+++ b/common/build-helper/rust.sh
@@ -30,6 +30,13 @@ else
 	unset CARGO_BUILD_TARGET
 fi
 
+if [ -n "$XBPS_SCCACHE" ] && [ "$pkgname" != "rust-sccache" ]; then
+	hostmakedepends+=" rust-sccache"
+	export RUSTC_WRAPPER="/usr/bin/sccache"
+	export SCCACHE_DIR="${XBPS_HOSTDIR}/sccache"
+	export SCCACHE_IDLE_TIMEOUT=60
+fi
+
 # prevent cargo stripping debug symbols
 export CARGO_PROFILE_RELEASE_STRIP=false
 
diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh
index 69ca6b78f5838e..f8cde449ee86d0 100644
--- a/common/xbps-src/shutils/chroot.sh
+++ b/common/xbps-src/shutils/chroot.sh
@@ -88,8 +88,8 @@ PATH=/void-packages:/usr/bin
 
 exec env -i -- SHELL=/bin/sh PATH="\$PATH" DISTCC_HOSTS="\$XBPS_DISTCC_HOSTS" DISTCC_DIR="/host/distcc" \
     ${XBPS_ARCH+XBPS_ARCH=$XBPS_ARCH} ${XBPS_CHECK_PKGS+XBPS_CHECK_PKGS=$XBPS_CHECK_PKGS} \
-    CCACHE_DIR="/host/ccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 TERM=linux HOME="/tmp" \
-    PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
+    CCACHE_DIR="/host/ccache" SCCACHE_DIR="/host/sccache" IN_CHROOT=1 LC_COLLATE=C LANG=en_US.UTF-8 \
+    TERM=linux HOME="/tmp" PS1="[\u@$XBPS_MASTERDIR \W]$ " /bin/bash +h "\$@"
 _EOF
 
     chmod 755 $XBPS_MASTERDIR/bin/xbps-shell
diff --git a/etc/defaults.conf b/etc/defaults.conf
index f70e4ea3d0067e..422f8511362585 100644
--- a/etc/defaults.conf
+++ b/etc/defaults.conf
@@ -55,6 +55,12 @@ XBPS_SUCMD="sudo /bin/sh -c"
 #
 #XBPS_CCACHE=yes
 
+# [OPTIONAL]
+# Enable or disable sccache when building packages. The sccache directory
+# is stored in the hostdir, i.e hostdir/sccache.
+#
+#XBPS_SCCACHE=yes
+
 # [OPTIONAL]
 # Enable or disable distcc when building packages. The distcc directory
 # is stored in the hostdir, i.e hostdir/distcc.
diff --git a/xbps-src b/xbps-src
index f8c21b3b92738d..8d07e59b5daf3f 100755
--- a/xbps-src
+++ b/xbps-src
@@ -689,7 +689,7 @@ export XBPS_SHUTILSDIR XBPS_CROSSPFDIR XBPS_TRIGGERSDIR \
     XBPS_CMPVER_CMD XBPS_FETCH_CMD XBPS_VERSION XBPS_BUILDSTYLEDIR \
     XBPS_CPPFLAGS XBPS_CFLAGS XBPS_CXXFLAGS XBPS_FFLAGS XBPS_LDFLAGS \
     XBPS_MAKEJOBS XBPS_BUILD_FORCEMODE XBPS_USE_GIT_REVS XBPS_DEBUG_PKGS \
-    XBPS_CHECK_PKGS XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
+    XBPS_CHECK_PKGS XBPS_SCCACHE XBPS_CCACHE XBPS_DISTCC XBPS_DISTCC_HOSTS XBPS_SKIP_DEPS \
     XBPS_SKIP_REMOTEREPOS XBPS_CROSS_BUILD XBPS_ARG_PKG_OPTIONS XBPS_CONFIG_FILE \
     XBPS_KEEP_ALL XBPS_HOSTDIR XBPS_MASTERDIR XBPS_SRC_VERSION \
     XBPS_DESTDIR XBPS_MACHINE XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-08-21 17:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 19:38 [PR PATCH] [RFC] Enable usage of rust-sccache for cargo builds icp1994
2023-01-13 20:08 ` [PR REVIEW] " Duncaen
2023-01-14  5:52 ` icp1994
2023-04-15  1:52 ` github-actions
2023-04-23 19:21 ` [PR PATCH] [Updated] " icp1994
2023-04-23 19:25 ` [PR REVIEW] " icp1994
2023-07-23  1:58 ` github-actions
2023-07-25 19:08 ` [PR PATCH] [Updated] " icp1994
2023-11-08  1:45 ` github-actions
2023-11-13  9:41 ` [PR PATCH] [Updated] " icp1994
2024-02-13  1:44 ` github-actions
2024-02-13 13:51 ` [PR PATCH] [Updated] " icp1994
2024-05-14  1:46 ` github-actions
2024-05-20  6:35 ` [PR PATCH] [Updated] " icp1994
2024-08-19  1:53 ` github-actions
2024-08-21 17:01 ` [PR PATCH] [Updated] " icp1994

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).