While this achieved the desired effect of dpkg being looked up in
the PATH, it also modified the PATH variable for everything executed
by dpkg, which we don't want. Let's just lookup dpkg in PATH before
running apt and put the result in Dir::Bin::dpkg which looks up
dpkg in the PATH without modifying the PATH used by dpkg itself.
Fixes #1456
# SPDX-License-Identifier: LGPL-2.1+
import os
+import shutil
import subprocess
import tempfile
from collections.abc import Sequence
Dir::Etc::trusted "/usr/share/keyrings/{state.config.release}-archive-keyring";
Dir::Etc::trustedparts "/usr/share/keyrings";
Dir::Log "{state.workspace / "apt/log"}";
- Dir::Bin::dpkg "dpkg";
- DPkg::Path "{os.environ["PATH"]}";
+ Dir::Bin::dpkg "{shutil.which("dpkg")}";
DPkg::Options:: "--root={state.root}";
DPkg::Options:: "--log={state.workspace / "apt/dpkg.log"}";
DPkg::Options:: "--force-unsafe-io";