forked from iLCSoft/iLCInstall
-
Notifications
You must be signed in to change notification settings - Fork 1
/
conddbmysql.py
91 lines (64 loc) · 2.95 KB
/
conddbmysql.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
##################################################
#
# CondDBMySQL module
#
# Author: Jan Engels, DESY
# Date: Jan, 2007
#
##################################################
# custom imports
from .baseilc import BaseILC
from .util import *
class CondDBMySQL(BaseILC):
""" Responsible for the CondDBMySQL installation process. """
def __init__(self, userInput):
BaseILC.__init__(self, userInput, "CondDBMySQL", "CondDBMySQL")
self.reqfiles = [ ["lib/libconddb.so","lib/libconddb.dylib"] ]
self.download.supportedTypes = [ "GitHub" ]
self.download.gituser = 'iLCSoft'
self.download.gitrepo = 'CondDBMySQL'
self.reqmodules_buildonly = [ "MySQL" ]
def setMode(self, mode):
BaseILC.setMode(self, mode)
if Version( self.version ) > '0.7.3':
self.hasCMakeBuildSupport = True
else:
self.hasCMakeBuildSupport = False
def downloadSources(self):
BaseILC.downloadSources(self)
if Version( self.version ) > '0.7.3':
return
# move sources to a subdirectory
os.renames( self.version, self.name )
os.renames( self.name, self.version + "/" + self.name )
# create build directory
trymakedir( self.installPath + "/build" )
def compile(self):
""" compile CondDBMySQL """
os.chdir( self.installPath + "/build" )
if( self.rebuild ):
if Version( self.version ) <= '0.7.3':
os_system( "make distclean" )
tryunlink( "CMakeCache.txt" )
if Version( self.version ) <= '0.7.3':
cfg_cmd = "../" + self.name + "/configure --prefix=" + self.installPath \
+ " --with-mysql-lib=" + self.parent.module("MySQL").installPath + "/lib/mysql" \
+ " --with-mysql-inc=" + self.parent.module("MySQL").installPath + "/include/mysql" \
+ " --with-conddbprofile=localhost:mydb:calvin:hobbes 2>&1 | tee -a " + self.logfile
else:
cfg_cmd = self.genCMakeCmd() + " 2>&1 | tee -a " + self.logfile
if( os_system( cfg_cmd ) != 0 ):
self.abort( "failed to configure!!" )
if( os_system( "make ${MAKEOPTS} 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to compile!!" )
if( os_system( "make install 2>&1 | tee -a " + self.logfile ) != 0 ):
self.abort( "failed to install!!" )
def cleanupInstall(self):
BaseILC.cleanupInstall(self)
os.chdir( self.installPath + "/build" )
os_system( "make clean" )
def postCheckDeps(self):
BaseILC.postCheckDeps(self)
self.env["CondDBMySQL"] = self.installPath
self.env["COND_DB_DEBUGLOG"] = '/dev/stdout'
self.envpath["LD_LIBRARY_PATH"].append( "$CondDBMySQL/lib" )