Skip to content

Commit 8ef5b0e

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 5590be4 commit 8ef5b0e

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
@@ -416,6 +416,18 @@ def diff_metal(diff_from, diff_to):
416416
git_diff(mount_dir_from, mount_dir_to)
417417

418418

419+
def diff_metal_du(diff_from, diff_to):
420+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
421+
cmd = ['find', '.', '-type', 'd', '-exec', 'du', '-sh', '{}', ';']
422+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy='cd')
423+
424+
425+
def diff_metal_ls(diff_from, diff_to):
426+
for mount_dir_from, mount_dir_to in diff_metal_helper(diff_from, diff_to):
427+
cmd = ['find', '.']
428+
diff_cmd_outputs(cmd, mount_dir_from, mount_dir_to, strategy='cd')
429+
430+
419431
def diff_cmd_outputs(cmd, path_from, path_to, strategy='template'):
420432
workingdir = os.getcwd()
421433
with tempfile.NamedTemporaryFile(prefix=cmd[0] + '-') as from_output, \
@@ -478,6 +490,10 @@ DIFFERS = [
478490
needs_ostree=OSTreeImport.NO, function=diff_metal_partitions),
479491
Differ("metal", "Diff metal disk image content",
480492
needs_ostree=OSTreeImport.NO, function=diff_metal),
493+
Differ("metal-du", "Compare directory usage of metal disk image content",
494+
needs_ostree=OSTreeImport.NO, function=diff_metal_du),
495+
Differ("metal-ls", "Compare directory listing of metal disk image content",
496+
needs_ostree=OSTreeImport.NO, function=diff_metal_ls),
481497
]
482498

483499
if __name__ == '__main__':

0 commit comments

Comments
 (0)