(context.root / d).symlink_to(f"usr/{d}")
(context.root / f"usr/{d}").mkdir(parents=True, exist_ok=True)
+ invoke_apt(context, "apt-get", "update", apivfs=False)
+
# Next, we invoke apt-get install to download all the essential packages. With DPkg::Pre-Install-Pkgs,
# we specify a shell command that will receive the list of packages that will be installed on stdin.
# By configuring Debug::pkgDpkgPm=1, apt-get install will not actually execute any dpkg commands, so
# all it does is download the essential debs and tell us their full in the apt cache without actually
# installing them.
- with tempfile.NamedTemporaryFile(dir="/tmp", mode="r") as f:
- cls.install_packages(context, [
- "-oDebug::pkgDPkgPm=1",
- f"-oDPkg::Pre-Install-Pkgs::=cat >{f.name}",
- "?essential", "?name(usr-is-merged)",
- ], apivfs=False)
+ with tempfile.NamedTemporaryFile(mode="r") as f:
+ invoke_apt(
+ context,
+ "apt-get",
+ "install",
+ [
+ "-oDebug::pkgDPkgPm=1",
+ f"-oDPkg::Pre-Install-Pkgs::=cat >{f.name}",
+ "?essential", "?name(usr-is-merged)",
+ ],
+ apivfs=False,
+ mounts=("--bind", f.name, f.name),
+ )
essential = f.read().strip().splitlines()
command: str,
operation: str,
packages: Sequence[str] = (),
+ *,
apivfs: bool = True,
+ mounts: Sequence[PathString] = (),
) -> None:
run(
apt_cmd(context, command) + [operation, *sort_packages(packages)],
"--bind", context.cache_dir, context.cache_dir,
"--ro-bind", context.workspace / "apt.conf", context.workspace / "apt.conf",
*finalize_crypto_mounts(tools=context.config.tools()),
+ *mounts,
],
) + (apivfs_cmd(context.root, tools=context.config.tools()) if apivfs else [])
),