From b2d1220c18fb95537015ecc752846ffe2b5989fa Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Thu, 13 May 2021 08:19:43 -0500 Subject: [PATCH] cherry-picked release script changes from fb1c569bc48ecf8d8adc79af59fed680aa12d3dc 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 | 91 ++++++++++++++++++++++--------------------------- 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/ACE/bin/make_release.py b/ACE/bin/make_release.py index 6f4f7633e92..b3fea3eb8c7 100755 --- a/ACE/bin/make_release.py +++ b/ACE/bin/make_release.py @@ -51,8 +51,6 @@ bin_regex = re.compile ("\.(mak|mdp|ide|exe|ico|gz|zip|xls|sxd|gif|vcp|vcproj|vc version_restr = r'(\d+)(?:\.(\d+)(?:\.(\d+))?)?' version_re = re.compile(version_restr) -default_branch = "master" - ################################################## #### 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,23 +217,21 @@ 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_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 + "_version"], - component, comp_versions[component + "_code"], - component) +#define {comp}_MAJOR_VERSION {major} +#define {comp}_MINOR_VERSION {minor} +#define {comp}_MICRO_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: @@ -421,29 +418,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" % @@ -458,17 +447,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_ACE7TAO3_* branches to point to the new release. """ name = "Latest_ACE7TAO3_" + 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_ACE7TAO3_* branches to point to the new release. """ @@ -484,14 +473,14 @@ 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", "Micro") - fn ("MPC", "Micro") + 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", "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", "Major") + fn ("ACE_TAO", "Major", opts.ace_tao_branch) + fn ("MPC", "ACETAO_Major", opts.mpc_branch) def tag (): @@ -527,8 +516,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) -- 2.11.4.GIT