]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
debian: Stop setting DPkg::Path
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Apr 2023 14:53:46 +0000 (16:53 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Apr 2023 14:58:29 +0000 (16:58 +0200)
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

mkosi/distributions/debian.py

index 6d1101320b5a4bf040addc5e8e7f6b4cfca43913..3ca9077597f915432d91f70aa7151c3707f4498b 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: LGPL-2.1+
 
 import os
+import shutil
 import subprocess
 import tempfile
 from collections.abc import Sequence
@@ -202,8 +203,7 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None:
             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";