]> git.seodisparate.com - AnotherAURHelper/commitdiff
Impl "Rust only" sccache usage by config option
authorStephen Seo <seo.disparate@gmail.com>
Fri, 23 Jun 2023 02:44:50 +0000 (11:44 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 23 Jun 2023 02:45:16 +0000 (11:45 +0900)
README.md
update.py

index e70f1989aca9de3dd2ab39e11cb0157fa68bb0bd..f9b633a2f304185eaa2f324064ec7295329abe42 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
index 56c0ffcc83a459d1d30f07ae96aa59670c61bec0..775e6f4c63360888a7e4ea67f73af9aed5a296f2 100755 (executable)
--- a/update.py
+++ b/update.py
@@ -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: