From nobody Tue May 21 07:14:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+57140+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57140+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1586459934; cv=none; d=zohomail.com; s=zohoarc; b=W7EhzP9HAUdap84i2Nr9s1jl4ofUuhc+6k1AHmHcQCfwgcOkjEAZlJObNZNkYannawg4n/6zQUtehrWRVXtyegXeYEWlxwhSmB9Gkn/9iUC6Vd540XEwXVjZLvrWxTswz7oe20V68Ajs4UXFNzGmVVBAH2a2PiJJHDQEUQeVW8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586459934; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=0kibTV4M4PzW2QLhd5cnQsxxfi7iTqZ6CWlq/qscjpQ=; b=cn0wcvQsqI0NuAfnKnpuzBkr2F3T49w0bNs6qtmRjHbKKgfhwY0Xlu4QwrSosZs7IbavePx9n2YB3qADJPMtYxsWcrA8QTqfHYjQF0c3VcYACLFM1vRVWJ4eqniAdBVbY9/8N/L81mkE4PF3y6e4qq4ba4F7vxPRMYN6rvX44gA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+57140+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1586459934177622.1776894748884; Thu, 9 Apr 2020 12:18:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id yUzRYY1788612x4LUHnpBgJ8; Thu, 09 Apr 2020 12:18:53 -0700 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.17049.1586459932847166214 for ; Thu, 09 Apr 2020 12:18:53 -0700 IronPort-SDR: fqQXuvQJ6s30ZG/qfgk+fFe3hXM88/Wfzvu0eFLKqw+EMqHeYrpXhTqL6zzx+BH/CU5Khka9Fz 48MwzbptEGtA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 12:18:52 -0700 IronPort-SDR: 1MDA0AbsGswPuvjNM63QOqvjhk0F9EDINpImfXgybclUyN+YzbHxmME/uldmun6fU2DaIZ0znk R2wpUkYACwiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,363,1580803200"; d="scan'208";a="330950781" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga001.jf.intel.com with ESMTP; 09 Apr 2020 12:18:51 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Fix sync -u when the initial combo is not present in the new manifest Date: Thu, 9 Apr 2020 12:18:49 -0700 Message-Id: <20200409191849.23764-1-ashley.e.desimone@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: i3SH2sGtnoV8n0mV03s3LJSWx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1586459933; bh=nyvJolzh+nyhacMOxQBDxtvvHtTNmuy/6oQRfcflYIE=; h=Cc:Date:From:Reply-To:Subject:To; b=vAUGJBLFoq1oLcOzfXyhOxwbaGyR31VPSWN4kIkTtDNMSVjzXzyR/2BxnDy9eTXusez o5jv14bQ9x7rmsGKEp4NYCHQleoucM6uKH/W4ew6kdeQNfMiklyV+UWjKHNhIkYj64ZXe fpLpH2kZenXWFtjugoCla1a3X5ZGurzFPHE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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_sources is available. If this case is encountered change the current checked out 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 Reviewed-by: Nate DeSimone --- 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_comma= nd.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_WARN= ING, SYNC_MANIFEST_UPDA from edkrepo.common.humble import SPARSE_RESET, SPARSE_CHECKOUT, SYNC_REPO= _CHANGE, SYNCING, FETCHING, UPDATING_MANIFEST from edkrepo.common.humble import NO_SYNC_DETACHED_HEAD, SYNC_COMMITS_ON_M= ASTER, SYNC_ERROR from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO, SYNC_NEEDS_R= EBASE, INCLUDED_FILE_NAME -from edkrepo.common.humble import SYNC_BRANCH_CHANGE_ON_LOCAL +from edkrepo.common.humble import SYNC_BRANCH_CHANGE_ON_LOCAL, SYNC_INCOMP= ATIBLE_COMBO from edkrepo.common.humble import SYNC_REBASE_CALC_FAIL from edkrepo.common.pathfix import get_actual_path from edkrepo.common.common_repo_functions 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 replaced= with underscores due to argparse self.__update_local_manifest(args, config, initial_manifest, w= orkspace_path) manifest =3D get_workspace_manifest() + if args.update_local_manifest: + try: + repo_sources_to_sync =3D manifest.get_repo_sources(current= _combo) + except ValueError: + # The manifest file was updated and the initial combo is n= o longer present so use the default combo + current_combo =3D manifest.general_config.default_combo + repo_sources_to_sync =3D 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 f= or 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_projec= t_xml(initial_manifest.project_info.codename)) global_manifest_path =3D os.path.join(global_manifest_directory, c= i_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 t= o 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 new= _manifest_to_check.get_repo_sources(new_manifest_to_check.general_config.de= fault_combo): + new_sources_for_current_combo =3D new_manifest_to_check.ge= t_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 out= with an IMCOMPATIBLE_COMBO warning + print(SYNC_COMBO_CHANGE.format(current_combo, initial_mani= fest.project_info.codename)) + raise EdkrepoManifestChangedException(SYNC_INCOMPATIBLE_CO= MBO) + else: + new_sources_for_current_combo =3D new_manifest_to_check.get_re= po_sources(current_combo) + new_sources =3D 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_s= ources(current_combo) + self.__check_submodule_config(workspace_path, new_manifest_to_chec= k, new_sources_for_current_combo) new_manifest_remotes =3D {name:url for name, url in new_manifest_t= o_check.remotes} #check for changes to remote urls @@ -221,12 +245,7 @@ class SyncCommand(EdkrepoCommand): if remote_name in new_manifest_remotes.keys(): if initial_manifest_remotes[remote_name] !=3D new_manifest= _remotes[remote_name]: raise EdkrepoManifestChangedException(SYNC_URL_CHANGE.= format(remote_name)) - #check to see if the currently checked out combo exists in the new= manifest. - new_combos =3D combinations_in_manifest(new_manifest_to_check) - if current_combo not in new_combos: - raise EdkrepoManifestChangedException(SYNC_COMBO_CHANGE.format= (current_combo, - = initial_manifest.project_info.codename)) - new_sources =3D new_manifest_to_check.get_repo_sources(current_com= bo) + # 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_sources= ): raise EdkrepoManifestChangedException(SYNC_REPO_CHANGE.format(= initial_manifest.project_info.codename)) diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py index 5326e88..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} bra= nch.\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.\n= To complete this operation please rerun the command with the --override fla= g\n' + SYNC_EXIT SYNC_URL_CHANGE =3D 'The URL for the remote, {0} has changed.\n' + SYNC_EX= IT -SYNC_COMBO_CHANGE =3D 'The current checked out combination, {0}, does not = exist in the latest manifest for project, {1}\n' + SYNC_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 cha= nge in currently cloned repositories.\nTo complete this operation please re= run the command with the --override flag\n' + SYNC_EXIT SYNC_SOURCE_MOVE_WARNING =3D '{}{}WARNING:{}{} {{}} being moved to {{}}'.f= ormat(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED) SYNC_REMOVE_WARNING =3D '{}{}WARNING:{}{} The following repos no longer ex= ist in the new manifest and can no \nlonger be used for submitting code. Pl= ease 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_UPDATE_FIX =3D 'To checkout the new SHA/tag/branch run edkrepo checko= ut on the current combo.\n' SYNC_BRANCH_CHANGE_ON_LOCAL =3D 'The SHA, tag or branch defined in the cur= rent combo has changed from {} to {} for the {} repo.\n The current workspa= ce is not on the SHA/tag/branch defined in the initial combo. Unable to che= ckout 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 lates= t manifest file. Cloning a new workspace is recommended. ' + SYNC_EXIT =20 #informational messages for sync_command.py SYNCING =3D 'Syncing {0} to latest {1} branch ...' --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#57140): https://edk2.groups.io/g/devel/message/57140 Mute This Topic: https://groups.io/mt/72904946/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-