Skip to content

Commit b8ea014

Browse files
committed
cmd-diff: support --metal-du and --metal-ls
A few more views of differences between two metal disk image mounted filesystems.
1 parent dca5d4a commit b8ea014

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/cmd-diff

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,18 @@ def diff_metal(diff_from, diff_to):
424424
git_diff(mount_dir_from, mount_dir_to)
425425

426426

427+
def diff_metal_du(diff_from, diff_to):
428+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
429+
cmd = ['find', '.', '-type', 'd', '-exec', 'du', '-sh', '{}', ';']
430+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy=DiffCmdOutputStrategy.CD)
431+
432+
433+
def diff_metal_ls(diff_from, diff_to):
434+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
435+
cmd = ['find', '.']
436+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy=DiffCmdOutputStrategy.CD)
437+
438+
427439
def diff_cmd_outputs(cmd, path_from, path_to, strategy: DiffCmdOutputStrategy = DiffCmdOutputStrategy.TEMPLATE):
428440
workingdir = None
429441
with tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as from_output, \
@@ -485,6 +497,10 @@ DIFFERS = [
485497
needs_ostree=OSTreeImport.NO, function=diff_metal_partitions),
486498
Differ("metal", "Diff metal disk image content",
487499
needs_ostree=OSTreeImport.NO, function=diff_metal),
500+
Differ("metal-du", "Compare directory usage of metal disk image content",
501+
needs_ostree=OSTreeImport.NO, function=diff_metal_du),
502+
Differ("metal-ls", "Compare directory listing of metal disk image content",
503+
needs_ostree=OSTreeImport.NO, function=diff_metal_ls),
488504
]
489505

490506
if __name__ == '__main__':

0 commit comments

Comments
 (0)