pmb.config.chroot_home_symlinks: cache rust dirs (!1850)
Rust packaging is new and still a bit weird in Alpine and postmarketOS. As of writing, we only have one package (squeekboard), and use cargo to download the source of all dependencies at build time (several git repositories!) and compile it. Usually, this is a no-go, but at least until this is resolved properly, let's cache the downloads as suggested in: https://doc.rust-lang.org/cargo/guide/cargo-home.html Related: #1861
This commit is contained in:
parent
b93e83d8b3
commit
728f304dc7
|
@ -28,7 +28,8 @@ import pmb.parse.apkindex
|
|||
|
||||
|
||||
def zap(args, confirm=True, dry=False, pkgs_local=False, http=False,
|
||||
pkgs_local_mismatch=False, pkgs_online_mismatch=False, distfiles=False):
|
||||
pkgs_local_mismatch=False, pkgs_online_mismatch=False, distfiles=False,
|
||||
rust=False):
|
||||
"""
|
||||
Shutdown everything inside the chroots (e.g. distccd, adb), umount
|
||||
everything and then safely remove folders from the work-directory.
|
||||
|
@ -41,6 +42,7 @@ def zap(args, confirm=True, dry=False, pkgs_local=False, http=False,
|
|||
:param pkgs_online_mismatch: Clean out outdated binary packages downloaded from
|
||||
mirrors (e.g. from Alpine)
|
||||
:param distfiles: Clear the downloaded files cache
|
||||
:param rust: Remove rust related caches
|
||||
|
||||
NOTE: This function gets called in pmb/config/init.py, with only args.work
|
||||
and args.device set!
|
||||
|
@ -73,6 +75,8 @@ def zap(args, confirm=True, dry=False, pkgs_local=False, http=False,
|
|||
patterns += ["cache_http"]
|
||||
if distfiles:
|
||||
patterns += ["cache_distfiles"]
|
||||
if rust:
|
||||
patterns += ["cache_rust"]
|
||||
|
||||
# Delete everything matching the patterns
|
||||
for pattern in patterns:
|
||||
|
|
|
@ -127,6 +127,7 @@ chroot_mount_bind = {
|
|||
"$WORK/cache_ccache_$ARCH": "/mnt/pmbootstrap-ccache",
|
||||
"$WORK/cache_distfiles": "/var/cache/distfiles",
|
||||
"$WORK/cache_git": "/mnt/pmbootstrap-git",
|
||||
"$WORK/cache_rust": "/mnt/pmbootstrap-rust",
|
||||
"$WORK/config_abuild": "/mnt/pmbootstrap-abuild-config",
|
||||
"$WORK/config_apk_keys": "/etc/apk/keys",
|
||||
"$WORK/packages": "/mnt/pmbootstrap-packages",
|
||||
|
@ -134,10 +135,19 @@ chroot_mount_bind = {
|
|||
|
||||
# Building chroots (all chroots, except for the rootfs_ chroot) get symlinks in
|
||||
# the "pmos" user's home folder pointing to mountfolders from above.
|
||||
# Rust packaging is new and still a bit weird in Alpine and postmarketOS. As of
|
||||
# writing, we only have one package (squeekboard), and use cargo to download
|
||||
# the source of all dependencies at build time and compile it. Usually, this is
|
||||
# a no-go, but at least until this is resolved properly, let's cache the
|
||||
# dependencies and downloads as suggested in "Caching the Cargo home in CI":
|
||||
# https://doc.rust-lang.org/cargo/guide/cargo-home.html
|
||||
chroot_home_symlinks = {
|
||||
"/mnt/pmbootstrap-abuild-config": "/home/pmos/.abuild",
|
||||
"/mnt/pmbootstrap-ccache": "/home/pmos/.ccache",
|
||||
"/mnt/pmbootstrap-packages": "/home/pmos/packages/pmos",
|
||||
"/mnt/pmbootstrap-rust/registry/index": "/home/pmos/.cargo/registry/index",
|
||||
"/mnt/pmbootstrap-rust/registry/cache": "/home/pmos/.cargo/registry/cache",
|
||||
"/mnt/pmbootstrap-rust/git/db": "/home/pmos/.cargo/git/db",
|
||||
}
|
||||
|
||||
# Device nodes to be created in each chroot. Syntax for each entry:
|
||||
|
|
|
@ -375,7 +375,8 @@ def zap(args):
|
|||
pmb.chroot.zap(args, dry=args.dry, http=args.http,
|
||||
distfiles=args.distfiles, pkgs_local=args.pkgs_local,
|
||||
pkgs_local_mismatch=args.pkgs_local_mismatch,
|
||||
pkgs_online_mismatch=args.pkgs_online_mismatch)
|
||||
pkgs_online_mismatch=args.pkgs_online_mismatch,
|
||||
rust=args.rust)
|
||||
|
||||
# Don't write the "Done" message
|
||||
pmb.helpers.logging.disable()
|
||||
|
|
|
@ -402,6 +402,8 @@ def arguments():
|
|||
dest="pkgs_online_mismatch",
|
||||
help="also delete outdated packages from online mirrors"
|
||||
" (that have been downloaded to the apk cache)")
|
||||
zap.add_argument("-r", "--rust", action="store_true",
|
||||
help="also delete rust related caches")
|
||||
|
||||
# Action: stats
|
||||
stats = sub.add_parser("stats", help="show ccache stats")
|
||||
|
|
Loading…
Reference in New Issue