From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.1563.1588981600546055161 for ; Fri, 08 May 2020 16:46:40 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: jXlfnBYVnIVbAKF6T7CxdO10y2LUGMh+smkUbxs4GR5Z0aeOWS+0Az7BMX0rnrb4Qzzr4b1tMy i8FDrnMiDLnA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2020 16:46:40 -0700 IronPort-SDR: ep3cbMfj+7l/rHzQJIodFlucEkl58lJ0aWjHyUwpC2qENvJuO9EEtm4HMbklOfnA9FoTcD5c5m i/fbUXGB6/IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,369,1583222400"; d="scan'208";a="264545628" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.16.147]) by orsmga006.jf.intel.com with ESMTP; 08 May 2020 16:46:39 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Add multiple manifest repository support to clone Date: Fri, 8 May 2020 16:46:36 -0700 Message-Id: <20200508234636.18268-3-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200508234636.18268-1-ashley.e.desimone@intel.com> References: <20200508234636.18268-1-ashley.e.desimone@intel.com> Update the clone command to support searching for the project to be cloned in all manifest repositories defined within both the edkrepo.cfg and the edkrepo_user.cfg files. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/clone_command.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py index cd65fe6..b7f3158 100644 --- a/edkrepo/commands/clone_command.py +++ b/edkrepo/commands/clone_command.py @@ -11,16 +11,18 @@ import os import shutil from edkrepo.commands.edkrepo_command import EdkrepoCommand -from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument +from edkrepo.commands.edkrepo_command import SubmoduleSkipArgument, SourceManifestRepoArgument import edkrepo.commands.arguments.clone_args as arguments -from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, clone_repos, sparse_checkout, verify_manifest_data -from edkrepo.common.common_repo_functions import update_editor_config +from edkrepo.common.common_repo_functions import clone_repos, sparse_checkout, verify_single_manifest +from edkrepo.common.common_repo_functions import update_editor_config, combinations_in_manifest from edkrepo.common.common_repo_functions import write_included_config, write_conditional_include -from edkrepo.common.common_repo_functions import find_project_in_index, combinations_in_manifest from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoManifestInvalidException from edkrepo.common.humble import CLONE_INVALID_WORKSPACE, CLONE_INVALID_PROJECT_ARG, CLONE_INVALID_COMBO_ARG from edkrepo.common.humble import SPARSE_CHECKOUT, CLONE_INVALID_LOCAL_ROOTS from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match +from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_all_manifest_repos, find_project_in_all_indices +from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos +from edkrepo.common.workspace_maintenance.humble.manifest_repos_maintenance_humble import PROJ_NOT_IN_REPO, SOURCE_MANIFEST_REPO_NOT_FOUND from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml @@ -58,12 +60,14 @@ class CloneCommand(EdkrepoCommand): 'required': False, 'help-text': arguments.NO_SPARSE_HELP}) args.append(SubmoduleSkipArgument) + args.append(SourceManifestRepoArgument) return metadata def run_command(self, args, config): - pull_latest_manifest_repo(args, config) + pull_all_manifest_repos(config['cfg_file'], config['user_cfg_file'], False) update_editor_config(config) + name_or_manifest = args.ProjectNameOrManifestFile workspace_dir = args.Workspace # Check to see if requested workspace exists. If not create it. If so check for empty @@ -77,17 +81,19 @@ class CloneCommand(EdkrepoCommand): if not os.path.isdir(workspace_dir): os.makedirs(workspace_dir) - # Get path to global manifest file - global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path - - # Verify the manifest directory at this point. - verify_manifest_data(global_manifest_directory, config, verbose=args.verbose, verify_proj=name_or_manifest) - - # Now try to find the correct manifest file. - index_path = os.path.join(global_manifest_directory, 'CiIndex.xml') - ci_index_xml = CiIndexXml(index_path) + cfg, user_cfg, conflicts = list_available_manifest_repos(config['cfg_file'], config['user_cfg_file']) + manifest_repo, source_cfg, global_manifest_path = find_project_in_all_indices(args.ProjectNameOrManifestFile, + config['cfg_file'], + config['user_cfg_file'], + PROJ_NOT_IN_REPO.format(args.ProjectNameOrManifestFile), + SOURCE_MANIFEST_REPO_NOT_FOUND.format(args.ProjectNameOrManifestFile), + args.source_manifest_repo) - global_manifest_path = find_project_in_index(name_or_manifest, ci_index_xml, global_manifest_directory, CLONE_INVALID_PROJECT_ARG) + # If this manifest is in a defined manifest repository validate the manifest within the manifest repo + if manifest_repo in cfg: + verify_single_manifest(config['cfg_file'], manifest_repo, global_manifest_path) + elif manifest_repo in user_cfg: + verify_single_manifest(config['user_cfg_file'], manifest_repo, global_manifest_path) # Copy project manifest to local manifest dir and rename it Manifest.xml. local_manifest_dir = os.path.join(workspace_dir, "repo") -- 2.16.2.windows.1