Example #1
0
	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
Example #2
0
	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
Example #3
0
	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 )
Example #4
0
	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
Example #5
0
	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
Example #6
0
	def build( self ):
		self.__parameters.parse( sys.argv )
		settings = self.getSettings()
		self.addLogger( ConsoleLogger() )
		settings.evalConfigurationFiles( self.getToolName() )
		MApplication.build( self )
Example #7
0
	def __init__( self ):
		MApplication.__init__( self, name = 'mom' )
		self.__parameters = MomParameters()
Example #8
0
	def __init__( self, name = None, parent = None ):
		MApplication.__init__( self, name, parent )

		self.__params = SimpleCiParameters()
		self.__params.parse()
		self.__buildStatus = BuildStatus()
Example #9
0
	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()
Example #10
0
	def runNotifications( self ):
		mode = mApp().getSettings().get( Settings.ScriptRunMode )
		if mode != Settings.RunMode_Build:
			return

		MApplication.runNotifications( self )
Example #11
0
	def runWrapups( self ):
		mode = mApp().getSettings().get( Settings.ScriptRunMode )
		if mode == Settings.RunMode_Build:
			return MApplication.runWrapups( self )
		else:
			return None