Compare commits
6 commits
d7f5eb1fe5
...
eb8fa7805a
Author | SHA1 | Date | |
---|---|---|---|
eb8fa7805a | |||
71cf85f1cd | |||
3cc1a0b583 | |||
99f3d915c6 | |||
a040785bd6 | |||
0b91176586 |
2 changed files with 74 additions and 2 deletions
22
README.md
22
README.md
|
@ -63,6 +63,24 @@ GiB somehow).
|
||||||
the build will fail if the limit is reached. If set to false, then the build
|
the build will fail if the limit is reached. If set to false, then the build
|
||||||
will continue even if the limit is reached.
|
will continue even if the limit is reached.
|
||||||
|
|
||||||
|
## Soft-lock if `sccache` is preinstalled in chroot
|
||||||
|
|
||||||
|
Apparently, some packages automatically use ccache/sccache if it is installed in
|
||||||
|
the chroot, and in some cases, causes a soft-lock during a build. It is
|
||||||
|
recommended to not have ccache/sccache preinstalled in the chroot and to just
|
||||||
|
let the aur-helper-script install it when necessary.
|
||||||
|
|
||||||
|
For example, when building `tenacity-git` with sccache preinstalled, the build
|
||||||
|
will hang after the final build step. Apparently, killing the running `sccache`
|
||||||
|
process stops the soft-lock in this case.
|
||||||
|
|
||||||
|
## Preloading ccache/sccache
|
||||||
|
|
||||||
|
This script expects ccache and sccache not to be installed in the chroot (for
|
||||||
|
reasons as mentioned in the previous section) and ccache or sccache will be
|
||||||
|
appended to a pkg's "other_deps" if a ccache or sccache directory is configured
|
||||||
|
for it.
|
||||||
|
|
||||||
# Setting up the AUR Helper
|
# Setting up the AUR Helper
|
||||||
|
|
||||||
The AUR Helper requires several things:
|
The AUR Helper requires several things:
|
||||||
|
@ -86,7 +104,9 @@ The `python-toml` package is required for the Python script to run.
|
||||||
|
|
||||||
Use `/usr/bin/mkarchroot` to create your CHROOT in a directory.
|
Use `/usr/bin/mkarchroot` to create your CHROOT in a directory.
|
||||||
|
|
||||||
mkarchroot $HOME/mychroot/root base base-devel ccache sccache cmake ninja
|
mkarchroot $HOME/mychroot/root base base-devel cmake ninja
|
||||||
|
|
||||||
|
As noted earlier, it is better to NOT preinstall `ccache` and `sccache`.
|
||||||
|
|
||||||
You must refer to the CHROOT as `$HOME/mychroot` if you used the same name as in
|
You must refer to the CHROOT as `$HOME/mychroot` if you used the same name as in
|
||||||
the previous example.
|
the previous example.
|
||||||
|
|
54
update.py
54
update.py
|
@ -741,6 +741,18 @@ def get_pkgbuild_version(
|
||||||
5,
|
5,
|
||||||
f'{os.environ["HOME"]}/.cargo/git:/build/.cargo/git',
|
f'{os.environ["HOME"]}/.cargo/git:/build/.cargo/git',
|
||||||
)
|
)
|
||||||
|
if len(pkg_state[pkg]["other_deps"]) != 0:
|
||||||
|
prefetch_result = prefetch_dependencies(
|
||||||
|
pkg_state[pkg]["other_deps"], other_state
|
||||||
|
)
|
||||||
|
if prefetch_result != "fetched":
|
||||||
|
log_print(
|
||||||
|
"ERROR: Failed to prefetch deps {}".format(
|
||||||
|
pkg_state[pkg]["other_deps"]
|
||||||
|
),
|
||||||
|
other_state=other_state,
|
||||||
|
)
|
||||||
|
return False, None, None, None
|
||||||
for dep in pkg_state[pkg]["other_deps"]:
|
for dep in pkg_state[pkg]["other_deps"]:
|
||||||
dep_fullpath = get_latest_pkg(dep, "/var/cache/pacman/pkg")
|
dep_fullpath = get_latest_pkg(dep, "/var/cache/pacman/pkg")
|
||||||
if not dep_fullpath:
|
if not dep_fullpath:
|
||||||
|
@ -1374,6 +1386,28 @@ def update_pkg_list(
|
||||||
"--holdver",
|
"--holdver",
|
||||||
]
|
]
|
||||||
failure = False
|
failure = False
|
||||||
|
if "ccache_dir" in pkg_state[pkg]:
|
||||||
|
pkg_state[pkg]["other_deps"].append("ccache")
|
||||||
|
elif "sccache_dir" in pkg_state[pkg]:
|
||||||
|
pkg_state[pkg]["other_deps"].append("sccache")
|
||||||
|
if len(pkg_state[pkg]["other_deps"]) != 0:
|
||||||
|
prefetch_result = prefetch_dependencies(
|
||||||
|
pkg_state[pkg]["other_deps"], other_state
|
||||||
|
)
|
||||||
|
if prefetch_result != "fetched":
|
||||||
|
log_print(
|
||||||
|
"ERROR: Failed to prefetch deps {}".format(
|
||||||
|
pkg_state[pkg]["other_deps"]
|
||||||
|
),
|
||||||
|
other_state=other_state,
|
||||||
|
)
|
||||||
|
failure = True
|
||||||
|
pkg_state[pkg]["build_status"] = "get_dep_fail"
|
||||||
|
break
|
||||||
|
log_print(
|
||||||
|
"Successfully prefetched deps, continuing on to build...",
|
||||||
|
other_state=other_state,
|
||||||
|
)
|
||||||
for dep in pkg_state[pkg]["other_deps"]:
|
for dep in pkg_state[pkg]["other_deps"]:
|
||||||
dep_fullpath = get_latest_pkg(dep, "/var/cache/pacman/pkg")
|
dep_fullpath = get_latest_pkg(dep, "/var/cache/pacman/pkg")
|
||||||
if not dep_fullpath:
|
if not dep_fullpath:
|
||||||
|
@ -1987,7 +2021,7 @@ fi
|
||||||
return "ok"
|
return "ok"
|
||||||
|
|
||||||
|
|
||||||
def prepare_user_chroot(other_state: [str, Any]):
|
def prepare_user_chroot(other_state: dict[str, Any]):
|
||||||
try:
|
try:
|
||||||
log_print(
|
log_print(
|
||||||
'Running "makechrootpkg ... --nobuild" with dummy package to ensure user chroot is ready...',
|
'Running "makechrootpkg ... --nobuild" with dummy package to ensure user chroot is ready...',
|
||||||
|
@ -2030,6 +2064,24 @@ def prepare_user_chroot(other_state: [str, Any]):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def prefetch_dependencies(pkg_names: [str], other_state: dict[str, Any]):
|
||||||
|
"""Returns "fetched" on success."""
|
||||||
|
log_print(
|
||||||
|
f'Prefetching packages "{pkg_names}" with "pacman -Sw"...',
|
||||||
|
other_state=other_state,
|
||||||
|
)
|
||||||
|
command_list = ["/usr/bin/env", "sudo", "pacman", "--noconfirm", "-Sw"]
|
||||||
|
command_list.extend(pkg_names)
|
||||||
|
try:
|
||||||
|
subprocess.run(
|
||||||
|
command_list,
|
||||||
|
check=True,
|
||||||
|
)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
return "fail"
|
||||||
|
return "fetched"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""The main function."""
|
"""The main function."""
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
Loading…
Reference in a new issue