Impl "Rust only" sccache usage by config option

This commit is contained in:
Stephen Seo 2023-06-23 11:44:50 +09:00
parent 8a86babb8c
commit cd6647d1a5
2 changed files with 37 additions and 5 deletions

View File

@ -204,3 +204,15 @@ timestamp.
If `is_log_timed` is `true` in the config, then output build logs are prepended
with a timestamp.
## sccache and Rust
If using `sccache` causes a build error when building a package compiling Rust,
one may specify in the config to only wrap `rustc` and nothing else by
specifying `sccache_rust_only`:
[[entry]]
name = "helix-git"
link_cargo_registry = true
sccache_dir="/home/user/aur/sccache_helix-git"
sccache_rust_only = true

View File

@ -1116,10 +1116,14 @@ def update_pkg_list(
pkgdir = os.path.join(other_state["clones_dir"], pkg)
if "ccache_dir" in pkg_state[pkg]:
cleanup_sccache(other_state["chroot"])
setup_ccache(other_state["chroot"])
if not pkg_state[pkg]["sccache_rust_only"]:
setup_ccache(other_state["chroot"])
else:
cleanup_ccache(other_state["chroot"])
if "sccache_dir" in pkg_state[pkg]:
if (
"sccache_dir" in pkg_state[pkg]
and not pkg_state[pkg]["sccache_rust_only"]
):
setup_sccache(other_state["chroot"])
else:
cleanup_sccache(other_state["chroot"])
@ -1243,6 +1247,13 @@ def update_pkg_list(
p1.wait()
tout.join()
terr.join()
if (
p1.returncode is None
or type(p1.returncode) is not int
or p1.returncode != 0
):
raise RuntimeError("pOpen process failed")
else:
subprocess.run(
command_list + post_command_list,
@ -1258,10 +1269,10 @@ def update_pkg_list(
)
pkg_state[pkg]["build_status"] = "fail"
continue
except BaseException:
except BaseException as e:
log_print(
'ERROR: Failed to build pkg "{}" in chroot (unknown Exception)'.format(
pkg
'ERROR: Failed to build pkg "{}" in chroot (unknown Exception): {}'.format(
pkg, e
),
other_state=other_state,
)
@ -1689,6 +1700,15 @@ if __name__ == "__main__":
]
else:
pkg_state[entry["name"]]["sccache_cache_size"] = "5G"
if (
"sccache_rust_only" in entry
and type(entry["sccache_rust_only"]) is bool
and entry["sccache_rust_only"]
):
pkg_state[entry["name"]]["sccache_rust_only"] = True
else:
pkg_state[entry["name"]]["sccache_rust_only"] = False
if "other_deps" in entry:
pkg_state[entry["name"]]["other_deps"] = entry["other_deps"]
else: