Buildbot: support building releases, make non-releases more consistent
* Auto detect rc and release version cycle in BKE_blender_version.h. * On Windows, generate zip and installer if a release is detected. * On macOS, always generate a dmg instead of zip. * Use standard package names without hash if a release is detected. * Buildbot package names now match platform names in releases. Ref T67056 Differential Revision: https://developer.blender.org/D5643
This commit is contained in:
parent
ad5e91a107
commit
81849e7c9d
@ -66,8 +66,28 @@ class VersionInfo:
|
||||
|
||||
version_number = int(self._parse_header_file(blender_h, 'BLENDER_VERSION'))
|
||||
self.version = "%d.%d" % (version_number // 100, version_number % 100)
|
||||
self.version_char = self._parse_header_file(blender_h, 'BLENDER_VERSION_CHAR')
|
||||
self.version_cycle = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE')
|
||||
self.version_cycle_number = self._parse_header_file(blender_h, 'BLENDER_VERSION_CYCLE_NUMBER')
|
||||
self.hash = self._parse_header_file(buildinfo_h, 'BUILD_HASH')[1:-1]
|
||||
|
||||
if self.version_cycle == "release":
|
||||
# Final release
|
||||
self.full_version = self.version + self.version_char
|
||||
self.is_development_build = False
|
||||
elif self.version_cycle == "rc":
|
||||
# Release candidate
|
||||
version_cycle = self.version_cycle + self.version_cycle_number
|
||||
if len(self.version_char) == 0:
|
||||
self.full_version = self.version + version_cycle
|
||||
else:
|
||||
self.full_version = self.version + self.version_char + '-' + version_cycle
|
||||
self.is_development_build = False
|
||||
else:
|
||||
# Development build
|
||||
self.full_version = self.version + '-' + self.hash
|
||||
self.is_development_build = True
|
||||
|
||||
def _parse_header_file(self, filename, define):
|
||||
import re
|
||||
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
|
||||
|
@ -29,15 +29,15 @@ import sys
|
||||
def get_package_name(builder, platform=None):
|
||||
info = buildbot_utils.VersionInfo(builder)
|
||||
|
||||
package_name = 'blender-' + info.version + '-' + info.hash
|
||||
package_name = 'blender-' + info.full_version
|
||||
if platform:
|
||||
package_name += '-' + platform
|
||||
if builder.branch != 'master':
|
||||
if builder.branch != 'master' and info.is_development_build:
|
||||
package_name = builder.branch + "-" + package_name
|
||||
|
||||
return package_name
|
||||
|
||||
def create_buildbot_upload_zip(builder, package_filepath, package_filename):
|
||||
def create_buildbot_upload_zip(builder, package_files):
|
||||
import zipfile
|
||||
|
||||
buildbot_upload_zip = os.path.join(builder.upload_dir, "buildbot_upload.zip")
|
||||
@ -46,7 +46,8 @@ def create_buildbot_upload_zip(builder, package_filepath, package_filename):
|
||||
|
||||
try:
|
||||
z = zipfile.ZipFile(buildbot_upload_zip, "w", compression=zipfile.ZIP_STORED)
|
||||
z.write(package_filepath, arcname=package_filename)
|
||||
for filepath, filename in package_files:
|
||||
z.write(filepath, arcname=filename)
|
||||
z.close()
|
||||
except Exception as ex:
|
||||
sys.stderr.write('Create buildbot_upload.zip failed: ' + str(ex) + '\n')
|
||||
@ -74,38 +75,61 @@ def cleanup_files(dirpath, extension):
|
||||
if os.path.isfile(filepath) and f.endswith(extension):
|
||||
os.remove(filepath)
|
||||
|
||||
def find_file(dirpath, extension):
|
||||
for f in os.listdir(dirpath):
|
||||
filepath = os.path.join(dirpath, f)
|
||||
if os.path.isfile(filepath) and f.endswith(extension):
|
||||
return f
|
||||
return None
|
||||
|
||||
|
||||
def pack_mac(builder):
|
||||
info = buildbot_utils.VersionInfo(builder)
|
||||
|
||||
os.chdir(builder.build_dir)
|
||||
cleanup_files(builder.build_dir, '.zip')
|
||||
cleanup_files(builder.build_dir, '.dmg')
|
||||
|
||||
package_name = get_package_name(builder, 'OSX-10.9-x86_64')
|
||||
package_filename = package_name + '.zip'
|
||||
package_name = get_package_name(builder, 'macOS')
|
||||
package_filename = package_name + '.dmg'
|
||||
package_filepath = os.path.join(builder.build_dir, package_filename)
|
||||
|
||||
buildbot_utils.call(['cpack', '-G', 'ZIP'])
|
||||
package_filepath = find_file(builder.build_dir, '.zip')
|
||||
release_dir = os.path.join(builder.blender_dir, 'release', 'darwin')
|
||||
bundle_sh = os.path.join(release_dir, 'bundle.sh')
|
||||
if info.is_development_build:
|
||||
background_image = os.path.join(release_dir, 'buildbot', 'background.tif')
|
||||
|
||||
create_buildbot_upload_zip(builder, package_filepath, package_filename)
|
||||
command = [bundle_sh]
|
||||
command += ['--source', builder.install_dir]
|
||||
command += ['--dmg', package_filepath]
|
||||
command += ['--background-image', background_image]
|
||||
buildbot_utils.call(command)
|
||||
|
||||
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
|
||||
|
||||
|
||||
def pack_win(builder):
|
||||
info = buildbot_utils.VersionInfo(builder)
|
||||
|
||||
os.chdir(builder.build_dir)
|
||||
cleanup_files(builder.build_dir, '.zip')
|
||||
|
||||
package_name = get_package_name(builder, 'win' + str(builder.bits))
|
||||
# CPack will add the platform name
|
||||
cpack_name = get_package_name(builder, None)
|
||||
package_name = get_package_name(builder, 'windows' + str(builder.bits))
|
||||
|
||||
command = ['cmake', '-DCPACK_OVERRIDE_PACKAGENAME:STRING=' + cpack_name, '.']
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
command = ['cpack', '-G', 'ZIP']
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
|
||||
package_filename = package_name + '.zip'
|
||||
package_filepath = os.path.join(builder.build_dir, package_filename)
|
||||
package_files = [(package_filepath, package_filename)]
|
||||
|
||||
buildbot_utils.call(['cpack', '-G', 'ZIP'])
|
||||
package_filepath = find_file(builder.build_dir, '.zip')
|
||||
if info.version_cycle == 'release':
|
||||
# Installer only for final release builds, otherwise will get
|
||||
# 'this product is already installed' messages.
|
||||
command = ['cpack', '-G', 'WIX']
|
||||
buildbot_utils.call(builder.command_prefix + command)
|
||||
|
||||
create_buildbot_upload_zip(builder, package_filepath, package_filename)
|
||||
package_filename = package_name + '.msi'
|
||||
package_filepath = os.path.join(builder.build_dir, package_filename)
|
||||
package_files += [(package_filepath, package_filename)]
|
||||
|
||||
create_buildbot_upload_zip(builder, package_files)
|
||||
|
||||
|
||||
def pack_linux(builder):
|
||||
@ -147,7 +171,7 @@ def pack_linux(builder):
|
||||
create_tar_bz2(builder.install_dir, package_filepath, package_name)
|
||||
|
||||
# Create buildbot_upload.zip
|
||||
create_buildbot_upload_zip(builder, package_filepath, package_filename)
|
||||
create_buildbot_upload_zip(builder, [(package_filepath, package_filename)])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
BIN
release/darwin/buildbot/background.tif
Normal file
BIN
release/darwin/buildbot/background.tif
Normal file
Binary file not shown.
@ -54,6 +54,11 @@ while [[ $# -gt 0 ]]; do
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--background-image)
|
||||
_background_image="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage:"
|
||||
echo " $(basename "$0") --source DIR --dmg IMAGENAME "
|
||||
|
@ -37,6 +37,8 @@
|
||||
#define BLENDER_VERSION_CHAR
|
||||
/** alpha/beta/rc/release, docs use this. */
|
||||
#define BLENDER_VERSION_CYCLE alpha
|
||||
/** Optionally set to 1,2,... for example to to get alpha1 or rc2. */
|
||||
#define BLENDER_VERSION_CYCLE_NUMBER
|
||||
|
||||
/** Defined in from blender.c */
|
||||
extern char versionstr[];
|
||||
|
@ -139,6 +139,11 @@ static void wm_block_splash_add_labels(uiBlock *block, int x, int y)
|
||||
BLENDER_VERSION % 100,
|
||||
version_suffix);
|
||||
|
||||
const char *cycle_number_suffix = STRINGIFY(BLENDER_VERSION_CYCLE_NUMBER);
|
||||
if (strlen(cycle_number_suffix)) {
|
||||
BLI_snprintf(version_buf, sizeof(version_buf), "%s %s", version_buf, cycle_number_suffix);
|
||||
}
|
||||
|
||||
wm_block_splash_add_label(block, version_buf, x, &y);
|
||||
|
||||
#ifdef WITH_BUILDINFO
|
||||
|
Loading…
Reference in New Issue
Block a user