Jon Turney wrote: > On 02/08/2022 13:17, Christian Franke wrote: >> In long standing cygwin installations, many no longer needed >> automatically installed packages (e.g. libicuNN) accumulate. This >> patch adds a new view which is possibly helpful to cleanup packages >> manually. >> >> Some possible later enhancements: >> - automatically refresh this view (a few seconds) after the user >> changed a package status as this may add or remove entries. >> - add a keyboard shortcut (^U) to the list view for "Uninstall this >> package and then select next package" >> > > Thanks.  This looks good. > > I think perhaps a better approach would be a view showing all packages > which aren't user_picked, or a dependency of a user_picked package. This would drop the ability to easily clean up user_picked packages without later conflicts. The attached new patch splits this into two views "Removable" (not "Uninstallable" due to possible ambiguity with "cannot be installed") and "Unneeded" (or "Stale" ?). > > (If I've read the code correctly your implementation has the weakness > that if e.g. appA -> libbB -> libC, which is then changed to appA -> > libD -> libE, it will only show libC as unneeded, then libB on the > next run?) I'm not sure for this case. It may be correct again after the view is refreshed during the same run. In general, this ad-hoc algorithm does not handle all corner cases. It should be sufficient if installation cleanup is done in a separate run. > > >> +// Scan installed or desired packages and collect the names of packages >> +// which provide the dependencies of other packages or are member of >> +// category "Base". >> +static void FindNeededPackages (const packagedb & db, >> std::set & needed) >> +{ >> +  std::map providedBy; >> +  for (const auto & p : db.packages) >> +    { >> +      const packagemeta & pkg = *p.second; >> +      if (!pkg.isBinary ()) >> +        continue; >> +      if (!(pkg.desired && (pkg.installed || pkg.picked ()))) >> +        continue; > > This seems redundant.  Why can't this be just !pkg.desired? Yes, fixed. I originally wanted to handle the "install source package without the binary" case here. During development of "Ctrl+I/R/U" patch, I learned that this could not happen. > This should also update the tooltip for the view dropdown > (IDS_VIEWBUTTON_TOOLTIP) to describe the new view. > Done. Open issue: An easy way to refresh the views after Uninstall requests (Ctrl+L ?).