[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [websites/build-kde-org/production] /: Add support for OSX in kdecilib.py
From:       Olivier DOLE <olivier.dole () gmail ! com>
Date:       2014-05-07 21:26:24
Message-ID: E1Wi9M8-0000Rp-Lp () scm ! kde ! org
[Download RAW message or body]

Git commit 2cba2368f354e3f6d77b95adf465924d35466c99 by Olivier DOLE.
Committed on 07/05/2014 at 21:21.
Pushed by olivierd into branch 'production'.

Add support for OSX in kdecilib.py

* Do not spawn xorg on OSX platform
* Use DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH on OSX platform
* Remove hardcoded path for PYTHONPATH and PERL5LIB setup

M  +2    -0    config/build/global.cfg
M  +2    -0    documentation/build-configuration.txt
M  +60   -15   tools/kdecilib.py

http://commits.kde.org/websites/build-kde-org/2cba2368f354e3f6d77b95adf465924d35466c99


diff --git a/config/build/global.cfg b/config/build/global.cfg
index ebe1a6f..43bf4c0 100644
--- a/config/build/global.cfg
+++ b/config/build/global.cfg
@@ -21,6 +21,7 @@ terminateTestEnvExecutable=killall
 cppcheckExecutable=cppcheck
 covBuildExecutable=cov-build
 pythonExecutable=python
+perlExecutable=perl
 
 [General]
 installPrefix=/srv/jenkins/install/%(opSys)s/%(architecture)s/%(compiler)s/
@@ -28,6 +29,7 @@ remotePrefix=/srv/jenkins/install/%(opSys)s/%(architecture)s/%(compiler)s/
  remoteHostPrefix=jenkins@build.kde.org:%(remotePrefix)s
 rsyncCommand=%(rsyncExecutable)s --delete-during -rlptgoD --checksum
 createRemotePathCommand=%(sshExecutable)s -x jenkins@build.kde.org mkdir -p \
{remotePath} +listPerlIncludeDirsCommand=%(perlExecutable)s -le "print foreach @INC"
 
 [Source]
 alwaysCheckoutSources=False
diff --git a/documentation/build-configuration.txt \
b/documentation/build-configuration.txt index 1995dd1..f69d5c6 100644
--- a/documentation/build-configuration.txt
+++ b/documentation/build-configuration.txt
@@ -43,6 +43,8 @@
 - remoteHostPrefix: Provides the prefix used by RSync to transfer builds to the \
                master CI server. 
 - rsyncCommand: Holds the full command used to invoke rsync, including arguments.
 - createRemotePathCommand: Holds the full command used to create directories on the \
master CI server. +- listPerlIncludeDirsCommand: Holds the full command used to list \
directories where Perl modules can be found. +- extraPrefix: Directories to add to \
search paths e.g. PATH, PERL5LIB, LD_LIBRARY_PATH... (colon separated list).  
 == Possible entries - Source section
 - alwaysCheckoutSources: Controls whether the scripts should always run the \
                appropriate checkout command (normally skipped)
diff --git a/tools/kdecilib.py b/tools/kdecilib.py
index b55adc8..106cd52 100644
--- a/tools/kdecilib.py
+++ b/tools/kdecilib.py
@@ -318,6 +318,32 @@ class BuildManager(object):
 		self.dependencies = project.determine_dependencies( self.branchGroup )
 		# We set the installPrefix now for convenience access elsewhere
 		self.installPrefix = self.project_prefix( self.project )
+	    # Get python running version (used to set PYTHONPATH)
+	    self.pythonVersion = sys.version[:3].split(' ')[0]
+	    # Get perl module path installation (used to set PERL5LIB)
+	    self.perlSuffixes = self.find_perl_suffixes()
+	    # Set libraryPathVariable containing variable name used to manage dynamic \
library loading +	    if sys.platform == 'darwin':
+	        self.libraryPathVariable = 'DYLD_LIBRARY_PATH'
+	    else:
+	        self.libraryPathVariable = 'LD_LIBRARY_PATH'
+
+	def find_perl_suffixes(self):
+	    suffixes = []
+	    # regexp = path containing /lib/, /lib32/ or /lib64/
+	    regexp = '.*/lib[0-9]*/(.*)[\n]'
+	    compiledRegexp = re.compile(regexp)
+	    # run listPerlIncludeDirsCommand which will display current paths where to find \
PERL module +	    command = self.config.get('General', 'listPerlIncludeDirsCommand')
+	    process = subprocess.Popen( shlex.split(command), stdout=subprocess.PIPE, \
stderr=subprocess.STDOUT) +	    process.wait()
+	    # Parse command output (1 directory per line)
+	    for variable in process.stdout:
+	        result = compiledRegexp.match(variable)
+	        if result is not None:
+	            # just keep path endings (i.e. path remaining after '/lib' pattern)
+	            suffixes.append(result.group(1))
+	    return suffixes
 
 	# Determine the proper prefix (either local or remote) where a project is installed
 	def project_prefix(self, project, local = True, includeHost = True, section = \
'General'): @@ -422,6 +448,13 @@ class BuildManager(object):
 		# Turn the list of requirements into a list of prefixes
 		reqPrefixes = [self.project_prefix( requirement ) for requirement, \
requirementBranch in requirements]  
+	    # Append prefix(es) found in extraPrefix variable
+	    if self.config.has_option('General', 'extraPrefix'):
+	        extraPrefixes = self.config.get('General', 'extraPrefix')
+	        for extraPrefix in extraPrefixes.split(':')
+	            if os.path.exists(extraPrefix):
+	                reqPrefixes.append(extraPrefix)
+
 		# For runtime, we need to add ourselves as well
 		# We add the local install/ root so this will work properly even if it has not \
been deployed  if runtime:
@@ -450,7 +483,7 @@ class BuildManager(object):
 				# Do LD_LIBRARY_PATH
 				extraLocation = os.path.join( reqPrefix, libraryDirName )
 				if os.path.exists( extraLocation ):
-					envChanges['LD_LIBRARY_PATH'].append(extraLocation)
+					envChanges[self.libraryPathVariable].append(extraLocation)
 
 				# Now do PKG_CONFIG_PATH
 				extraLocation = os.path.join( reqPrefix, libraryDirName, 'pkgconfig' )
@@ -458,14 +491,15 @@ class BuildManager(object):
 					envChanges['PKG_CONFIG_PATH'].append(extraLocation)
 
 				# Now we check PYTHONPATH
-				extraLocation = os.path.join( reqPrefix, libraryDirName, \
'python2.7/site-packages' ) +				extraLocation = os.path.join( reqPrefix, \
libraryDirName, 'python' + self.pythonVersion + '/site-packages' )  if \
os.path.exists( extraLocation ):  envChanges['PYTHONPATH'].append(extraLocation)
 
-				# Next is PERL5LIB
-				extraLocation = os.path.join( reqPrefix, libraryDirName, \
                'perl5/site_perl/5.16.2/x86_64-linux-thread-multi/' )
-				if os.path.exists( extraLocation ):
-					envChanges['PERL5LIB'].append(extraLocation)
+	            # Next is PERL5LIB
+	            for perlSuffix in self.perlSuffixes:
+	                extraLocation = os.path.join( reqPrefix, libraryDirName, perlSuffix \
) +	                if os.path.exists( extraLocation ):
+	                    envChanges['PERL5LIB'].append(extraLocation)
 
 				# Next up is QT_PLUGIN_PATH
 				for pluginDirName in ['qt4/plugins', 'kde4/plugins', 'plugins', 'qca']:
@@ -729,14 +763,17 @@ class BuildManager(object):
 			# All done
 			return
 
-		# Setup Xvfb
-		runtimeEnv['DISPLAY'] = self.config.get('Test', 'xvfbDisplayName')
-		command = self.config.get('Test', 'xvfbCommand')
-		xvfbProcess = subprocess.Popen( shlex.split(command), stdout=open(os.devnull, \
'w'), stderr=subprocess.STDOUT, env=runtimeEnv ) +	    # Spawn a base user interface \
if needed +	    if self.use_xorg_environment():
+	        # Setup Xvfb
+	        runtimeEnv['DISPLAY'] = self.config.get('Test', 'xvfbDisplayName')
+	        command = self.config.get('Test', 'xvfbCommand')
+	        xvfbProcess = subprocess.Popen( shlex.split(command), \
stdout=open(os.devnull, 'w'), stderr=subprocess.STDOUT, env=runtimeEnv ) +
+	        # Startup a Window Manager
+	        command = self.config.get('Test', 'wmCommand')
+	        wmProcess = subprocess.Popen( shlex.split(command), stdout=open(os.devnull, \
'w'), stderr=subprocess.STDOUT, env=runtimeEnv )  
-		# Startup a Window Manager
-		command = self.config.get('Test', 'wmCommand')
-		wmProcess = subprocess.Popen( shlex.split(command), stdout=open(os.devnull, 'w'), \
stderr=subprocess.STDOUT, env=runtimeEnv )  
 		# Startup D-Bus and ensure the environment is adjusted
 		command = self.config.get('Test', 'dbusLaunchCommand')
@@ -798,8 +835,9 @@ class BuildManager(object):
 		# All finished, shut everyone down
 		command = self.config.get('Test', 'terminateTestEnvCommand')
 		subprocess.Popen( shlex.split(command) )
-		wmProcess.terminate()
-		xvfbProcess.terminate()
+	    if self.use_xorg_environment():
+	        wmProcess.terminate()
+	        xvfbProcess.terminate()
 
 	def convert_ctest_to_junit(self, buildDirectory):
 		# Where is the base prefix for all test data for this project located?
@@ -885,6 +923,13 @@ class BuildManager(object):
 		serverPath = self.project_prefix( self.project, local=False, \
section='DependencyInformation' )  return self.perform_rsync( source=outputDirectory, \
destination=serverPath )  
+	# Check if current process will require Xorg backend
+	# Currently only Linux platform will use Xorg backend
+	def use_xorg_environment(self):
+	    if sys.platform == 'linux2':
+		    return True
+		return False
+
 # Loads a configuration for a given project
 def load_project_configuration( project, branchGroup, platform, variation = None ):
 	# Create a configuration parser


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic