]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Silence sfdisk when refreshing partition tables
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 11 Oct 2021 14:00:34 +0000 (15:00 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 12 Oct 2021 06:44:18 +0000 (08:44 +0200)
Let's try to keep the output minimal when building from cached images.
Currently sfdisk is the only program producing non-trivial amounts of
output when building from cached images so let's pass the --quiet flag
when refreshing partition tables.

mkosi/__init__.py
mkosi/backend.py

index 477cb537a7992f253b64944963bb5782b8b69a18..c6cc8493991dd3802ff29acc522cead279ae5fbd 100644 (file)
@@ -648,7 +648,7 @@ def refresh_partition_table(args: CommandLineArguments, f: BinaryIO) -> None:
 
     with complete_step("Refreshing partition table…", "Refreshed partition table."):
         if args.partition_table.partitions:
-            args.partition_table.run_sfdisk(f.name)
+            args.partition_table.run_sfdisk(f.name, quiet=True)
 
 
 def refresh_file_system(args: CommandLineArguments, dev: Optional[Path], cached: bool) -> None:
index 1c3dce6d3b3a61db02695093b386ab5798f14fa0..283f481ecfa9be9556dd1c9c5ffc556fdb5b3f75 100644 (file)
@@ -324,15 +324,18 @@ class PartitionTable:
                  *(p.sfdisk_spec() for p in self.partitions.values())]
         return '\n'.join(table)
 
-    def run_sfdisk(self, device: PathString) -> None:
+    def run_sfdisk(self, device: PathString, *, quiet: bool = False) -> None:
         spec = self.sfdisk_spec()
         device = Path(device)
 
         if 'disk' in ARG_DEBUG:
             print_between_lines(spec)
 
-        run(["sfdisk", "--color=never", "--no-reread", "--no-tell-kernel", device],
-            input=spec.encode("utf-8"))
+        cmd: List[PathString] = ["sfdisk", "--color=never", "--no-reread", "--no-tell-kernel", device]
+        if quiet:
+            cmd += ["--quiet"]
+
+        run(cmd, input=spec.encode("utf-8"))
 
         if device.is_block_device():
             run(["sync"])