From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.2109.1586541334480746705 for ; Fri, 10 Apr 2020 10:55:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: D0hZU2J6WmmyJh/hx54RQLuS7KSE5u1lVbrUh4lT3f0h1dr2N2uxupGw6+ZtN3jFA1Av1I2UoW 36upgYN4cgSQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 10:55:33 -0700 IronPort-SDR: doRxxe6TAbxP00VR0hCCNtDTvVG3qZt+UwU93UAIwoZSHThUhn/d+aotBuLXodZd+OD3Bv9f0a B2s/iInmTkLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,367,1580803200"; d="scan'208";a="255540233" Received: from orsmsx102.amr.corp.intel.com ([10.22.225.129]) by orsmga006.jf.intel.com with ESMTP; 10 Apr 2020 10:55:33 -0700 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.205]) by ORSMSX102.amr.corp.intel.com ([169.254.3.165]) with mapi id 14.03.0439.000; Fri, 10 Apr 2020 10:55:33 -0700 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "Desimone, Ashley E" CC: "Pandya, Puja" , "Bjorge, Erik C" , Bret Barkelew , "Agyeman, Prince" Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix sync -u when the initial combo is not present in the new manifest Thread-Topic: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix sync -u when the initial combo is not present in the new manifest Thread-Index: AQHWDqO3M1sElB0EgkWkTZV3S6NsZqhypRaQ Date: Fri, 10 Apr 2020 17:55:32 +0000 Message-ID: <02A34F284D1DA44BB705E61F7180EF0AB5E7E596@ORSMSX114.amr.corp.intel.com> References: <20200409191849.23764-1-ashley.e.desimone@intel.com> In-Reply-To: <20200409191849.23764-1-ashley.e.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWI3YTRlNDktZWFhNy00YTAxLTlmYWItZjY0MDU2NjZiNzQ2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiekZZbWpKcmtqcFBJSFR2VnFPUE00dTJlbURSOFJZb0FYOFFDNndLZUozQml3eWxFTnBBYTc5MnJSUjc5R2FGUSJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: devel@edk2.groups.io On Behalf Of Ashley E De= simone Sent: Thursday, April 9, 2020 12:19 PM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Pandya, Puja <= puja.pandya@intel.com>; Bjorge, Erik C ; Bret Bark= elew ; Agyeman, Prince Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix sync -u = when the initial combo is not present in the new manifest Allow the sync command to update the local manifest when the combos in the= initial manifest are no longer present if a combo with compatible repo_sou= rces is available. If this case is encountered change the current checked o= ut combo to be the default combination from the new manifest file. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/sync_command.py | 37 ++++++++++++++++++++++++++++-------= -- edkrepo/common/humble.py | 3 ++- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_comm= and.py index eac8727..af83cd2 100644 --- a/edkrepo/commands/sync_command.py +++ b/edkrepo/commands/sync_command.py @@ -29,7 +29,7 @@ from edkrepo.common.humble import SYNC_MANIFEST_DIFF_WAR= NING, SYNC_MANIFEST_UPDA from edkrepo.common.humble import SPARSE_RESET, S= PARSE_CHECKOUT, SYNC_REPO_CHANGE, SYNCING, FETCHING, UPDATING_MANIFEST fro= m edkrepo.common.humble import NO_SYNC_DETACHED_HEAD, SYNC_COMMITS_ON_MASTE= R, SYNC_ERROR from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO= , SYNC_NEEDS_REBASE, INCLUDED_FILE_NAME -from edkrepo.common.humble import = SYNC_BRANCH_CHANGE_ON_LOCAL +from edkrepo.common.humble import SYNC_BRANCH_CHANGE_ON_LOCAL,=20 +SYNC_INCOMPATIBLE_COMBO from edkrepo.common.humble import SYNC_REBASE_CALC_FAIL from edkrepo.com= mon.pathfix import get_actual_path from edkrepo.common.common_repo_functio= ns import pull_latest_manifest_repo, clone_repos, sparse_checkout_enabled @= @ -104,8 +104,15 @@ class SyncCommand(EdkrepoCommand): if args.update_local_manifest: #NOTE: hyphens in arg name replace= d with underscores due to argparse self.__update_local_manifest(args, config, initial_manifest, = workspace_path) manifest =3D get_workspace_manifest() + if args.update_local_manifest: + try: + repo_sources_to_sync =3D manifest.get_repo_sources(curren= t_combo) + except ValueError: + # The manifest file was updated and the initial combo is = no longer present so use the default combo + current_combo =3D manifest.general_config.default_combo + repo_sources_to_sync =3D=20 + manifest.get_repo_sources(current_combo) manifest.write_current_combo(current_combo) - repo_sources_to_sync =3D manifest.get_repo_sources(current_combo) + sync_error =3D False # Calculate the hooks which need to be updated, added or removed = for the sync if args.update_local_manifest: @@ -211,9 +218,26 @@ class SyncCommand(EdkrepoCommand): ci_index_xml_rel_path =3D os.path.normpath(ci_index_xml.get_proje= ct_xml(initial_manifest.project_info.codename)) global_manifest_path =3D os.path.join(global_manifest_directory, = ci_index_xml_rel_path) new_manifest_to_check =3D ManifestXml(global_manifest_path) + + # Does the current combo exist in the new manifest? If not check = to see if you can use the repo sources from + # the default combo + initial_combos =3D combinations_in_manifest(initial_manifest) + new_combos =3D combinations_in_manifest(new_manifest_to_check) + if (current_combo not in new_combos) or (set(new_combos) !=3D set= (initial_combos)): + if initial_manifest.get_repo_sources(current_combo) =3D=3D ne= w_manifest_to_check.get_repo_sources(new_manifest_to_check.general_config.d= efault_combo): + new_sources_for_current_combo =3D new_manifest_to_check.g= et_repo_sources(new_manifest_to_check.general_config.default_combo) + new_sources =3D new_sources_for_current_combo + else: + # Since asymetric combinations are not supported error ou= t with an IMCOMPATIBLE_COMBO warning + print(SYNC_COMBO_CHANGE.format(current_combo, initial_man= ifest.project_info.codename)) + raise EdkrepoManifestChangedException(SYNC_INCOMPATIBLE_C= OMBO) + else: + new_sources_for_current_combo =3D new_manifest_to_check.get_r= epo_sources(current_combo) + new_sources =3D=20 + new_manifest_to_check.get_repo_sources(current_combo) + remove_included_config(initial_manifest.remotes, initial_manifest= .submodule_alternate_remotes, local_manifest_dir) write_included_config(new_manifest_to_check.remotes, new_manifest= _to_check.submodule_alternate_remotes, local_manifest_dir) - new_sources_for_current_combo =3D new_manifest_to_check.get_repo_= sources(current_combo) + self.__check_submodule_config(workspace_path, new_manifest_to_che= ck, new_sources_for_current_combo) new_manifest_remotes =3D {name:url for name, url in new_manifest_= to_check.remotes} #check for changes to remote urls @@ -221,12 +245,7 @@ class Sync= Command(EdkrepoCommand): if remote_name in new_manifest_remotes.keys(): if initial_manifest_remotes[remote_name] !=3D new_manifes= t_remotes[remote_name]: raise EdkrepoManifestChangedException(SYNC_URL_CHANGE= .format(remote_name)) - #check to see if the currently checked out combo exists in the ne= w manifest. - new_combos =3D combinations_in_manifest(new_manifest_to_check) - if current_combo not in new_combos: - raise EdkrepoManifestChangedException(SYNC_COMBO_CHANGE.forma= t(current_combo, - = initial_manifest.project_info.codename)) - new_sources =3D new_manifest_to_check.get_repo_sources(current_co= mbo) + # Check that the repo sources lists are the same. If they are not= the same and the override flag is not set, throw an exception. if not args.override and set(initial_sources) !=3D set(new_source= s): raise EdkrepoManifestChangedException(SYNC_REPO_CHANGE.format= (initial_manifest.project_info.codename)) diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py index 532= 6e88..64b9519 100644 --- a/edkrepo/common/humble.py +++ b/edkrepo/common/humble.py @@ -49,7 +49,7 @@ SYNC_COMMITS_ON_MASTER =3D 'Commits were found on {0} br= anch.\n (use the "--overr SYNC_ERROR =3D '\nError: Some repositories were= not updated.' SYNC_MANIFEST_NOT_FOUND =3D 'A manifest for project, {0}, was not found.\= nTo complete this operation please rerun the command with the --override fl= ag\n' + SYNC_EXIT SYNC_URL_CHANGE =3D 'The URL for the remote, {0} has cha= nged.\n' + SYNC_EXIT -SYNC_COMBO_CHANGE =3D 'The current checked out combin= ation, {0}, does not exist in the latest manifest for project, {1}\n' + SYN= C_EXIT +SYNC_COMBO_CHANGE =3D 'The current checked out combination, {0}, does not= exist in the latest manifest for project, {1}\n'=20 SYNC_REPO_CHANGE =3D 'The latest manifest for project, {0}, requires a ch= ange in currently cloned repositories.\nTo complete this operation please r= erun the command with the --override flag\n' + SYNC_EXIT SYNC_SOURCE_MOVE_= WARNING =3D '{}{}WARNING:{}{} {{}} being moved to {{}}'.format(Style.BRIGHT= , Fore.RED, Style.RESET_ALL, Fore.RED) SYNC_REMOVE_WARNING =3D '{}{}WARNIN= G:{}{} The following repos no longer exist in the new manifest and can no \= nlonger be used for submitting code. Please manually delete the following \= ndirectories after saving any work you have in them:'.format(Style.BRIGHT, = Fore.RED, Style.RESET_ALL, Fore.RED) @@ -58,6 +58,7 @@ SYNC_NEEDS_REBASE = =3D BRANCH_BEHIND + '\n' + ' (use "git rebase {target_remote}/{ SYNC_UPD= ATE_FIX =3D 'To checkout the new SHA/tag/branch run edkrepo checkout on the= current combo.\n' SYNC_BRANCH_CHANGE_ON_LOCAL =3D 'The SHA, tag or branch defined in the cu= rrent combo has changed from {} to {} for the {} repo.\n The current worksp= ace is not on the SHA/tag/branch defined in the initial combo. Unable to ch= eckout new SHA/tag/branch.\n' + SYNC_UPDATE_FIX SYNC_REBASE_CALC_FAIL =3D = 'Unable to calculate if a rebase is required for the current branch' +SYNC_INCOMPATIBLE_COMBO =3D 'No compatible combinations found in the=20 +latest manifest file. Cloning a new workspace is recommended. ' +=20 +SYNC_EXIT =20 #informational messages for sync_command.py SYNCING =3D 'Syncing {0} to = latest {1} branch ...' -- 2.16.2.windows.1