rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if modelFile.exists():
if modelFile.exists() and not argSet.pop('ignore-model', False):
def runCommand(self, cfg, argSet, otherArgs): kwargs = { 'systemModel': False } kwargs['restartInfo'] = argSet.pop('restart-info', None)
raise e
raise
def open_http(self, url, data=None, ssl=False): """override this WHOLE FUNCTION to change one magic string -- the content type -- which is hardcoded in (this version also supports https)""" # Splitting some of the functionality so we can reuse this code with # PUT requests too
raise NotImplementedException
raise NotImplementedError
def apply(self, fileDict, justDatabase = False, noScripts = False): raise NotImplementedException
raise NotImplementedException
raise NotImplementedError
def install(self, troveCs): raise NotImplementedException
raise NotImplementedException
raise NotImplementedError
def remove(self, trove): raise NotImplementedException
url, sizes = FileCachingChangesetFilter.getFileContents(self,
result = FileCachingChangesetFilter.getFileContents(self,
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): # Are any of the requested files capsule related? fcInfoList = self._getFileContentsCapsuleInfo(caller, clientVersion, fileList) # Compute indices of capsule-based files, we will need them later so # we can reconstruct the res...
return url, sizes url = self._localUrl(url) self._saveFileContents(capsuleBasedFileList, url, sizes)
return result elif not authCheckOnly: url, sizes = result url = self._localUrl(url) self._saveFileContents(capsuleBasedFileList, url, sizes)
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): # Are any of the requested files capsule related? fcInfoList = self._getFileContentsCapsuleInfo(caller, clientVersion, fileList) # Compute indices of capsule-based files, we will need them later so # we can reconstruct the res...
url, sizes = caller.getFileContents(clientVersion, otherFileList,
result = caller.getFileContents(clientVersion, otherFileList,
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): # Are any of the requested files capsule related? fcInfoList = self._getFileContentsCapsuleInfo(caller, clientVersion, fileList) # Compute indices of capsule-based files, we will need them later so # we can reconstruct the res...
return url, sizes url = self._localUrl(url) self._saveFileContents(otherFileList, url, sizes)
return result elif not authCheckOnly: url, sizes = result url = self._localUrl(url) self._saveFileContents(otherFileList, url, sizes)
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): # Are any of the requested files capsule related? fcInfoList = self._getFileContentsCapsuleInfo(caller, clientVersion, fileList) # Compute indices of capsule-based files, we will need them later so # we can reconstruct the res...
return self._saveFileContentsChangeset(clientVersion, fileList)
if authCheckOnly: return True else: return self._saveFileContentsChangeset(clientVersion, fileList)
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): # Are any of the requested files capsule related? fcInfoList = self._getFileContentsCapsuleInfo(caller, clientVersion, fileList) # Compute indices of capsule-based files, we will need them later so # we can reconstruct the res...
oldTroves = self.oldTroveList.findTroves(None, oldTroves)
oldTroves = self.oldTroveList.findTroves(None, oldTroves, allowMissing=True)
def findJobs(self, jobList): """ Finds a job given a changeSpec foo=--1.0 will match a fresh install to 1.0 foo=1.0 will match a fresh install or an upgrade to 1.0 foo will match an install, upgrade or erasure of foo foo=1.0-- will match an erasure of foo v. 1.0 foo=1.0--2.0 will match an upgrade of foo from 1.0 to 2.0...
oldTups = oldTroves[n, None, None] oldTups.append((n, None, None))
oldTups = oldTroves.get((n, None, None), None) if oldTups is None: oldTups = [] oldTroves[(n, None, None)] = oldTups oldTups.append((n, None, deps.Flavor()))
def findJobs(self, jobList): """ Finds a job given a changeSpec foo=--1.0 will match a fresh install to 1.0 foo=1.0 will match a fresh install or an upgrade to 1.0 foo will match an install, upgrade or erasure of foo foo=1.0-- will match an erasure of foo v. 1.0 foo=1.0--2.0 will match an upgrade of foo from 1.0 to 2.0...
if oldFiles or modFiles:
if oldVer and (newFiles or oldFiles or modFiles):
def _getOldFile(pathId, fileId, version): return self.oldTroveSource.getFileVersion(pathId, fileId, version)
if trvCs:
if oldVer:
def _getOldFile(pathId, fileId, version): return self.oldTroveSource.getFileVersion(pathId, fileId, version)
path = self.path + ('?%s' % self.params or '')
path = self.path + (self.params and '?%s' % self.params or '')
def filePath(self,useParentPath=True): if self.parent and useParentPath: fragment = self.parent.fragment or '' port = self.parent.port or '' path = self.parent.path + (self.parent.params or '') host = self.parent.host else: fragment = self.fragment or '' port = self.port or '' path = self.path + ('?%s' % self.params or...
class CookCallback(conaryclient.callbacks.ChangesetCallback, callbacks.CookCallback):
class CookCallback(client_callbacks.ChangesetCallback, callbacks.CookCallback):
def merge(self, idDict): # merges the ids contained in idDict into this object; existing # id's are preferred idDict.update(self.map) self.map = idDict
prefilter = FetchAction def __init__(self, primaryTroveSet, updateTroveSet): DelayedTupleSetAction.__init__(self, primaryTroveSet, updateTroveSet) self.updateTroveSet = updateTroveSet def _handleTrove(self, data, beforeInfo, afterInfo, oldTuple, newTuple, installSet, optionalSet): raise NotImplementedError def _prep...
def buildAfter(self, troveCache):
def optionalAction(self, data): for troveSet in self._inputSets: self.outSet._setOptional(troveSet._getOptionalSet()) self.outSet._setOptional(troveSet._getInstallSet())
self.updateTroveSet._walk(data.troveCache, recurse = True):
self.updateTroveSet._walk(troveCache, recurse = True):
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
installSetSwitch = set()
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
self.primaryTroveSet._walk(data.troveCache, recurse = True):
self.primaryTroveSet._walk(troveCache, recurse = True):
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
if (not inInstallSet and troveTup in afterInfo and afterInfo[troveTup][1]): installSetSwitch.add(troveTup)
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
for troveTup in installSetSwitch: for (subTroveTup, inInstallSet, explicit) in \ data.troveCache.iterTroveListInfo(troveTup): before.delTrove(subTroveTup[0], subTroveTup[1], subTroveTup[2], True)
return before, beforeInfo, installSet, optionalSet class PatchAction(AbstractModifyAction): prefilter = FetchAction def __init__(self, primaryTroveSet, updateTroveSet): AbstractModifyAction.__init__(self, primaryTroveSet, updateTroveSet) self.updateTroveSet = updateTroveSet def patchAction(self, data): before = tro...
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
for troveTup in (set(after.iterTroveList(strongRefs = True)) & set(before.iterTroveList(strongRefs = True))): if beforeInfo[troveTup] != afterInfo[troveTup]: troveMapping.append( (troveTup[0], troveTup[1:3], troveTup[1:3], False) ) self._preprocess(data, beforeInfo, afterInfo) self.outSet.updateMap = {}
data.troveCache.getTimestamps( beforeInfo.keys() + afterInfo.keys() )
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
if newTuple in explicitTups: if oldTuple[1] is not None: self.outSet.updateMap[newTuple] = oldTuple else: self.outSet.updateMap[newTuple] = None
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
class PatchAction(AbstractModifyAction):
def patchAction(self, data): before = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor()) after = trove.Trove("@tsupdate", versions.NewVersion(), deps.Flavor())
def _preprocess(self, data, beforeInfo, afterInfo): data.troveCache.getTimestamps( beforeInfo.keys() + afterInfo.keys() )
def _preprocess(self, data, beforeInfo, afterInfo): # populate the cache with timestamped versions as a bulk operation data.troveCache.getTimestamps( beforeInfo.keys() + afterInfo.keys() )
return self._action(*troveSetList, ActionClass = GroupUnionAction)
return self._action(ActionClass = GroupUnionAction, *troveSetList)
def union(self, *troveSetList): return self._action(*troveSetList, ActionClass = GroupUnionAction)
return self._action(*troveSpecs, ActionClass = GroupFindAction)
return self._action(ActionClass = GroupFindAction, *troveSpecs)
def find(self, *troveSpecs): return self._action(*troveSpecs, ActionClass = GroupFindAction)
import conary.build.destdirpolicy import conary.build.derivedpolicy import conary.build.derivedcapsulepolicy import conary.build.infopolicy import conary.build.packagepolicy import conary.build.capsulepolicy import conary.build.grouppolicy for pt in internalPolicyModules: m = sys.modules['conary.build.'+pt] for symbolN...
def loadPolicy(recipeObj, policySet = None, internalPolicyModules = (), basePolicy = Policy): # path -> module policyPathMap = {} # bucket -> ordered list of policy objects policies = { TESTSUITE: [], DESTDIR_PREPARATION: [], DESTDIR_MODIFICATION: [], PACKAGE_CREATION: [], PACKAGE_MODIFICATION: [], ENFORCEMENT: [], ERR...
os.symlink(target, ent.nlink)
os.symlink(target, ent.payload.read())
def explode(self, destDir): for ent in self: target = destDir + '/' + ent.filename parent = os.path.dirname(target) if not os.path.exists(parent): os.makedirs(parent)
try: logFile.pushDescriptor('cook') logBuildEnvironment(logFile, sourceVersion, policyTroves, recipeObj.macros, cfg) except: logFile.close() raise
else: try: logFile.pushDescriptor('cook') logBuildEnvironment(logFile, sourceVersion, policyTroves, recipeObj.macros, cfg) except: logFile.close() raise
def _cookPackageObject(repos, cfg, loader, sourceVersion, prep=True, macros={}, resume = None, ignoreDeps=False, logBuild=False, crossCompile=None, enforceManagedPolicy=False, requireCleanSources = False, downloadOnly = False, redirectStdin = False): """Builds the package for cookPackageObject. Parameter meanings are...
self.preserveList = []
self.preserveSet = set()
def __init__(self, *args, **kwargs): CapsuleOperation.__init__(self, *args, **kwargs) self.installs = [] self.removes = [] self.preserveList = []
self.preserveList.append(path)
self.preserveSet.add(path)
def preservePath(self, path): self.preserveList.append(path)
if not justDatabase and self.preserveList:
if not justDatabase and self.preserveSet:
def apply(self, fileDict, justDatabase = False): if not justDatabase and self.preserveList: capsuleJournal = ConaryOwnedJournal(self.root) for path in self.preserveList: fullPath = self.root + path capsuleJournal.backup(fullPath, skipDirs = True) if not util.removeIfExists(fullPath): capsuleJournal.create(fullPath) els...
for path in self.preserveList:
for path in self.preserveSet:
def apply(self, fileDict, justDatabase = False): if not justDatabase and self.preserveList: capsuleJournal = ConaryOwnedJournal(self.root) for path in self.preserveList: fullPath = self.root + path capsuleJournal.backup(fullPath, skipDirs = True) if not util.removeIfExists(fullPath): capsuleJournal.create(fullPath) els...
except Exception, KeyError:
except KeyError:
def load(self, path): assert(not self.cache and not self.depCache) try: cs = changeset.ChangeSetFromFile(path) except filecontainer.BadContainer: log.warning('trove cache %s was corrupt, ignoring' %path) return except (IOError, errors.ConaryError): return
def _getTarget(self)
def _getTarget(self):
def _getTarget(self) target = None if 'targetos' in self.recipe.macros: target = self.recipe.macros.targetos
host, port = urllib.splitnport(hostport, None)
i = hostport.rfind(':') j = hostport.rfind(']') if i > j: host, port = hostport[:i], int(hostport[i+1:]) else: host = hostport port = None if host and host[0] == '[' and host[-1] == ']': host = host[1:-1]
def urlSplit(url, defaultPort = None): """A function to split a URL in the format <scheme>://<user>:<pass>@<host>:<port>/<path>;<params>#<fragment> into a tuple (<scheme>, <user>, <pass>, <host>, <port>, <path>, <params>, <fragment>) Any missing pieces (user/pass) will be set to None. If the port is missing, it will be...
hostport = host
if ':' in host: host = '[%s]' % (host,)
def urlUnsplit(urlTuple): """Recompose a split URL as returned by urlSplit into a single string """ scheme, user, passwd, host, port, path, query, fragment = urlTuple userpass = None if user: if passwd: userpass = "%s:${passwd}" % (urllib.quote(user)) else: userpass = urllib.quote(user) hostport = host if port is not N...
hostport = urllib.quote("%s:%s" % (host, port), safe = ':')
hostport = urllib.quote("%s:%s" % (host, port), safe = ':[]') else: hostport = host
def urlUnsplit(urlTuple): """Recompose a split URL as returned by urlSplit into a single string """ scheme, user, passwd, host, port, path, query, fragment = urlTuple userpass = None if user: if passwd: userpass = "%s:${passwd}" % (urllib.quote(user)) else: userpass = urllib.quote(user) hostport = host if port is not N...
sourceName = self.getFilename()
sourceName = 'lookaside:/' + self.getFilename()
def __init__(self, recipe, url, tag='HEAD', branch='master', **kwargs): self.url = url % recipe.macros self.tag = tag % recipe.macros self.branch = branch % recipe.macros sourceName = self.getFilename() _RevisionControl.__init__(self, recipe, sourceName, **kwargs)
sourceName = self.getFilename()
sourceName = 'lookaside:/' + self.getFilename()
def __init__(self, recipe, url, tag = 'tip', **kwargs): self.url = url % recipe.macros self.tag = tag % recipe.macros sourceName = self.getFilename() _RevisionControl.__init__(self, recipe, sourceName, **kwargs)
sourceName = self.getFilename()
sourceName = 'lookaside:/' + self.getFilename()
def __init__(self, recipe, root, project, tag = 'HEAD', **kwargs): self.root = root % recipe.macros self.project = project % recipe.macros self.tag = tag % recipe.macros sourceName = self.getFilename() _RevisionControl.__init__(self, recipe, sourceName, **kwargs)
sourceName = self.getFilename()
sourceName = 'lookaside:/' + self.getFilename()
def __init__(self, recipe, url, project = None, revision = 'HEAD', **kwargs): self.url = url % recipe.macros self.revision = revision % recipe.macros if project is None: self.project = recipe.name else: self.project = project % recipe.macros
sourceName = self.getFilename()
sourceName = 'lookaside:/' + self.getFilename()
def __init__(self, recipe, url, tag = None, **kwargs): self.url = url % recipe.macros if tag: self.tag = tag % recipe.macros self.tagArg = '-r tag:%s' % self.tag else: self.tag = tag self.tagArg = '' sourceName = self.getFilename()
inputSets = action.getInputSets(graph = self.g)
inputSets = action.getInputSets()
def _action(self, *args, **kwargs): ActionClass = kwargs.pop('ActionClass') edgeList = kwargs.pop('edgeList', None) if isinstance(edgeList, (list, tuple, set)): edgeList = iter(edgeList)
self.primaryTroveSet = primaryTroveSet self._inputSets = [ self.primaryTroveSet ] self._inputSets += [ x for x in args if isinstance(x, TroveTupleSet) ] def _applyFilters(self, l, graph = None):
inputSets = [ primaryTroveSet ] inputSets += [ x for x in args if isinstance(x, TroveTupleSet) ] self._inputSets = self._applyFilters(inputSets) self.primaryTroveSet = self._inputSets[0] def _applyFilters(self, l): if not self.prefilter: return l
def __init__(self, primaryTroveSet, *args): self.primaryTroveSet = primaryTroveSet self._inputSets = [ self.primaryTroveSet ] self._inputSets += [ x for x in args if isinstance(x, TroveTupleSet) ]
for (ts, filterAction) in l: newTs = ts._action(ActionClass = filterAction)
for ts in l: newTs = ts._action(ActionClass = self.prefilter)
def _applyFilters(self, l, graph = None): r = [] for (ts, filterAction) in l: newTs = ts._action(ActionClass = filterAction) r.append(newTs)
def getInputSets(self, graph = None): if self.prefilter is None: return self._inputSets return self._applyFilters( [ (ts, self.prefilter) for ts in self._inputSets ] )
def getInputSets(self): return self._inputSets
def getInputSets(self, graph = None): if self.prefilter is None: return self._inputSets
if trove.getSize():
if trove.getSize() is not None:
def formatInfo(self, trove): """ returns iterator of format lines about this local trove """ # TODO: it'd be nice if this were set up to do arbitrary # formats...
if not modelFile.exists() and not ignoreModel:
if ignoreModel or not modelFile.exists():
def runCommand(self, cfg, argSet, otherArgs): kwargs = { 'systemModel': False } model = cml.CML(cfg) modelFile = systemmodel.SystemModelFile(model)
op = self.spec
spec = self.spec
def __repr__(self): op = None if self.op: op = self.op spec = None if self.spec: op = self.spec return "%s(line=%r, context=%r, op=%r, spec=%r)" % ( self.__class__.__name__, self.line, self.context, op, spec)
class TroveCapsule(streams.StreamSet):
class TroveRpmCapsule(streams.StreamSet):
def addFromHeader(self, h): if rpmhelper.OBSOLETENAME not in h: # really, really, REALLY old RPM packages might not have # OBSOLETEFLAGS or OBSOLETEVERSION. I doubt we could find one # if we tried. return
_TROVECAPSULE_RPM : (SMALL, TroveCapsule, 'rpm' ),
_TROVECAPSULE_RPM : (SMALL, TroveRpmCapsule, 'rpm' ),
def reset(self): self.name.set(None) self.version.set(None) self.release.set(None) self.arch.set(None) self.epoch.set(None)
select distinct tmpInstanceId.instanceId, ugt.ugtId, ugt.recursive
select distinct tmpInstanceId.instanceId, ugt.userGroupId, ugt.ugtId, ugt.recursive
def add(self, roleId, troveList, recursive=True): """ grant access on a troveList to a Role. If recursive = True, then access is also granted to all the children of the troves passed """ self._findInstanceIds(troveList) recursive = int(bool(recursive)) # we have now the list of instanceIds in the tmpInstanceId table. #...
rtList = [] for instanceId, rtId, recflag in cu.fetchall(): if rtId != roleId:
ugtList = [] results = cu.fetchall() instanceIds = set([ x[0] for x in results ]) for instanceId in instanceIds: permissions = [ x[2:] for x in results if x[0] == instanceId and x[1] == roleId ] if len(permissions) == 0:
def add(self, roleId, troveList, recursive=True): """ grant access on a troveList to a Role. If recursive = True, then access is also granted to all the children of the troves passed """ self._findInstanceIds(troveList) recursive = int(bool(recursive)) # we have now the list of instanceIds in the tmpInstanceId table. #...
rtId = cu.lastrowid elif recursive and not recflag: cu.execute("update UserGroupTroves set recursive = ? where rtId = ?", (recursive, rtId)) else: rtId = None if rtId: self.rebuild(cu, rtId, roleId) rtList.append(rtId) return rtList
ugtId = cu.lastrowid else: ugtId, recflag = permissions[0] if recursive and not recflag: cu.execute("update UserGroupTroves set recursive = ? where ugtId = ?", (recursive, ugtId)) else: ugtId = None if ugtId: self.rebuild(cu, ugtId, roleId) ugtList.append(ugtId) return ugtList
def add(self, roleId, troveList, recursive=True): """ grant access on a troveList to a Role. If recursive = True, then access is also granted to all the children of the troves passed """ self._findInstanceIds(troveList) recursive = int(bool(recursive)) # we have now the list of instanceIds in the tmpInstanceId table. #...
B{patchName} : Name of patch program to run (Default: C{patch))
B{patchName} : Name of patch program to run (Default: C{patch})
def do(self): f = self.doDownload() Ownership = {} destDir = action._expandOnePath(self.dir, self.recipe.macros, defaultDir=self.builddir)
if '[' in r.name: reMatch = self.rpmStringRe.match(r.name) if reMatch and reMatch.groups(): rpmClass = reMatch.group(1) rpmFlags = reMatch.group(2).strip() if rpmClass == 'perl' and rpmFlags: ds = deps.DependencySet() dep = deps.Dependency(rpmFlags) ds.addDep(deps.PerlDependencies, dep) if cnyReqs.satisfies(ds) or \ cn...
reMatch = self.rpmStringRe.match(r.name) if reMatch and reMatch.groups(): rpmFile = reMatch.group(1) rpmFlags = reMatch.group(2).strip() else: rpmFile = r.name rpmFlags = '' if rpmFile == 'perl' and rpmFlags:
def do(self): for comp in self.recipe.autopkg.components.items(): capsule = self.recipe._getCapsule(comp[0])
dep = deps.Dependency(r.name)
dep = deps.Dependency(rpmFlags) ds.addDep(deps.PerlDependencies, dep) if cnyReqs.satisfies(ds) or \ cnyProv.satisfies(ds): culledReqs.addDep( deps.RpmDependencies,r) elif '.so' in rpmFile: ds = deps.DependencySet() flags = [] if rpmFlags == '64bit': flags={ 'x86_64' : deps.FLAG_SENSE_REQUIRED} dep = deps.Dependency(rpm...
def do(self): for comp in self.recipe.autopkg.components.items(): capsule = self.recipe._getCapsule(comp[0])
elif isinstance(e, socket.sslerror):
elif issubclass(type(e),socket.sslerror):
def request(self, host, handler, body, verbose=0):
return self.open(shouldLock=False)
return self.open()
def open(self, shouldLock = True): """ Attempt to open the file. Returns a file object if the file exists. Returns None if the file does not exist, and needs to be created. At this point the lock is acquired. Use write() and commit() to have the file created and the lock released. """
callback = derive.DeriveCallback(cfg)
callback = derive.DeriveCallback(cfg.trustThreshold)
def runCommand(self, cfg, argSet, args, profile = False, callback = None, repos = None): args = args[1:] checkoutDir = argSet.pop('dir', None) extract = argSet.pop('extract', False) targetLabel = argSet.pop('target', None) info = prep = False if argSet.has_key('info'): del argSet['info'] info = True
self.recipe.winHelper.name = self.recipe.name self.recipe.winHelper.version = \ self.recipe.winHelper.platform = \ self.recipe.winHelper.productCode = \ self.recipe.winHelper.upgradeCode = m.contents['version']
raise SourceError('MSI capsules cannot be added without a ' 'windowsBuildService defined in the conary ' 'configuration')
def doDownload(self): f = self._findSource()
except pgsql.InternalError:
except pgsql.DatabaseError:
def connect(self, **kwargs): assert(self.database) cdb = self._connectData() if not cdb.get("port", None): cdb["port"] = -1 try: self.dbh = pgsql.connect(**cdb) except pgsql.InternalError: raise sqlerrors.DatabaseError("Could not connect to database", cdb)
trv = data.troveCache.getTrove(*nvf, withFiles = False)
trv = data.troveCache.getTrove(withFiles=False, *nvf)
def includeAction(self, data): if self.resultSet: self.outSet._setInstall(self.resultSet._getInstallSet()) self.outSet._setOptional(self.resultSet._getOptionalSet())
inspectList = [ (x, True) for x in inspectList ] while inspectList: (klass, needsCfg) = inspectList.pop(0) if isinstance(klass, recipe.Recipe):
for klass in inspectList: if issubclass(klass, recipe.Recipe):
def docObject(cfg, what): inspectList = sys.modules[__name__].classList if what in [_parentName(x).replace('Dummy', '') for x in inspectList]: return docClass(cfg, what) # see if a parent class was specified (to disambiguate) className = None if '.' in what: split = what.split('.') if len(split) != 2: print 'Too may "....
self.perlPath, perlIncPath, _ = self._getperl(macros, self.recipe) self.perlIncArgs = ' '.join('-I'+x for x in perlIncPath)
self.perlPath, perlIncPath, perlDestInc = self._getperl(macros, self.recipe) if perlDestInc: self.perlIncArgs = perlDestInc else: self.perlIncArgs = ' '.join('-I'+x for x in perlIncPath)
def _fetchPerl(self): """ Cache the perl path and @INC path with -I%(destdir)s prepended to each element if necessary """ if self.perlPath is not None: return
if type(exceptions) in (list, filter.PathSet):
if type(exceptions) in (list, set):
def updateArgs(self, *args, **keywords): """ The default way to update a class is to override any provided keywords. Subclasses which have the ability to provide more intelligent handling can override this method. This method is invoked automatically by recipe.py when a recipe references a policy object. It acts rat...
if isinstance(inclusions, (list, filter.PathSet)):
if isinstance(inclusions, (list, set)):
def updateArgs(self, *args, **keywords): """ The default way to update a class is to override any provided keywords. Subclasses which have the ability to provide more intelligent handling can override this method. This method is invoked automatically by recipe.py when a recipe references a policy object. It acts rat...
if not isinstance(self.exceptions, (tuple, list)):
if not isinstance(self.exceptions, (tuple, list, set)):
def doProcess(self, recipe): """ Invocation instance @param recipe: holds the recipe object, which is used for the macro set and package objects. @return: None @rtype: None """ self.recipe = recipe self.macros = recipe.macros
if isinstance(self.inclusions, (tuple, list)):
if isinstance(self.inclusions, (tuple, list, set)):
def doProcess(self, recipe): """ Invocation instance @param recipe: holds the recipe object, which is used for the macro set and package objects. @return: None @rtype: None """ self.recipe = recipe self.macros = recipe.macros
if not isinstance(self.inclusions, (tuple, list)):
if not isinstance(self.inclusions, (tuple, list, set)):
def doProcess(self, recipe): """ Invocation instance @param recipe: holds the recipe object, which is used for the macro set and package objects. @return: None @rtype: None """ self.recipe = recipe self.macros = recipe.macros
if ':' in host:
if host and ':' in host:
def urlUnsplit(urlTuple): """Recompose a split URL as returned by urlSplit into a single string """ scheme, user, passwd, host, port, path, query, fragment = urlTuple userpass = None if user: if passwd: userpass = "%s:${passwd}" % (urllib.quote(user)) else: userpass = urllib.quote(user) if ':' in host: # Support IPv6 a...
fileIdsPathMap, recipeObj):
fileIdsPathMap, recipeObj=None):
def _getPathIdGen(repos, sourceName, targetVersion, targetLabel, pkgNames, fileIdsPathMap, recipeObj): ident = _IdGen() # add the target branch as the first entry in the list to search searchBranches = [targetVersion.branch()] if targetLabel: # this keeps cook and emerge branchs from showing up searchBranches = [searc...
if hasattr(recipeObj, 'pathIdSearchBranches'):
if recipeObj and hasattr(recipeObj, 'pathIdSearchBranches'):
def _getPathIdGen(repos, sourceName, targetVersion, targetLabel, pkgNames, fileIdsPathMap, recipeObj): ident = _IdGen() # add the target branch as the first entry in the list to search searchBranches = [targetVersion.branch()] if targetLabel: # this keeps cook and emerge branchs from showing up searchBranches = [searc...
pass
fileIdsPathMap.pop(path)
def _getPathIdGen(repos, sourceName, targetVersion, targetLabel, pkgNames, fileIdsPathMap, recipeObj): ident = _IdGen() # add the target branch as the first entry in the list to search searchBranches = [targetVersion.branch()] if targetLabel: # this keeps cook and emerge branchs from showing up searchBranches = [searc...
for h, _ in ts.getKeys(): orderedKeys.append("%s-%s-%s.%s" %( h['name'], h['version'], h['release'], h['arch']))
transactionKeys = ts.getKeys() if transactionKeys is not None: for te in transactionKeys: if te is not None: h = te[0] orderedKeys.append("%s-%s-%s.%s" %( h['name'], h['version'], h['release'], h['arch']))
def doApply(self, fileDict, justDatabase = False, noScripts = False): # force the nss modules to be loaded from outside of any chroot pwd.getpwall()
def __init__(self, path, mode='w+b', chmod=0644, tmpsuffix = ""):
def __init__(self, path, mode='w+b', chmod=0644, tmpsuffix = "", tmpprefix = None):
def __init__(self, path, mode='w+b', chmod=0644, tmpsuffix = ""): self.finalPath = os.path.realpath(path) self.finalMode = chmod
suffix=tmpsuffix, prefix=os.path.basename(self.finalPath))
suffix=tmpsuffix, prefix=tmpprefix)
def __init__(self, path, mode='w+b', chmod=0644, tmpsuffix = ""): self.finalPath = os.path.realpath(path) self.finalMode = chmod
if type(cryptoKey.key).__name__ == 'rsaKey':
elif type(cryptoKey.key).__name__ == 'rsaKey':
def sign(self, packet, passwordCallback, sigType = None, creation = None, expiration = None, trustLevel = None, trustAmount = None, trustRegex = None, **kwargs): """Sign packet (user packet only). If expiration is None, the signature will expire when the key expire, if the key expires, otherwise it does not expire eith...
sizes = [ int(x) for x in sizes ] (fd, tmpPath) = tempfile.mkstemp(dir = self.cfg.tmpDir, suffix = '.tmp') dest = util.ExtendedFile(tmpPath, "w+", buffering = False) os.close(fd) os.unlink(tmpPath) inUrl = transport.ConaryURLOpener(proxies = self.proxies).open(url) size = util.copyfileobj(inUrl, dest) inUrl.close() de...
self._saveFileContents(neededFiles, url, sizes) url, sizes = self._saveFileContentsChangeset(fileList) return url, sizes def _saveFileContents(self, fileList, url, sizes): sizes = [ int(x) for x in sizes ] (fd, tmpPath) = tempfile.mkstemp(dir = self.cfg.tmpDir, suffix = '.tmp') dest = util.ExtendedFile(tmpPath, "w...
def getFileContents(self, caller, authToken, clientVersion, fileList, authCheckOnly = False): if clientVersion < 42: # server doesn't support auth checks through getFileContents return caller.getFileContents(clientVersion, fileList, authCheckOnly)
allGroupTroves = [ x for x in db.getTroves(allGroupTups) if x.getName() != 'group-patton' ]
allGroupTroves = db.getTroves(allGroupTups)
def initialForesightModel(installedTroves, model): allGroupTups = [ x for x in installedTroves if trove.troveIsGroup(x[0]) ] allGroupTroves = [ x for x in db.getTroves(allGroupTups) if x.getName() != 'group-patton' ] # simplistic, but we can't have loops in groups so good enough groupTroves = [] for trv in allGroupTro...
repos = self.laReposCache.repos
def populateLcache(self): """ Populate a repository lookaside cache """ class lcachePopulationState: """Used to track the state of the lcache to enable it to be populated on demand efficiently""" classes=None sourcePaths={} fetchedPaths=set()
(x[1][0] and self.fromVersion(x[1][0]) or '', x[1][1] and self.fromFlavor(x[1][1]) or ''),
(x[1][0] and self.fromVersion(x[1][0]) or 0, x[1][1] and self.fromFlavor(x[1][1]) or 0),
def getChangeSetFingerprints(self, csList, recurse, withFiles, withFileContents, excludeAutoSource, mirrorMode): byServer = {} for cs in csList: name, (oldV, oldF), (newV, newF), abs = cs host = newV.getHost() if oldV and oldV.getHost() != host: raise RuntimeError('requested fingerprint for a changeset ' 'between two d...
sourceList = [ ts._getResolveSource(debDb = depDb)
sourceList = [ ts._getResolveSource(depDb = depDb)
def _getResolveSource(self, depDb = None): # we search differently then we resolve; resolving is recursive # while searching isn't sourceList = [ ts._getResolveSource(debDb = depDb) for ts in self.troveSetList ] return searchsource.SearchSourceStack(*sourceList)
if self.parent and useParentPath: fragment = self.parent.fragment or '' port = self.parent.port or '' path = self.parent.path + (self.parent.params and '?%s' % self.parent.params or '') host = self.parent.host else: fragment = self.fragment or '' port = self.port or '' path = self.path + (self.params and '?%s' % self.p...
(host, path, fragment) = self.getHostAndPath()
def filePath(self, useParentPath=True): if self.parent and useParentPath: fragment = self.parent.fragment or '' port = self.parent.port or '' path = self.parent.path + (self.parent.params and '?%s' % self.parent.params or '') host = self.parent.host else: fragment = self.fragment or '' port = self.port or '' path = sel...
if port and host: host += host + ":" + str(port)
def filePath(self, useParentPath=True): if self.parent and useParentPath: fragment = self.parent.fragment or '' port = self.parent.port or '' path = self.parent.path + (self.parent.params and '?%s' % self.parent.params or '') host = self.parent.host else: fragment = self.fragment or '' port = self.port or '' path = sel...
if table in self.tables and name not in self.tables[table]:
if check:
def createIndex(self, table, name, columns, unique = False, check = True): if unique: unique = "UNIQUE" else: unique = "" if check: assert(table in self.tables) if name in self.tables[table]: return False sql = "CREATE %s INDEX %s on %s (%s)" % ( unique, name, table, columns) cu = self.dbh.cursor() cu.execute(sql) if t...
if keyType == 'RSA':
elif keyType == 'RSA':
def sign(self, packet, passwordCallback, sigType = None, creation = None, expiration = None, trustLevel = None, trustAmount = None, trustRegex = None, **kwargs): """Sign packet (user packet only). If expiration is None, the signature will expire when the key expire, if the key expires, otherwise it does not expire eith...
skipCapsuleOps = flags.skipCapsuleOps)
skipCapsuleOps = getattr(flags, 'skipCapsuleOps',False))
def __init__(self, db, changeSet, fsTroveDict, root, callback = None, flags = None, removeHints = {}, rollbackPhase = None, deferredScripts = None):
trv = self.getTrove(*troveTup, withFiles = False);
trv = self.getTrove(withFiles = False, *troveTup)
def getPackageComponents(self, troveTup): if self.troveIsCached(troveTup): trv = self.getTrove(*troveTup, withFiles = False); return [ x[0] for x in trv.iterTroveList(strongRefs = True, weakRefs = True) ]
self.fsJob = weakref.ref(fsJob)
if isinstance(fsJob,weakref.ProxyType): self.fsJob = fsJob else: self.fsJob = weakref.proxy(fsJob)
def __init__(self, root, db, changeSet, callback, fsJob): self.root = root self.db = db self.changeSet = changeSet self.fsJob = weakref.ref(fsJob) self.callback = callback self.errors = []
trv = oldTrove.copy() trv.applyChangeSet(trvCs) path = trv.getFile(pathId)[0]
path = newTrove.getFile(pathId)[0]
def _reassembleChangeSet(self, csInfo, nonCapsuleCsInfoMap, absOldChangeSetMap): newCs = changeset.ChangeSetFromFile(csInfo.path) # We need to restore primaryTroveList in the end primaryTroveList = newCs.primaryTroveList.copy() csfiles = changeset.files getFrozenFileFlags = csfiles.frozenFileFlags for trvCs in newCs.it...
size = cs.appendToFile(fobj)
csInfo.size = cs.appendToFile(fobj) csInfo.rawSize = fobj.tell() csInfo.fingerprint = fprint
def _getNeededChangeSets(self, caller, authToken, verPath, chgSetList, serverVersion, getCsVersion, wireCsVersion, neededCsVersion, recurse, withFiles, withFileContents, excludeAutoSource, mirrorMode, infoOnly, _recursed = False):
csInfo.size = size csInfo.fingerprint = fprint
def _getNeededChangeSets(self, caller, authToken, verPath, chgSetList, serverVersion, getCsVersion, wireCsVersion, neededCsVersion, recurse, withFiles, withFileContents, excludeAutoSource, mirrorMode, infoOnly, _recursed = False):
(csInfo, fobj, size))
(csInfo, fobj, csInfo.rawSize))
def _getNeededChangeSets(self, caller, authToken, verPath, chgSetList, serverVersion, getCsVersion, wireCsVersion, neededCsVersion, recurse, withFiles, withFileContents, excludeAutoSource, mirrorMode, infoOnly, _recursed = False):
finalJob, uJob = buildJobs(client, cache, model)
finalJob, uJob = buildJobs(client, cache, finalModel)
def emitDeferred(specClass, deferredItems): if deferredItems: # list() to copy finalModel.appendTroveOp(specClass(item=list(deferredItems))) deferredItems[:] = []
self._message('Targeting Sources' % (current, total))
self._message('Targeting Sources')
def targetSources(self, current=0, total=0): self.prefix = 'Step 2/5: ' if total: self._message('Targeting Sources (%s/%s)' % (current, total)) else: self._message('Targeting Sources' % (current, total))
weakref.ref(self))
weakref.proxy(self))
def __init__(self, db, changeSet, fsTroveDict, root, callback = None, flags = None, removeHints = {}, rollbackPhase = None, deferredScripts = None):