This a suggestion for bigger projects with many parts depending on each another.
When a part has dependencies (defined using the after
keyword), snapcraft clean <part>
may exit with the following message:
Requested clean of 'part' but 'a', 'b', ... and 'z' depend upon it. Please add each to the clean command if that's what you intended.
If there are many parts depending on the part to clean, it might not be the best developer experience to add each depending part to the clean
command.
For example, for a snap I’m currently working on, snapcraft clean kde-dependencies
results in:
Requested clean of 'kde-dependencies' but 'karchive', 'kauth', 'kcodecs', 'kconfig', 'kconfigwidgets', 'kcoreaddons', 'kcrash', 'kdbusaddons', 'kdoctools', 'kguiaddons', 'ki18n', 'kiconthemes', 'kitemviews', 'knotifications', 'kwidgetsaddons', 'kwindowsystem', 'libliri', 'modemmanager-qt', 'networkmanager-qt', 'phonon', 'polkit-qt-1', 'qt-gstreamer', and 'solid' depend upon it. Please add each to the clean command if that's what you intended.
To improve the experience in cases like this, I would suggest to add an additional argument to snapcraft clean
. Something like snapcraft clean <part> --depending
comes to my mind to also clear depending parts automatically.