Bundle and Package Updating

This is the process used by gpt-install and gpt-build to determine updates for bundles and packages

Starting Data

At the start of an update operation, there are two sets of bundles and two sets of packages as well as the -force flag:

InstalledBundles

Set of bundles that are already installed in the directory pointed to by $GLOBUS_LOCATION

InputBundles

Set of bundles passed in to the command line from the user.

UnaffiliatedInstalledPackages

Set of packages that are already installed in the directory pointed to by $GLOBUS_LOCATION which are not "owned" by any InstalledBundles

UnaffiliatedInputPkgs

Set of packages passed in to the command line from the user. These packages are not 'owned' by any InputBundles

Bundles create with GPT older than version 3.0 are treated as a collection of Unaffiliated Input Packages since they are not versioned.

Sorting the Bundles

The InputBundles and InstalledBundles need to be compared and sorted. The result of this generates the following bundle sets:

NewerBundles

This set is all of the bundles in InputBundles that are a new version of the same bundle in InstalledBundles

OlderBundles

This set is all of the bundles in InputBundles that are an old version of the same bundle in InstalledBundles

AddedBundles

This set is all of the bundles in InputBundles that have never been installed

UntouchedBundles

This set is all of the bundles in InstalledBundles that do not have any version of themselves present in InputBundles

ReplacedBundles

This set is all of the bundles in InstalledBundles that do have a version of themselves present in InputBundles

Testing Replacement Bundles and -force

The -force flag now is used to determine the replacement set of bundles which we will call ToReplaceBundles. If the -force flag is true then the set will consist of both NewerBundles and OlderBundles. Otherwise the set consists of only NewerBundles. If OlderBundles is not empty and the -force flag is false then we transition into an error state which will cause nothing to be installed. However even with this error state, the algorithm continues so that all errors are collected.

Searching for Package Conflicts

Now the installation picture is clear at the bundle level. After the process is completed, the set of installed bundles will be the union of ToReplaceBundles, AddedBundles, and UntouchedBundles. We will call this set NewInstallationBundles. The set initially contains the bundles from UntouchedBundles. Every bundle in ToReplaceBundles and AddedBundles is then scanned for package conflicts. The scan is done by creating package sets for the sorting packages algorithm. The packages from every bundle in NewInstallationBundles are designated as the OldPackageSet. The packages of the bundle being scanned are designated as the NewPackageSet. After the sorting is done the scanned bundle is added to NewInstallationBundles. Any packages that are in the ToReplacePackages set are considered conflicts. If conflicts are found then the process transitions to an error condition. Processing continues even with errors until all of the conflicts are found.

Conflicts with UnaffiliatedInputPackages

The package sort is called one more time with UnaffiliatedInputPackages designated as the NewPackageSet. As before, any packages that are in the ToReplacePackages set are considered conflicts. If conflicts are found then the process transitions to an error condition. Processing continues even with errors until all of the conflicts are found.

Searching for File Conflicts

At this point a package set can be created from NewInstallationBundles and UnaffiliatedInputPackages. This set should be scanned for file conflicts.

End of Error State Processing

After the file conflicts, All possible errors have been checked for. If any errors exist, they are reported and the process ends.

Creating the Package Removal Set

The bundles in ReplacedBundles contain packages that are candidates for removal or replacement. We will call this set ToBeRemovedPackageSet. To generate this set, the package sorting algorithm is called with OldPackageSet generated from ReplacedBundles and NewPackageSet generated from the package union of NewInstallationBundles and UnaffiliatedInputPackages. After the algorithm is completed, the UntouchedPackages set will be the packages that will no longer exist in the installation. Because of this, the set needs to be run through the uninstall algorithm. The union of modified UntouchedPackages set and ReplacedPackages set is the ToBeRemovedPackageSet.

Creating Adding and Replacement Package Sets

The ToBeAddedPackageSet consists of the package union of ToReplaceBundles, AddedBundles and UnaffiliatedInputPackages.

Update Algorithm Outputs

The two sets ToBeRemovedPackageSet and ToBeAddedPackageSet are the output data that is passed to the code performing the actual package installation.