diff options
author | Steve Huston <shuston@riverace.com> | 2010-04-23 13:40:04 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2010-04-23 13:40:04 +0000 |
commit | ca82d0af6cb5583c49f28a9d165350f8b16d3b6d (patch) | |
tree | 112565648062c8a6507bf03ad1ec20d40cffc21b | |
parent | bdd3cdf8146881397881b39b2dd48aa094b4d03b (diff) | |
download | ATCD-ca82d0af6cb5583c49f28a9d165350f8b16d3b6d.tar.gz |
Added ability to make a Riverace Fix Kit
-rwxr-xr-x | bin/make_release.py | 315 |
1 files changed, 193 insertions, 122 deletions
diff --git a/bin/make_release.py b/bin/make_release.py index ed6409a4f9f..4cbb0f7c4ee 100755 --- a/bin/make_release.py +++ b/bin/make_release.py @@ -5,7 +5,7 @@ # # Packaging script for ACE/TAO/CIAO -from __future__ import with_statement +#from __future__ import with_statement from time import strftime import pysvn import re @@ -33,6 +33,7 @@ mailid = None """ A dict containing version information used for the release. This dict contains entries of the form COMPONENT_version +COMPONENT_fix COMPONENT_beta COMPONENT_minor COMPONENT_major """ @@ -87,6 +88,8 @@ def parse_args (): help="Create a minor release.", default=None, const="minor") parser.add_option ("--beta", dest="release_type", action="store_const", help="Create a beta release.", default=None, const="beta") + parser.add_option ("--fix", dest="release_type", action="store_const", + help="Create a fix kit release.", default=None, const="fix") parser.add_option ("--tag", dest="action", action="store_const", @@ -94,6 +97,8 @@ def parse_args (): parser.add_option ("--update", dest="update", action="store_true", help="Update the version numbers, only used with --tag", default=False) + parser.add_option ("--ace", dest="ace_only", action="store_const", + help="Only do ACE, not TAO, CIAO", default=None, const="yes") parser.add_option ("--kit", dest="action", action="store_const", help="Create kits. DO NOT USE WITH --tag", default=None, const="kit") @@ -188,14 +193,14 @@ def commit (files): rev = svn_client.checkin (files, "ChangeLogTag:%s %s <%s>" % (release_date, signature, mailid)) - print "Checked in files, resuling in revision ", rev.number + print "Checked in files, resulting in revision ", rev.number def check_workspace (): """ Checks that the DOC and MPC repositories are up to date. """ global opts, doc_root, svn_client # @@TODO: Replace with a svn library try: - rev = svn_client.update (doc_root) + rev = svn_client.update (doc_root + "ACE") print "Successfully updated ACE/TAO/CIAO working copy to revision " except: print "Unable to update ACE/TAO/CIAO workspace at " + doc_root @@ -221,26 +226,43 @@ def update_version_files (component): retval = list () ## Update component/VERSION - with open (component + "/VERSION", "r+") as version_file: - new_version = re.sub (component + " version .*", - "%s version %s, released %s" % (component, - comp_versions[component + "_version"], - release_date), - version_file.read ()) - if opts.take_action: - version_file.seek (0) - version_file.truncate (0) - version_file.write (new_version) - else: - print "New version file for " + component - print new_version + version_file = open (component + "/VERSION", "r+") + new_version = re.sub (component + " version .*", + "%s version %s, released %s" % (component, + comp_versions[component + "_version"], + release_date), + version_file.read ()) + if opts.take_action: + version_file.seek (0) + version_file.truncate (0) + version_file.write (new_version) + else: + print "New version file for " + component + print new_version vprint ("Updating Version.h for " + component) - + version_file.close() retval += [component + "/VERSION"] ## Update component/component/Version.h - version_header = """ + if opts.release_type == "fix": + version_header = """ +// -*- C++ -*- +// $Id$ +// This is file was automatically generated by \$ACE_ROOT/bin/make_release. + +#define %s_MAJOR_VERSION %s +#define %s_MINOR_VERSION %s +#define %s_BETA_VERSION %s +#define %s_FIX_VERSION \"%s\" +#define %s_VERSION \"%s\" +""" % (component, comp_versions[component + "_major"], + component, comp_versions[component + "_minor"], + component, comp_versions[component + "_beta"], + component, comp_versions[component + "_fix"], + component, comp_versions[component + "_version"]) + else: + version_header = """ // -*- C++ -*- // $Id$ // This is file was automatically generated by \$ACE_ROOT/bin/make_release. @@ -255,8 +277,9 @@ def update_version_files (component): component, comp_versions[component + "_version"]) if opts.take_action: - with open (component + '/' + component.lower () + "/Version.h", 'r+') as version_h: - version_h.write (version_header) + version_h = open (component + '/' + component.lower () + "/Version.h", 'r+') + version_h.write (version_header) + version_h.close() else: print "New Version.h for " + component print version_header @@ -268,31 +291,31 @@ def update_version_files (component): version_string = re.compile ("^\s*(\w+) +VERSION ?:") - with open (component + "/PROBLEM-REPORT-FORM", 'r+') as prf: - new_prf = "" - for line in prf.readlines (): - match = None - match = version_string.search (line) - if match is not None: - vprint ("Found PRF Version for " + match.group (1)) - line = re.sub ("(\d\.)+\d?", - comp_versions[match.group(1) + "_version"], - line) - - new_prf += line - - if opts.take_action: - prf.seek (0) - prf.truncate (0) - prf.writelines (new_prf) - else: - print "New PRF for " + component - print "".join (new_prf) + prf = open (component + "/PROBLEM-REPORT-FORM", 'r+') + new_prf = "" + for line in prf.readlines (): + match = None + match = version_string.search (line) + if match is not None: + vprint ("Found PRF Version for " + match.group (1)) + line = re.sub ("(\d\.)+\d?[a-z]?", + comp_versions[match.group(1) + "_version"], + line) + + new_prf += line + + if opts.take_action: + prf.seek (0) + prf.truncate (0) + prf.writelines (new_prf) + else: + print "New PRF for " + component + print "".join (new_prf) retval += [component + "/PROBLEM-REPORT-FORM"] + prf.close() return retval - def get_and_update_versions (): """ Gets current version information for each component, updates the version files, creates changelog entries, @@ -300,16 +323,19 @@ def get_and_update_versions (): try: get_comp_versions ("ACE") - get_comp_versions ("TAO") - get_comp_versions ("CIAO") + if opts.ace_only != "yes": + get_comp_versions ("TAO") + get_comp_versions ("CIAO") files = list () files += update_version_files ("ACE") - files += update_version_files ("TAO") - files += update_version_files ("CIAO") + if opts.ace_only != "yes": + files += update_version_files ("TAO") + files += update_version_files ("CIAO") files += create_changelog ("ACE") - files += create_changelog ("TAO") - files += create_changelog ("CIAO") + if opts.ace_only != "yes": + files += create_changelog ("TAO") + files += create_changelog ("CIAO") commit (files) except: @@ -334,65 +360,80 @@ def create_changelog (component): vprint ("Changelog Entry for " + component + "\n" + changelog_entry) - with open ("%s/ChangeLog" % (component), 'r+') as changelog: - changelog_entry += changelog.read () - - if opts.take_action: - changelog.seek (0) - changelog.truncate (0) - changelog.write (changelog_entry) + changelog = open ("%s/ChangeLog" % (component), 'r+') + changelog_entry += changelog.read () + if opts.take_action: + changelog.seek (0) + changelog.truncate (0) + changelog.write (changelog_entry) + changelog.close() return ["%s/ChangeLog" % (component)] def get_comp_versions (component): """ Extracts the current version number from the VERSION file and increments it appropriately for the release type requested.""" - vprint ("Detecting current version for" + component) + vprint ("Detecting current version for " + component) import re global comp_versions, opts + fix = re.compile ("version (\d+)\.(\d+)([a-z]{1})") beta = re.compile ("version (\d+)\.(\d+)\.(\d+)") minor = re.compile ("version (\d+)\.(\d+)[^\.]") major = re.compile ("version (\d+)[^\.]") - with open (component + "/VERSION") as version_file: - for line in version_file: - match = None + version_file = open (component + "/VERSION") + for line in version_file: + match = None - match = beta.search (line) - if match is not None: - vprint ("Detected beta version %s.%s.%s" % - (match.group (1), match.group (2), match.group (3))) + match = fix.search (line) + if match is not None: + vprint ("Detected fix version %s.%s%s" % + (match.group (1), match.group (2), match.group (3))) - comp_versions[component + "_major"] = int (match.group (1)) - comp_versions[component + "_minor"] = int (match.group (2)) - comp_versions[component + "_beta"] = int (match.group (3)) - break + comp_versions[component + "_major"] = int (match.group (1)) + comp_versions[component + "_minor"] = int (match.group (2)) + comp_versions[component + "_fix"] = str (match.group (3)) + comp_versions[component + "_beta"] = 0 + break + + match = beta.search (line) + if match is not None: + vprint ("Detected beta version %s.%s.%s" % + (match.group (1), match.group (2), match.group (3))) - match = minor.search (line) - if match is not None: - vprint ("Detected minor version %s.%s" % - (match.group (1), match.group (2))) + comp_versions[component + "_major"] = int (match.group (1)) + comp_versions[component + "_minor"] = int (match.group (2)) + comp_versions[component + "_beta"] = int (match.group (3)) + break - comp_versions[component + "_major"] = int (match.group (1)) - comp_versions[component + "_minor"] = int (match.group (2)) - comp_versions[component + "_beta"] = 0 - break + match = minor.search (line) + if match is not None: + vprint ("Detected minor version %s.%s" % + (match.group (1), match.group (2))) - match = major.search (line) - if match is not None: - vprint ("Detected major version " + match.group (1) + ".0") + comp_versions[component + "_major"] = int (match.group (1)) + comp_versions[component + "_minor"] = int (match.group (2)) + comp_versions[component + "_beta"] = 0 + comp_versions[component + "_fix"] = "" + break - comp_versions[component + "_major"] = int (match.group (1)) - comp_versions[component + "_minor"] = 0 - comp_versions[component + "_beta"] = 0 - break + match = major.search (line) + if match is not None: + vprint ("Detected major version " + match.group (1) + ".0") - print "FATAL ERROR: Unable to locate current version for " + component - raise Exception + comp_versions[component + "_major"] = int (match.group (1)) + comp_versions[component + "_minor"] = 0 + comp_versions[component + "_beta"] = 0 + comp_versions[component + "_fix"] = "" + break + + print "FATAL ERROR: Unable to locate current version for " + component + raise Exception + version_file.close() if opts.update: if opts.release_type == "major": @@ -404,12 +445,25 @@ def get_comp_versions (component): comp_versions[component + "_beta"] = 0 elif opts.release_type == "beta": comp_versions[component + "_beta"] += 1 + elif opts.release_type == "fix": + if comp_versions[component + "_fix"] == "": + comp_versions[component + "_fix"] = "a" + else: + fixsequence = "abcdefghijklmnopqrstuvwxyz" + oldfix = comp_versions[component + "_fix"] + comp_versions[component + "_fix"] = \ + fixsequence[fixsequence.find(oldfix) + 1] if opts.release_type == "beta": comp_versions [component + "_version"] = \ str (comp_versions[component + "_major"]) + '.' + \ str (comp_versions[component + "_minor"]) + '.' + \ str (comp_versions[component + "_beta"]) + elif opts.release_type == "fix": + comp_versions [component + "_version"] = \ + str (comp_versions[component + "_major"]) + '.' + \ + str (comp_versions[component + "_minor"]) + \ + str (comp_versions[component + "_fix"]) else: comp_versions [component + "_version"] = \ str (comp_versions[component + "_major"]) + '.' + \ @@ -420,12 +474,21 @@ def tag (): """ Tags the DOC and MPC repositories for the version """ global comp_versions, opts - branch = "ACE+TAO+CIAO-%d_%d_%d" % (comp_versions["ACE_major"], - comp_versions["ACE_minor"], - comp_versions["ACE_beta"]) - # Tag middleware - svn_client.copy (opts.repo_root + "/Middleware/trunk", - opts.repo_root + "/Middleware/tags/" + branch) + # If making an ACE fix kit, only tag the ACE branch, not all of trunk. + if opts.release_type == "fix": + branch = "Riverace-ACE-%d_%d%s" % (comp_versions["ACE_major"], + comp_versions["ACE_minor"], + comp_versions["ACE_fix"]) + # Tag ACE + svn_client.copy (opts.repo_root + "/Middleware/branches/Riverace-5.7", + opts.repo_root + "/Middleware/tags/" + branch) + else: + branch = "ACE+TAO+CIAO-%d_%d_%d" % (comp_versions["ACE_major"], + comp_versions["ACE_minor"], + comp_versions["ACE_beta"]) + # Tag middleware + svn_client.copy (opts.repo_root + "/Middleware/trunk", + opts.repo_root + "/Middleware/tags/" + branch) # Tag MPC svn_client.copy (opts.repo_root + "/MPC/trunk", @@ -447,13 +510,14 @@ def export_wc (stage_dir): svn_client.export (doc_root + "/ACE/MPC", stage_dir + "/ACE_wrappers/MPC") - print ("Exporting TAO") - svn_client.export (doc_root + "/TAO", - stage_dir + "/ACE_wrappers/TAO") + if opts.ace_only != "yes": + print ("Exporting TAO") + svn_client.export (doc_root + "/TAO", + stage_dir + "/ACE_wrappers/TAO") - print ("Exporting CIAO") - svn_client.export (doc_root + "/CIAO", - stage_dir + "/ACE_wrappers/TAO/CIAO") + print ("Exporting CIAO") + svn_client.export (doc_root + "/CIAO", + stage_dir + "/ACE_wrappers/TAO/CIAO") def update_packages (text_files, bin_files, stage_dir, package_dir): @@ -640,31 +704,33 @@ def package (stage_dir, package_dir, decorator): text_files = list () bin_files = list () - # for TAO: - text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers/TAO"), - "ACE_wrappers/TAO", ["CIAO", "autom4te.cache"]) + if opts.ace_only != "yes": -# write_file_lists ("fTAO" + decorator, text_files, bin_files) - update_packages ("\n".join (text_files), - "\n".join (bin_files), - stage_dir, - package_dir) + # for TAO: + text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers/TAO"), + "ACE_wrappers/TAO", ["CIAO", "autom4te.cache"]) - move_packages ("ACE+TAO" + decorator, stage_dir, package_dir) + # write_file_lists ("fTAO" + decorator, text_files, bin_files) + update_packages ("\n".join (text_files), + "\n".join (bin_files), + stage_dir, + package_dir) - text_files = list () - bin_files = list () - # for CIAO: - text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers/TAO/CIAO"), - "ACE_wrappers/TAO/CIAO", "") + move_packages ("ACE+TAO" + decorator, stage_dir, package_dir) -# write_file_lists ("fCIAO" + decorator, text_files, bin_files) - update_packages ("\n".join (text_files), - "\n".join (bin_files), - stage_dir, - package_dir) + text_files = list () + bin_files = list () + # for CIAO: + text_files, bin_files = create_file_lists (join (stage_dir, "ACE_wrappers/TAO/CIAO"), + "ACE_wrappers/TAO/CIAO", "") + + # write_file_lists ("fCIAO" + decorator, text_files, bin_files) + update_packages ("\n".join (text_files), + "\n".join (bin_files), + stage_dir, + package_dir) - move_packages ("ACE+TAO+CIAO" + decorator, stage_dir, package_dir) + move_packages ("ACE+TAO+CIAO" + decorator, stage_dir, package_dir) def generate_workspaces (stage_dir): """ Generates workspaces in the given stage_dir """ @@ -678,15 +744,19 @@ def generate_workspaces (stage_dir): # Set up our environment os.putenv ("ACE_ROOT", os.path.join (stage_dir, "ACE_wrappers")) os.putenv ("MPC_ROOT", os.path.join (stage_dir, "ACE_wrappers", "MPC")) - os.putenv ("TAO_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO")) - os.putenv ("CIAO_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO", "CIAO")) + if opts.ace_only != "yes": + os.putenv ("TAO_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO")) + os.putenv ("CIAO_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO", "CIAO")) # Create option strings mpc_command = os.path.join (stage_dir, "ACE_wrappers", "bin", "mwc.pl") - exclude_option = ' -exclude TAO/TAO_*.mwc,TAO/CIAO/CIAO_*.mwc ' mpc_option = ' -recurse -hierarchy -relative ACE_ROOT=' + stage_dir + '/ACE_wrappers ' - mpc_option += ' -relative TAO_ROOT=' + stage_dir + '/ACE_wrappers/TAO ' - mpc_option += ' -relative CIAO_ROOT=' + stage_dir + '/ACE_wrappers/TAO/CIAO ' + if opts.ace_only != "yes": + mpc_option += ' -relative TAO_ROOT=' + stage_dir + '/ACE_wrappers/TAO ' + mpc_option += ' -relative CIAO_ROOT=' + stage_dir + '/ACE_wrappers/TAO/CIAO ' + exclude_option = ' -exclude TAO/TAO_*.mwc,TAO/CIAO/CIAO_*.mwc ' + else: + exclude_option = ' ' static_vc71_option = ' -static -name_modifier *_vc71_Static -apply_project -exclude TAO/CIAO ' static_vc71_option += mpc_option @@ -755,8 +825,9 @@ def create_kit (): print "Getting current version information...." get_comp_versions ("ACE") - get_comp_versions ("TAO") - get_comp_versions ("CIAO") + if opts.ace_only != "yes": + get_comp_versions ("TAO") + get_comp_versions ("CIAO") print "Creating working directories...." stage_dir, package_dir = make_working_directories () |