From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.4894.1588309989753910554 for ; Thu, 30 Apr 2020 22:13:10 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: ZKac3FlQcXuqV0EY54vtIXsp1vqvpfdPLd/nYHmnWvNj04Cvao3fuVAgn0Aua89IR0eKEkKvZW d9YE4z/phIig== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 22:13:08 -0700 IronPort-SDR: yAmijEvaYpvPECHjwwbWj2nHng+PztfLCP+j2W+fyLJ6RlKdU2SWnEWOC97Nrjrkd65C9Vr/Di V57iA97WnPqQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,338,1583222400"; d="scan'208";a="283096096" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.210.118]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2020 22:12:50 -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 V2 8/8] EdkRepo: Rename man to manifest Date: Thu, 30 Apr 2020 22:12:39 -0700 Message-Id: <20200501051239.13976-9-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200501051239.13976-1-ashley.e.desimone@intel.com> References: <20200501051239.13976-1-ashley.e.desimone@intel.com> Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- .../humble/manifest_repos_maintenance_humble.py | 2 +- .../manifest_repos_maintenance.py | 32 ++++++++++++---------- edkrepo/config/tool_config.py | 10 +++++++ edkrepo_manifest_parser/edk_manifest.py | 10 +++---- 4 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 edkrepo/config/tool_config.py diff --git a/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py index 05e76b1..290b463 100644 --- a/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py +++ b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py @@ -25,5 +25,5 @@ CONFLICT_NO_CLONE = ('The definition of global manifest repository, {}, ' 'in the edkrepo_user.cfg does not match the definition in the edkrepo.cfg. ' 'This global manifest repository will not be downloaded or updated. ' 'Resolve the conflict and then re-run the failed operation') -SOURCE_MAN_REPO_NOT_FOUND = 'Could not determine the source global manifest repository for project: {}' +SOURCE_MANIFEST_REPO_NOT_FOUND = 'Could not determine the source global manifest repository for project: {}' PROJ_NOT_IN_REPO = 'Project: {} does not exist in any global manifest repository' \ No newline at end of file diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py index 7a7f946..2a5a70f 100644 --- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py +++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py @@ -15,7 +15,9 @@ import git from git import Repo import edkrepo.config.config_factory as cfg +from edkrepo.config.tool_config import CI_INDEX_FILE_NAME from edkrepo.common.edkrepo_exception import EdkrepoUncommitedChangesException, EdkrepoInvalidParametersException +from edkrepo.common.edkrepo_exception import EdkrepoManifestNotFoundException from edkrepo.common.progress_handler import GitProgressHandler import edkrepo.common.workspace_maintenance.humble.manifest_repos_maintenance_humble as humble from edkrepo.common.workspace_maintenance.workspace_maintenance import generate_name_for_obsolete_backup @@ -66,7 +68,7 @@ def pull_all_manifest_repos(edkrepo_cfg, edkrepo_user_cfg, reset_hard=False): cfg_man_repos = [] user_cfg_man_repos = [] conflicts = [] - cfg_man_repos, user_cfg_man_repos, conflicts = list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg) + cfg_man_repos, user_cfg_man_repos, conflicts = list_available_manifest_repos(edkrepo_cfg, edkrepo_user_cfg) for conflict in conflicts: print(humble.CONFLICT_NO_CLONE.format(conflict)) for repo in cfg_man_repos: @@ -81,7 +83,7 @@ def pull_all_manifest_repos(edkrepo_cfg, edkrepo_user_cfg, reset_hard=False): reset_hard) -def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): +def detect_manifest_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): ''' Determines whether there is are conflicting or duplicated manifest repositories listed in the edkrepo.cfg and the edkrepo_user.cfg. @@ -107,7 +109,7 @@ def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): duplicates.append(repo) return conflicts, duplicates -def list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg): +def list_available_manifest_repos(edkrepo_cfg, edkrepo_user_cfg): ''' Checks for conflicts/duplicates within all manifest repositories defined in both the edkrepo.cfg and the edkrepo_user.cfg and resturns a list of available @@ -115,7 +117,7 @@ def list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg): ''' cfg_man_repos = [] user_cfg_man_repos = [] - conflicts, duplicates = detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg) + conflicts, duplicates = detect_manifest_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg) if not conflicts and not duplicates: cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) @@ -160,17 +162,17 @@ def find_project_in_all_indices (project, edkrepo_cfg, edkrepo_user_cfg, except_ edkrepo_user.cfg. If a project with the same name is found uses man_repo to select the correct entry ''' - cfg_man_repos, user_cfg_man_repos, conflicts = list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg) + cfg_man_repos, user_cfg_man_repos, conflicts = list_available_manifest_repos(edkrepo_cfg, edkrepo_user_cfg) projects = {} for repo in cfg_man_repos: manifest_dir = edkrepo_cfg.manifest_repo_abs_path(repo) - index_file = CiIndexXml(os.path.join(manifest_dir, 'CiIndex.xml')) + index_file = CiIndexXml(os.path.join(manifest_dir, CI_INDEX_FILE_NAME)) found, man_path = find_project_in_single_index(project, index_file, manifest_dir) if found: projects[repo] = ('edkrepo_cfg', man_path) for repo in user_cfg_man_repos: manifest_dir = edkrepo_user_cfg.manifest_repo_abs_path(repo) - index_file = CiIndexXml(os.path.join(manifest_dir, 'CiIndex.xml')) + index_file = CiIndexXml(os.path.join(manifest_dir, CI_INDEX_FILE_NAME)) found, man_path = find_project_in_single_index(project, index_file, manifest_dir) if found: projects[repo] = ('edkrepo_user_cfg', man_path) @@ -197,30 +199,32 @@ def find_project_in_all_indices (project, edkrepo_cfg, edkrepo_user_cfg, except_ for dirpath, dirname, filenames in os.walk(edkrepo_user_cfg.manifest_repo_abs_path(repo)): if project in filenames: return repo, 'edkrepo_user_cfg', os.path.join(dirpath, project) + else: + raise EdkrepoManifestNotFoundException(humble.PROJ_NOT_IN_REPO.format(project)) -def find_source_man_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo=None): +def find_source_manifest_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo=None): ''' Finds the source manifest repo for a given project. ''' - if project_manifest.general_config.source_man_repo: - return project_manifest.general_config.source_man_repo + if project_manifest.general_config.source_manifest_repo: + return project_manifest.general_config.source_manifest_repo else: src_man_repo, src_config, src_man_path = find_project_in_all_indices(project_manifest.project_info.codename, edkrepo_cfg, edkrepo_user_cfg, humble.PROJ_NOT_IN_REPO.format(project_manifest.project_info.codename), - humble.SOURCE_MAN_REPO_NOT_FOUND.format(project_manifest.project_info.codename), + humble.SOURCE_MANIFEST_REPO_NOT_FOUND.format(project_manifest.project_info.codename), man_repo=None) project_manifest.write_source_manifest_repo(src_man_repo) return src_man_repo -def pull_workspace_man_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo=None, reset_hard=False): +def pull_workspace_manifest_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo=None, reset_hard=False): ''' Pulls only the global manifest repo for the current workspace. ''' - src_man_repo = find_source_man_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo) - config_repos, user_config_repos, conflicts = list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg) + src_man_repo = find_source_manifest_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, man_repo) + config_repos, user_config_repos, conflicts = list_available_manifest_repos(edkrepo_cfg, edkrepo_user_cfg) if src_man_repo in config_repos: pull_single_manifest_repo(edkrepo_cfg.get_manifest_repo_url(src_man_repo), edkrepo_cfg.get_manifest_repo_branch(src_man_repo), diff --git a/edkrepo/config/tool_config.py b/edkrepo/config/tool_config.py new file mode 100644 index 0000000..eee1326 --- /dev/null +++ b/edkrepo/config/tool_config.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python3 +# +## @file +# tool)config.py +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +CI_INDEX_FILE_NAME = 'CiIndex.xml' \ No newline at end of file diff --git a/edkrepo_manifest_parser/edk_manifest.py b/edkrepo_manifest_parser/edk_manifest.py index dcf9c29..f7118ae 100644 --- a/edkrepo_manifest_parser/edk_manifest.py +++ b/edkrepo_manifest_parser/edk_manifest.py @@ -21,7 +21,7 @@ import copy # All the namedtuple data structures that consumers of this module will need. # ProjectInfo = namedtuple('ProjectInfo', ['codename', 'description', 'dev_leads', 'reviewers', 'org', 'short_name']) -GeneralConfig = namedtuple('GeneralConfig', ['default_combo', 'current_combo', 'pin_path', 'source_man_repo']) +GeneralConfig = namedtuple('GeneralConfig', ['default_combo', 'current_combo', 'pin_path', 'source_manifest_repo']) RemoteRepo = namedtuple('RemoteRepo', ['name', 'url']) RepoHook = namedtuple('RepoHook', ['source', 'dest_path', 'dest_file', 'remote_url']) Combination = namedtuple('Combination', ['name', 'description']) @@ -422,7 +422,7 @@ class ManifestXml(BaseXmlHelper): element = ET.SubElement(subroot, 'SourceManifestRepository') element.attrib['manifest_repo'] = manifest_repo self._tree.write(filename) - self.__general_config.source_man_repo = manifest_repo + self.__general_config.source_manifest_repo = manifest_repo def generate_pin_xml(self, description, combo_name, repo_source_list, filename=None): @@ -624,13 +624,13 @@ class _GeneralConfig(): except: self.curr_combo = None try: - self.source_man_repo = element.find('SourceManifestRepository').attrib['manifest_repo'] + self.source_manifest_repo = element.find('SourceManifestRepository').attrib['manifest_repo'] except: - self.source_man_repo = None + self.source_manifest_repo = None @property def tuple(self): - return GeneralConfig(self.default_combo, self.curr_combo, self.pin_path, self.source_man_repo) + return GeneralConfig(self.default_combo, self.curr_combo, self.pin_path, self.source_manifest_repo) class _RemoteRepo(): def __init__(self, element): -- 2.16.2.windows.1