Skip to content

Commit 91946be

Browse files
committed
remove force_out, improve comments/testing
Signed-off-by: Zen <[email protected]>
1 parent 423d3a1 commit 91946be

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

docs/configuration.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Modules write to a shared config dict that is accessible by other modules.
4343
* `find_libgcc` (true) Automatically locates libgcc using ldconfig -p and adds it to the initramfs.
4444
* `out_dir` (initramfs_out) If relative, it will be placed under `tmpdir`, defines the output directory.
4545
* `out_file` Sets the name of the output file, under `out_dir`.
46-
* `force_out` (false) Forces out_file/dir to ignore the defined TMPDIR.
4746
* `clean` (true) forces the build dir to be cleaned on each run.
4847
* `old_count` (1) Sets the number of old file to keep when running the `_rotate_old` function.
4948
* `binaries` - A list used to define programs to be pulled into the initrams. `which` is used to find the path of added entries, and `lddtree` is used to resolve dependendies.

src/ugrd/base/core.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ def _process_out_file(self, out_file: str) -> None:
194194
If set to the current directory, resolves and sets the out_dir to the current directory.
195195
If a '/' is present, resolves the path and sets the out_dir to the parent directory.
196196
If out_file is a directory, sets the out_dir to the directory, stops processing.
197-
198-
If it's an absolute path, sets the out_dir to the parent directory.
199-
otherise, force_out is enabled, sets the out_dir to the resolved parent directory.
200197
"""
201198
out_file = str(out_file)
202199
if out_file == "./" or out_file == ".":
@@ -220,9 +217,6 @@ def _process_out_file(self, out_file: str) -> None:
220217
self["out_dir"] = out_file.parent
221218
self.logger.info("Resolved out_dir to: %s" % self["out_dir"])
222219
out_file = out_file.name
223-
elif self["force_out"]:
224-
self["out_dir"] = out_file.parent.resolve()
225-
out_file = out_file.name
226220

227221
self.data["out_file"] = out_file
228222

src/ugrd/base/core.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,5 @@ masks = "dict" # Imports to be masked in the initramfs
7474
make_nodes = "bool" # If true, actual device nodes will be created in the build dir
7575
out_dir = "Path" # The directory where the initramfs is packed/output. If no packer is used, this is the final output directory.
7676
out_file = "str" # The name of the output file, if absolute, overrides out dir with the path, and sets out_file to the filename
77-
force_out = "bool" # If true, the out_dir will be interpreted literally, and the initramfs will be output there
7877
old_count = "int" # The number of times to cycle old files before deleting
7978
clean = "bool" # Add the clean property, used to define if the mounts should be cleaned up after boot

src/ugrd/base/test.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ test_rootfs_name = 'ugrd-test-rootfs'
22
test_rootfs_build_dir = 'initramfs_test_rootfs'
33
test_image_size = 16
44

5-
test_copy_config = ["mounts", "force_out", "out_dir", "tmpdir", "clean", "test_image_size", "test_flag", "cryptsetup"]
5+
test_copy_config = ["mounts", "out_dir", "tmpdir", "clean", "test_image_size", "test_flag", "cryptsetup"]
66

77
test_memory = '256M'
88
test_cpu = 'host'

src/ugrd/generator_helpers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from zenlib.util import pretty_print
66

7-
__version__ = "1.3.8"
7+
__version__ = "1.3.9"
88
__author__ = "desultory"
99

1010

@@ -25,7 +25,7 @@ class GeneratorHelpers:
2525
def _get_out_path(self, path: Union[Path, str]) -> Path:
2626
"""Takes a filename, if the out_dir is relative, returns the path relative to the tmpdir.
2727
If the out_dir is absolute, returns the path relative to the out_dir."""
28-
if self.out_dir.is_absolute() or self.get("force_out"):
28+
if self.out_dir.is_absolute():
2929
return get_subpath(self.out_dir, path)
3030
return get_subpath(get_subpath(self.tmpdir, self.out_dir), path)
3131

tests/test_output_paths.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def test_TMPDIR(self):
5555
finally:
5656
environ.pop("TMPDIR")
5757

58-
def test_force_out(self):
59-
""" Tests force_out which ignores the tmpdir prefix """
58+
def test_implied_relative_output(self):
59+
""" Tests implied relative output paths. Should resolve out_dir to the current dir. """
6060
out_file = "implied/relative/path/initrd"
61-
generator = InitramfsGenerator(logger=self.logger, config="tests/fullauto.toml", out_file=out_file, force_out=True)
61+
generator = InitramfsGenerator(logger=self.logger, config="tests/fullauto.toml", out_file=out_file)
6262
out_path = Path(out_file)
6363
if out_path.exists():
6464
self.fail(f"File {out_file} already exists")
@@ -68,6 +68,8 @@ def test_force_out(self):
6868
test_image = out_path.parent / generator["test_rootfs_name"]
6969
self.assertTrue(test_image.exists())
7070
test_image.unlink()
71+
generator["out_dir"].rmdir()
72+
7173

7274

7375
if __name__ == "__main__":

0 commit comments

Comments
 (0)