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-stagin/EdkRepo] [PATCH 1/4] EdkRepo: Update sync to support multiple manifest repositories
Date: Sun, 10 May 2020 17:50:23 -0700 [thread overview]
Message-ID: <20200511005026.23532-2-ashley.e.desimone@intel.com> (raw)
In-Reply-To: <20200511005026.23532-1-ashley.e.desimone@intel.com>
Update the sync command to only update the global manifest repository
that the workspace is based on and to only check the source manfiest
repository for manifest updates.
Update the manifest parser to ignore the 'SourceManifestRepository'
field when conducting an equality operation.
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>
---
edkrepo/commands/sync_command.py | 36 +++++++++++++++++-----------
edkrepo_manifest_parser/edk_manifest.py | 42 +++++++++++++++++++++++++--------
2 files changed, 54 insertions(+), 24 deletions(-)
diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_command.py
index 82f5247..d1db4f1 100644
--- a/edkrepo/commands/sync_command.py
+++ b/edkrepo/commands/sync_command.py
@@ -18,7 +18,7 @@ from git import Repo
# Our modules
from edkrepo.commands.edkrepo_command import EdkrepoCommand
-from edkrepo.commands.edkrepo_command import DryRunArgument, SubmoduleSkipArgument
+from edkrepo.commands.edkrepo_command import DryRunArgument, SubmoduleSkipArgument, SourceManifestRepoArgument
import edkrepo.commands.arguments.sync_args as arguments
from edkrepo.common.progress_handler import GitProgressHandler
from edkrepo.common.edkrepo_exception import EdkrepoUncommitedChangesException, EdkrepoManifestNotFoundException
@@ -32,8 +32,8 @@ from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO, SYNC_NEEDS_REBASE,
from edkrepo.common.humble import SYNC_BRANCH_CHANGE_ON_LOCAL, SYNC_INCOMPATIBLE_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
-from edkrepo.common.common_repo_functions import reset_sparse_checkout, sparse_checkout, verify_manifest_data
+from edkrepo.common.common_repo_functions import clone_repos, sparse_checkout_enabled
+from edkrepo.common.common_repo_functions import reset_sparse_checkout, sparse_checkout, verify_single_manifest
from edkrepo.common.common_repo_functions import checkout_repos, check_dirty_repos
from edkrepo.common.common_repo_functions import update_editor_config
from edkrepo.common.common_repo_functions import update_repo_commit_template, get_latest_sha
@@ -41,8 +41,12 @@ from edkrepo.common.common_repo_functions import has_primary_repo_remote, fetch_
from edkrepo.common.common_repo_functions import update_hooks, maintain_submodules, combinations_in_manifest
from edkrepo.common.common_repo_functions import write_included_config, remove_included_config
from edkrepo.common.workspace_maintenance.workspace_maintenance import generate_name_for_obsolete_backup
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_workspace_manifest_repo
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
from edkrepo.common.ui_functions import init_color_console
from edkrepo.config.config_factory import get_workspace_path, get_workspace_manifest, get_edkrepo_global_data_directory
+from edkrepo.config.config_factory import get_workspace_manifest_file
from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
@@ -71,23 +75,30 @@ class SyncCommand(EdkrepoCommand):
'required' : False,
'help-text' : arguments.OVERRIDE_HELP})
args.append(SubmoduleSkipArgument)
+ args.append(SourceManifestRepoArgument)
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
initial_sources = initial_manifest.get_repo_sources(current_combo)
initial_hooks = initial_manifest.repo_hooks
- pull_latest_manifest_repo(args, config)
+ source_global_manifest_repo = find_source_manifest_repo(initial_manifest, config['cfg_file'], config['user_cfg_file'], args.source_manifest_repo)
+ pull_workspace_manifest_repo(initial_manifest, config['cfg_file'], config['user_cfg_file'], args.source_manifest_repo, False)
+ cfg_manifest_repos, user_cfg_manifest_repos, conflicts = list_available_manifest_repos(config['cfg_file'], config['user_cfg_file'])
+ if source_global_manifest_repo in cfg_manifest_repos:
+ global_manifest_directory = config['cfg_file'].manifest_repo_abs_path(source_global_manifest_repo)
+ verify_single_manifest(config['cfg_file'], source_global_manifest_repo, get_workspace_manifest_file(), args.verbose)
+ elif source_global_manifest_repo in user_cfg_manifest_repos:
+ 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)
- # Verify that the latest version of the manifest in the global manifest repository is not broken
- global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
- verify_manifest_data(global_manifest_directory, config, verbose=args.verbose, verify_proj=initial_manifest.project_info.codename)
if not args.update_local_manifest:
- self.__check_for_new_manifest(args, config, initial_manifest, workspace_path)
+ self.__check_for_new_manifest(args, config, initial_manifest, workspace_path, global_manifest_directory)
check_dirty_repos(initial_manifest, workspace_path)
# Determine if sparse checkout needs to be disabled for this operation
sparse_settings = initial_manifest.sparse_settings
@@ -103,7 +114,7 @@ class SyncCommand(EdkrepoCommand):
# Get the latest manifest if requested
if args.update_local_manifest: #NOTE: hyphens in arg name replaced with underscores due to argparse
- self.__update_local_manifest(args, config, initial_manifest, workspace_path)
+ self.__update_local_manifest(args, config, initial_manifest, workspace_path, global_manifest_directory)
manifest = get_workspace_manifest()
if args.update_local_manifest:
try:
@@ -199,7 +210,7 @@ class SyncCommand(EdkrepoCommand):
print(SPARSE_CHECKOUT)
sparse_checkout(workspace_path, repo_sources_to_sync, manifest)
- def __update_local_manifest(self, args, config, initial_manifest, workspace_path):
+ def __update_local_manifest(self, args, config, initial_manifest, workspace_path, global_manifest_directory):
local_manifest_dir = os.path.join(workspace_path, 'repo')
current_combo = initial_manifest.general_config.current_combo
initial_sources = initial_manifest.get_repo_sources(current_combo)
@@ -210,8 +221,6 @@ class SyncCommand(EdkrepoCommand):
origin = repo.remotes.origin
origin.fetch()
- global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
-
#see if there is an entry in CiIndex.xml that matches the prject name of the current manifest
index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
ci_index_xml = CiIndexXml(index_path)
@@ -364,8 +373,7 @@ class SyncCommand(EdkrepoCommand):
break
return repos_to_checkout
- def __check_for_new_manifest(self, args, config, initial_manifest, workspace_path):
- global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
+ def __check_for_new_manifest(self, args, config, initial_manifest, workspace_path, global_manifest_directory):
#see if there is an entry in CiIndex.xml that matches the prject name of the current manifest
index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
ci_index_xml = CiIndexXml(index_path)
diff --git a/edkrepo_manifest_parser/edk_manifest.py b/edkrepo_manifest_parser/edk_manifest.py
index 69583b1..1e2b111 100644
--- a/edkrepo_manifest_parser/edk_manifest.py
+++ b/edkrepo_manifest_parser/edk_manifest.py
@@ -425,6 +425,7 @@ class ManifestXml(BaseXmlHelper):
element = subroot.find('SourceManifestRepository')
if element is None:
element = ET.SubElement(subroot, 'SourceManifestRepository')
+ element.tail = '\n'
element.attrib['manifest_repo'] = manifest_repo
self._tree.write(filename)
self.__general_config.source_manifest_repo = manifest_repo
@@ -549,7 +550,16 @@ class ManifestXml(BaseXmlHelper):
if element1.text != element2.text:
return False
if element1.tail != element2.tail:
- return False
+ if element1.tail is not None:
+ tail1 = element1.tail.strip()
+ else:
+ tail1 = ''
+ if element2.tail is not None:
+ tail2 = element2.tail.strip()
+ else:
+ tail2 = ''
+ if tail1 != tail2:
+ return False
if element1.attrib != element2.attrib:
return False
if len(element1) != len(element2):
@@ -558,25 +568,37 @@ class ManifestXml(BaseXmlHelper):
def equals(self, other, ignore_current_combo=False):
status = self._compare_elements(self._tree.getroot(), other._tree.getroot())
- if not status and ignore_current_combo:
+ if not status:
tree1 = copy.deepcopy(self._tree.getroot())
tree2 = copy.deepcopy(other._tree.getroot())
subroot = tree1.find('GeneralConfig')
if subroot is None:
return False
- element = subroot.find('CurrentClonedCombo')
+ if ignore_current_combo:
+ element = subroot.find('CurrentClonedCombo')
+ if element is None:
+ element = ET.SubElement(subroot, 'CurrentClonedCombo')
+ element.tail = '\n'
+ element.attrib['combination'] = ''
+ element = subroot.find('SourceManifestRepository')
if element is None:
- element = ET.SubElement(subroot, 'CurrentClonedCombo')
- element.tail = '\n'
- element.attrib['combination'] = ''
+ element = ET.SubElement(subroot, 'SourceManifestRepository')
+ element.tail ='\n'
+ element.attrib['manifest_repo'] = ''
subroot = tree2.find('GeneralConfig')
if subroot is None:
return False
- element = subroot.find('CurrentClonedCombo')
+ if ignore_current_combo:
+ element = subroot.find('CurrentClonedCombo')
+ if element is None:
+ element = ET.SubElement(subroot, 'CurrentClonedCombo')
+ element.tail = '\n'
+ element.attrib['combination'] = ''
+ element = subroot.find('SourceManifestRepository')
if element is None:
- element = ET.SubElement(subroot, 'CurrentClonedCombo')
- element.tail = '\n'
- element.attrib['combination'] = ''
+ element = ET.SubElement(subroot, 'SourceManifestRepository')
+ element.tail ='\n'
+ element.attrib['manifest_repo'] = ''
status = self._compare_elements(tree1, tree2)
return status
--
2.16.2.windows.1
next prev parent reply other threads:[~2020-05-11 0:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 0:50 [edk2-staging/EdkRepo] [PATCH 0/4] EdkRepo: Finalize multiple manifest repository support Ashley E Desimone
2020-05-11 0:50 ` Ashley E Desimone [this message]
2020-05-11 0:50 ` [edk2-staing/EdkRepo] [PATCH 2/4] EdkRepo: Remove unused functions from common_repo_functions.py Ashley E Desimone
2020-05-11 0:50 ` [edk2-staging/EdkRepo] [PATCH 3/4] EdkRepo: Add support for multiple manifest repostories to command completions Ashley E Desimone
2020-05-11 0:50 ` [edk2-staging/EdkRepo] [PATCH 4/4] EdkRepo: Remove support for deprecated Manifest-Repo content in edkrepo.cfg Ashley E Desimone
2020-05-11 6:10 ` [edk2-devel] [edk2-staging/EdkRepo] [PATCH 0/4] EdkRepo: Finalize multiple manifest repository support Nate DeSimone
2020-05-11 6:33 ` 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=20200511005026.23532-2-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