40 lines
		
	
	
	
		
			1.1 KiB
			
		
	
	
	
		
			Text
		
	
	
	
	
	
		
		
			
		
	
	
			40 lines
		
	
	
	
		
			1.1 KiB
			
		
	
	
	
		
			Text
		
	
	
	
	
	
| 
								 | 
							
								#!/usr/bin/env python
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import os
							 | 
						||
| 
								 | 
							
								import subprocess
							 | 
						||
| 
								 | 
							
								import sys
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
							 | 
						||
| 
								 | 
							
								# We're in JENKINS_ROOT/workspace/brightray. Walk up to JENKINS_ROOT.
							 | 
						||
| 
								 | 
							
								JENKINS_ROOT = os.path.dirname(os.path.dirname(SOURCE_ROOT))
							 | 
						||
| 
								 | 
							
								S3_CREDENTIALS_FILE = os.path.join(JENKINS_ROOT, 'config', 's3credentials')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def main():
							 | 
						||
| 
								 | 
							
								    if not os.path.isfile(S3_CREDENTIALS_FILE):
							 | 
						||
| 
								 | 
							
								        return 'Error: Can\'t find {0}'.format(S3_CREDENTIALS_FILE)
							 | 
						||
| 
								 | 
							
								    copy_to_environment(S3_CREDENTIALS_FILE)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    run_script('bootstrap', 'https://{0}.s3.amazonaws.com/libchromiumcontent'.format(os.environ['JANKY_ARTIFACTS_S3_BUCKET']))
							 | 
						||
| 
								 | 
							
								    run_script('build')
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def copy_to_environment(credentials_file):
							 | 
						||
| 
								 | 
							
								    with open(credentials_file, 'r') as f:
							 | 
						||
| 
								 | 
							
								        for line in f:
							 | 
						||
| 
								 | 
							
								            key, value = line.strip().split('=')
							 | 
						||
| 
								 | 
							
								            value = value.strip("'")
							 | 
						||
| 
								 | 
							
								            os.environ[key] = value
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def run_script(script, *args):
							 | 
						||
| 
								 | 
							
								    script = os.path.join('script', script)
							 | 
						||
| 
								 | 
							
								    sys.stderr.write('+ {0}\n'.format(script))
							 | 
						||
| 
								 | 
							
								    sys.stderr.flush()
							 | 
						||
| 
								 | 
							
								    subprocess.check_call([sys.executable, script] + list(args))
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								if __name__ == '__main__':
							 | 
						||
| 
								 | 
							
								    sys.exit(main())
							 |