From 73a4f1065a2e2e633abd21a1ff4a9225d1ee87c4 Mon Sep 17 00:00:00 2001 From: Steve Huston Date: Fri, 24 Sep 2010 15:26:47 +0000 Subject: Merge in ability to make Riverace fix kits --- bin/make_release.py | 423 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 248 insertions(+), 175 deletions(-) diff --git a/bin/make_release.py b/bin/make_release.py index ffc6ec463ac..bdf074801e1 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") @@ -195,7 +200,7 @@ def check_workspace (): 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 @@ -215,7 +220,7 @@ def check_workspace (): # By default retrieve MPC root from working copy if opts.mpc_root is None: - info = svn_client.info2 (doc_root + "/ACE/MPC")[0] + info = svn_client.info2 (doc_root + "/MPC")[0] opts.mpc_root = info[1]["repos_root_URL"] vprint ("Repos root URL = " + opts.repo_root + "\n") @@ -235,26 +240,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. @@ -269,8 +291,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 @@ -282,59 +305,60 @@ 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) + 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 + 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) + 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 update_spec_file (): global comp_versions, opts - with open (doc_root + "/ACE/rpmbuild/ace-tao.spec", 'r+') as spec_file: - new_spec = "" - for line in spec_file.readlines (): - if line.find ("define ACEVER ") is not -1: - line = "%define ACEVER " + comp_versions["ACE_version"] + "\n" - if line.find ("define TAOVER ") is not -1: - line = "%define TAOVER " + comp_versions["TAO_version"] + "\n" - if line.find ("define CIAOVER ") is not -1: - line = "%define CIAOVER " + comp_versions["CIAO_version"] + "\n" - if line.find ("define is_major_ver") is not -1: - if opts.release_type == "beta": - line = "%define is_major_ver 0\n" - else: - line = "%define is_major_ver 1\n" + spec_file = open (doc_root + "/ACE/rpmbuild/ace-tao.spec", 'r+') + new_spec = "" + for line in spec_file.readlines (): + if line.find ("define ACEVER ") is not -1: + line = "%define ACEVER " + comp_versions["ACE_version"] + "\n" + if line.find ("define TAOVER ") is not -1: + line = "%define TAOVER " + comp_versions["TAO_version"] + "\n" + if line.find ("define CIAOVER ") is not -1: + line = "%define CIAOVER " + comp_versions["CIAO_version"] + "\n" + if line.find ("define is_major_ver") is not -1: + if opts.release_type == "beta": + line = "%define is_major_ver 0\n" + else: + line = "%define is_major_ver 1\n" - new_spec += line + new_spec += line - if opts.take_action: - spec_file.seek (0) - spec_file.truncate (0) - spec_file.writelines (new_spec) - else: - print "New spec file:" - print "".join (new_spec) + if opts.take_action: + spec_file.seek (0) + spec_file.truncate (0) + spec_file.writelines (new_spec) + else: + print "New spec file:" + print "".join (new_spec) + close (spec_file) return [doc_root + "/ACE/rpmbuild/ace-tao.spec"] @@ -391,23 +415,24 @@ def update_debianbuild (): else: return match.group (1) + match.group (2) + comp_versions["ACE_version"] + match.group (4) - with open (doc_root + "/ACE/debian/control", 'r+') as control_file: - new_ctrl = "" - for line in control_file.readlines (): - if re.search ("^(Package|Depends|Suggests):", line) is not None: - line = mask.sub (update_ver, line) - elif re.search ('^Replaces:', line) is not None: - line = line.replace (prev_ace_ver, comp_versions["ACE_version"]) + control_file = open (doc_root + "/ACE/debian/control", 'r+') + new_ctrl = "" + for line in control_file.readlines (): + if re.search ("^(Package|Depends|Suggests):", line) is not None: + line = mask.sub (update_ver, line) + elif re.search ('^Replaces:', line) is not None: + line = line.replace (prev_ace_ver, comp_versions["ACE_version"]) - new_ctrl += line + new_ctrl += line - if opts.take_action: - control_file.seek (0) - control_file.truncate (0) - control_file.writelines (new_ctrl) - else: - print "New control file:" - print "".join (new_ctrl) + if opts.take_action: + control_file.seek (0) + control_file.truncate (0) + control_file.writelines (new_ctrl) + else: + print "New control file:" + print "".join (new_ctrl) + close (control_file) files.append (doc_root + "/ACE/debian/control") @@ -424,10 +449,11 @@ def update_debianbuild (): # """ % (comp_versions["TAO_version"], comp_versions["ACE_version"]) if opts.take_action: - with open (doc_root + "/ACE/debian/dsc", 'r+') as dsc_file: - dsc_file.seek (0) - dsc_file.truncate (0) - dsc_file.writelines (dsc_lines) + dsc_file = open (doc_root + "/ACE/debian/dsc", 'r+') + dsc_file.seek (0) + dsc_file.truncate (0) + dsc_file.writelines (dsc_lines) + close (dsc_file) else: print "New dsc file:\n" print dsc_lines @@ -443,18 +469,21 @@ 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") - files += update_spec_file () - files += update_debianbuild () + if opts.ace_only != "yes": + files += create_changelog ("TAO") + files += create_changelog ("CIAO") + files += update_spec_file () + files += update_debianbuild () commit (files) except: @@ -479,65 +508,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 = minor.search (line) - if match is not None: - vprint ("Detected minor version %s.%s" % - (match.group (1), match.group (2))) + 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))) - comp_versions[component + "_major"] = int (match.group (1)) - comp_versions[component + "_minor"] = int (match.group (2)) - comp_versions[component + "_beta"] = 0 - break + 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 - match = major.search (line) - if match is not None: - vprint ("Detected major version " + match.group (1) + ".0") + 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"] = 0 - comp_versions[component + "_beta"] = 0 - break + 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 - print "FATAL ERROR: Unable to locate current version for " + component - raise Exception + 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"] = 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": @@ -549,12 +593,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"]) + '.' + \ @@ -576,22 +633,30 @@ 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"]) - - if opts.take_action: - # Tag middleware - svn_client.copy (opts.repo_root + "/trunk", - opts.repo_root + "/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 + "/branches/Riverace-5.8", + opts.repo_root + "/tags/" + branch) + else: + branch = "ACE+TAO+CIAO-%d_%d_%d" % (comp_versions["ACE_major"], + comp_versions["ACE_minor"], + comp_versions["ACE_beta"]) + if opts.take_action: + # Tag middleware + svn_client.copy (opts.repo_root + "/trunk", + opts.repo_root + "/tags/" + branch) - # Tag MPC - svn_client.copy (opts.mpc_root + "/trunk", - opts.mpc_root + "/tags/" + branch) + # Tag MPC + svn_client.copy (opts.mpc_root + "/trunk", + opts.mpc_root + "/tags/" + branch) - # Update latest tag - # mcorino@remedy.nl - subversion does not seem to support propset directly - # on URLs (except for some strange reason through propedit) + # Update latest tag + # mcorino@remedy.nl - subversion does not seem to support propset directly + # on URLs (except for some strange reason through propedit) #if opts.release_type == "major": #update_latest_tag ("Major", branch) #elif opts.release_type == "minor": @@ -601,10 +666,10 @@ def tag (): #update_latest_tag ("Micro", branch) #if comp_versions["ACE_beta"] == 1: #update_latest_tag ("BFO", branch) - else: - print "Creating tags:\n" - print opts.repo_root + "/trunk -> " + opts.repo_root + "/tags/" + branch + "\n" - print opts.mpc_root + "/trunk -> " + opts.mpc_root + "/tags/" + branch + "\n" + else: + print "Creating tags:\n" + print opts.repo_root + "/trunk -> " + opts.repo_root + "/tags/" + branch + "\n" + print opts.mpc_root + "/trunk -> " + opts.mpc_root + "/tags/" + branch + "\n" ################################################## #### Packaging methods @@ -622,13 +687,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): @@ -815,31 +881,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", "") - move_packages ("ACE+TAO+CIAO" + 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) + + move_packages ("ACE+TAO+CIAO" + decorator, stage_dir, package_dir) def generate_workspaces (stage_dir): """ Generates workspaces in the given stage_dir """ @@ -853,16 +921,20 @@ 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")) os.putenv ("DANCE_ROOT", os.path.join (stage_dir, "ACE_wrappers", "TAO", "CIAO", "DAnCE")) # 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 = ' ' mpc_option += ' -relative DANCE_ROOT=' + stage_dir + '/ACE_wrappers/TAO/CIAO/DAnCE ' static_vc8_option = ' -static -name_modifier *_vc8_Static -apply_project -exclude TAO/CIAO ' @@ -920,8 +992,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 () -- cgit v1.2.1