1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-11-14 18:49:03 +01:00

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
This commit is contained in:
Giulio Cesare Solaroli 2013-04-17 17:45:39 +02:00
parent 4ce8041b11
commit 48c9280c9a
6 changed files with 62 additions and 9 deletions

View File

@ -0,0 +1,4 @@
{
"request.path": "json",
"should.pay.toll": "true"
}

2
scripts/builder/backendBuilder.py Normal file → Executable file
View File

@ -85,9 +85,11 @@ class BackendBuilder(object):
md5Digest = self.formatMAC(hashlib.md5(content.encode('utf-8')).hexdigest()) md5Digest = self.formatMAC(hashlib.md5(content.encode('utf-8')).hexdigest())
shaDigest = self.formatMAC(hashlib.sha1(content.encode('utf-8')).hexdigest()) shaDigest = self.formatMAC(hashlib.sha1(content.encode('utf-8')).hexdigest())
sha256Digest = self.formatMAC(hashlib.sha256(content.encode('utf-8')).hexdigest()) sha256Digest = self.formatMAC(hashlib.sha256(content.encode('utf-8')).hexdigest())
print "-----"
print message + ": " + md5Digest + " (md5)" print message + ": " + md5Digest + " (md5)"
print message + ": " + shaDigest + " (sha1)" print message + ": " + shaDigest + " (sha1)"
print message + ": " + sha256Digest + " (sha256)" print message + ": " + sha256Digest + " (sha256)"
print "====="
def shouldCompileCode (self): def shouldCompileCode (self):

View File

@ -0,0 +1,50 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import shutil
import subprocess
import main
from backendBuilder import BackendBuilder
class ChecksumBuilder(BackendBuilder):
def name(self):
return "Checksum builder"
def relativePath(self):
return 'checksum'
def compileCode (self):
pass
def createPackage (self):
src = self.tempFolder()
dst = self.targetFolder()
shutil.copytree(src, dst)
def run (self):
print self.name() + " - RUN (checksum)"
for frontend in self.frontends:
if (frontend.module == frontend.submodule):
submoduleExtension = ''
else:
submoduleExtension = '.' + frontend.submodule
main.createFolder(os.path.join(self.frontEndTempFolder(), frontend.module))
index = self.configureIndexContent(frontend.assemble())
self.writeToFolder(self.frontEndTempFolder(), os.path.join(frontend.module, 'index' + submoduleExtension + '.html'), index)
self.logChecksums(index, "[" + self.name() + " - " + frontend.module + "] index" + submoduleExtension + ".html checksum")
print ""
self.createPackage()

8
scripts/builder/backends/devBuilder.py Normal file → Executable file
View File

@ -18,14 +18,6 @@ class DevBuilder(BackendBuilder):
return 'dev' return 'dev'
# def frontEndTempFolder (self):
# return os.path.join(self.tempFolder(), 'src', 'main', 'webapp')
# def targetFolder (self):
# return self.projectTargetDir
def compileCode (self): def compileCode (self):
pass pass

View File

@ -152,7 +152,7 @@ def main ():
clean() clean()
versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters)) versions = list(itertools.takewhile(lambda x: not x.startswith('--'), parameters))
settings['versions'] = versions; #['debug', 'install', 'development'] settings['versions'] = versions; #['debug', 'install', 'development', 'checksum']
parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters)) parameters = deque(itertools.dropwhile(lambda x: not x.startswith('--'), parameters))
if len(parameters) > 0: if len(parameters) > 0:
@ -175,6 +175,11 @@ def main ():
else: else:
parameter = None parameter = None
if 'checksum' in settings['versions']:
if not 'backends' in settings:
settings['backends'] = []
settings['backends'].append('checksum')
if (not settings.has_key('versions')): if (not settings.has_key('versions')):
usage("missing 'versions'") usage("missing 'versions'")
if (not settings.has_key('frontends')): if (not settings.has_key('frontends')):

0
scripts/builder/repository.py Normal file → Executable file
View File