From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com []) by mx.groups.io with SMTP id smtpd.web10.4017.1589158230010710343 for ; Sun, 10 May 2020 17:50:30 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: PYAZxYBrisr8dN4Ip0/H5J+3M7SFSVMpqlCoevskoPjlF5OyeBNSMhjyKeVvGnod9Ju26gQWs4 lPxwvYUwPG/A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2020 17:50:30 -0700 IronPort-SDR: Bke9lTsxNWvwM+kUXi0ASNJCEydzLLAEaPCEY6w10xR/u1zWYd8B+DSxRV4OjsbrxzWif0urZo 427X+i1+TQQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,377,1583222400"; d="scan'208";a="296747725" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.208.216]) by fmsmga002.fm.intel.com with ESMTP; 10 May 2020 17:50:29 -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 4/4] EdkRepo: Remove support for deprecated Manifest-Repo content in edkrepo.cfg Date: Sun, 10 May 2020 17:50:26 -0700 Message-Id: <20200511005026.23532-5-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200511005026.23532-1-ashley.e.desimone@intel.com> References: <20200511005026.23532-1-ashley.e.desimone@intel.com> Remove the remaining uses of manifest_repo_abs_local_path() and update to use manifest_repo_abs_path where appropriate. Remove the config prop definitions for the Manifest-Repo section of the edkrepo.cfg file. Remove the Manifest-Repo entry from the edkrepo.cfg file. 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 | 3 ++- edkrepo/commands/sync_command.py | 8 +++--- edkrepo/common/common_repo_functions.py | 45 ++++++++++++++++++++------------- edkrepo/config/config_factory.py | 12 ++------- edkrepo_installer/Vendor/edkrepo.cfg | 5 ---- 5 files changed, 36 insertions(+), 37 deletions(-) diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py index b7f3158..179aaf7 100644 --- a/edkrepo/commands/clone_command.py +++ b/edkrepo/commands/clone_command.py @@ -66,7 +66,6 @@ class CloneCommand(EdkrepoCommand): def run_command(self, 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 @@ -92,8 +91,10 @@ class CloneCommand(EdkrepoCommand): # 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) + update_editor_config(config, config['cfg_file'].manifest_repo_abs_path(manifest_repo)) elif manifest_repo in user_cfg: verify_single_manifest(config['user_cfg_file'], manifest_repo, global_manifest_path) + update_editor_config(config, config['user_cfg_file'].manifest_repo_abs_path(manifest_repo)) # Copy project manifest to local manifest dir and rename it Manifest.xml. local_manifest_dir = os.path.join(workspace_dir, "repo") diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py index d1db4f1..da99397 100644 --- a/edkrepo/commands/sync_command.py +++ b/edkrepo/commands/sync_command.py @@ -79,8 +79,6 @@ class SyncCommand(EdkrepoCommand): return metadata def run_command(self, args, config): - update_editor_config(config) - workspace_path = get_workspace_path() initial_manifest = get_workspace_manifest() current_combo = initial_manifest.general_config.current_combo @@ -97,6 +95,8 @@ class SyncCommand(EdkrepoCommand): global_manifest_directory = config['user_cfg_file'].manifest_repo_abs_path(source_global_manifest_repo) verify_single_manifest(config['user_cfg_file'], source_global_manifest_repo, get_workspace_manifest_file(), args.verbose) + update_editor_config(config, global_manifest_directory) + if not args.update_local_manifest: self.__check_for_new_manifest(args, config, initial_manifest, workspace_path, global_manifest_directory) check_dirty_repos(initial_manifest, workspace_path) @@ -145,7 +145,7 @@ class SyncCommand(EdkrepoCommand): for repo_to_sync in repo_sources_to_sync: local_repo_path = os.path.join(workspace_path, repo_to_sync.root) # Update any hooks - update_hooks(hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo_to_sync, config) + update_hooks(hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo_to_sync, config, global_manifest_directory) repo = Repo(local_repo_path) #Fetch notes repo.remotes.origin.fetch("refs/notes/*:refs/notes/*") @@ -200,7 +200,7 @@ class SyncCommand(EdkrepoCommand): # Perform submodule updates and url redirection maintain_submodules(repo_to_sync, repo) # Update commit message templates - update_repo_commit_template(workspace_path, repo, repo_to_sync, config) + update_repo_commit_template(workspace_path, repo, repo_to_sync, config, source_global_manifest_repo) if sync_error: print(SYNC_ERROR) diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py index 5ec834b..61133f1 100644 --- a/edkrepo/common/common_repo_functions.py +++ b/edkrepo/common/common_repo_functions.py @@ -59,8 +59,8 @@ from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml from edkrepo.common.edkrepo_exception import EdkrepoNotFoundException, EdkrepoGitException, EdkrepoWarningException from edkrepo.common.edkrepo_exception import EdkrepoFoundMultipleException, EdkrepoHookNotFoundException -from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupException, EdkrepoManifestInvalidException -from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_single_manifest_repo +from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupException, EdkrepoManifestInvalidException, EdkrepoManifestNotFoundException +from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo, list_available_manifest_repos from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match from edkrepo.common.ui_functions import init_color_console from edkrepo_manifest_parser import edk_manifest @@ -112,11 +112,27 @@ def clone_repos(args, workspace_dir, repos_to_clone, project_client_side_hooks, if repo_to_clone.enable_submodule: maintain_submodules(repo_to_clone, repo, args.verbose) - # Install git hooks - install_hooks(project_client_side_hooks, local_repo_path, repo_to_clone, config) + try: + if 'source_manifest_repo' in vars(args).keys(): + src_manifest_repo = find_source_manifest_repo(manifest, config['cfg_file'], config['user_cfg_file'], args.source_manifest_repo) + else: + src_manifest_repo = find_source_manifest_repo(manifest, config['cfg_file'], config['user_cfg_file'], None) + except EdkrepoManifestNotFoundException: + src_manifest_repo = None + if src_manifest_repo: + cfg, user_cfg, conflicts = list_available_manifest_repos(config['cfg_file'], config['user_cfg_file']) + if src_manifest_repo in cfg: + global_manifest_directory = config['cfg_file'].manifest_repo_abs_path(src_manifest_repo) + elif src_manifest_repo in user_cfg: + global_manifest_directory = config['user_cfg_file'].manifest_repo_abs_path(src_manifest_repo) + else: + global_manifest_directory = None + if global_manifest_directory: + # Install git hooks if there is a manifest repo associated with the manifest being cloned + install_hooks(project_client_side_hooks, local_repo_path, repo_to_clone, config, global_manifest_directory) - # Add the commit template if it exists. - update_repo_commit_template(workspace_dir, repo, repo_to_clone, config) + # Add the commit template if it exists. + update_repo_commit_template(workspace_dir, repo, repo_to_clone, config, global_manifest_directory) # Check to see if mirror is in sync with primary repo if not in_sync_with_primary(repo, repo_to_clone, args.verbose): @@ -194,7 +210,7 @@ def maintain_submodules(repo_sources, repo, verbose = False): except: raise EdkrepoGitException(SUBMODULE_FAILURE.format(repo_sources.remote_name)) -def install_hooks(hooks, local_repo_path, repo_for_install, config): +def install_hooks(hooks, local_repo_path, repo_for_install, config, global_manifest_directory): # Determine the which hooks are for the repo in question and which are from a URL based source or are in a global # manifest repo relative path hooks_url = [] @@ -222,7 +238,6 @@ def install_hooks(hooks, local_repo_path, repo_for_install, config): # Copy any global manifest repository relative path source based hooks for hook in hooks_path: - global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path man_dir_rel_hook_path = os.path.join(global_manifest_directory, hook.source) if not os.path.exists(man_dir_rel_hook_path): raise EdkrepoHookNotFoundException(HOOK_NOT_FOUND_ERROR.format(hook.source, repo_for_install.root)) @@ -258,11 +273,11 @@ def uninstall_hooks(hooks, local_repo_path, repo_for_uninstall): hook_file = os.path.join(destination, (os.path.basename(str(hook.source)))) os.remove(hook_file) -def update_hooks (hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo, config): +def update_hooks (hooks_add, hooks_update, hooks_uninstall, local_repo_path, repo, config, global_manifest_directory): if hooks_add: - install_hooks(hooks_add, local_repo_path, repo, config) + install_hooks(hooks_add, local_repo_path, repo, config, global_manifest_directory) if hooks_update: - install_hooks(hooks_update, local_repo_path, repo, config) + install_hooks(hooks_update, local_repo_path, repo, config, global_manifest_directory) if hooks_uninstall: uninstall_hooks(hooks_uninstall, local_repo_path, repo) @@ -562,15 +577,11 @@ def get_latest_sha(repo, branch, remote_or_url='origin'): latest_sha = None return latest_sha -def update_repo_commit_template(workspace_dir, repo, repo_info, config): +def update_repo_commit_template(workspace_dir, repo, repo_info, config, global_manifest_directory): # Open the local manifest and get any templates manifest = edk_manifest.ManifestXml(os.path.join(workspace_dir, 'repo', 'Manifest.xml')) templates = manifest.commit_templates - # Need to know where the global manifest directory is located at this point - global_manifest_directory = os.path.join(get_edkrepo_global_data_directory(), - config['cfg_file'].manifest_repo_local_path) - # Apply the template based on current manifest with repo.config_writer() as cw: if cw.has_option(section='commit', option='template'): @@ -590,7 +601,7 @@ def update_repo_commit_template(workspace_dir, repo, repo_info, config): if cw.has_option(section='commit', option='template'): cw.remove_option(section='commit', option='template') -def update_editor_config(config): +def update_editor_config(config, global_manifest_directory): return def has_primary_repo_remote(repo, verbose=False): diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py index 6d56ee6..c0b9f68 100644 --- a/edkrepo/config/config_factory.py +++ b/edkrepo/config/config_factory.py @@ -119,7 +119,7 @@ class BaseConfig(): """Returns a list of available manifest repos""" if self.cfg.has_section('manifest-repos'): return self.cfg.options('manifest-repos') - + def manifest_repo_props(self, manifest_repo): """ Returns a list of cfg_prop objects that pertain to a given manifest @@ -128,7 +128,7 @@ class BaseConfig(): return [x for x in self.prop_list if manifest_repo in x.name] def get_manifest_repo_url(self, manifest_repo): - """ + """ Returns the URL value for a given manifest repo based on config file contents. """ @@ -172,9 +172,6 @@ class GlobalConfig(BaseConfig): def __init__(self): self.filename = os.path.join(get_edkrepo_global_data_directory(), "edkrepo.cfg") self.prop_list = [ - CfgProp('manifest-repo', 'URL', 'manifest_repo_url', None, True), - CfgProp('manifest-repo', 'Branch', 'manifest_repo_branch', None, True), - CfgProp('manifest-repo', 'LocalPath', 'manifest_repo_local_path', None, True), CfgProp('sparsecheckout', 'always_include', 'sparsecheckout_always_include', None, True), CfgProp('sparsecheckout', 'always_exclude', 'sparsecheckout_always_exclude', None, True), CfgProp('f2f-cherry-pick', 'ignored_folder_substrings', 'f2f_cp_ignored_folder_substrings'), @@ -199,11 +196,6 @@ class GlobalConfig(BaseConfig): pkg_list.append(pkg.strip()) return pkg_list - @property - def manifest_repo_abs_local_path(self): - """Provides an absolute path to the manifest repo based on configuration file values.""" - return os.path.join(self.global_data_dir, self.manifest_repo_local_path) - @property def sparsecheckout_data(self): always_include = self.sparsecheckout_always_include.split('|') diff --git a/edkrepo_installer/Vendor/edkrepo.cfg b/edkrepo_installer/Vendor/edkrepo.cfg index 38d7b35..738b832 100644 --- a/edkrepo_installer/Vendor/edkrepo.cfg +++ b/edkrepo_installer/Vendor/edkrepo.cfg @@ -6,11 +6,6 @@ URL = https://github.com/tianocore/edk2-staging.git Branch = EdkRepo-Manifest LocalPath = edk2-staging-manifest-master -[manifest-repo] -URL = https://github.com/tianocore/edk2-staging.git -Branch = EdkRepo-Manifest -LocalPath = manifest-master - [git-ver] minimum = 2.13.0 recommended = 2.16.2 -- 2.16.2.windows.1