Uninstalling Packages and Bundles

This algorithm is used for uninstalling bundles and packages with gpt-uninstall. The key to this algorithm is that only those packages which do not fulfill dependencies to other packages and are not owned by any installed bundles can be deleted. The algorithm starts with two sets of packages, two sets of bundles, the -force flag.

ToBeUninstalledBundles

List of bundles the user wants to remove from an installation.

ToBeUninstalledPackages

List of packages the user wants to remove from an installation.

InstalledBundles

List of bundles that are currently installed.

InstalledPackages

List of packages that are currently installed.

The algorithm is outlined in the following steps:

  1. The ToBeUninstalledBundles set is expanded to packages which are added to the ToBeUninstalledPackages set.

  2. This check is skipped if -force is true. Each package in ToBeUninstalledPackages is examined to determine which bundles include the package in their packaging list. If any of these bundles are not in ToBeUninstalledBundles then the package is removed from ToBeUninstalledPackages.

  3. This check is skipped if -force is true. Each package in ToBeUninstalledPackages is examined to determine if the package provides dependencies to other packages in InstalledPackages. If any of these dependent packages are not in ToBeUninstalledPackages the package is simply from ToBeUninstalledPackages.

  4. ToBeUninstalledBundles and ToBeUninstalledPackages are passed to the code that does the actual removals.