]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Rename sandbox verb to box
authorDaanDeMeyer <daan.j.demeyer@gmail.com>
Fri, 4 Jul 2025 18:38:35 +0000 (20:38 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 4 Jul 2025 20:45:21 +0000 (22:45 +0200)
It's both shorter, and doesn't give the wrong impression that this
is about security sandboxing, so let's rename the sandbox name to
just box. Keep the old name as well of course for compat.

.github/workflows/ci.yml
mkosi/__init__.py
mkosi/config.py
mkosi/resources/man/mkosi.1.md
tests/test_config.py

index 3a4f6b089b1881ad5ed00ddbc92c4bda8cf97374..2e8b271aef3910912bbea2fd589615c00235de6e 100644 (file)
@@ -212,14 +212,14 @@ jobs:
         run: sudo mkosi summary
 
       - name: Build tools tree
-        run: sudo mkosi -f sandbox -- true
+        run: sudo mkosi -f box -- true
 
       - name: Build image
         run: sudo mkosi --distribution ${{ matrix.distro }} -f
 
       - name: Run integration tests
         run: |
-          sudo mkosi sandbox -- \
+          sudo mkosi box -- \
             timeout -k 30 1h \
             python3 -m pytest \
             --tb=no \
index 99a424f9798e8c037ba473dc21e9eaaafcf83c11..c4a3564a2258d94417440ec7ff36c2654ffb65ef 100644 (file)
@@ -74,7 +74,7 @@ from mkosi.config import (
     expand_delayed_specifiers,
     finalize_configdir,
     format_bytes,
-    in_sandbox,
+    in_box,
     parse_boolean,
     parse_config,
     resolve_deps,
@@ -4114,11 +4114,11 @@ def build_image(context: Context) -> None:
     print_output_size(context.config.output_dir_or_cwd() / context.config.output_with_compression)
 
 
-def run_sandbox(args: Args, config: Config) -> None:
-    if in_sandbox():
+def run_box(args: Args, config: Config) -> None:
+    if in_box():
         die(
-            "mkosi sandbox cannot be invoked from within another mkosi sandbox environment",
-            hint="Exit the current sandbox environment and try again",
+            "mkosi box cannot be invoked from within another mkosi box environment",
+            hint="Exit the current mkosi box environment and try again",
         )
 
     if not args.cmdline:
@@ -4139,7 +4139,7 @@ def run_sandbox(args: Args, config: Config) -> None:
 
     hd, hr = detect_distribution()
 
-    env = {"MKOSI_IN_SANDBOX": "1"}
+    env = {"MKOSI_IN_BOX": "1"}
     if hd:
         env |= {"MKOSI_HOST_DISTRIBUTION": str(hd)}
     if hr:
@@ -5106,7 +5106,8 @@ def run_verb(args: Args, tools: Optional[Config], images: Sequence[Config], *, r
             Verb.ssh: run_ssh,
             Verb.journalctl: run_journalctl,
             Verb.coredumpctl: run_coredumpctl,
-            Verb.sandbox: run_sandbox,
+            Verb.box: run_box,
+            Verb.sandbox: run_box,
         }[args.verb](args, last)
 
     if last.output_format == OutputFormat.none:
index c966260a86b129b11c11be0f7ea317fb2e8dbb81..e7da3fde6836c095f1aeea9e4762c5e7a22a05e1 100644 (file)
@@ -87,6 +87,7 @@ class Verb(StrEnum):
     dependencies = enum.auto()
     completion = enum.auto()
     sysupdate = enum.auto()
+    box = enum.auto()
     sandbox = enum.auto()
     init = enum.auto()
 
@@ -104,12 +105,13 @@ class Verb(StrEnum):
             Verb.completion,
             Verb.documentation,
             Verb.sysupdate,
+            Verb.box,
             Verb.sandbox,
             Verb.dependencies,
         )
 
     def needs_tools(self) -> bool:
-        return self in (Verb.sandbox, Verb.journalctl, Verb.coredumpctl, Verb.ssh)
+        return self in (Verb.box, Verb.sandbox, Verb.journalctl, Verb.coredumpctl, Verb.ssh)
 
     def needs_build(self) -> bool:
         return self in (
@@ -675,8 +677,8 @@ def parse_boolean(s: str) -> bool:
     return value
 
 
-def in_sandbox() -> bool:
-    return parse_boolean(os.getenv("MKOSI_IN_SANDBOX", "0"))
+def in_box() -> bool:
+    return parse_boolean(os.getenv("MKOSI_IN_BOX", "0"))
 
 
 def parse_path(
@@ -1479,7 +1481,7 @@ def config_parse_minimum_version(value: Optional[str], old: Optional[str]) -> Op
         return old
 
     if hash := startswith(value, "commit:"):
-        if not in_sandbox():
+        if not in_box():
             gitdir = Path(__file__).parent.parent
             if not (gitdir / ".git").exists():
                 die("Cannot check mkosi git version, not running mkosi from a git repository")
@@ -2175,7 +2177,7 @@ class Config:
         return self.package_cache_dir or (INVOKING_USER.cache_dir() / "mkosi" / key)
 
     def tools(self) -> Path:
-        if in_sandbox():
+        if in_box():
             return Path("/")
 
         return self.tools_tree or Path("/")
@@ -2310,8 +2312,8 @@ class Config:
             # Caching the package manager used does not matter for the default tools tree because we don't
             # cache the package manager metadata for the tools tree either. In fact, it can cause issues as
             # the cache manifest for the tools tree will sometimes be different depending on whether we're
-            # running inside or outside of the mkosi sandbox. To avoid these issues, don't cache the package
-            # manager used in the tools tree cache manifest.
+            # running inside or outside of the mkosi box environment. To avoid these issues, don't cache the
+            # package manager used in the tools tree cache manifest.
             **(
                 {"package_manager": self.distribution.package_manager(self).executable(self)}
                 if self.image != "tools"
@@ -5172,7 +5174,7 @@ def parse_config(
 
     tools = None
     if config.get("tools_tree") == Path("default"):
-        if in_sandbox():
+        if in_box():
             config["tools_tree"] = Path(os.environ["MKOSI_DEFAULT_TOOLS_TREE_PATH"])
         else:
             tools = finalize_default_tools(context, config, configdir=configdir, resources=resources)
index feea867a98d026522aef4ef68364621280ff43db..d7b4671d6de8e1fc6cc73578725a290aa602e31f 100644 (file)
@@ -30,7 +30,7 @@ mkosi — Build Bespoke OS Images
 
 `mkosi [options…] sysupdate [-- sysupdate settings…]`
 
-`mkosi [options…] sandbox [-- command line…]`
+`mkosi [options…] box [-- command line…]`
 
 `mkosi [options…] dependencies [-- options…]`
 
@@ -143,8 +143,8 @@ The following command line verbs are known:
     specified after the `sysupdate` verb and separated from the regular
     options with `--` are passed directly to **systemd-sysupdate**.
 
-`sandbox`
-:   Run arbitrary commands inside of the same sandbox used to execute
+`box`
+:   Run arbitrary commands inside of the same environment used to execute
     other verbs such as `boot`, `shell`, `vm` and more. This means
     `/usr` will be replaced by `/usr` from the tools tree if one is used
     while everything else will remain in place. If no command is provided,
index acd446adf749bf239a0b60d2c447b8841126ce77..d9c537e08a0d7eec08943b6e5038e181764f5d9b 100644 (file)
@@ -21,7 +21,7 @@ from mkosi.config import (
     OutputFormat,
     Verb,
     config_parse_bytes,
-    in_sandbox,
+    in_box,
     parse_config,
     parse_ini,
 )
@@ -1487,8 +1487,8 @@ def test_tools(tmp_path: Path) -> None:
     d = tmp_path
     argv = ["--tools-tree=default"]
 
-    if in_sandbox():
-        pytest.skip("Cannot run test_tools() test within mkosi sandbox environment")
+    if in_box():
+        pytest.skip("Cannot run test_tools() test within mkosi box environment")
 
     with resource_path(mkosi.resources) as resources, chdir(d):
         _, tools, _ = parse_config(argv, resources=resources)