Skip to content

Commit a9e3a95

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 8684239 commit a9e3a95

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
@@ -421,6 +421,18 @@ def diff_metal(diff_from, diff_to):
421421
git_diff(mount_dir_from, mount_dir_to)
422422

423423

424+
def diff_metal_du(diff_from, diff_to):
425+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
426+
cmd = ['find', '.', '-type', 'd', '-exec', 'du', '-sh', '{}', ';']
427+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy=DiffCmdOutputStrategy.CD)
428+
429+
430+
def diff_metal_ls(diff_from, diff_to):
431+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
432+
cmd = ['find', '.']
433+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy=DiffCmdOutputStrategy.CD)
434+
435+
424436
def diff_cmd_outputs(cmd, path_from, path_to, strategy: DiffCmdOutputStrategy = DiffCmdOutputStrategy.TEMPLATE):
425437
workingdir = None
426438
with tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as from_output, \
@@ -482,6 +494,10 @@ DIFFERS = [
482494
needs_ostree=OSTreeImport.NO, function=diff_metal_partitions),
483495
Differ("metal", "Diff metal disk image content",
484496
needs_ostree=OSTreeImport.NO, function=diff_metal),
497+
Differ("metal-du", "Compare directory usage of metal disk image content",
498+
needs_ostree=OSTreeImport.NO, function=diff_metal_du),
499+
Differ("metal-ls", "Compare directory listing of metal disk image content",
500+
needs_ostree=OSTreeImport.NO, function=diff_metal_ls),
485501
]
486502

487503
if __name__ == '__main__':

0 commit comments

Comments
 (0)