rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.edges[fromIdx].add(toIdx)
self.edges.setdefault(fromIdx, set()).add(toIdx)
def addEdge(self, fromItem, toItem): fromIdx, toIdx = (self.data.getIndex(fromItem), self.data.getIndex(toItem)) self.edges[fromIdx].add(toIdx)
return cmp(finishes[b[0]], finishes[b[0]])
return cmp(finishes[b[0]], finishes[a[0]])
def nodeSelect(a, b): return cmp(finishes[b[0]], finishes[b[0]])
self.troveFiles = trovecontents.TroveFiles(self.db)
self.troveFiles = trovefiles.TroveFiles(self.db)
def __init__(self, path):
ret = self._cursor.fetchmany_dict(size) return sqllib.CaselessDict(ret)
return [ sqllib.CaselessDict(x) for x in self._cursor.fetchmany_dict(size) ]
def fetchmany_dict(self, size): ret = self._cursor.fetchmany_dict(size) return sqllib.CaselessDict(ret)
ret = self._cursor.fetchall_dict() return sqllib.CaselessDict(ret)
return [ sqllib.CaselessDict(x) for x in self._cursor.fetchall_dict() ]
def fetchall_dict(self): ret = self._cursor.fetchall_dict() return sqllib.CaselessDict(ret)
' --single-version-externally-managed'
' --prefix=%%(prefix)s' ' --install-purelib=%%(prefix)s/lib/python2.4/site-packages/' ' --install-platlib=%%(libdir)s/python2.4/site-packages/'
def do(self, macros):
def __init__(self, path, mode, use=None, component=None): self.mode = mode
def __init__(self, path, mode, **keywords): _FileAction.__init__(self, **keywords)
def __init__(self, path, mode, use=None, component=None):
self.component=component self.use = util.checkUse(use)
def __init__(self, path, mode, use=None, component=None):
if self.mode >= 0: self.chmod(macros['destdir'], thisdest[destlen:]) def __init__(self, fromFiles, toFile, mode, use, component):
self.chmod(macros['destdir'], thisdest[destlen:]) def __init__(self, fromFiles, toFile, **keywords): _FileAction.__init__(self, **keywords)
def do(self, macros):
self.component = component if mode >= 0: if _permmap.has_key(mode): log.warning('odd permission %o, correcting to %o: add initial "0"?' \ %(mode, _permmap[mode])) mode = _permmap[mode] self.mode = mode self.use = util.checkUse(use)
def __init__(self, fromFiles, toFile, mode, use, component):
def __init__(self, fromFiles, toFile, mode = 0644, use=None, component=None): _PutFiles.__init__(self, fromFiles, toFile, mode, use, component)
def __init__(self, fromFiles, toFile, mode=0644, **keywords): _PutFiles.__init__(self, fromFiles, toFile, **keywords) self.mode = mode
def __init__(self, fromFiles, toFile, mode = 0644, use=None, component=None):
def __init__(self, fromFiles, toFile, mode = -1, use=None, component=None): _PutFiles.__init__(self, fromFiles, toFile, mode, use, component)
def __init__(self, fromFiles, toFile, **keywords): _PutFiles.__init__(self, fromFiles, toFile, **keywords)
def __init__(self, fromFiles, toFile, mode = -1, use=None, component=None):
def __init__(self, fromFiles, toFile, use=None, component=None, allowDangling=False):
def __init__(self, fromFiles, toFile, **keywords):
def __init__(self, fromFiles, toFile, use=None, component=None, allowDangling=False): """ Create a new InstallSymlinks instance
@param use: Optional argument; Use flag(s) telling whether to actually perform the action. @type use: None, Use flag, or sequence of Use flags @param allowDangling: Optional argument; set to True to allow the
@keyword allowDangling: Optional argument; set to True to allow the
def __init__(self, fromFiles, toFile, use=None, component=None, allowDangling=False): """ Create a new InstallSymlinks instance
self.use = util.checkUse(use) self.component = component self.allowDangling = allowDangling
def __init__(self, fromFiles, toFile, use=None, component=None, allowDangling=False): """ Create a new InstallSymlinks instance
def __init__(self, filespecs, recursive=0, use=None):
def __init__(self, filespecs, **keywords): BuildAction.__init__(self, **keywords)
def __init__(self, filespecs, recursive=0, use=None):
self.recursive = recursive self.use = util.checkUse(use)
def __init__(self, filespecs, recursive=0, use=None):
for newpath in util.copytree(path, dest, True):
for newpath in util.copytree(path %macros, dest, True):
def do(self, macros):
def __init__(self, paths, component=None, subdir='', use=None): if type(paths) is str: self.paths = (paths,)
def __init__(self, *args, **keywords): BuildAction.__init__(self, *args, **keywords) if type(args[0]) is tuple: self.paths = args[0]
def __init__(self, paths, component=None, subdir='', use=None):
self.paths = paths self.component = component self.subdir = subdir self.use = util.checkUse(use)
self.paths = args
def __init__(self, paths, component=None, subdir='', use=None):
if self.mode >= 0: self.chmod(macros['destdir'], d) def __init__(self, paths, **keywords): _FileAction.__init__(self, paths, **keywords) if type(paths) is str: self.paths = (paths,)
self.chmod(macros['destdir'], d) def __init__(self, *args, **keywords): _FileAction.__init__(self, *args, **keywords) if type(args[0]) is tuple: self.paths = args[0]
def do(self, macros): for path in self.paths: path = path %macros dirs = util.braceExpand(path) for d in dirs: d = d %macros dest = macros['destdir'] + d log.debug('creating directory %s', dest)
self.paths = paths if self.mode >= 0: if _permmap.has_key(self.mode): log.warning('odd permission %o, correcting to %o: add initial "0"?' \ %(mode, _permmap[self.mode])) mode = _permmap[self.mode]
self.paths = args
def __init__(self, paths, **keywords): _FileAction.__init__(self, paths, **keywords)
print "creating cs"
def _createAllCs(q, cs, uJob, lock):
from lib import epdb epdb.st()
def _createAllCs(q, cs, uJob, lock):
print "done"
def _createAllCs(q, cs, uJob, lock):
if m.name != 'ELF':
if m and m.name == 'ELF':
def _markProvides(self, path, provision, pkg, m, f): if path not in pkg.providesMap: # BuildPackage only fills in providesMap for ELF files; we may # need to create a few more DependencySets. pkg.providesMap[path] = deps.DependencySet()
if provision.startswith("abi:"): abistring = provision[4:].strip() op = abistring.index('(') abi = abistring[:op] flags = abistring[op+1:-1].split() pkg.providesMap[path].addDep(deps.AbiDependency, deps.Dependency(abi, flags)) if provision.startswith("file"): f.flags.isPathDependencyTarget(True)
return
def _markProvides(self, path, provision, pkg, m, f): if path not in pkg.providesMap: # BuildPackage only fills in providesMap for ELF files; we may # need to create a few more DependencySets. pkg.providesMap[path] = deps.DependencySet()
dict.__setitem__(self, name, value % self)
d = {name: self.get(name)} value = value.replace('%', '%%') value = value.replace('%%%%(%s)s' %name, '%%(%s)s'%name) dict.__setitem__(self, name, value % d)
def __setitem__(self, name, value):
return dict.__getitem__(self, name)
return dict.__getitem__(self, name) %self
def __getitem__(self, name):
print " cvc branch <newshadow> <trove>[=<version>][[flavor]]"
print " cvc branch <newbranch> <trove>[=<version>][[flavor]]"
def usage(rc = 1): print "usage: cvc add <file> [<file2> <file3> ...]" print " cvc annotate <file>" print " cvc branch <newshadow> <trove>[=<version>][[flavor]]" print " cvc checkout [--dir <dir>] <trove>[=<version>]" print " cvc commit [--message <message>]" print ' cvc cook [--prep] [--d...
if isinstance(other, Flag): other = bool(other) return bool(self) == other
if not isinstance(other, (Flag, bool)): return False return bool(self) == bool(other)
def __eq__(self, other): if isinstance(other, Flag): other = bool(other) return bool(self) == other
raise repository.PackageMissing(pkgName, branch)
raise PackageMissing(pkgName, branch)
def getTroveLatestVersion(self, pkgName, branch): try: return self.troveStore.troveLatestVersion(pkgName, branch) except KeyError: raise repository.PackageMissing(pkgName, branch)
raise repository.PackageMissing(pkgName, version)
raise PackageMissing(pkgName, version)
def getTrove(self, pkgName, version, flavor, pristine = True):
raise repository.PackageMissing, pkgName
raise PackageMissing, pkgName
def createTroveBranch(self, pkgName, branch):
self.groupDB = versioned.FileIndexedDatabase( self.top + "/groups.db", self.createBranches, mode)
def open(self, mode):
if self.getRequires():
if not self.getRequires().isEmpty():
def depformat(name, dep, f): f.write('\t%s: %s\n' %(name, str(dep).replace('\n', '\n\t%s' %(' '* (len(name)+2)))))
if self.getProvides():
if not self.getProvides().isEmpty():
def depformat(name, dep, f): f.write('\t%s: %s\n' %(name, str(dep).replace('\n', '\n\t%s' %(' '* (len(name)+2)))))
if self.getOldFlavor():
if not self.getOldFlavor().isEmpty():
def depformat(name, dep, f): f.write('\t%s: %s\n' %(name, str(dep).replace('\n', '\n\t%s' %(' '* (len(name)+2)))))
if self.getNewFlavor():
if not self.getNewFlavor().isEmpty():
def depformat(name, dep, f): f.write('\t%s: %s\n' %(name, str(dep).replace('\n', '\n\t%s' %(' '* (len(name)+2)))))
for oldFlavor in removed.get(name, {}).keys():
for oldFlavor in removed[name]:
def diff(self, them, absolute = 0):
built = ((),)
built = None
def cookItem(repos, cfg, item, prep=0, macros=()): """ Cooks an item specified on the command line. If the item is a file which can be loaded as a recipe, it's cooked and a change set with the result is saved. If that's not the case, the item is taken to be the name of a package, and the recipe is pulled from the :sour...
built = (tuple(troves), changeSetFile)
if troves: built = (tuple(troves), changeSetFile)
def cookItem(repos, cfg, item, prep=0, macros=()): """ Cooks an item specified on the command line. If the item is a file which can be loaded as a recipe, it's cooked and a change set with the result is saved. If that's not the case, the item is taken to be the name of a package, and the recipe is pulled from the :sour...
for component, version in troves:
for component, version in components:
def cookCommand(cfg, args, prep, macros): # this ensures the repository exists repos = repository.LocalRepository(cfg.reppath, "c") repos.close() for item in args: # we want to fork here to isolate changes the recipe might make # in the environment (such as environment variables) signal.signal(signal.SIGTTOU, signal.S...
res = troveSource.getTroveVersionFlavors(query, bestFlavor=True)
res = troveSource.getTroveVersionFlavors(query, bestFlavor=self.bestFlavor)
def _findAllFlavor(self, troveSource, missing, finalMap): namesToFind = set(self.query[0]) foundNames = set() for query in self.query: # delete any found names - don't search for them again for name in foundNames: query.pop(name, None) res = troveSource.getTroveVersionFlavors(query, bestFlavor=True) for name in res: ma...
return troveSource.getTroveLeavesByBranch(query, bestFlavor=True)
return troveSource.getTroveLeavesByBranch(query, bestFlavor=self.bestFlavor)
def callQueryFunction(self, troveSource, query): if self.getLeaves: return troveSource.getTroveLeavesByBranch(query, bestFlavor=True) else: return troveSource.getTroveVersionsByBranch(query)
return troveSource.getTroveVersionsByBranch(query, bestFlavor=True)
return troveSource.getTroveVersionsByBranch(query, bestFlavor=self.bestFlavor)
def callQueryFunction(self, troveSource, query): return troveSource.getTroveVersionsByBranch(query, bestFlavor=True)
return { version: versionFlavorDict[version] } return {}
if self.getLeaves: return { version: versionFlavorDict[version] } else: results[version] = versionFlavorDict[version] return results
def filterTroveMatches(self, name, versionFlavorDict): versionFlavorDict = QueryByBranch.filterTroveMatches(self, name, versionFlavorDict) versionStr = self.map[name][1] try: verRel = versions.Revision(versionStr) except errors.ParseError: verRel = None
return troveSource.getTroveVersionsByLabel(query, bestFlavor=True)
return troveSource.getTroveVersionsByLabel(query, bestFlavor=self.bestFlavor)
def callQueryFunction(self, troveSource, query): return troveSource.getTroveVersionsByLabel(query, bestFlavor=True)
if not self.acrossLabels:
if self.getLeaves and not self.acrossLabels:
def filterTroveMatches(self, name, versionFlavorDict): """ Take the results found in QueryByLabelPath.findAll for name and filter them based on if they match the given revision for name. Return a versionFlavorDict """ versionFlavorDict = QueryByLabelPath.filterTroveMatches(self, name, versionFlavorDict)
label = version.branch().label() if label in matchingLabels: continue matchingLabels.add(label)
if self.getLeaves: label = version.branch().label() if label in matchingLabels: continue matchingLabels.add(label)
def filterTroveMatches(self, name, versionFlavorDict): """ Take the results found in QueryByLabelPath.findAll for name and filter them based on if they match the given revision for name. Return a versionFlavorDict """ versionFlavorDict = QueryByLabelPath.filterTroveMatches(self, name, versionFlavorDict)
self.server = ShimServerProxy(server, protocol, port, authToken)
proxy = ShimServerProxy(server, protocol, port, authToken) self.c = FakeServerCache(proxy)
def __init__(self, server, protocol, port, authToken, repMap): netclient.NetworkRepositoryClient.__init__(self, repMap) self.server = ShimServerProxy(server, protocol, port, authToken)
for troveTup in sorted(group.iterTroveList(strongRefs=True)): log.debug(' %s=%s[%s]' % troveTup)
for troveTup, isStrong, byDefault, _ in sorted(group.iterTroveListInfo()): extra = '' if not byDefault: extra += '[NotByDefault]' if not isStrong: extra += '[Weak]' log.debug(' %s=%s[%s] %s' % (troveTup + (extra,)))
def _sortGroups(groupList): """ Sorts groupList so that if group a includes group b, group b is before a in the returned list. Also checks for cyclic group inclusion. """ g = graph.DirectedGraph()
raise IncompatibleKey('Unable to parse ASCII armored key')
raise openpgpfile.IncompatibleKey('Unable to parse ASCII armored key')
def addNewAsciiKey(self, userId, asciiData): keyData = openpgpfile.parseAsciiArmorKey(asciiData) if not keyData: raise IncompatibleKey('Unable to parse ASCII armored key') self.addNewKey(userId, keyData)
raise IncompatibleKey('Key must be a public key')
raise openpgpfile.IncompatibleKey('Key must be a public key')
def addNewKey(self, userId, pgpKeyData): cu = self.db.cursor() # start a transaction so that our SELECT is protected against # race conditions self.db._begin() r = cu.execute('SELECT IFNULL(MAX(keyId),0) + 1 FROM PGPKeys') keyId = r.fetchone()[0] keyRing = StringIO.StringIO(pgpKeyData)
raise IncompatibleKey('Submit only one key at a time.')
raise openpgpfile.IncompatibleKey('Submit only one key at a time.')
def addNewKey(self, userId, pgpKeyData): cu = self.db.cursor() # start a transaction so that our SELECT is protected against # race conditions self.db._begin() r = cu.execute('SELECT IFNULL(MAX(keyId),0) + 1 FROM PGPKeys') keyId = r.fetchone()[0] keyRing = StringIO.StringIO(pgpKeyData)
except sqlite3.ProgrammingError:
except sqlite3.ProgrammingError, e:
def addNewKey(self, userId, pgpKeyData): cu = self.db.cursor() # start a transaction so that our SELECT is protected against # race conditions self.db._begin() r = cu.execute('SELECT IFNULL(MAX(keyId),0) + 1 FROM PGPKeys') keyId = r.fetchone()[0] keyRing = StringIO.StringIO(pgpKeyData)
cu.execute('UPDATE PGPKeys set pgpKey=? where fingerprint=?',
if e.args[0].startswith("column") and e.args[0].endswith("is not unique"): cu.execute('UPDATE PGPKeys set pgpKey=? where fingerprint=?',
def addNewKey(self, userId, pgpKeyData): cu = self.db.cursor() # start a transaction so that our SELECT is protected against # race conditions self.db._begin() r = cu.execute('SELECT IFNULL(MAX(keyId),0) + 1 FROM PGPKeys') keyId = r.fetchone()[0] keyRing = StringIO.StringIO(pgpKeyData)
import sys print >>sys.stderr, method sys.stderr.flush()
def _method_handler(self): cookies = Cookie.get_cookies(self.req, Cookie.MarshalCookie, secret = HMACsalt) if 'authToken' in cookies: self.authToken = cookies['authToken'].value
self.debugfiles.update(frozenset([x[:-1] for x in util.popen(
self.debugfiles |= set(util.popen(
def doFile(self, path):
' -l /dev/stdout '%self.dm +fullpath).readlines()]))
' -l /dev/stdout '%self.dm +fullpath).read().split('\x00')[:-1])
def doFile(self, path):
debugfiles = list(self.debugfiles) debugfiles.sort() for file in debugfiles:
for file in sorted(self.debugfiles):
def postProcess(self): if self.debuginfo: debugfiles = list(self.debugfiles) debugfiles.sort() for file in debugfiles: dir = os.path.dirname(file) util.mkdirChain('%(destdir)s%(debugsrcdir)s/'%self.dm +dir) shutil.copy2('%(topbuilddir)s/'%self.dm +file, '%(destdir)s%(debugsrcdir)s/'%self.dm +file)
failedDeps = self._checkDependencies(cfg, repos, labelPath)
failedDeps = self._checkDependencies(repos)
def findTroves(self, troveMap, cfg, repos, labelPath, flavor): self._findTroves(troveMap) self._removeTroves(repos)
' repository. This cook will not merge config'
' repository. This cook will create new versions' ' for all files on update.'
def cookObject(repos, cfg, recipeClass, sourceVersion, changeSetFile = None, prep=True, macros={}, targetLabel = None, resume = None, alwaysBumpCount = False, allowUnknownFlags = False, allowMissingSource = False, ignoreDeps = False, logBuild = False, crossCompile = None, callback = None, requireCleanSources = False, d...
downloadThread.join(120)
downloadThread.join(20)
# def applyUpdate -- body begins here
for (name, (oldVersion, oldFlavor), (newVersion, newFlavor), abstract) \ in csList: if not newVersion: continue primaryTroveCs = cs.getNewPackageVersion(name, newVersion, newFlavor) for (name, changeList) in primaryTroveCs.iterChangedTroves(): for (changeType, version, flavor, byDef) in changeList: if changeType == ...
if skipNotByDefault: inclusions = {} for troveCs in cs.iterNewPackageList(): for (name, changeList) in troveCs.iterChangedTroves(): for (changeType, version, flavor, byDef) in changeList: if changeType == '+': if byDef: inclusions[(name, version, flavor)] = True else: inclusions.setdefault((name, version, flavor), Fa...
def _createChangeSetList(self, csList, recurse = True, skipNotByDefault = False, excludeList = []): primaryList = [] for (name, (oldVersion, oldFlavor), (newVersion, newFlavor), abstract) \ in csList: if newVersion: primaryList.append((name, newVersion, newFlavor)) else: primaryList.append((name, oldVersion, oldFlavor)...
skipNotByDefault = False, excludeList = [],
skipNotByDefault = True, excludeList = [],
def createChangeSet(self, csList, recurse = True, skipNotByDefault = False, excludeList = [], callback = None, withFiles = False, withFileContents = False): """ Like self.createChangeSetFile(), but returns a change set object. withFiles and withFileContents are the same as for the underlying repository call. """ (fullC...
skipNotByDefault = False, excludeList = [],
skipNotByDefault = True, excludeList = [],
def createChangeSetFile(self, path, csList, recurse = True, skipNotByDefault = False, excludeList = [], callback = None): """ Creates <path> as a change set file.
store = DataStoreSet(storeList)
store = DataStoreSet(*storeList)
def __init__(self, name, troveStore, contentsDir, repositoryMap, logFile = None, requireSigs = False):
attempt, methodname, str(e,args))
attempt, methodname, str(e.args))
def callWrapper(self, protocol, port, methodname, authToken, args): """ Returns a tuple of (usedAnonymous, Exception, result). usedAnonymous is a Boolean stating whether the operation was performed as the anonymous user (due to a failure w/ the passed authToken). Exception is a Boolean stating whether an error occured....
(i.e. C{r.ComponentRequires({'data', set(('lib',))})} means that in
(i.e. C{r.ComponentRequires({'data': set(('lib',))})} means that in
def _markItem(self, path, group): # XXX -- remove return return self.setUserGroupDep(path, user, deps.GroupInfoDependencies)
and C{r.ComponentRequires({'foo', {'data', set(('lib',))}})} makes that
and C{r.ComponentRequires({'foo': {'data': set(('lib',))}})} makes that
def _markItem(self, path, group): # XXX -- remove return return self.setUserGroupDep(path, user, deps.GroupInfoDependencies)
cu.executemany(''' INSERT INTO tmpInstances SELECT instanceId FROM Instances WHERE itemId=(SELECT itemId FROM Items WHERE item=?) AND versionId=(SELECT versionId FROM Versions WHERE version=?) AND flavorId=(SELECT flavorId FROM Flavors WHERE flavor=?) ''', ( (n, v.asString(), f.freeze()) for (n, v, f)
cu.executemany(""" INSERT INTO tmpInstances SELECT instanceId FROM Instances JOIN Items ON Instances.itemId = Items.itemId JOIN Versions ON Instances.versionId = Versions.versionId JOIN Flavors ON Instances.flavorId = Flavors.flavorId WHERE Items.item = ? AND Versions.version = ? AND Flavors.flavor = ? """, ( (n, v.asS...
def resolve(self, label, depSetList, troveList=[]): """ Determine troves that provide the given dependencies, restricting by label and limiting to latest version for each (name, flavor) pair. """ # dep set list must be unique and indexable. depSetList = list(set(depSetList))
instanceIds = [ x[0] for x in cu.execute("SELECT instanceId FROM tmpInstances") ] cu.execute('''INSERT INTO tmpInstances2 SELECT DISTINCT includedId FROM TroveTroves LEFT JOIN tmpInstances ON includedId = tmpInstances.instanceId WHERE tmpInstances.instanceId IS NULL ''', start_transaction=False) cu.execute('''INSERT I...
cu.execute(""" INSERT INTO tmpInstances2 SELECT DISTINCT TT.includedId FROM tmpInstances AS TI JOIN TroveTroves AS TT USING(instanceId) LEFT JOIN tmpInstances as haveTI ON TT.includedId = haveTI.instanceId WHERE haveTI.instanceId IS NULL """, start_transaction=False) cu.execute("INSERT INTO tmpInstances SELECT instance...
def resolve(self, label, depSetList, troveList=[]): """ Determine troves that provide the given dependencies, restricting by label and limiting to latest version for each (name, flavor) pair. """ # dep set list must be unique and indexable. depSetList = list(set(depSetList))
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def updateMetadata(self, auth, troveName, branch, shortDesc, longDesc, source, selUrl, selLicense, selCategory): branch = self.repServer.thawVersion(branch)
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def userlist(self, auth): return self._write("user_admin", netAuth = self.repServer.auth)
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addPermForm(self, auth, userGroupName): groups = (x[1] for x in self.repServer.auth.iterGroups()) labels = (x[1] for x in self.repServer.auth.iterLabels()) troves = (x[1] for x in self.repServer.auth.iterItems())
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def editPermForm(self, auth, group, label, trove, writeperm, capped, admin): groups = (x[1] for x in self.repServer.auth.iterGroups()) labels = (x[1] for x in self.repServer.auth.iterLabels()) troves = (x[1] for x in self.repServer.auth.iterItems())
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addPerm(self, auth, group, label, trove, writeperm, capped, admin): writeperm = (writeperm == "on") capped = (capped == "on") admin = (admin == "on")
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def editPerm(self, auth, group, label, trove, oldlabel, oldtrove, writeperm, capped, admin): writeperm = (writeperm == "on") capped = (capped == "on") admin = (admin == "on")
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addGroupForm(self, auth): users = dict(self.repServer.auth.iterUsers()) return self._write("add_group", modify = False, userGroupName = None, userGroupId = None, users = users, members = [])
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def manageGroupForm(self, auth, userGroupName): users = dict(self.repServer.auth.iterUsers()) groupId = self.repServer.auth.getGroupIdByName(userGroupName) members = list(self.repServer.auth.iterGroupMembers(groupId))
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def manageGroup(self, auth, userGroupId, userGroupName, initialUserIds): try: self.repServer.auth.renameGroup(userGroupId, userGroupName) except GroupAlreadyExists: return self._write("error", shortError="Invalid Group Name", error = "The group name you have chosen is already in use.") self.repServer.auth.updateGroupMe...
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addGroup(self, auth, userGroupName, initialUserIds): newGroupId = self.repServer.auth.addGroup(userGroupName) for userId in initialUserIds: self.repServer.auth.addGroupMember(newGroupId, userId)
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def deleteGroup(self, auth, userGroupId): self.repServer.auth.deleteGroupById(userGroupId) self._redirect("userlist")
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def deletePerm(self, auth, groupId, labelId, itemId): # labelId and itemId are optional parameters so we can't # default them to None: the fields decorators treat that as # required, so we need to reset them to None here: if not labelId: labelId = None if not itemId: itemId = None self.repServer.auth.deleteAcl(groupId,...
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addUserForm(self, auth): return self._write("add_user")
@checkAuth(write = True, admin = True)
@checkAuth(admin = True)
def addUser(self, auth, user, password, write, admin): self.repServer.addUser(self.authToken, 0, user, password) self.repServer.addAcl(self.authToken, 0, user, "", "", write, True, admin)
SYNOPSIS ======== C{r.FixDirModes([filterexp])}
def replaceBuildPath(self, path):
The C{r.FixDirModes()} class is called from within a Conary recipe to modify directory permissions which would otherwise prevent Conary from packaging C{%(destdir)s} as a non-root user.
The C{r.FixDirModes()} class modifies directory permissions whicho would otherwise prevent Conary from packaging C{%(destdir)s} as a non-root user.
def replaceBuildPath(self, path):
fixed up now so that we can traverse the tree in following policy,
fixed up first so that Conary can traverse the tree in following policy,
def replaceBuildPath(self, path):
This policy must be run first so that other policies can be counted on to search the full directory tree.
def replaceBuildPath(self, path):
logMe(3, "Emptying out redirects...")
logMe(3, "Changing absolute redirects to branch redirects...")
def migrate(self): from conary import files # fix the duplicate FileStreams.fileId fields logMe(3, "Looking for duplicate fileId entries...") # this takes a bit to execute, especially on sqlite self.cu.execute(""" CREATE TEMPORARY TABLE origs AS SELECT a.streamId AS streamId, a.fileId AS fileId FROM FileStreams AS ...
SELECT instanceId, item FROM Instances
SELECT instanceId, item, version FROM Instances
def migrate(self): from conary import files # fix the duplicate FileStreams.fileId fields logMe(3, "Looking for duplicate fileId entries...") # this takes a bit to execute, especially on sqlite self.cu.execute(""" CREATE TEMPORARY TABLE origs AS SELECT a.streamId AS streamId, a.fileId AS fileId FROM FileStreams AS ...
for instanceId, name in self.cu: pkgName = name.split(":")[0]
for instanceId, name, version in self.cu: l = name.split(":") pkgName = l[0] if len(l) > 1: compName = l[1] else: compName = None branchStr = versions.VersionFromString(version).branch().asString()
def migrate(self): from conary import files # fix the duplicate FileStreams.fileId fields logMe(3, "Looking for duplicate fileId entries...") # this takes a bit to execute, especially on sqlite self.cu.execute(""" CREATE TEMPORARY TABLE origs AS SELECT a.streamId AS streamId, a.fileId AS fileId FROM FileStreams AS ...
subPkgName = subName.split(":")[0] if subPkgName != subName: version = versions.VersionFromString(subVersion) branchStr = version.branch().asString() branchId = cu2.execute("SELECT branchId FROM " "Branches WHERE branch=?", branchStr).fetchall() if not branchId: cu2.execute("INSERT INTO Branches (branch) " "VALUES (?)...
l = subName.split(":") subPkgName = l[0] if len(l) > 1: subCompName = l[1] else: subCompName = None subVersion = versions.VersionFromString(subVersion) subBranchStr = subVersion.branch().asString() if subPkgName != pkgName or branchStr != subBranchStr: if compName == subCompName: branchId = cu2.execute("SELECT branchI...
def migrate(self): from conary import files # fix the duplicate FileStreams.fileId fields logMe(3, "Looking for duplicate fileId entries...") # this takes a bit to execute, especially on sqlite self.cu.execute(""" CREATE TEMPORARY TABLE origs AS SELECT a.streamId AS streamId, a.fileId AS fileId FROM FileStreams AS ...
cu2.execute(""" INSERT INTO TroveRedirects (instanceId, itemId, branchId, flavorId) VALUES (?, ?, ?, NULL)""", instanceId, subItemId, branchId) cu2.execute("DELETE FROM TroveTroves WHERE instanceId=?", instanceId)
def migrate(self): from conary import files # fix the duplicate FileStreams.fileId fields logMe(3, "Looking for duplicate fileId entries...") # this takes a bit to execute, especially on sqlite self.cu.execute(""" CREATE TEMPORARY TABLE origs AS SELECT a.streamId AS streamId, a.fileId AS fileId FROM FileStreams AS ...
for trove in self.repos.walkTroveSet(parentTrove):
for trove in self.repos.walkTroveSet(parentTrove, withFiles = False):
def files(self, auth, t, v, f): v = versions.ThawVersion(v) f = deps.ThawDependencySet(f)
attempt, methodname, str(e,args)))
attempt, methodname, str(e.args)))
def callWrapper(self, protocol, port, methodname, authToken, args): """ Returns a tuple of (usedAnonymous, Exception, result). usedAnonymous is a Boolean stating whether the operation was performed as the anonymous user (due to a failure w/ the passed authToken). Exception is a Boolean stating whether an error occured....
if parser.rargs: potentialParam = parser.rargs[0] if not potentialParam: del parser.rargs[0] elif potentialParam[0] != '-': value = potentialParam del parser.rargs[0]
if option.had_explicit_value: value = parser.rargs[0] del parser.rargs[0]
def optParamCallback(option, opt_str, value, parser, *args, **kw): value = True if parser.rargs: potentialParam = parser.rargs[0] if not potentialParam: del parser.rargs[0] elif potentialParam[0] != '-': value = potentialParam del parser.rargs[0] setattr(parser.values, option.dest, value)
d['debug'] = COUNT_PARAM, 'Print helpful debugging output (use multiple times for internal debug info)'
d['debug'] = OPT_PARAM, 'Print helpful debugging output (use --debug=all for internal debug info)'
def _processArgs(params, cfgMap, cfg, usage, argv=sys.argv, version=None, commonParams=None, useHelp=False, defaultGroup=None, interspersedArgs=True, hobbleShortOpts=False): argSet = {} # don't mangle the command line argv = argv[:] # historically, usage was generally a function to print out the usage # message. We w...