Add buildslave target for builder.blender.org integration
This commit is contained in:
parent
d485a54b59
commit
d2a721cfd5
|
@ -669,7 +669,14 @@ if 'blenderlite' in B.targets:
|
|||
|
||||
Depends(nsiscmd, allinstall)
|
||||
|
||||
buildslave_action = env.Action(btools.buildslave, btools.buildslave_print)
|
||||
buildslave_cmd = env.Command('buildslave_exec', None, buildslave_action)
|
||||
buildslave_alias = env.Alias('buildslave', buildslave_cmd)
|
||||
|
||||
Depends(buildslave_cmd, allinstall)
|
||||
|
||||
Default(B.program_list)
|
||||
|
||||
if not env['WITHOUT_BF_INSTALL']:
|
||||
Default(installtarget)
|
||||
|
||||
|
|
|
@ -56,10 +56,16 @@ def get_version():
|
|||
|
||||
raise Exception("%s: missing version string" % fname)
|
||||
|
||||
def get_revision():
|
||||
build_rev = os.popen('svnversion').read()[:-1] # remove \n
|
||||
if build_rev == '' or build_rev==None:
|
||||
build_rev = 'UNKNOWN'
|
||||
|
||||
return 'r' + build_rev
|
||||
|
||||
# This is used in creating the local config directories
|
||||
VERSION, VERSION_DISPLAY = get_version()
|
||||
|
||||
REVISION = get_revision()
|
||||
|
||||
def print_arguments(args, bc):
|
||||
if len(args):
|
||||
|
@ -175,7 +181,7 @@ def print_targets(targs, bc):
|
|||
def validate_targets(targs, bc):
|
||||
valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin',
|
||||
'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release',
|
||||
'everything', 'clean', 'install-bin', 'install', 'nsis']
|
||||
'everything', 'clean', 'install-bin', 'install', 'nsis','buildslave']
|
||||
oklist = []
|
||||
for t in targs:
|
||||
if t in valid_list:
|
||||
|
@ -496,6 +502,67 @@ def read_opts(env, cfg, args):
|
|||
|
||||
return localopts
|
||||
|
||||
def buildbot_zip(src, dest, package_name, extension):
|
||||
import zipfile
|
||||
ln = len(src)+1 # one extra to remove leading os.sep when cleaning root for package_root
|
||||
flist = list()
|
||||
|
||||
# create list of tuples containing file and archive name
|
||||
for root, dirs, files in os.walk(src):
|
||||
package_root = os.path.join(package_name, root[ln:])
|
||||
flist.extend([(os.path.join(root, file), os.path.join(package_root, file)) for file in files])
|
||||
|
||||
if extension == '.zip':
|
||||
package = zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED)
|
||||
package.comment = package_name + ' is a zip-file containing the Blender software. Visit http://www.blender.org for more information.'
|
||||
for entry in flist:
|
||||
package.write(entry[0], entry[1])
|
||||
package.close()
|
||||
else:
|
||||
import tarfile
|
||||
package = tarfile.open(dest, 'w:bz2')
|
||||
for entry in flist:
|
||||
package.add(entry[0], entry[1], recursive=False)
|
||||
package.close()
|
||||
bb_zip_name = os.path.normpath(src + os.sep + '..' + os.sep + 'buildbot_upload.zip')
|
||||
print("creating %s" % (bb_zip_name))
|
||||
bb_zip = zipfile.ZipFile(bb_zip_name, 'w', zipfile.ZIP_DEFLATED)
|
||||
print("writing %s to %s" % (dest, bb_zip_name))
|
||||
bb_zip.write(dest, os.path.split(dest)[1])
|
||||
bb_zip.close()
|
||||
print("done.")
|
||||
|
||||
def buildslave_print(target, source, env):
|
||||
return "Running buildslave target"
|
||||
|
||||
def buildslave(target=None, source=None, env=None):
|
||||
"""
|
||||
Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only.
|
||||
"""
|
||||
|
||||
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
|
||||
extension = '.zip'
|
||||
else:
|
||||
extension = '.tar.bz2'
|
||||
|
||||
outdir = os.path.abspath(env['BF_INSTALLDIR'])
|
||||
package_name = 'blender-' + env['OURPLATFORM'].split('-')[0] + '-'+VERSION+'-'+REVISION
|
||||
package_dir = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name)
|
||||
package_archive = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name + extension)
|
||||
|
||||
try:
|
||||
if os.path.exists(package_archive):
|
||||
os.remove(package_archive)
|
||||
if os.path.exists(package_dir):
|
||||
shutil.rmtree(package_dir)
|
||||
except Exception, ex:
|
||||
sys.stderr.write('Failed to clean up old package files: ' + str(ex) + '\n')
|
||||
return 1
|
||||
|
||||
buildbot_zip(outdir, package_archive, package_name, extension)
|
||||
|
||||
return 0
|
||||
|
||||
def NSIS_print(target, source, env):
|
||||
return "Creating NSIS installer for Blender"
|
||||
|
||||
|
|
Loading…
Reference in New Issue