From: "Ashley E Desimone" <ashley.e.desimone@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
Puja Pandya <puja.pandya@intel.com>,
Erik Bjorge <erik.c.bjorge@intel.com>,
Bret Barkelew <Bret.Barkelew@microsoft.com>,
Prince Agyeman <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH V2 8/8] EdkRepo: Rename man to manifest
Date: Thu, 30 Apr 2020 22:12:39 -0700 [thread overview]
Message-ID: <20200501051239.13976-9-ashley.e.desimone@intel.com> (raw)
In-Reply-To: <20200501051239.13976-1-ashley.e.desimone@intel.com>
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
.../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.<BR>
+# 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
next prev parent reply other threads:[~2020-05-01 5:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-01 5:12 [edk2-staging/EdkRepo] [PATCH V2 0/8] EdkRepo: Support for consuming multiple manifest repositories Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH V2 1/8] EdkRepo: Add check for conflicting/duplicated manifest repo definitions Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH V2 2/8] EdkRepo: Add downloading all available manifest repositories Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH 3/8] EdkRepo: Add optional field to edkrepo_manifst to track the source manifest repo Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH V2 4/8] EdkRepo: Add list_available_manifest_repos() Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH 5/8] EdkRepo: Add ability to find projects across all manifest repositories Ashley E Desimone
2020-05-01 5:12 ` [edk2-stagin/EdkRepo] [PATCH 6/8] EdkRepo: Add ability to determine the source manifest of a workspace Ashley E Desimone
2020-05-01 5:12 ` [edk2-staging/EdkRepo] [PATCH V2 7/8] EdkRepo: Add the ability to pull only the global manifest repository for a given workspace Ashley E Desimone
2020-05-01 5:12 ` Ashley E Desimone [this message]
2020-05-01 5:30 ` [edk2-staging/EdkRepo] [PATCH V2 0/8] EdkRepo: Support for consuming multiple manifest repositories Nate DeSimone
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200501051239.13976-9-ashley.e.desimone@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox