Feature #6747

product cleanup script

Added by Lynn Garren over 6 years ago. Updated over 3 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
Spent time:
SSI Package:


Supply a script that can be used to remove a product and all its dependencies. Such a script must verify that the dependencies are not needed by another product in the ups database.


#1 Updated by Christopher Green over 6 years ago

  • Status changed from New to Accepted
  • Priority changed from Normal to Low
  • Target version set to 521
  • SSI Package cetpkgsupport added
  • SSI Package deleted ()

This is certainly desirable in some form, but there are complexities and cases where products may be removed that are still desired for standalone use (e.g. python), that need careful consideration.

#2 Updated by Brett Viren over 6 years ago

I recently found the need for such a tool and Lynn pointed me to this ticket.

This seems to be a good application for the mark-and-sweep garbage collection algorithm. I think it should be fairly simple to implement. The one minor sticking point is that one needs to generate the full dependency graph of all the UPS products to be considered.

Can UPS generate this full graph by itself? The only way I know how to do it would be to iterate on the output of "ups list" and call "ups depend" for each line. This should work but will be a bit tedious to code and probably slow to run.

#3 Updated by Brett Viren over 6 years ago

FYI, I've begun development of such a tool.

At this point, given the description of a high-level product it can determine which other products may be purged which are not needed by others that are to be kept.

It still needs some testing which I'll do against the installed products at RACF.

BTW, in the end, the mark-and-sweep alg was an overblown idea. Instead, the simple built in Python set methods and what networkx provides was enough to split the product tree into parts that can be purged and parts that must be kept.

#4 Updated by Brett Viren over 6 years ago

FYI, the python-ups-util package now handles purging of products from a UPS products area, correctly respecting any remaining need for shared dependecies. See the readme file for examples. It can only purge at the relatively coarse package/version level. As per discussion on the larsoft mailing list, this is because there is not enough information given by the "ups" command to reliably purge at the level of individual flavor/qualifiers.

#5 Updated by Lynn Garren over 6 years ago

Actually, that's great. Removing all copies of a particular version of a package is what we imagined.

#6 Updated by Kyle Knoepfel over 3 years ago

  • Target version deleted (521)

Also available in: Atom PDF