def build( self ): '''Execute the tool.''' settings = self.getSettings() settings.set( Settings.ScriptLogLevel, self.getParameters().getDebugLevel() ) self.addLogger( ConsoleLogger() ) # parse settings: settings.evalConfigurationFiles( self.getToolName() ) settings.set( Settings.ScriptLogLevel, self.getParameters().getDebugLevel() ) self.debug( self, 'debug level is {0}'.format( self.getParameters().getDebugLevel() ) ) database = os.path.join( self.getDataDir(), 'buildstatus.sqlite' ) self.debug( self, 'using database: {0}'.format( database ) ) self.getBuildStatus().setDatabaseFilename( database ) MApplication.build( self ) # call base class implementation
def __init__( self, location, branch = None, tag = None, path = 'admin', script = 'buildscript.py' , rootTrunk = False ): MApplication.__init__( self, name = 'proxybuilder' ) self.addLogger( ConsoleLogger() ) self.setDoBranchBuilds( False ) self.__params = BuildParameters() self.__params.parse() self.__params.apply( self.getSettings() ) self.getSettings().set( Settings.ScriptLogLevel, self.__params.getDebugLevel() ) self.__location = location self.__branch = branch self.__tag = tag self.__path = path self.__script = script self.__rootTrunk = rootTrunk
def _buildAndReturn( self ): '''Overloaded method that verifies the run mode.''' if self.getSettings().get( Settings.ScriptRunMode ) not in Settings.RunModes: raise MomError( 'Unknown run mode "{0}". Known run modes are: {1}'.format( self.getSettings().get( Settings.ScriptRunMode ), ', '.join( Settings.RunModes ) ) ) return MApplication._buildAndReturn( self )
def createXmlNode( self, document, recursive = True ): node = MApplication.createXmlNode( self, document, recursive ) # add machine info for key, value in machine_info().items(): node.attributes[key] = value node.attributes["returncode"] = str( self.getReturnCode() ) node.attributes["startTime"] = str ( formatted_time( self.__startTime ) ) node.attributes["sys-shortname"] = self.getSystemShortName() return node
def runShutDowns( self ): mode = mApp().getSettings().get( Settings.ScriptRunMode ) if mode == Settings.RunMode_Build and not self.getParameters().getDisableShutdown(): if self.getDeleteLogDirOnShutdown(): try: if os.path.isdir( self.getLogDir() ): mApp().debugN( self, 2, 'deleting log directory structure at "{0}"'.format( self.getLogDir() ) ) shutil.rmtree( self.getLogDir() ) except OSError as e: raise ConfigurationError( 'Cannot delete log directory at "{0}": {1}'.format( self.getLogDir(), str( e ) ) ) if self.getPackagesDir(): try: if os.path.isdir( self.getPackagesDir() ): mApp().debugN( self, 2, 'deleting packages directory structure at "{0}"'.format( self.getPackagesDir() ) ) shutil.rmtree( self.getPackagesDir() ) except OSError as e: raise ConfigurationError( 'Cannot delete packages directory at "{0}": {1}'.format( self.getPackagesDir(), str( e ) ) ) return MApplication.runShutDowns( self ) else: return None
def build( self ): self.__parameters.parse( sys.argv ) settings = self.getSettings() self.addLogger( ConsoleLogger() ) settings.evalConfigurationFiles( self.getToolName() ) MApplication.build( self )
def __init__( self ): MApplication.__init__( self, name = 'mom' ) self.__parameters = MomParameters()
def __init__( self, name = None, parent = None ): MApplication.__init__( self, name, parent ) self.__params = SimpleCiParameters() self.__params.parse() self.__buildStatus = BuildStatus()
def __init__( self, minimumMomVersion = None, name = None, parent = None ): MApplication.__init__( self, minimumMomVersion, name, parent ) mApp().getSettings().set( Settings.ScriptBuildName, name ) self.__project = None self.__parameters = BuildParameters() self.__startTime = datetime.utcnow()
def runNotifications( self ): mode = mApp().getSettings().get( Settings.ScriptRunMode ) if mode != Settings.RunMode_Build: return MApplication.runNotifications( self )
def runWrapups( self ): mode = mApp().getSettings().get( Settings.ScriptRunMode ) if mode == Settings.RunMode_Build: return MApplication.runWrapups( self ) else: return None