summaryrefslogtreecommitdiff
authorGiulio Cesare Solaroli <giulio.cesare@clipperz.com>2013-04-17 15:45:39 (UTC)
committer Giulio Cesare Solaroli <giulio.cesare@clipperz.com>2013-04-17 15:45:39 (UTC)
commit48c9280c9a255f2a85ad5729830df884e64a9c5d (patch) (unidiff)
tree14787438153cdc0b4b445c66f046bccf3dd99ee2
parent4ce8041b11afc7f02c678565e0e96e59a5a557b6 (diff)
downloadclipperz-48c9280c9a255f2a85ad5729830df884e64a9c5d.zip
clipperz-48c9280c9a255f2a85ad5729830df884e64a9c5d.tar.gz
clipperz-48c9280c9a255f2a85ad5729830df884e64a9c5d.tar.bz2
Updated build script to handle 'checksum' target
The build script can now be invoked, for example, with the following options: > ./scripts/build checksum --frontend beta gamma
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--backend/checksum/properties/checksum.properties.json4
-rwxr-xr-x[-rw-r--r--]scripts/builder/backendBuilder.py2
-rwxr-xr-xscripts/builder/backends/checksumBuilder.py50
-rwxr-xr-x[-rw-r--r--]scripts/builder/backends/devBuilder.py8
-rwxr-xr-xscripts/builder/main.py7
-rwxr-xr-x[-rw-r--r--]scripts/builder/repository.py0
6 files changed, 62 insertions, 9 deletions
diff --git a/backend/checksum/properties/checksum.properties.json b/backend/checksum/properties/checksum.properties.json
new file mode 100644
index 0000000..1c2dae5
--- a/dev/null
+++ b/backend/checksum/properties/checksum.properties.json
@@ -0,0 +1,4 @@
1{
2 "request.path": "json",
3 "should.pay.toll": "true"
4} \ No newline at end of file
diff --git a/scripts/builder/backendBuilder.py b/scripts/builder/backendBuilder.py
index 20b4bd0..b4ee990 100644..100755
--- a/scripts/builder/backendBuilder.py
+++ b/scripts/builder/backendBuilder.py
@@ -1,143 +1,145 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import sys, os, json 4import sys, os, json
5import shutil 5import shutil
6import hashlib 6import hashlib
7 7
8from functools import reduce 8from functools import reduce
9from operator import add 9from operator import add
10from itertools import izip 10from itertools import izip
11 11
12import main 12import main
13 13
14#=================================================================== 14#===================================================================
15 15
16class BackendBuilder(object): 16class BackendBuilder(object):
17 17
18 def __init__ (self, projectTargetDir, frontends, versions, settings): 18 def __init__ (self, projectTargetDir, frontends, versions, settings):
19 self.projectTargetDir = projectTargetDir 19 self.projectTargetDir = projectTargetDir
20 self.frontends = frontends 20 self.frontends = frontends
21 self.versions = versions 21 self.versions = versions
22 self.settings = settings 22 self.settings = settings
23 23
24 # -------------------------------------------------------------------------- 24 # --------------------------------------------------------------------------
25 25
26 def name (self): 26 def name (self):
27 raise NotImplementedError() 27 raise NotImplementedError()
28 28
29 29
30 def relativePath (self): 30 def relativePath (self):
31 raise NotImplementedError() 31 raise NotImplementedError()
32 32
33 33
34 def compileCode (self): 34 def compileCode (self):
35 raise NotImplementedError() 35 raise NotImplementedError()
36 36
37 37
38 def createPackage (self): 38 def createPackage (self):
39 raise NotImplementedError() 39 raise NotImplementedError()
40 40
41 # -------------------------------------------------------------------------- 41 # --------------------------------------------------------------------------
42 42
43 def sourceFolder (self): 43 def sourceFolder (self):
44 return os.path.join(main.projectBaseDir() , 'backend', self.relativePath(), 'src') 44 return os.path.join(main.projectBaseDir() , 'backend', self.relativePath(), 'src')
45 45
46 46
47 def tempFolder (self): 47 def tempFolder (self):
48 return os.path.join(self.projectTargetDir, '.tmp', self.relativePath()) 48 return os.path.join(self.projectTargetDir, '.tmp', self.relativePath())
49 49
50 50
51 def frontEndTempFolder (self): 51 def frontEndTempFolder (self):
52 return self.tempFolder() 52 return self.tempFolder()
53 53
54 54
55 def developmentTargetFolder (self): 55 def developmentTargetFolder (self):
56 return os.path.join(self.projectTargetDir, 'development') 56 return os.path.join(self.projectTargetDir, 'development')
57 57
58 58
59 def targetFolder (self): 59 def targetFolder (self):
60 return os.path.join(self.projectTargetDir, self.relativePath()) 60 return os.path.join(self.projectTargetDir, self.relativePath())
61 61
62 62
63 # -------------------------------------------------------------------------- 63 # --------------------------------------------------------------------------
64 64
65 def writeToFolder (self, folder, filename, content): 65 def writeToFolder (self, folder, filename, content):
66 file = open(os.path.join(folder, filename), 'w') 66 file = open(os.path.join(folder, filename), 'w')
67 file.write(content.encode('utf-8')) 67 file.write(content.encode('utf-8'))
68 file.close() 68 file.close()
69 69
70 70
71 def configureIndexContent (self, indexContent, requestPathPrefix = ".."): 71 def configureIndexContent (self, indexContent, requestPathPrefix = ".."):
72 result = indexContent 72 result = indexContent
73 result = result.replace( '@request.path@', requestPathPrefix + '/' + self.settings['request.path'] ) 73 result = result.replace( '@request.path@', requestPathPrefix + '/' + self.settings['request.path'] )
74 result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] ) 74 result = result.replace( '@should.pay.toll@', self.settings['should.pay.toll'] )
75 75
76 return result 76 return result
77 77
78 78
79 def formatMAC (self, value): 79 def formatMAC (self, value):
80 x = iter(value) 80 x = iter(value)
81 return ' '.join([reduce(add, tup) for tup in izip(x, x, x, x)]) 81 return ' '.join([reduce(add, tup) for tup in izip(x, x, x, x)])
82 82
83 83
84 def logChecksums (self, content, message): 84 def logChecksums (self, content, message):
85 md5Digest = self.formatMAC(hashlib.md5(content.encode('utf-8')).hexdigest()) 85 md5Digest = self.formatMAC(hashlib.md5(content.encode('utf-8')).hexdigest())
86 shaDigest = self.formatMAC(hashlib.sha1(content.encode('utf-8')).hexdigest()) 86 shaDigest = self.formatMAC(hashlib.sha1(content.encode('utf-8')).hexdigest())
87 sha256Digest= self.formatMAC(hashlib.sha256(content.encode('utf-8')).hexdigest()) 87 sha256Digest= self.formatMAC(hashlib.sha256(content.encode('utf-8')).hexdigest())
88 print "-----"
88 print message + ": " + md5Digest + " (md5)" 89 print message + ": " + md5Digest + " (md5)"
89 print message + ": " + shaDigest + " (sha1)" 90 print message + ": " + shaDigest + " (sha1)"
90 print message + ": " + sha256Digest + " (sha256)" 91 print message + ": " + sha256Digest + " (sha256)"
92 print "====="
91 93
92 94
93 def shouldCompileCode (self): 95 def shouldCompileCode (self):
94 return ('debug' in self.versions) or ('install' in self.versions) 96 return ('debug' in self.versions) or ('install' in self.versions)
95 97
96 98
97 def run (self): 99 def run (self):
98 print self.name() + " - RUN" 100 print self.name() + " - RUN"
99 101
100 if self.shouldCompileCode(): 102 if self.shouldCompileCode():
101 self.compileCode() 103 self.compileCode()
102 104
103 for frontend in self.frontends: 105 for frontend in self.frontends:
104 if (frontend.module == frontend.submodule): 106 if (frontend.module == frontend.submodule):
105 submoduleExtension = '' 107 submoduleExtension = ''
106 else: 108 else:
107 submoduleExtension = '.' + frontend.submodule 109 submoduleExtension = '.' + frontend.submodule
108 110
109 main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) 111 main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module))
110 112
111 if 'debug' in self.versions: 113 if 'debug' in self.versions:
112 frontend.copyResourcesToFolder(self.frontEndTempFolder()) 114 frontend.copyResourcesToFolder(self.frontEndTempFolder())
113 115
114 index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) 116 index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG'))
115 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug' + submoduleExtension + '.html'), index) 117 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index_debug' + submoduleExtension + '.html'), index)
116 118
117 if 'install' in self.versions: 119 if 'install' in self.versions:
118 index = self.configureIndexContent(frontend.assemble()) 120 index = self.configureIndexContent(frontend.assemble())
119 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) 121 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index)
120 122
121 self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum") 123 self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum")
122 124
123 self.createPackage() 125 self.createPackage()
124 126
125 # if 'development' in self.versions: 127 # if 'development' in self.versions:
126 # for frontend in self.frontends: 128 # for frontend in self.frontends:
127 # if (frontend.module == frontend.submodule): 129 # if (frontend.module == frontend.submodule):
128 # submoduleExtension = '' 130 # submoduleExtension = ''
129 # else: 131 # else:
130 # submoduleExtension = '.' + frontend.submodule 132 # submoduleExtension = '.' + frontend.submodule
131# 133#
132 # print "FRONTEND module: " + frontend.module 134 # print "FRONTEND module: " + frontend.module
133 # print "FRONTEND submodule: " + frontend.submodule 135 # print "FRONTEND submodule: " + frontend.submodule
134# 136#
135 ## main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module)) 137 ## main.createFolder(os.path.join(self.developmentTargetFolder(), frontend.module))
136 # main.createFolder(self.developmentTargetFolder()) 138 # main.createFolder(self.developmentTargetFolder())
137# 139#
138 # index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url']) 140 # index = self.configureIndexContent(frontend.assemble(assemblyMode='DEVELOPMENT', versionType='DEBUG'), self.settings['development.settings']['url'])
139 ## self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index_development' + submoduleExtension + '.html'), index) 141 ## self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module, 'index_development' + submoduleExtension + '.html'), index)
140 # self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module + submoduleExtension + '.html'), index) 142 # self.writeToFolder(self.developmentTargetFolder(), os.path.join(frontend.module + submoduleExtension + '.html'), index)
141 143
142 144
143#=================================================================== 145#===================================================================
diff --git a/scripts/builder/backends/checksumBuilder.py b/scripts/builder/backends/checksumBuilder.py
new file mode 100755
index 0000000..5f44c8a
--- a/dev/null
+++ b/scripts/builder/backends/checksumBuilder.py
@@ -0,0 +1,50 @@
1#!/usr/bin/env python
2# -*- coding: UTF-8 -*-
3
4import os
5import shutil
6import subprocess
7import main
8
9from backendBuilder import BackendBuilder
10
11class ChecksumBuilder(BackendBuilder):
12
13 def name(self):
14 return "Checksum builder"
15
16
17 def relativePath(self):
18 return 'checksum'
19
20
21 def compileCode (self):
22 pass
23
24
25 def createPackage (self):
26 src = self.tempFolder()
27 dst = self.targetFolder()
28
29 shutil.copytree(src, dst)
30
31
32 def run (self):
33 print self.name() + " - RUN (checksum)"
34
35 for frontend in self.frontends:
36 if (frontend.module == frontend.submodule):
37 submoduleExtension = ''
38 else:
39 submoduleExtension = '.' + frontend.submodule
40
41 main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module))
42
43 index = self.configureIndexContent(frontend.assemble())
44 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index)
45 self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum")
46 print ""
47
48 self.createPackage()
49
50
diff --git a/scripts/builder/backends/devBuilder.py b/scripts/builder/backends/devBuilder.py
index 671765e..354e014 100644..100755
--- a/scripts/builder/backends/devBuilder.py
+++ b/scripts/builder/backends/devBuilder.py
@@ -1,56 +1,48 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import os 4import os
5import shutil 5import shutil
6import subprocess 6import subprocess
7import main 7import main
8 8
9from backendBuilder import BackendBuilder 9from backendBuilder import BackendBuilder
10 10
11class DevBuilder(BackendBuilder): 11class DevBuilder(BackendBuilder):
12 12
13 def name(self): 13 def name(self):
14 return "Dev builder" 14 return "Dev builder"
15 15
16 16
17 def relativePath(self): 17 def relativePath(self):
18 return 'dev' 18 return 'dev'
19 19
20 20
21 #def frontEndTempFolder (self):
22 # return os.path.join(self.tempFolder(), 'src', 'main', 'webapp')
23
24
25 #def targetFolder (self):
26 # return self.projectTargetDir
27
28
29 def compileCode (self): 21 def compileCode (self):
30 pass 22 pass
31 23
32 24
33 def createPackage (self): 25 def createPackage (self):
34 src = self.tempFolder() 26 src = self.tempFolder()
35 dst = self.targetFolder() 27 dst = self.targetFolder()
36 28
37 shutil.copytree(src, dst) 29 shutil.copytree(src, dst)
38 30
39 31
40 def run (self): 32 def run (self):
41 print self.name() + " - RUN (dev)" 33 print self.name() + " - RUN (dev)"
42 34
43 for frontend in self.frontends: 35 for frontend in self.frontends:
44 if (frontend.module == frontend.submodule): 36 if (frontend.module == frontend.submodule):
45 submoduleExtension = '' 37 submoduleExtension = ''
46 else: 38 else:
47 submoduleExtension = '.' + frontend.submodule 39 submoduleExtension = '.' + frontend.submodule
48 40
49 main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module)) 41 main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module))
50 42
51 index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG')) 43 index = self.configureIndexContent(frontend.assemble(assemblyMode='DEBUG', versionType='DEBUG'))
52 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index) 44 self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index)
53 45
54 self.createPackage() 46 self.createPackage()
55 47
56 48
diff --git a/scripts/builder/main.py b/scripts/builder/main.py
index b9fe04a..ecdbf6a 100755
--- a/scripts/builder/main.py
+++ b/scripts/builder/main.py
@@ -1,191 +1,196 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2# -*- coding: UTF-8 -*- 2# -*- coding: UTF-8 -*-
3 3
4import sys 4import sys
5import os 5import os
6import json 6import json
7import shutil 7import shutil
8import pprint 8import pprint
9import codecs 9import codecs
10import itertools 10import itertools
11from collections import deque 11from collections import deque
12 12
13#import frontendBuilder 13#import frontendBuilder
14import repository 14import repository
15 15
16pp = pprint.PrettyPrinter(indent=4, depth=4) 16pp = pprint.PrettyPrinter(indent=4, depth=4)
17 17
18#-------------------------------------------------------------------- 18#--------------------------------------------------------------------
19 19
20def scriptDir (): 20def scriptDir ():
21 return os.path.dirname(sys.argv[0]) 21 return os.path.dirname(sys.argv[0])
22 22
23def projectBaseDir (): 23def projectBaseDir ():
24 return os.path.abspath(scriptDir() + '/../..') 24 return os.path.abspath(scriptDir() + '/../..')
25 25
26def projectTargetDir(): 26def projectTargetDir():
27 return projectBaseDir() + '/target/' 27 return projectBaseDir() + '/target/'
28 28
29#-------------------------------------------------------------------- 29#--------------------------------------------------------------------
30 30
31def createFolder (path): 31def createFolder (path):
32 if not os.path.exists(path): 32 if not os.path.exists(path):
33 os.makedirs(path) 33 os.makedirs(path)
34 34
35#-------------------------------------------------------------------- 35#--------------------------------------------------------------------
36 36
37def loadSettings (component, module): 37def loadSettings (component, module):
38 # print "MODULE: " + module 38 # print "MODULE: " + module
39 39
40 if '.' in module: 40 if '.' in module:
41 moduleComponents = module.split('.') 41 moduleComponents = module.split('.')
42 module = moduleComponents[0] 42 module = moduleComponents[0]
43 submodule = moduleComponents[1] 43 submodule = moduleComponents[1]
44 else: 44 else:
45 submodule = module 45 submodule = module
46 46
47 #settings = codecs.open(projectBaseDir() + os.sep + component + os.sep + module + os.sep + 'properties' + os.sep + submodule + '.properties.json', 'r', 'utf-8') 47 #settings = codecs.open(projectBaseDir() + os.sep + component + os.sep + module + os.sep + 'properties' + os.sep + submodule + '.properties.json', 'r', 'utf-8')
48 settings = codecs.open(os.path.join(projectBaseDir(), component, module, 'properties', submodule + '.properties.json'), 'r', 'utf-8') 48 settings = codecs.open(os.path.join(projectBaseDir(), component, module, 'properties', submodule + '.properties.json'), 'r', 'utf-8')
49 result = json.load(settings) 49 result = json.load(settings)
50 settings.close 50 settings.close
51 51
52 return result 52 return result
53 53
54#==================================================================== 54#====================================================================
55# 55#
56# def assembleFrontend (frontend, versions): 56# def assembleFrontend (frontend, versions):
57 # result = {} 57 # result = {}
58 # settings = loadSettings('frontend', frontend) 58 # settings = loadSettings('frontend', frontend)
59 # builder = frontendBuilder.FrontendBuilder(frontend, settings, projectBaseDir()) 59 # builder = frontendBuilder.FrontendBuilder(frontend, settings, projectBaseDir())
60 # 60 #
61 # for version in versions: 61 # for version in versions:
62 # if version == 'install': 62 # if version == 'install':
63 # result[version] = builder.assembleInstallVersion() 63 # result[version] = builder.assembleInstallVersion()
64 # elif version == 'debug': 64 # elif version == 'debug':
65 # result[version] = builder.assembleDebugVersion() 65 # result[version] = builder.assembleDebugVersion()
66 # else: 66 # else:
67 # raise Exception('unrecognized version: ' + version) 67 # raise Exception('unrecognized version: ' + version)
68 # 68 #
69 # return result 69 # return result
70# 70#
71#==================================================================== 71#====================================================================
72 72
73def assembleBackend (backend, frontends, versions): 73def assembleBackend (backend, frontends, versions):
74 settings = loadSettings('backend', backend) 74 settings = loadSettings('backend', backend)
75 75
76 builderModuleName = backend + 'Builder' 76 builderModuleName = backend + 'Builder'
77 builderClassName = backend.capitalize() + 'Builder' 77 builderClassName = backend.capitalize() + 'Builder'
78 #print ("BUILD BACKENDS - module: " + builderModuleName + " , class: " + builderClassName) 78 #print ("BUILD BACKENDS - module: " + builderModuleName + " , class: " + builderClassName)
79 builderModule = __import__(builderModuleName) 79 builderModule = __import__(builderModuleName)
80 builderClass = getattr(builderModule, builderClassName) 80 builderClass = getattr(builderModule, builderClassName)
81 81
82 backendBuilder = builderClass(projectTargetDir(), frontends, versions, settings) 82 backendBuilder = builderClass(projectTargetDir(), frontends, versions, settings)
83 backendBuilder.run() 83 backendBuilder.run()
84 84
85#==================================================================== 85#====================================================================
86 86
87def build (settings, repository): 87def build (settings, repository):
88 frontends = [] 88 frontends = []
89 89
90 if repository.areTherePendingChanges(): 90 if repository.areTherePendingChanges():
91 if 'install' in settings['versions']: 91 if 'install' in settings['versions']:
92 raise Exception("repository has pending changes, can't 'install'") 92 raise Exception("repository has pending changes, can't 'install'")
93 else: 93 else:
94 print "\nWARNING: repository has pending changes\n" 94 print "\nWARNING: repository has pending changes\n"
95 95
96 for frontend in settings['frontends']: 96 for frontend in settings['frontends']:
97 normalizedFrontendName = frontend.replace(".", "_") 97 normalizedFrontendName = frontend.replace(".", "_")
98 builderModuleName = normalizedFrontendName + 'Builder' 98 builderModuleName = normalizedFrontendName + 'Builder'
99 builderClassName = normalizedFrontendName.title() + 'Builder' 99 builderClassName = normalizedFrontendName.title() + 'Builder'
100 100
101 #print ("BUILD FRONTEND - module: " + builderModuleName + " , class: " + builderClassName) 101 #print ("BUILD FRONTEND - module: " + builderModuleName + " , class: " + builderClassName)
102 builderModule = __import__(builderModuleName) 102 builderModule = __import__(builderModuleName)
103 builderClass = getattr(builderModule, builderClassName) 103 builderClass = getattr(builderModule, builderClassName)
104 builder = builderClass(frontend, loadSettings('frontend', frontend), repository.version()) 104 builder = builderClass(frontend, loadSettings('frontend', frontend), repository.version())
105 #builder = frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend), repository.version()) 105 #builder = frontendBuilder.FrontendBuilder(frontend, loadSettings('frontend', frontend), repository.version())
106 frontends.append(builder) 106 frontends.append(builder)
107 107
108 for backend in settings['backends']: 108 for backend in settings['backends']:
109 assembleBackend(backend, frontends, settings['versions']) 109 assembleBackend(backend, frontends, settings['versions'])
110 110
111#-------------------------------------------------------------------- 111#--------------------------------------------------------------------
112 112
113def clean (): 113def clean ():
114 # print "cleaning up …" 114 # print "cleaning up …"
115 if os.path.exists(projectTargetDir()): 115 if os.path.exists(projectTargetDir()):
116 shutil.rmtree(projectTargetDir()) 116 shutil.rmtree(projectTargetDir())
117 117
118#-------------------------------------------------------------------- 118#--------------------------------------------------------------------
119 119
120def usage (message): 120def usage (message):
121 if message != None: 121 if message != None:
122 print "ERROR: " + message 122 print "ERROR: " + message
123 123
124 print 124 print
125 # print "build clean" 125 # print "build clean"
126 # print "build clean install" 126 # print "build clean install"
127 print "build install --ALL" 127 print "build install --ALL"
128 print "build install debug --ALL" 128 print "build install debug --ALL"
129 print "build install debug development --ALL" 129 print "build install debug development --ALL"
130 # print "build clean install debug --ALL" 130 # print "build clean install debug --ALL"
131 print "build install debug --backends php python --frontends beta gamma" 131 print "build install debug --backends php python --frontends beta gamma"
132 print "build install debug development --backends php python --frontends beta gamma gamma.mobile" 132 print "build install debug development --backends php python --frontends beta gamma gamma.mobile"
133 exit(1) 133 exit(1)
134 134
135#-------------------------------------------------------------------- 135#--------------------------------------------------------------------
136 136
137def allFrontends (): 137def allFrontends ():
138 return ['beta', 'gamma', 'gamma.mobile'] 138 return ['beta', 'gamma', 'gamma.mobile']
139 139
140def allBackends (): 140def allBackends ():
141 return ['php', 'python'] 141 return ['php', 'python']
142 142
143#-------------------------------------------------------------------- 143#--------------------------------------------------------------------
144 144
145def main (): 145def main ():
146 settings = {} 146 settings = {}
147 parameters = list(itertools.islice(sys.argv, 1, None)) 147 parameters = list(itertools.islice(sys.argv, 1, None))
148 148
149 sys.path.append(os.path.join(scriptDir(), 'backends')) 149 sys.path.append(os.path.join(scriptDir(), 'backends'))
150 sys.path.append(os.path.join(scriptDir(), 'frontends')) 150 sys.path.append(os.path.join(scriptDir(), 'frontends'))
151 currentRepository = repository.repositoryWithPath(projectBaseDir()) 151 currentRepository = repository.repositoryWithPath(projectBaseDir())
152 152
153 clean() 153 clean()
154 versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) 154 versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
155 settings['versions'] = versions; #['debug', 'install', 'development'] 155 settings['versions'] = versions; #['debug', 'install', 'development', 'checksum']
156 parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) 156 parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
157 157
158 if len(parameters) > 0: 158 if len(parameters) > 0:
159 parameter = parameters.popleft() 159 parameter = parameters.popleft()
160 if parameter == "--ALL": 160 if parameter == "--ALL":
161 settings['frontends'] = allFrontends() 161 settings['frontends'] = allFrontends()
162 settings['backends'] = allBackends() 162 settings['backends'] = allBackends()
163 else: 163 else:
164 while parameter != None: 164 while parameter != None:
165 values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) 165 values = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
166 166
167 if parameter == "--backends": 167 if parameter == "--backends":
168 settings['backends'] = values 168 settings['backends'] = values
169 elif parameter == "--frontends": 169 elif parameter == "--frontends":
170 settings['frontends'] = values 170 settings['frontends'] = values
171 171
172 parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) 172 parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
173 if parameters: 173 if parameters:
174 parameter = parameters.popleft() 174 parameter = parameters.popleft()
175 else: 175 else:
176 parameter = None 176 parameter = None
177 177
178 if 'checksum' in settings['versions']:
179 if not 'backends' in settings:
180 settings['backends'] = []
181 settings['backends'].append('checksum')
182
178 if (not settings.has_key('versions')): 183 if (not settings.has_key('versions')):
179 usage("missing 'versions'") 184 usage("missing 'versions'")
180 if (not settings.has_key('frontends')): 185 if (not settings.has_key('frontends')):
181 usage("missing 'frontends'") 186 usage("missing 'frontends'")
182 if (not settings.has_key('backends')): 187 if (not settings.has_key('backends')):
183 usage("missing 'backends'") 188 usage("missing 'backends'")
184 189
185 build(settings, currentRepository) 190 build(settings, currentRepository)
186 else: 191 else:
187 usage("Suggestions on how to call the 'build' script:") 192 usage("Suggestions on how to call the 'build' script:")
188 193
189 194
190if __name__ == "__main__": 195if __name__ == "__main__":
191 main() 196 main()
diff --git a/scripts/builder/repository.py b/scripts/builder/repository.py
index 2d4a12b..2d4a12b 100644..100755
--- a/scripts/builder/repository.py
+++ b/scripts/builder/repository.py