#!/usr/bin/python import os import stat import sha import sys testBuildFile = 'evolution.test.xpi' liveBuildFile = 'evolution.xpi' def packXPI(versionNum, fileName): f = open('install.template') updateText = f.read() f.close() updateText = updateText.replace("%version%", versionNum) f = open('install.rdf', 'w') f.write(updateText) f.close() os.spawnlp(os.P_WAIT, 'zip', 'zip', '-r', 'toolbar', '.', '-i', 'chrome.manifest', 'content/*', 'defaults/*', 'install.rdf', 'locale/*' , 'preferences/*', 'skin/*'); os.rename('toolbar.zip', fileName); os.chmod(fileName, stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH ); #end print "Updating SVN..." os.spawnlp(os.P_WAIT, 'svn', 'svn', 'update'); print "Packing xpi..." f = open('version', 'r+') versionNum = str( int(f.read()) + 1 ) f.seek(0) f.write( versionNum ) f.close() packXPI(versionNum, testBuildFile) # switch the test paths over to live f = open('content/wikiasearch.js', 'r+') text = str( f.read() ) text = text.replace('http://fp029.sjc.wikia-inc.com/search/', 'http://re.search.wikia.com/') text = text.replace('http://kt.search.isc.org/kt/', 'http://kt.search.isc.org/kttest/') f.seek(0) f.write(text) f.close() packXPI(versionNum, liveBuildFile) f = open(liveBuildFile, 'r') m = sha.new(f.read()) shaHash = str( m.hexdigest() ) f.close() os.unlink('content/wikiasearch.js') os.spawnlp(os.P_WAIT, 'svn', 'svn', 'update'); os.spawnlp(os.P_WAIT, 'svn', 'svn', 'commit', '-m', '"updated evolution.xpi"'); print "Current version: " + versionNum print "SHA1: " + shaHash