Package conary :: Package conaryclient :: Module update :: Class ClientUpdate
[hide private]
[frames] | no frames]

Class ClientUpdate

source code

Known Subclasses:
ConaryClient

Instance Methods [hide private]
 
__init__(self, callback=None) source code
 
getUpdateCallback(self)
PUBLIC API
source code
 
setUpdateCallback(self, callback)
PUBLIC API
source code
 
_resolveDependencies(self, uJob, jobSet, split=False, resolveDeps=True, useRepos=True, resolveSource=None, keepRequired=True, criticalUpdateInfo=None) source code
 
_processRedirects(self, csSource, uJob, jobSet, transitiveClosure, recurse)
Looks for redirects in the change set, and returns a list of troves which need to be included in the update.
source code
 
_mergeGroupChanges(self, uJob, primaryJobList, transitiveClosure, redirectHack, recurse, ineligible, checkPrimaryPins, installedPrimaries, installMissingRefs=False, updateOnly=False, respectBranchAffinity=True, alwaysFollowLocalChanges=False, removeNotByDefault=False) source code
 
_splitPinnedJob(self, uJob, troveSource, job, force=False) source code
 
_findOverlappingJobs(self, jobSet, troveSource)
Returns a list of sets of jobs.
source code
 
_trovesNotFound(self, notFound)
Raises a nice error message when changeset creation failed to include all the necessary troves.
source code
 
_confirmLaterPackages(self, findTroveResults) source code
 
_updateChangeSet(self, itemList, uJob, keepExisting=None, recurse=True, updateMode=True, sync=False, useAffinity=True, checkPrimaryPins=True, forceJobClosure=False, ineligible=set([]), syncChildren=False, updateOnly=False, installMissing=False, removeNotByDefault=False, exactFlavors=False)
Updates a trove on the local system to the latest version in the respository that the trove was initially installed from.
source code
 
_addJobPreEraseScript(self, job, updJob) source code
 
_processJobList(self, jobList, updJob, troveSourceCallback) source code
 
_fullMigrate(self, itemList, uJob, recurse=True) source code
list
getUpdateItemList(self)
PUBLIC API
source code
 
fullUpdateItemList(self) source code
list of jobs
getPrimaryLocalUpdates(self, troveNames=None)
Returns a set of changes (jobs) that explain how the user is likely to have modified their system to get it to its current state.
source code
 
getChildLocalUpdates(self, searchSource, localUpdates, installedTroves=None, missingTroves=None)
Given a set of primary local updates (the updates the user is likely to have typed at the command line, return their child updates).
source code
 
_replaceIncomplete(self, cs, localSource, db, repos) source code
 
loadRestartInfo(self, restartInfo, updJob)
Load the restart information (generally happening after installing a critical update), generated with saveRestartInfo
source code
 
saveRestartInfo(self, updJob, remainingJobs)
Save the restart information after applying a critical update, in order to continue after restart.
source code
 
cleanRestartInfo(self, restartInfo)
Clean up the restart information (generated with saveRestartInfo).
source code
 
newUpdateJob(self, closeDatabase=True)
PUBLIC API Create a new update job.
source code
dict
prepareUpdateJob(self, updJob, itemList, keepExisting=False, recurse=True, resolveDeps=True, test=False, updateByDefault=True, split=True, sync=False, fromChangesets=[], checkPathConflicts=True, checkPrimaryPins=True, resolveRepos=True, syncChildren=False, updateOnly=False, resolveGroupList=None, installMissing=False, removeNotByDefault=False, keepRequired=None, migrate=False, criticalUpdateInfo=None, resolveSource=None, applyCriticalOnly=False, restartInfo=None, exactFlavors=False)
PUBLIC API
source code
 
applyUpdateJob(self, updJob, replaceFiles=None, tagScript=None, test=False, justDatabase=False, journal=None, localRollbacks=None, autoPinList=None, keepJournal=False, noRestart=False, replaceManagedFiles=False, replaceUnmanagedFiles=False, replaceModifiedFiles=False, replaceModifiedConfigFiles=False)
PUBLIC API
source code
 
recordManifest(self)
Records the list of currently installed troves to a file
source code
 
_combineJobs(self, uJob, splitJob, criticalJobs)
Coming the dependency-ordered list of individual jobs into large jobs for update efficiency.
source code
 
updateChangeSet(self, itemList, keepExisting=False, recurse=True, resolveDeps=True, test=False, updateByDefault=True, callback=None, split=True, sync=False, fromChangesets=[], checkPathConflicts=True, checkPrimaryPins=True, resolveRepos=True, syncChildren=False, updateOnly=False, resolveGroupList=None, installMissing=False, removeNotByDefault=False, keepRequired=None, migrate=False, criticalUpdateInfo=None, resolveSource=None, updateJob=None, exactFlavors=False)
PUBLIC API
source code
 
_validateJob(self, jobSet) source code
 
_createCs(self, repos, db, jobSet, uJob) source code
 
_applyCs(self, cs, uJob, removeHints={}, **kwargs) source code
 
_createAllCs(self, q, allJobs, uJob, cfg, stopSelf) source code
list
getDownloadSizes(self, uJob)
PUBLIC API
source code
 
downloadUpdate(self, uJob, destDir)
PUBLIC API
source code
 
applyUpdate(self, uJob, replaceFiles=False, tagScript=None, test=False, justDatabase=False, journal=None, callback=None, localRollbacks=False, autoPinList=RegularExpressionList([]), keepJournal=False)
DEPRECATED, use applyUpdateJob instead.
source code
 
_applyUpdate(self, *args, **kwargs) source code
 
_applyUpdateL(self, uJob, tagScript=None, journal=None, callback=None, autoPinList=None, commitFlags=None) source code
Static Methods [hide private]
 
revertJournal(cfg)
Method Details [hide private]

getUpdateCallback(self)

source code 
PUBLIC API
Decorators:
  • @api.publicApi

setUpdateCallback(self, callback)

source code 

PUBLIC API

set the callback function for an update
Decorators:
  • @api.publicApi
Raises:
  • AssertionError - raised if the callback is None or is an inappropriate object type

_processRedirects(self, csSource, uJob, jobSet, transitiveClosure, recurse)

source code 
Looks for redirects in the change set, and returns a list of troves which need to be included in the update. This returns redirectHack, which maps targets of redirections to the sources of those redirections.

_findOverlappingJobs(self, jobSet, troveSource)

source code 

Returns a list of sets of jobs.

Each set has the following property:

For every job in the set, there is another job in the set such that: 1) the job removes a path that the other job adds 2) the job adds a path that other job removes 3) both jobs add the same path or 4) both jobs remove the same path (though this should be impossible because conary only allows one trove to own a file)

All sets in a job should be connected to each other through some chain of these relationships.

_updateChangeSet(self, itemList, uJob, keepExisting=None, recurse=True, updateMode=True, sync=False, useAffinity=True, checkPrimaryPins=True, forceJobClosure=False, ineligible=set([]), syncChildren=False, updateOnly=False, installMissing=False, removeNotByDefault=False, exactFlavors=False)

source code 
Updates a trove on the local system to the latest version in the respository that the trove was initially installed from.
Parameters:
  • itemList (list) - List specifying the changes to apply. Each item in the list must be a ChangeSetFromFile, or a standard job tuple. Versions in the job tuple may be strings, versions, branches, or None. Flavors may be None.

getUpdateItemList(self)

source code 

PUBLIC API

Returns top-level items: troves that need to be updated in order to update the entire system.
Returns: list
Decorators:
  • @api.publicApi

getPrimaryLocalUpdates(self, troveNames=None)

source code 

Returns a set of changes (jobs) that explain how the user is likely to have modified their system to get it to its current state.

The changes made are the top-level jobs, that is, if the user updated foo (which includes foo:runtime) from branch a to branch b, an update job for foo will be returned but not foo:runtime.
Parameters:
  • troveNames (list) - If specified, then the changes returned are those related to the given trove names. They may include changes of troves with other names, however. For example, if you request changes for troves named foo, and foo is included by group-dist, and the only change related to foo you have made is installing group-dist, then a job showing the install of group-dist will be returned.
Returns: list of jobs

getChildLocalUpdates(self, searchSource, localUpdates, installedTroves=None, missingTroves=None)

source code 
Given a set of primary local updates (the updates the user is likely to have typed at the command line, return their child updates). Given a primary update from a -> b, we look at the children of a and b and see if a child of a is not installed where a child of b is, and assert that that update is from childa -> childb.

saveRestartInfo(self, updJob, remainingJobs)

source code 

Save the restart information after applying a critical update, in order to continue after restart.

The restart information can be loaded with loadRestartInfo

newUpdateJob(self, closeDatabase=True)

source code 
PUBLIC API

Create a new update job.

        The job can be initialized either by using prepareUpdateJob or by
        thawing it from a frozen representation.
        @param closeDatabase: If True, the database used by this client
        job is closed when the updateJob is destroyed or closed. See
        CNY-1834.
        @rtype: L{database.UpdateJob}
        @return: the new update job
        

Decorators:
  • @api.publicApi

prepareUpdateJob(self, updJob, itemList, keepExisting=False, recurse=True, resolveDeps=True, test=False, updateByDefault=True, split=True, sync=False, fromChangesets=[], checkPathConflicts=True, checkPrimaryPins=True, resolveRepos=True, syncChildren=False, updateOnly=False, resolveGroupList=None, installMissing=False, removeNotByDefault=False, keepRequired=None, migrate=False, criticalUpdateInfo=None, resolveSource=None, applyCriticalOnly=False, restartInfo=None, exactFlavors=False)

source code 

PUBLIC API

Populates an update job based on a set of trove update and erase operations.If self.cfg.autoResolve is set, dependencies within the job are automatically closed. Returns a mapping with suggestions for possible dependency resolutions.
Parameters:
  • updJob (conary.local.database.UpdateJob) - A conary.local.database.UpdateJob object
  • itemList (list) - A list of change specs: (troveName, (oldVersionSpec, oldFlavor), (newVersionSpec, newFlavor), isAbsolute). isAbsolute specifies whether to try to find an older version of trove on the system to replace if none is specified. If updateByDefault is True, trove names in itemList prefixed by a '-' will be erased. If updateByDefault is False, troves without a prefix will be erased, but troves prefixed by a '+' will be updated. itemList can be None if restartInfo is set (see below).
  • keepExisting (bool) - If True, troves updated not erase older versions of the same trove, as long as there are no conflicting files in either trove.
  • keepRequired (bool) - If True, troves are not erased when they are the target of a dependency for a trove which is retained.
  • recurse (bool) - Apply updates/erases to troves referenced by containers.
  • resolveDeps (bool) - Should dependencies error be flagged or silently ignored?
  • test (bool) - If True, the operations will be attempted but the filesystem and database will not be updated.
  • updateByDefault (bool) - If True, troves passed to itemList without a '-' or '+' prefix will be updated. If False, troves without a prefix will be erased.
  • split (bool) - Split large update operations into separate jobs. As of 1.0.10, this must be true (False broke how we handle users and groups, which requires info- packages to be installed first and in separate jobs)
  • sync (bool) - Limit acceptabe trove updates only to versions referenced in the local database.
  • fromChangesets (list) - When specified, this list of changeset.ChangeSetFromFile objects is used as the source of troves, instead of the repository.
  • checkPathConflicts (bool) - check that applying the update job would not create path conflicts (True by default).
  • checkPrimaryPins (bool) - If True, pins on primary troves raise a warning if an update can be made while leaving the old trove in place, or an error, if the update/erase cannot be made without removing the old trove.
  • resolveRepos (bool) - If True, search the repository for resolution troves.
  • syncChildren (bool) - If True, sync child troves so that they match the references in the specified troves.
  • updateOnly (bool) - If True, do not install missing troves, just update installed troves.
  • installMissing (bool) - If True, always install missing troves
  • removeNotByDefault (bool) - remove child troves that are not by default.
  • criticalUpdateInfo (CriticalUpdateInfo) - Settings and data needed for critical updates
  • resolveSource (conaryclient.resolve.DepResolutionMethod) - Instance of conaryclient.resolve.DepResolutionMethod to be used for dep resolution. If left blank, it will be created based on installLabelPath or resolveGroups.
  • applyCriticalOnly (bool) - apply only the critical update.
  • restartInfo (string) - If specified, overrides itemList. It specifies the location where the rest of an update job run was stored (after applying the critical update).
Returns: dict
Decorators:
  • @api.publicApi
Raises:

applyUpdateJob(self, updJob, replaceFiles=None, tagScript=None, test=False, justDatabase=False, journal=None, localRollbacks=None, autoPinList=None, keepJournal=False, noRestart=False, replaceManagedFiles=False, replaceUnmanagedFiles=False, replaceModifiedFiles=False, replaceModifiedConfigFiles=False)

source code 

PUBLIC API

Apply the update job.

The update job must have been initialized by calling prepareUpdateJob, or thawed using database.UpdateJob.thaw.
Parameters:
  • updJob (conary.local.database.UpdateJob object) - An UpdateJob object.
  • replaceFiles (bool) - Replace locally changed files (deprecated).
  • tagScript () -
  • test (bool) - Dry-run, don't perform any changes.
  • justDatabase (bool) - If set, no filesystem changes will be performed (changes are limited to the database).
  • journal () -
  • localRollbacks (bool) - Store the complete rollback information in the rollback directory (without referring to the changesets in the repository). This allows the system to apply rollbacks without connecting the repository, at the expense of disk space consumption. The setting defaults to the value of self.cfg.localRollbacks.
  • autoPinList (list) - A list of troves that will not change. Defaults to the value from self.cfg.pinList
  • keepJournal (bool) - If set, the conary journal file will be left behind (useful only for debugging journal cleanup routines)
  • noRestart (bool) - If set, suppresses the restart after critical updates behavior default to conary.
Returns:
None if the update was fully applied, or restart information if a critical update was applied and a restart is necessary to make it active.
Decorators:
  • @api.publicApi
Raises:
  • InternalConaryError - if a jobset was inconsistent.
  • UpdateError - Generic update error.
  • other - Callbacks may generate exceptions on their own. See the note for an explanation of the behavior of exceptions within callbacks.

Note: If one of the callbacks raises an exception, the behavior depends on the type of exception.

  • Uncatchable exceptions (SystemExit, KeyboardInterrupt and exceptions that have a field errorIsUncatchable set to True) will terminate the operation immediately.
  • Exceptions derived from errors.CancelOperationException (or having a field cancelOperation set to True) will print a warning and stop the operation when the current job finishes. For instance, if an update was split in 3 jobs, and during the application of the second one such an exception is raised, only the first two jobs will be completed.
  • All other exceptions will only print a warning, and will let the operation succeed.

_combineJobs(self, uJob, splitJob, criticalJobs)

source code 

Coming the dependency-ordered list of individual jobs into large jobs
for update efficiency. The following rules apply:

1. Info packages/components must be in there own jobs because of
limitations with our user handling (bah). We actually allow them
to combine if multiple versions/flavors of a single info package
are installed, which doesn't seem quite right but hasn't hurt
anything.
2. We don't combine groups with other types of troves. Groups may
be combined with other groups.
3. self.cfg.updateThreshold is the maximum number of troves
which may be installed within a single job. The only reason this
will be exceeded is if a single dependency job is larger than this.
4. We generally break jobs on packages and groups, not on components.
The rule for updateThreshold overrides this.
5. Jobs are made as large as possible given the other constraints.
6. jobs split for critical updates to prevent including non-critical
updates in a critical job unnecessarily.
7. Try hard to keep packages and components in a single job.

updateChangeSet(self, itemList, keepExisting=False, recurse=True, resolveDeps=True, test=False, updateByDefault=True, callback=None, split=True, sync=False, fromChangesets=[], checkPathConflicts=True, checkPrimaryPins=True, resolveRepos=True, syncChildren=False, updateOnly=False, resolveGroupList=None, installMissing=False, removeNotByDefault=False, keepRequired=None, migrate=False, criticalUpdateInfo=None, resolveSource=None, updateJob=None, exactFlavors=False)

source code 

PUBLIC API

DEPRECATED, use newUpdateJob and prepareUpdateJob instead.

Create an update job.
Decorators:
  • @api.publicApi

_validateJob(self, jobSet)

source code 
Raises:

getDownloadSizes(self, uJob)

source code 

PUBLIC API

Return the download sizes for each jobset in the update job.
Parameters:
Returns: list
List of sizes for each jobset
Decorators:
  • @api.publicApi

downloadUpdate(self, uJob, destDir)

source code 

PUBLIC API

Download the changesets required in order to apply an update job.
Parameters:
  • uJob (database.UpdateJob) - The update job.
  • destDir (path) - Directory where the changesets will be stored.
Decorators:
  • @api.publicApi

applyUpdate(self, uJob, replaceFiles=False, tagScript=None, test=False, justDatabase=False, journal=None, callback=None, localRollbacks=False, autoPinList=RegularExpressionList([]), keepJournal=False)

source code 

DEPRECATED, use applyUpdateJob instead.

Apply an update job.