""" This class contains all the functions for storing stuff """ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Copyright 2004 Dries Verachtert # normally you dont use this class directly but a subclass # use getInstance() to get the correct type of subclass (defined by a config parameter) # PostgresqlStorage: store everything in a pgsql database # MemoryStorage: store everything in memory import posixpath, posix, string, sys, config sys.path.append("pydar") sys.path.append(".") from command import Command from log4py import Logger # SINGLETON, so use getInstance() class Storage: __myInstance = None __myConfig = None def __init__(self): raise Exception("use getStorage() on StorageFactory") def getConfig(cls): #raise Exception("todo getConfig") if cls.__myConfig == None: cls.__myConfig = config.Config.getInstance() return cls.__myConfig getConfig = classmethod(getConfig) ## classmethod #def getInstance(cls): # if cls.__myInstance == None: # unused = Storage() # return cls.__myInstance #getInstance = classmethod(getInstance) def clearAssignedRights(self): raise Exception("clearAssignedRights:: Dont use Storage but a subclass of Storage, use getInstance()") def addAccount(self,name,type,fullname,passw,rights): raise Exception("addAccount:: Dont use Storage but a subclass of Storage, use getInstance()") def updateTarget(self, newTarget): raise Exception("updateTarget:: Dont use Storage but a subclass of Storage, use getInstance()") def getSpecRepositoryFileListToIds(self,specRepo): raise Exception("getSpecRepositoryFileListToIds:: Dont use Storage but a subclass of Storage, use getInstance()") def saveSpecRepositorySpecFile(self, specRepo, specRepoSpecFile): raise Exception("saveSpecRepositorySpecFile:: Dont use Storage but a subclass of Storage, use getInstance()") def saveSpecRepository(self,specRepo): raise Exception("saveSpecRepository:: Dont use Storage but a subclass of Storage, use getInstance()") def getSpecRepositoryFileListToChecksum(self,specRepo): raise Exception("getSpecRepositoryFileListToChecksum:: Dont use Storage but a subclass of Storage, use getInstance()") def checkIfValidUserId(self, userId,password, right): raise Exception("checkIfValidUserId:: Dont use Storage but a subclass of Storage, use getInstance()") def checkIfValidBuildMachineId(self, buildmachineid, password, right): raise Exception("checkIfValidBuildMachineId:: Dont use Storage but a subclass of Storage, use getInstance()") def registerSlave(self, buildmachineid): raise Exception("registerSlave:: Dont use Storage but a subclass of Storage, use getInstance()") def addDistroArchTag(self, buildmachineid, machroot): raise Exception("addDistroArchTag:: Dont use Storage but a subclass of Storage, use getInstance()") def addResultFileName(self,buildmachineid,commandId,fileName): raise Exception("addResultFileName:: Dont use Storage but a subclass of Storage, use getInstance()") def setBuildResult(self,buildmachineid,commandId,buildResult): raise Exception("setBuildResult:: Dont use Storage but a subclass of Storage, use getInstance()") # a seperate program updates the spec file repositories. # result: the commands which have to be executed to update all the spec file repositories # example: "cd /a/b/c; svn update" def getSpecRepositoriesUpdateCommands(self): raise Exception("getSpecRepositoriesUpdateCommands:: Dont use Storage but a subclass of Storage, use getInstance()") def reserveCommand(self, buildmachineid): raise Exception("reserveCommand:: Dont use Storage but a subclass of Storage, use getInstance()") # get a mapping from something like fc3-i386 to --define fc3 1 --define dist fc3 for example def getDefinesByDistroArchTag(self,distroArchTag): raise Exception("getDefinesByDistroArchTag:: Dont use Storage but a subclass of Storage, use getInstance()")