diff --git a/build.py b/build.py index 5e2c1bbc893..0c1ba9caf43 100755 --- a/build.py +++ b/build.py @@ -100,13 +100,46 @@ def choose_omero_version(): if not omero_build: omero_version = re.sub("([-]DEV)?-\d+-[a-f0-9]+(-dirty)?",\ "-DEV", omero_version) - return [ "-Domero.version=%s%s" % (omero_version, omero_build) ] except: print "Error getting version for BUILD_NUMBER=%s" % omero_build if err: print err sys.exit(1) + command = [ find_java(), "omero",BUILD_PY,"-q","plainversion" ] + err = "" + try: + p = popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + omero_plain_version, err = p.communicate() + omero_plain_version = omero_plain_version.split()[1] + if not omero_build: + omero_plain_version = re.sub("([-]DEV)?-\d+-[a-f0-9]+(-dirty)?",\ + "-DEV", omero_plain_version) + except: + print "Error getting plain version for BUILD_NUMBER=%s" % omero_build + if err: + print err + sys.exit(1) + + command = [ find_java(), "omero",BUILD_PY,"-q","shortversion" ] + err = "" + try: + p = popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + omero_short_version, err = p.communicate() + omero_short_version = omero_short_version.split()[1] + if not omero_build: + omero_short_version = re.sub("([-]DEV)?-\d+-[a-f0-9]+(-dirty)?",\ + "-DEV", omero_short_version) + except: + print "Error getting short version for BUILD_NUMBER=%s" % omero_build + if err: + print err + sys.exit(1) + + return [ "-Domero.version=%s%s" % (omero_version, omero_build), + "-Domero.plainversion=%s" % (omero_plain_version), + "-Domero.shortversion=%s" % (omero_short_version) ] + def handle_tools(args): _ = os.path.sep.join diff --git a/build.xml b/build.xml index 9e23913a3c7..2cbddcc557d 100644 --- a/build.xml +++ b/build.xml @@ -55,12 +55,17 @@ To get started using Eclipse, execute "./build.py build-dev" and import the top- + + + + + @@ -422,8 +427,8 @@ To get started using Eclipse, execute "./build.py build-dev" and import the top- - + @@ -438,17 +443,26 @@ To get started using Eclipse, execute "./build.py build-dev" and import the top- - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + - + @@ -1039,12 +1051,42 @@ omero.version=${omero.version} - + + ${omero.plainversion}-ice${versions.ice_lib} + + + ${version.describe}-ice${versions.ice_lib} + + + + ${omero.plainversion} + + + + + + ${version.describe} + + + + + + ${omero.shortversion} + + + + + + ${version.describe} + + + + *.maxmem.* settings diff --git a/components/antlib/scripts/source-archive b/components/antlib/scripts/source-archive new file mode 100755 index 00000000000..a36a29cd05d --- /dev/null +++ b/components/antlib/scripts/source-archive @@ -0,0 +1,97 @@ +#!/usr/bin/python + +from __future__ import print_function + +import os +from subprocess import call, Popen, PIPE +import sys +import zipfile + +# Due to "git archive" not supporting archiving of submodules in +# addition to the base tree, this requires additional support in order +# to create a complete and functional source archive. +# +# This script archives the base tree, and then uses "git submodule +# foreach" to archive each submodule separately, setting the correct +# path prefix for each archive, so that they may all be unpacked in +# the same root to result in a complete and functional source tree. +# It then repacks each of these zip files into a single zip which is +# the source release, taking care to preserve timestamps and exectute +# permissions, etc. This is done via ZipInfo objects, and the +# repacking is done entirely in memory so that this should work on any +# platform irrespective of filesystem support for the archive +# attributes. It excludes .gitignore files at this point to avoid +# polluting the release with version control files. + +if __name__ == "__main__": + if len(sys.argv) != 6: + raise Exception('Usage: %s releasename shortversion fullversion versionfile targetdir') + + release = sys.argv[1] + shortversion = sys.argv[2] + version = sys.argv[3] + versionfile = sys.argv[4] + target = os.path.abspath(sys.argv[5]) + release = "%s-%s" % (release,version) + + if not os.path.isdir('.git'): + raise Exception('Releasing is only possible from a git repository') + + print("Releasing %s" % (release)) + sys.stdout.flush() + + # Create base archive + base_archive_status = call(['git', 'archive', '--format', 'zip', + '--prefix', "%s/" % (release), + '--output', "%s/%s-base.zip" % (target, release), + 'HEAD']) + if base_archive_status != 0: + raise Exception('Failed to create git base archive') + + zips = list(["%s/%s-base.zip" % (target, release)]) + + # Create submodule archives + submodule_archive = Popen(['git', 'submodule', 'foreach', '--quiet', '--recursive', + "npath=\"$(echo \"$path\" | tr / _)\"; \ + zip=\"%s/%s-submod-${npath}.zip\"; \ + git archive --format zip --prefix \"%s/${path}/\" --output \"${zip}\" HEAD || exit 1; \ + echo \"${zip}\"" % (target, release, release)], + stdout=PIPE) + submodule_zips = submodule_archive.communicate()[0] + if submodule_archive.returncode != 0: + raise Exception('Failed to create git submodule archives') + + zips.extend(submodule_zips.splitlines()) + + # Create destination zip file + print(" - creating %s/%s.zip" % (target, release)) + sys.stdout.flush() + basezip = zipfile.ZipFile("%s/%s.zip" % (target, release), 'w') + + # Repack each of the separate zips into the destination zip + for name in zips: + subzip = zipfile.ZipFile(name, 'r') + print(" - repacking %s" % (name)) + sys.stdout.flush() + # Iterate over the ZipInfo objects from the archive + for info in subzip.infolist(): + # Skip unwanted git and travis files + if os.path.basename(info.filename) == '.gitignore' or os.path.basename(info.filename) == '.gitmodule' or os.path.basename(info.filename) == '.travis.yml': + continue + # Repack a single zip object; preserve the metadata + # directly via the ZipInfo object and rewrite the content + # (which unfortunately requires decompression and + # recompression rather than a direct copy) + basezip.writestr(info, subzip.open(info.filename).read()) + + # Remove repacked zip + os.remove(name) + + # Embed release number + basezip.writestr("%s/%s" % (release, versionfile), +""" + + + + +""" % (shortversion, version)) diff --git a/components/rendering/src/omeis/CVS/Entries b/components/rendering/src/omeis/CVS/Entries deleted file mode 100644 index f383a02d18a..00000000000 --- a/components/rendering/src/omeis/CVS/Entries +++ /dev/null @@ -1,3 +0,0 @@ -D/ds//// -D/io//// -D/proxy//// diff --git a/docs/hudson/OMERO.sh b/docs/hudson/OMERO.sh index fff295b81df..a287a7c8d7b 100644 --- a/docs/hudson/OMERO.sh +++ b/docs/hudson/OMERO.sh @@ -15,6 +15,10 @@ echo Building $OMERO_BRANCH ./build.py clean ./build.py build-default test-compile ./build.py release-all +if [ -d .git ] +then + ./build.py release-src +fi # Log information echo BUILD_NUMBER=$BUILD_NUMBER > target/$OMERO_BRANCH.log