From fb1c569bc48ecf8d8adc79af59fed680aa12d3dc Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Wed, 12 May 2021 15:14:57 -0500 Subject: [PATCH] Fix Branch Issue with Release Script Also do some cleanup, and change the `*_VERSION_CODE` macros to be formatted using hexadecimal. --- ACE/bin/make_release.py | 96 ++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 54 deletions(-) diff --git a/ACE/bin/make_release.py b/ACE/bin/make_release.py index e89e0ca7cea88..764f826c39003 100755 --- a/ACE/bin/make_release.py +++ b/ACE/bin/make_release.py @@ -51,8 +51,6 @@ version_restr = r'(\d+)(?:\.(\d+)(?:\.(\d+))?)?' version_re = re.compile(version_restr) -default_branch = "ace6tao2" - ################################################## #### Utility Methods ################################################## @@ -89,13 +87,14 @@ def parse_args (): parser.add_argument ("--root", dest="repo_root", help="Specify an alternate repository root", default="https://github.com/DOCGroup/ACE_TAO.git") - - parser.add_argument ("--branch", - help="Git branch to work off", default=default_branch) + parser.add_argument ("--ace-tao-branch", + help="ACE/TAO branch to update", default="ace6tao2") parser.add_argument ("--mpc_root", help="Specify an alternate MPC repository root", default="https://github.com/DOCGroup/MPC.git") + parser.add_argument ("--mpc-branch", + help="MPC branch to update", default="master") parser.add_argument ("-n", dest="take_action", action="store_false", help="Take no action", default=True) @@ -218,25 +217,22 @@ def update_version_files (component): retval.append(path) - ## Update component/component/Version.h + ## Update COMPONENT/component/Version.h + comp_l = len(component + "_") + parts = {k[comp_l:]:v for (k, v) in comp_versions.items() if k.startswith(component)} + parts["comp"] = component version_header = """ // -*- C++ -*- // This is file was automatically generated by $ACE_ROOT/bin/make_release.py -#define %s_MAJOR_VERSION %s -#define %s_MINOR_VERSION %s -#define %s_MICRO_VERSION %s -#define %s_BETA_VERSION %s -#define %s_VERSION \"%s\" -#define %s_VERSION_CODE %s -#define %s_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -""" % (component, comp_versions[component + "_major"], - component, comp_versions[component + "_minor"], - component, comp_versions[component + "_micro"], - component, comp_versions[component + "_micro"], - component, comp_versions[component + "_version"], - component, comp_versions[component + "_code"], - component) +#define {comp}_MAJOR_VERSION {major} +#define {comp}_MINOR_VERSION {minor} +#define {comp}_MICRO_VERSION {micro} +#define {comp}_BETA_VERSION {micro} +#define {comp}_VERSION \"{version}\" +#define {comp}_VERSION_CODE 0x{code:x} +#define {comp}_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +""".format(**parts) path = get_path(component, component.lower (), "Version.h") if opts.take_action: @@ -423,29 +419,21 @@ def get_comp_versions (component): elif opts.release_type == ReleaseType.micro: comp_versions[micro] += 1 - #if opts.release_type == "micro": - comp_versions [component + "_version"] = \ - str (comp_versions[major]) + '.' + \ - str (comp_versions[minor]) + '.' + \ - str (comp_versions[micro]) - comp_versions [component + "_version_"] = \ - str (comp_versions[major]) + '_' + \ - str (comp_versions[minor]) + '_' + \ - str (comp_versions[micro]) + def make_version (versions, joiner): + return joiner.join ([ + str (versions[component + '_' + x]) for x in ReleaseType.__members__.keys () + ]) + + comp_versions [component + "_version"] = make_version (comp_versions, '.') + comp_versions [component + "_version_"] = make_version (comp_versions, '_') comp_versions [component + "_code"] = \ - str((comp_versions[major] << 16) + \ - (comp_versions[minor] << 8) + \ - comp_versions[micro]) - - old_comp_versions[component + "_version"] = \ - str (old_comp_versions[major]) + '.' + \ - str (old_comp_versions[minor]) + '.' + \ - str (old_comp_versions[micro]) - old_comp_versions[component + "_version_"] = \ - str (old_comp_versions[major]) + '_' + \ - str (old_comp_versions[minor]) + '_' + \ - str (old_comp_versions[micro]) + (comp_versions[major] << 16) + \ + (comp_versions[minor] << 8) + \ + comp_versions[micro] + + old_comp_versions [component + "_version"] = make_version (old_comp_versions, '.') + old_comp_versions [component + "_version_"] = make_version (old_comp_versions, '_') if opts.update: vprint ("Updating from version %s to version %s" % @@ -460,17 +448,17 @@ def get_comp_versions (component): # str (comp_versions[minor]) -def update_latest_branch (product, which): +def update_latest_branch (product, which, main_branch): """Update one of the Latest_* branches to point to the new release. """ name = "Latest_" + which - vprint ('Fast-forwarding', name, 'to', opts.branch) - ex ("cd $DOC_ROOT/" + product + " && git fetch . " + opts.branch + ":" + name) + vprint ('Fast-forwarding', name, 'to', main_branch) + ex ("cd $DOC_ROOT/" + product + " && git fetch . " + main_branch + ":" + name) -def push_latest_branch (product, which): +def push_latest_branch (product, which, main_branch): """Update one of the remote Latest_* branches to point to the new release. """ @@ -486,15 +474,15 @@ def latest_branch_helper (fn, release_type): release_types = tuple(ReleaseType.__members__.values()) do = release_types[release_types.index(release_type):] if ReleaseType.micro in do: - fn ("ACE_TAO", "Beta") - fn ("ACE_TAO", "Micro") - fn ("MPC", "ACETAO_Micro") + fn ("ACE_TAO", "Beta", opts.ace_tao_branch) + fn ("ACE_TAO", "Micro", opts.ace_tao_branch) + fn ("MPC", "ACETAO_Micro", opts.mpc_branch) if ReleaseType.minor in do: - fn ("ACE_TAO", "Minor") - fn ("MPC", "ACETAO_Minor") + fn ("ACE_TAO", "Minor", opts.ace_tao_branch) + fn ("MPC", "ACETAO_Minor", opts.mpc_branch) if ReleaseType.major in do: - fn ("ACE_TAO", "Major") - fn ("MPC", "ACETAO_Major") + fn ("ACE_TAO", "Major", opts.ace_tao_branch) + fn ("MPC", "ACETAO_Major", opts.mpc_branch) def tag (): @@ -530,8 +518,8 @@ def push (): if opts.push: if opts.take_action: - vprint ("Pushing ACE_TAO", opts.branch, "to origin") - ex ("cd $DOC_ROOT/ACE_TAO && git push origin " + opts.branch) + vprint ("Pushing ACE_TAO", opts.ace_tao_branch, "to origin") + ex ("cd $DOC_ROOT/ACE_TAO && git push origin " + opts.ace_tao_branch) vprint ("Pushing tag %s on ACE_TAO" % (tagname)) ex ("cd $DOC_ROOT/ACE_TAO && git push origin tag " + tagname)