network=True,
options=[
"--bind", context.root, context.root,
- "--bind", context.cache_dir, context.cache_dir,
+ "--bind", context.cache_dir / "lib/apt", context.cache_dir / "lib/apt",
+ "--bind", context.cache_dir / "cache/apt", context.cache_dir / "cache/apt",
"--ro-bind", context.workspace / "apt.conf", context.workspace / "apt.conf",
*finalize_crypto_mounts(tools=context.config.tools()),
*mounts,
return Path(dnf or find_binary("dnf5", root=root) or find_binary("dnf", root=root) or "yum").name
+def dnf_subdir(context: Context) -> str:
+ dnf = dnf_executable(context)
+ return "libdnf5" if dnf.endswith("dnf5") else "dnf"
+
+
def setup_dnf(context: Context, repositories: Iterable[RpmRepository], filelists: bool = True) -> None:
(context.pkgmngr / "etc/dnf/vars").mkdir(exist_ok=True, parents=True)
(context.pkgmngr / "etc/yum.repos.d").mkdir(exist_ok=True, parents=True)
+ (context.cache_dir / "cache" / dnf_subdir(context)).mkdir(exist_ok=True, parents=True)
+ (context.cache_dir / "lib" / dnf_subdir(context)).mkdir(exist_ok=True, parents=True)
+
config = context.pkgmngr / "etc/dnf/dnf.conf"
if not config.exists():
f"--releasever={context.config.release}",
f"--installroot={context.root}",
"--setopt=keepcache=1",
- f"--setopt=cachedir={context.cache_dir / 'cache' / ('libdnf5' if dnf.endswith('dnf5') else 'dnf')}",
- f"--setopt=persistdir={context.cache_dir / 'lib' / ('libdnf5' if dnf.endswith('dnf5') else 'dnf')}",
+ f"--setopt=cachedir={context.cache_dir / 'cache' / dnf_subdir(context)}",
+ f"--setopt=persistdir={context.cache_dir / 'lib' / dnf_subdir(context)}",
f"--setopt=install_weak_deps={int(context.config.with_recommends)}",
"--setopt=check_config_file_age=0",
"--disable-plugin=*" if dnf.endswith("dnf5") else "--disableplugin=*",
network=True,
options=[
"--bind", context.root, context.root,
- "--bind", context.cache_dir, context.cache_dir,
+ "--bind",
+ context.cache_dir / "cache" / dnf_subdir(context),
+ context.cache_dir / "cache" / dnf_subdir(context),
+ "--bind",
+ context.cache_dir / "lib" / dnf_subdir(context),
+ context.cache_dir / "lib" / dnf_subdir(context),
*finalize_crypto_mounts(tools=context.config.tools()),
],
) + (apivfs_cmd(context.root, tools=context.config.tools()) if apivfs else [])
network=True,
options=[
"--bind", context.root, context.root,
- "--bind", context.cache_dir, context.cache_dir,
+ "--bind", context.cache_dir / "cache/pacman/pkg", context.cache_dir / "cache/pacman/pkg",
*finalize_crypto_mounts(tools=context.config.tools()),
],
) + (apivfs_cmd(context.root, tools=context.config.tools()) if apivfs else [])
config = context.pkgmngr / "etc/zypp/zypp.conf"
config.parent.mkdir(exist_ok=True, parents=True)
+ (context.cache_dir / "cache/zypp").mkdir(exist_ok=True, parents=True)
+
# rpm.install.excludedocs can only be configured in zypp.conf so we append
# to any user provided config file. Let's also bump the refresh delay to
# the same default as dnf which is 48 hours.
network=True,
options=[
"--bind", context.root, context.root,
- "--bind", context.cache_dir, context.cache_dir,
+ "--bind", context.cache_dir / "cache/zypp", context.cache_dir / "cache/zypp",
*finalize_crypto_mounts(tools=context.config.tools()),
],
) + (apivfs_cmd(context.root, tools=context.config.tools()) if apivfs else [])