Skip to main content

KernelDB.prune_orphan_symlinks()

Find symlinks under the download trees whose target no longer exists.

Usage

Source

KernelDB.prune_orphan_symlinks(dry_run=True)

The method walks every mission’s download tree recursively, derived from metakernel_registry.mk_path (the parent of the mk/ directory), and finds dangling symlinks. These accumulate when an underlying kernel store moves, or after prune or clean --locations removes a locations row. The symlinks pointing at that file are not themselves tracked in locations, so they survive as junk.

Healthy symlinks and regular files are left alone.

Parameters

dry_run: bool = True
With True (the default) only report. With False, unlink every dangling symlink.

Returns

list[str]
The absolute paths that were, or with dry_run would be, removed.