Skip to content

Commit 5b0306e

Browse files
committed
assume any "out_file" with a / in it should not be under a tmpdir
previously, ./ had to be explictly passed for the out_dir to be updated, and the tmpdir not be used. This broke running make install from the /usr/src/linux dir, as it passes a path like arch/boot/initrd which then got interpreted to be a new out_dir, under the tmpdir. Signed-off-by: Zen <[email protected]>
1 parent 978899b commit 5b0306e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/ugrd/base/core.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "3.10.0"
2+
__version__ = "3.10.1"
33

44
from pathlib import Path
55
from typing import Union
@@ -186,8 +186,9 @@ def find_libgcc(self) -> None:
186186
def _process_out_file(self, out_file: str) -> None:
187187
"""Processes the out_file.
188188
If set to the current directory, resolves and sets the out_dir to the current directory.
189-
If it starts with './', resolves it to the current directory.
190-
If it is a directory, sets the out_dir to the directory.
189+
If a '/' is present, resolves the path and sets the out_dir to the parent directory.
190+
If out_file is a directory, sets the out_dir to the directory, stops processing.
191+
191192
If it's an absolute path, sets the out_dir to the parent directory.
192193
"""
193194
out_file = str(out_file)
@@ -197,10 +198,9 @@ def _process_out_file(self, out_file: str) -> None:
197198
self["out_dir"] = current_dir
198199
return
199200

200-
if out_file.startswith("./"):
201-
cwd = Path(".").resolve()
202-
self.logger.info("Resolved relative out_file path: %s" % cwd)
203-
out_file = cwd / out_file[2:]
201+
if "/" in out_file: # If the out_file contains a path, resolve it
202+
out_file = Path(out_file).resolve()
203+
self.logger.info("Resolved relative output path: %s" % out_file)
204204
else:
205205
out_file = Path(out_file)
206206

@@ -209,7 +209,7 @@ def _process_out_file(self, out_file: str) -> None:
209209
self["out_dir"] = out_file
210210
return
211211

212-
if out_file.parent.is_dir() and str(out_file.parent) != ".":
212+
if str(out_file.parent) != ".": # If the parent isn't the curent dir, set the out_dir to the parent
213213
self["out_dir"] = out_file.parent
214214
self.logger.info("Resolved out_dir to: %s" % self["out_dir"])
215215
out_file = out_file.name

0 commit comments

Comments
 (0)