179
|
1 |
#============================================================================
|
|
2 |
#Name : ccmutil.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 |
""" utility module related to ccm """
|
|
21 |
|
|
22 |
import nokia.nokiaccm
|
|
23 |
import configuration
|
|
24 |
import ccm.extra
|
|
25 |
|
|
26 |
def get_session(database, username, password, engine, dbpath):
|
|
27 |
""" Returns a user session """
|
|
28 |
session = None
|
|
29 |
if database != None:
|
|
30 |
session = nokia.nokiaccm.open_session(username, password, database=database)
|
|
31 |
else:
|
|
32 |
session = nokia.nokiaccm.open_session(username, password, engine, dbpath)
|
|
33 |
return session
|
|
34 |
|
|
35 |
def get_ccm_cache(ccm_cache_xml):
|
|
36 |
cache = None
|
|
37 |
if ccm_cache_xml is not None:
|
|
38 |
cache = str(ccm_cache_xml)
|
|
39 |
return cache
|
|
40 |
|
|
41 |
def get_ccm_project(session, deliveryfile, waroot):
|
|
42 |
""" Returns top level ccm project """
|
|
43 |
configBuilder = configuration.NestedConfigurationBuilder(open(deliveryfile, 'r'))
|
|
44 |
configSet = configBuilder.getConfiguration()
|
|
45 |
for config in configSet.getConfigurations():
|
|
46 |
waroot = config['dir']
|
|
47 |
print "Found wa for project %s" % waroot
|
|
48 |
return ccm.extra.get_toplevel_project(session, waroot)
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|