""" This class represents one command given by an rpc client """ # 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 import config, os, string from log4py import Logger class Command: def __init__(self): raise Exception("Command::__init__") def getDefines(self): raise Exception("Command::getDefines") def getCommandName(self): raise Exception("Command::getCommandName") def getUserId(self): raise Exception("Command::getUserId") def getSpecRepoId(self): raise Exception("Command::getSpecRepoId") def getSpecFileId(self): raise Exception("Command::getSpecFileId") def getToEmail(self): raise Exception("Command::getToEmail") def getDistroArchTag(self): raise Exception("Command::getDistroArchTag") def getPriority(self): raise Exception("Command::getPriority") def getTargetId(self): raise Exception("Command::getTargetId") def getId(self): raise Exception("Command::getId") def getSpecRepositoryName(self): raise Exception("Command::getSpecRepositoryName") def getSpecFileFileName(self): raise Exception("Command::getSpecFileFileName") def getAuthority(self): raise Exception("Command::getAuthority") # get the version of the spec file # a version is unique within one specrepository but might not be unique within all specrepositories # this is not the database id of this specfile version def getVersion(self): raise Exception("Command::getVersion") def getSpecFileShortFileName(self): tmp = self.getSpecFileFileName() (dir,fname) = os.path.split(tmp) return fname def toMultiLineString(self): output = "" output = output + "command id: " + str(self.getId()) + "\n" output = output + "spec file: " + self.getSpecFileFileName() + " (" + str(self.getSpecFileId()) + ")\n" output = output + "spec repo: " + self.getSpecRepositoryName() + " (" + str(self.getSpecRepoId()) + ")\n" output = output + "defines: " + self.getDefines() + "\n" output = output + "command name: " + self.getCommandName() + "\n" output = output + "user id: " + str(self.getUserId()) + "\n" output = output + "priority: " + str(self.getPriority()) + "\n" output = output + "to email: " + self.getToEmail() + "\n" output = output + "target id: " + str(self.getTargetId()) + "\n" output = output + "version: " + str(self.getVersion()) + "\n" output = output + "authority: " + str(self.getAuthority()) + "\n" return output def toString(self): return "commandName=" + self.getCommandName() + ",userId=" + str(self.getUserId()) + ",specRepoId=" + str(self.getSpecRepoId()) + ",toEmail=" + self.getToEmail() + ",specFileId=" + str(self.getSpecFileId()) + ",distroArchTag=" + self.getDistroArchTag() + ",commandId=" + str(self.getId()) + ",priority=" + str(self.getPriority()) def getArch(self): fullStr = self.getDistroArchTag() # get everything after the first '-' #print "fullStr: " + str(fullStr) #print "string find voor - : " + str(string.find('-', fullStr)) retval = fullStr[string.find(fullStr,'-')+1:] return retval