1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # Runs on buildbot slave, creating a release package using the build
22 # system and zipping it into buildbot_upload.zip. This is then uploaded
23 # to the master in the next buildbot step.
32 sys.stderr.write("Not enough arguments, expecting builder name\n")
38 if len(sys.argv) >= 3:
41 # scons does own packaging
42 if builder.find('scons') != -1:
43 os.chdir('../blender')
44 scons_options = ['BF_QUICK=slnt', 'BUILDBOT_BRANCH=' + branch, 'buildslave']
46 if builder.find('linux') != -1:
47 buildbot_dir = os.path.dirname(os.path.realpath(__file__))
48 config_dir = os.path.join(buildbot_dir, 'config')
49 build_dir = os.path.join('..', 'build', builder)
50 install_dir = os.path.join('..', 'install', builder)
52 scons_options += ['WITH_BF_NOBLENDER=True', 'WITH_BF_PLAYER=False',
53 'BF_BUILDDIR=' + build_dir,
54 'BF_INSTALLDIR=' + install_dir,
55 'WITHOUT_BF_INSTALL=True']
59 if builder.endswith('linux_x86_64_scons'):
60 config = 'user-config-x86_64.py'
61 elif builder.endswith('linux_i386_scons'):
62 config = 'user-config-x86_64.py'
64 if config is not None:
65 config_fpath = os.path.join(config_dir, config)
66 scons_options.append('BF_CONFIG=' + config_fpath)
68 blender = os.path.join(install_dir, 'blender')
69 blenderplayer = os.path.join(install_dir, 'blenderplayer')
70 subprocess.call(['strip', '--strip-all', blender, blenderplayer])
72 retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
75 if builder.find('win') != -1:
78 if builder.find('win64') != -1:
81 scons_options.append('BF_BITNESS=' + bitness)
83 retcode = subprocess.call(['python', 'scons/scons.py'] + scons_options)
86 # clean release directory if it already exists
87 release_dir = 'release'
89 if os.path.exists(release_dir):
90 for f in os.listdir(release_dir):
91 if os.path.isfile(os.path.join(release_dir, f)):
92 os.remove(os.path.join(release_dir, f))
94 # create release package
96 subprocess.call(['make', 'package_archive'])
98 sys.stderr.write('Make package release failed' + str(ex) + '\n')
101 # find release directory, must exist this time
102 if not os.path.exists(release_dir):
103 sys.stderr.write("Failed to find release directory %r.\n" % release_dir)
106 # find release package
110 for f in os.listdir(release_dir):
111 rf = os.path.join(release_dir, f)
112 if os.path.isfile(rf) and f.startswith('blender'):
117 sys.stderr.write("Failed to find release package.\n")
122 upload_zip = "buildbot_upload.zip"
123 if os.path.exists(upload_zip):
124 os.remove(upload_zip)
125 z = zipfile.ZipFile(upload_zip, "w", compression=zipfile.ZIP_STORED)
126 z.write(filepath, arcname=file)
128 except Exception, ex:
129 sys.stderr.write('Create buildbot_upload.zip failed' + str(ex) + '\n')