diff -r 7685cec9fd3c -r f2ddfa555b0f doc/api/python/buildmanagement-pysrc.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/api/python/buildmanagement-pysrc.html Fri Sep 11 11:54:49 2009 +0100 @@ -0,0 +1,544 @@ + + + + + buildmanagement + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Module buildmanagement + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module buildmanagement

+
+  1  #============================================================================  
+  2  #Name        : buildmanagement.py  
+  3  #Part of     : Helium  
+  4   
+  5  #Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+  6  #All rights reserved. 
+  7  #This component and the accompanying materials are made available 
+  8  #under the terms of the License "Eclipse Public License v1.0" 
+  9  #which accompanies this distribution, and is available 
+ 10  #at the URL "http://www.eclipse.org/legal/epl-v10.html". 
+ 11  # 
+ 12  #Initial Contributors: 
+ 13  #Nokia Corporation - initial contribution. 
+ 14  # 
+ 15  #Contributors: 
+ 16  # 
+ 17  #Description: 
+ 18  #=============================================================================== 
+ 19   
+ 20  """ BuildManagement module """ 
+ 21   
+ 22  import os 
+ 23  import logging 
+ 24  import types 
+ 25  import string 
+ 26   
+ 27  import ant 
+ 28  import ccm 
+ 29  import configuration 
+ 30  import nokia.nokiaccm 
+ 31   
+ 32   
+ 33  # Uncomment this line to enable logging in this module, or configure logging elsewhere 
+ 34  logging.basicConfig(level=logging.DEBUG) 
+ 35  logger = logging.getLogger("buildmanagement") 
+ 36   
+
37 -def buildmanager(synergyhost, databasepath, configfile, specname): +
38 """ Buildmanager """ + 39 logger.debug("Start buildmanger") + 40 session = None + 41 session = nokia.nokiaccm.open_session(engine=synergyhost, dbpath=databasepath) + 42 print ('session = %s', session) + 43 session.role = "build_mgr" + 44 configBuilder = configuration.NestedConfigurationBuilder(open(configfile, 'r')) + 45 configSet = configBuilder.getConfiguration() + 46 logger.debug('Getting configuration: "' + specname + '" from: "' + configfile + '"') + 47 configs = configSet.getConfigurations(specname) + 48 for config in configs: + 49 for k in sorted(config.keys()): + 50 value = config[k] + 51 if isinstance(value, types.UnicodeType): + 52 value = value.encode('ascii', 'ignore') + 53 #logger.debug( k + ': ' + str(value)) + 54 logger.debug(config['function.name']) + 55 result = eval(config['function.name'])(session, config) + 56 logger.debug("got result:" + result) + 57 logger.debug('Finished parsing configs') + 58 session.close() + 59 del(session) +
60 +
61 -def add_approved_tasks(session, config): +
62 """ add approved tasks to be updated to project """ + 63 logger.debug("Start adding approved tasks") + 64 #this assumes there is only one folder in the reconfigure properties: + 65 if config['project.release.folder'] == "automatic": + 66 toplevelproject = ccm.Project(session, config['project.four.part.name']) + 67 releasefolders = toplevelproject.folders + 68 releasefolder = releasefolders[0] + 69 logger.debug("Release folder found from rp is: " + releasefolder.name) + 70 else: + 71 releasefolder = ccm.Folder(session, config['project.release.folder']) + 72 + 73 folderlist = force_list(config['project.approval.folders']) + 74 + 75 for approvalfolderfpn in folderlist: + 76 approvalfolder = ccm.Folder(session, approvalfolderfpn) + 77 logger.debug("Copying tasks from folder " + approvalfolder.name + ", to folder " + releasefolder.name) + 78 approvalfolder.copy(releasefolder) + 79 + 80 logger.debug("Finished adding approved tasks") +
81 +
82 -def reconcile(session, config): +
83 """ reconcile """ + 84 logger.debug("Start reconciling: " + config['project.four.part.name']) + 85 toplevelproject = ccm.Project(session, config['project.four.part.name']) + 86 toplevelproject.reconcile(updatewa=True, recurse=True, consideruncontrolled=True, missingwafile=True, report=True) + 87 logger.debug("Finished reconciling: " + config['project.four.part.name']) +
88 +
89 -def set_latest_baseline(session, config): +
90 """ Setting latest baseline """ + 91 logger.debug("Start updating the baseline of: " + config['project.name']) + 92 toplevelproject = ccm.Project(session, config['project.four.part.name']) + 93 latestbaseline = toplevelproject.get_latest_baseline(config['project.version.filter'], config['project.baseline.state']) + 94 logger.debug("Using: " + latestbaseline) + 95 toplevelproject.set_baseline(latestbaseline, recurse=True) + 96 logger.debug("Finished updating the baseline of: " + config['project.name']) +
97 +
98 -def reconfigure(session, config): +
99 """ recongifure """ +100 logger.debug("Start reconfiguring: " + config['project.four.part.name']) +101 toplevelproject = ccm.Project(session, config['project.four.part.name']) +102 replacesubprojects = config.get_boolean('replace.subprojects', True) +103 recursesubprojects = config.get_boolean('recurse.subprojects', True) +104 updatekeepgoing = not config.get_boolean('update.failonerror', True) +105 toplevelproject.update(recursesubprojects, replacesubprojects, updatekeepgoing) +106 logger.debug("Finished reconfiguring: " + config['project.four.part.name']) +
107 +
108 -def update_release_tags(session, config): +
109 """ update release tags """ +110 logger.debug("Start updating release tags in folder: " + config['project.release.folder']) +111 if config['project.release.folder'] == "automatic": +112 toplevelproject = ccm.Project(session, config['project.four.part.name']) +113 releasefolders = toplevelproject.folders +114 releasefolder = releasefolders[0] +115 logger.debug("Release folder found from rp is: " + releasefolder.name) +116 else: +117 releasefolder = ccm.Folder(session, config['project.release.folder']) +118 for task in releasefolder.tasks: +119 if str(task.get_release_tag()).strip() == config['task.release.tag.from']: +120 logger.debug("Changing release tag of %s to %s" % (task.name, config['task.release.tag.to'])) +121 task.set_release_tag(config['task.release.tag.to']) +122 logger.debug("Finished updating release tags in folder: " + config['project.release.folder']) +
123 +
124 -def create_baseline(session, config): +
125 """ Create baseline """ +126 logger.debug("Start creating the baseline(s): " + config['project.name'] + "-" + config['baseline.tag']) +127 project = ccm.Project(session, config['project.four.part.name']) +128 logger.debug("Project: " + project.name) +129 project.create_baseline(config['project.name'] + "-" + config['baseline.tag'], config['project.release.tag'], config['baseline.tag'], config['baseline.purpose'], config['baseline.state']) +130 logger.debug("Finished creating the baseline: " + config['project.name'] + "-" + config['baseline.tag']) +
131 +
132 -def force_list(myobject): +
133 """ force list of objects """ +134 if isinstance(myobject, list): +135 return myobject +136 else: +137 return [myobject] +
138 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + +