public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command
@ 2020-05-10  4:21 Ashley E Desimone
  2020-05-10  4:45 ` Nate DeSimone
  2020-05-10  4:47 ` Nate DeSimone
  0 siblings, 2 replies; 3+ messages in thread
From: Ashley E Desimone @ 2020-05-10  4:21 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Integrate multiple manifest repository support in the manifest command

Add the validate_manifest_repo() function to common_repo_functions

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/manifest_command.py    | 86 +++++++++++++++++++++------------
 edkrepo/common/common_repo_functions.py | 14 +++++-
 2 files changed, 68 insertions(+), 32 deletions(-)

diff --git a/edkrepo/commands/manifest_command.py b/edkrepo/commands/manifest_command.py
index 44218c9..bb6252d 100644
--- a/edkrepo/commands/manifest_command.py
+++ b/edkrepo/commands/manifest_command.py
@@ -3,7 +3,7 @@
 ## @file
 # manifest_command.py
 #
-# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 
@@ -15,9 +15,12 @@ from colorama import Fore
 from edkrepo.commands.edkrepo_command import EdkrepoCommand
 from edkrepo.commands.edkrepo_command import ColorArgument
 import edkrepo.commands.arguments.manifest_args as arguments
-from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceInvalidException
-from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, verify_manifest_data
+from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceInvalidException, EdkrepoManifestNotFoundException
+from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, validate_manifest_repo
 from edkrepo.common.ui_functions import init_color_console
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_all_manifest_repos
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
 from edkrepo.config.config_factory import get_workspace_manifest
 from edkrepo_manifest_parser.edk_manifest import CiIndexXml
 
@@ -44,46 +47,67 @@ class ManifestCommand(EdkrepoCommand):
         print()
         init_color_console(args.color)
 
-        # Get path to global manifest file
-        global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
-        if args.verbose:
-            print("Manifest directory:")
-            print(global_manifest_directory)
-            print()
-        index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+        cfg_file = config['cfg_file']
+        user_cfg = config['user_cfg_file']
+        cfg_man_repos, user_cfg_man_repos, conflicts = list_available_manifest_repos(cfg_file, user_cfg)
+        man_repos = {}
 
-        pull_latest_manifest_repo(args, config)
-        print()
+        pull_all_manifest_repos(cfg_file, user_cfg, False)
 
-        ci_index_xml = CiIndexXml(index_path)
+        # Get paths to the global manifest dirs and their index files
+        for repo in cfg_man_repos:
+            global_manifest_directory = cfg_file.manifest_repo_abs_path(repo)
+            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+            man_repos[repo] = (global_manifest_directory, index_path)
+        for repo in user_cfg_man_repos:
+            global_manifest_directory = user_cfg.manifest_repo_abs_path(repo)
+            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+            man_repos[repo] = (global_manifest_directory, index_path)
 
         try:
-            current_project = get_workspace_manifest().project_info.codename
+            wkspc_manifest = get_workspace_manifest()
+            current_project = wkspc_manifest.project_info.codename
+            src_man_repo = find_source_manifest_repo(wkspc_manifest, cfg_file, user_cfg, None)
         except EdkrepoWorkspaceInvalidException:
             current_project = None
+            src_man_repo = None
+        except EdkrepoManifestNotFoundException:
+            src_man_repo = None
 
-        # Attempt to make sure the manifest data is good
-        try:
-            verify_manifest_data(global_manifest_directory, config, verbose=args.verbose, verify_all=True, verify_archived=args.archived)
-        except:
-            print()
 
-        print("Projects:")
-        for project in ci_index_xml.project_list:
-            if project == current_project:
-                print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
-            else:
-                print("  {}".format(project))
+        for repo in man_repos.keys():
+            print()
+            print("Manifest directory:")
+            print(repo)
             if args.verbose:
-                print("   -> {}".format(ci_index_xml.get_project_xml(project)))
-
-        if args.archived:
+                print('Manifest directory path:')
+                print(man_repos[repo][0])
             print()
-            print("Archived Projects:")
-            for project in ci_index_xml.archived_project_list:
-                if project == current_project:
+
+            ci_index_xml = CiIndexXml(man_repos[repo][1])
+
+            # Attempt to make sure the manifest data is good
+            try:
+                validate_manifest_repo(man_repos[repo][0], args.verbose, args.archived)
+            except:
+                print()
+
+            print("Projects:")
+            for project in sorted(ci_index_xml.project_list):
+                if (project == current_project and src_man_repo == repo) or (not src_man_repo and project == current_project):
                     print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
                 else:
                     print("  {}".format(project))
                 if args.verbose:
                     print("   -> {}".format(ci_index_xml.get_project_xml(project)))
+
+            if args.archived:
+                print()
+                print("Archived Projects:")
+                for project in sorted(ci_index_xml.archived_project_list):
+                    if project == current_project:
+                        print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
+                    else:
+                        print("  {}".format(project))
+                    if args.verbose:
+                        print("   -> {}".format(ci_index_xml.get_project_xml(project)))
diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index 20dcb8a..eb6c4c0 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -54,6 +54,7 @@ from edkrepo.common.pathfix import get_actual_path
 from project_utils.sparse import BuildInfo, process_sparse_checkout
 from edkrepo.config.config_factory import get_workspace_path
 from edkrepo.config.config_factory import get_workspace_manifest
+from edkrepo.config.tool_config import CI_INDEX_FILE_NAME
 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
@@ -426,11 +427,22 @@ def verify_manifest_data(global_manifest_directory, config, verbose=False, verif
             if verbose:
                 print_manifest_errors(manifestfile_validation_data)
 
+def validate_manifest_repo(manifest_repo, verbose=False, archived=False):
+    print(VERIFY_GLOBAL)
+    if archived:
+        print(VERIFY_ARCHIVED)
+    manifest_validation_data = validate_manifestrepo(manifest_repo, archived)
+    manifest_repo_error = get_manifest_validation_status(manifest_validation_data)
+    if manifest_repo_error:
+        print(VERIFY_GLOBAL_FAIL)
+        if verbose:
+            print_manifest_errors(manifest_validation_data)
+
 def verify_single_manifest(cfg_file, manifest_repo, manifest_path, verbose=False):
     manifest = ManifestXml(manifest_path)
     print(VERIFY_PROJ.format(manifest.project_info.codename))
     index_path = os.path.join(cfg_file.manifest_repo_abs_path(manifest_repo), CI_INDEX_FILE_NAME)
-    proj_val_data = validate_manifestfiles(index_path, [manifest_path])
+    proj_val_data = validate_manifestfiles([manifest_path])
     proj_val_error = get_manifest_validation_status(proj_val_data)
     if proj_val_error:
         if verbose:
-- 
2.16.2.windows.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command
  2020-05-10  4:21 [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
@ 2020-05-10  4:45 ` Nate DeSimone
  2020-05-10  4:47 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2020-05-10  4:45 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Desimone, Ashley E <ashley.e.desimone@intel.com>
> Sent: Saturday, May 9, 2020 9:21 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret
> Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince
> <prince.agyeman@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple
> manifest repository support in the manifest command
> 
> Integrate multiple manifest repository support in the manifest command
> 
> Add the validate_manifest_repo() function to common_repo_functions
> 
> 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/manifest_command.py    | 86
> +++++++++++++++++++++------------
>  edkrepo/common/common_repo_functions.py | 14 +++++-
>  2 files changed, 68 insertions(+), 32 deletions(-)
> 
> diff --git a/edkrepo/commands/manifest_command.py
> b/edkrepo/commands/manifest_command.py
> index 44218c9..bb6252d 100644
> --- a/edkrepo/commands/manifest_command.py
> +++ b/edkrepo/commands/manifest_command.py
> @@ -3,7 +3,7 @@
>  ## @file
>  # manifest_command.py
>  #
> -# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> @@ -15,9 +15,12 @@ from colorama import Fore  from
> edkrepo.commands.edkrepo_command import EdkrepoCommand  from
> edkrepo.commands.edkrepo_command import ColorArgument  import
> edkrepo.commands.arguments.manifest_args as arguments -from
> edkrepo.common.edkrepo_exception import
> EdkrepoWorkspaceInvalidException -from
> edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo, verify_manifest_data
> +from edkrepo.common.edkrepo_exception import
> +EdkrepoWorkspaceInvalidException, EdkrepoManifestNotFoundException
> from
> +edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo,
> +validate_manifest_repo
>  from edkrepo.common.ui_functions import init_color_console
> +from
> edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> +import list_available_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +pull_all_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +find_source_manifest_repo
>  from edkrepo.config.config_factory import get_workspace_manifest  from
> edkrepo_manifest_parser.edk_manifest import CiIndexXml
> 
> @@ -44,46 +47,67 @@ class ManifestCommand(EdkrepoCommand):
>          print()
>          init_color_console(args.color)
> 
> -        # Get path to global manifest file
> -        global_manifest_directory =
> config['cfg_file'].manifest_repo_abs_local_path
> -        if args.verbose:
> -            print("Manifest directory:")
> -            print(global_manifest_directory)
> -            print()
> -        index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +        cfg_file = config['cfg_file']
> +        user_cfg = config['user_cfg_file']
> +        cfg_man_repos, user_cfg_man_repos, conflicts =
> list_available_manifest_repos(cfg_file, user_cfg)
> +        man_repos = {}
> 
> -        pull_latest_manifest_repo(args, config)
> -        print()
> +        pull_all_manifest_repos(cfg_file, user_cfg, False)
> 
> -        ci_index_xml = CiIndexXml(index_path)
> +        # Get paths to the global manifest dirs and their index files
> +        for repo in cfg_man_repos:
> +            global_manifest_directory = cfg_file.manifest_repo_abs_path(repo)
> +            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +            man_repos[repo] = (global_manifest_directory, index_path)
> +        for repo in user_cfg_man_repos:
> +            global_manifest_directory =
> user_cfg.manifest_repo_abs_path(repo)
> +            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +            man_repos[repo] = (global_manifest_directory, index_path)
> 
>          try:
> -            current_project = get_workspace_manifest().project_info.codename
> +            wkspc_manifest = get_workspace_manifest()
> +            current_project = wkspc_manifest.project_info.codename
> +            src_man_repo = find_source_manifest_repo(wkspc_manifest,
> + cfg_file, user_cfg, None)
>          except EdkrepoWorkspaceInvalidException:
>              current_project = None
> +            src_man_repo = None
> +        except EdkrepoManifestNotFoundException:
> +            src_man_repo = None
> 
> -        # Attempt to make sure the manifest data is good
> -        try:
> -            verify_manifest_data(global_manifest_directory, config,
> verbose=args.verbose, verify_all=True, verify_archived=args.archived)
> -        except:
> -            print()
> 
> -        print("Projects:")
> -        for project in ci_index_xml.project_list:
> -            if project == current_project:
> -                print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> -            else:
> -                print("  {}".format(project))
> +        for repo in man_repos.keys():
> +            print()
> +            print("Manifest directory:")
> +            print(repo)
>              if args.verbose:
> -                print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> -
> -        if args.archived:
> +                print('Manifest directory path:')
> +                print(man_repos[repo][0])
>              print()
> -            print("Archived Projects:")
> -            for project in ci_index_xml.archived_project_list:
> -                if project == current_project:
> +
> +            ci_index_xml = CiIndexXml(man_repos[repo][1])
> +
> +            # Attempt to make sure the manifest data is good
> +            try:
> +                validate_manifest_repo(man_repos[repo][0], args.verbose,
> args.archived)
> +            except:
> +                print()
> +
> +            print("Projects:")
> +            for project in sorted(ci_index_xml.project_list):
> +                if (project == current_project and src_man_repo == repo) or (not
> src_man_repo and project == current_project):
>                      print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
>                  else:
>                      print("  {}".format(project))
>                  if args.verbose:
>                      print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> +
> +            if args.archived:
> +                print()
> +                print("Archived Projects:")
> +                for project in sorted(ci_index_xml.archived_project_list):
> +                    if project == current_project:
> +                        print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> +                    else:
> +                        print("  {}".format(project))
> +                    if args.verbose:
> +                        print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> diff --git a/edkrepo/common/common_repo_functions.py
> b/edkrepo/common/common_repo_functions.py
> index 20dcb8a..eb6c4c0 100644
> --- a/edkrepo/common/common_repo_functions.py
> +++ b/edkrepo/common/common_repo_functions.py
> @@ -54,6 +54,7 @@ from edkrepo.common.pathfix import get_actual_path
> from project_utils.sparse import BuildInfo, process_sparse_checkout  from
> edkrepo.config.config_factory import get_workspace_path  from
> edkrepo.config.config_factory import get_workspace_manifest
> +from edkrepo.config.tool_config import CI_INDEX_FILE_NAME
>  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 @@ -426,11 +427,22 @@ def
> verify_manifest_data(global_manifest_directory, config, verbose=False,
> verif
>              if verbose:
>                  print_manifest_errors(manifestfile_validation_data)
> 
> +def validate_manifest_repo(manifest_repo, verbose=False,
> archived=False):
> +    print(VERIFY_GLOBAL)
> +    if archived:
> +        print(VERIFY_ARCHIVED)
> +    manifest_validation_data = validate_manifestrepo(manifest_repo,
> archived)
> +    manifest_repo_error =
> get_manifest_validation_status(manifest_validation_data)
> +    if manifest_repo_error:
> +        print(VERIFY_GLOBAL_FAIL)
> +        if verbose:
> +            print_manifest_errors(manifest_validation_data)
> +
>  def verify_single_manifest(cfg_file, manifest_repo, manifest_path,
> verbose=False):
>      manifest = ManifestXml(manifest_path)
>      print(VERIFY_PROJ.format(manifest.project_info.codename))
>      index_path =
> os.path.join(cfg_file.manifest_repo_abs_path(manifest_repo),
> CI_INDEX_FILE_NAME)
> -    proj_val_data = validate_manifestfiles(index_path, [manifest_path])
> +    proj_val_data = validate_manifestfiles([manifest_path])
>      proj_val_error = get_manifest_validation_status(proj_val_data)
>      if proj_val_error:
>          if verbose:
> --
> 2.16.2.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command
  2020-05-10  4:21 [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
  2020-05-10  4:45 ` Nate DeSimone
@ 2020-05-10  4:47 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2020-05-10  4:47 UTC (permalink / raw)
  To: Desimone, Ashley E, devel@edk2.groups.io
  Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince

Pushed: d574765910ea770e57809be232f1dcad8c6ef5ba

> -----Original Message-----
> From: Desimone, Ashley E <ashley.e.desimone@intel.com>
> Sent: Saturday, May 9, 2020 9:21 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret
> Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince
> <prince.agyeman@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple
> manifest repository support in the manifest command
> 
> Integrate multiple manifest repository support in the manifest command
> 
> Add the validate_manifest_repo() function to common_repo_functions
> 
> 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/manifest_command.py    | 86
> +++++++++++++++++++++------------
>  edkrepo/common/common_repo_functions.py | 14 +++++-
>  2 files changed, 68 insertions(+), 32 deletions(-)
> 
> diff --git a/edkrepo/commands/manifest_command.py
> b/edkrepo/commands/manifest_command.py
> index 44218c9..bb6252d 100644
> --- a/edkrepo/commands/manifest_command.py
> +++ b/edkrepo/commands/manifest_command.py
> @@ -3,7 +3,7 @@
>  ## @file
>  # manifest_command.py
>  #
> -# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> @@ -15,9 +15,12 @@ from colorama import Fore  from
> edkrepo.commands.edkrepo_command import EdkrepoCommand  from
> edkrepo.commands.edkrepo_command import ColorArgument  import
> edkrepo.commands.arguments.manifest_args as arguments -from
> edkrepo.common.edkrepo_exception import
> EdkrepoWorkspaceInvalidException -from
> edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo, verify_manifest_data
> +from edkrepo.common.edkrepo_exception import
> +EdkrepoWorkspaceInvalidException, EdkrepoManifestNotFoundException
> from
> +edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo,
> +validate_manifest_repo
>  from edkrepo.common.ui_functions import init_color_console
> +from
> edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> +import list_available_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +pull_all_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +find_source_manifest_repo
>  from edkrepo.config.config_factory import get_workspace_manifest  from
> edkrepo_manifest_parser.edk_manifest import CiIndexXml
> 
> @@ -44,46 +47,67 @@ class ManifestCommand(EdkrepoCommand):
>          print()
>          init_color_console(args.color)
> 
> -        # Get path to global manifest file
> -        global_manifest_directory =
> config['cfg_file'].manifest_repo_abs_local_path
> -        if args.verbose:
> -            print("Manifest directory:")
> -            print(global_manifest_directory)
> -            print()
> -        index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +        cfg_file = config['cfg_file']
> +        user_cfg = config['user_cfg_file']
> +        cfg_man_repos, user_cfg_man_repos, conflicts =
> list_available_manifest_repos(cfg_file, user_cfg)
> +        man_repos = {}
> 
> -        pull_latest_manifest_repo(args, config)
> -        print()
> +        pull_all_manifest_repos(cfg_file, user_cfg, False)
> 
> -        ci_index_xml = CiIndexXml(index_path)
> +        # Get paths to the global manifest dirs and their index files
> +        for repo in cfg_man_repos:
> +            global_manifest_directory = cfg_file.manifest_repo_abs_path(repo)
> +            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +            man_repos[repo] = (global_manifest_directory, index_path)
> +        for repo in user_cfg_man_repos:
> +            global_manifest_directory =
> user_cfg.manifest_repo_abs_path(repo)
> +            index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> +            man_repos[repo] = (global_manifest_directory, index_path)
> 
>          try:
> -            current_project = get_workspace_manifest().project_info.codename
> +            wkspc_manifest = get_workspace_manifest()
> +            current_project = wkspc_manifest.project_info.codename
> +            src_man_repo = find_source_manifest_repo(wkspc_manifest,
> + cfg_file, user_cfg, None)
>          except EdkrepoWorkspaceInvalidException:
>              current_project = None
> +            src_man_repo = None
> +        except EdkrepoManifestNotFoundException:
> +            src_man_repo = None
> 
> -        # Attempt to make sure the manifest data is good
> -        try:
> -            verify_manifest_data(global_manifest_directory, config,
> verbose=args.verbose, verify_all=True, verify_archived=args.archived)
> -        except:
> -            print()
> 
> -        print("Projects:")
> -        for project in ci_index_xml.project_list:
> -            if project == current_project:
> -                print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> -            else:
> -                print("  {}".format(project))
> +        for repo in man_repos.keys():
> +            print()
> +            print("Manifest directory:")
> +            print(repo)
>              if args.verbose:
> -                print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> -
> -        if args.archived:
> +                print('Manifest directory path:')
> +                print(man_repos[repo][0])
>              print()
> -            print("Archived Projects:")
> -            for project in ci_index_xml.archived_project_list:
> -                if project == current_project:
> +
> +            ci_index_xml = CiIndexXml(man_repos[repo][1])
> +
> +            # Attempt to make sure the manifest data is good
> +            try:
> +                validate_manifest_repo(man_repos[repo][0], args.verbose,
> args.archived)
> +            except:
> +                print()
> +
> +            print("Projects:")
> +            for project in sorted(ci_index_xml.project_list):
> +                if (project == current_project and src_man_repo == repo) or (not
> src_man_repo and project == current_project):
>                      print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
>                  else:
>                      print("  {}".format(project))
>                  if args.verbose:
>                      print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> +
> +            if args.archived:
> +                print()
> +                print("Archived Projects:")
> +                for project in sorted(ci_index_xml.archived_project_list):
> +                    if project == current_project:
> +                        print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> +                    else:
> +                        print("  {}".format(project))
> +                    if args.verbose:
> +                        print("   -> {}".format(ci_index_xml.get_project_xml(project)))
> diff --git a/edkrepo/common/common_repo_functions.py
> b/edkrepo/common/common_repo_functions.py
> index 20dcb8a..eb6c4c0 100644
> --- a/edkrepo/common/common_repo_functions.py
> +++ b/edkrepo/common/common_repo_functions.py
> @@ -54,6 +54,7 @@ from edkrepo.common.pathfix import get_actual_path
> from project_utils.sparse import BuildInfo, process_sparse_checkout  from
> edkrepo.config.config_factory import get_workspace_path  from
> edkrepo.config.config_factory import get_workspace_manifest
> +from edkrepo.config.tool_config import CI_INDEX_FILE_NAME
>  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 @@ -426,11 +427,22 @@ def
> verify_manifest_data(global_manifest_directory, config, verbose=False,
> verif
>              if verbose:
>                  print_manifest_errors(manifestfile_validation_data)
> 
> +def validate_manifest_repo(manifest_repo, verbose=False,
> archived=False):
> +    print(VERIFY_GLOBAL)
> +    if archived:
> +        print(VERIFY_ARCHIVED)
> +    manifest_validation_data = validate_manifestrepo(manifest_repo,
> archived)
> +    manifest_repo_error =
> get_manifest_validation_status(manifest_validation_data)
> +    if manifest_repo_error:
> +        print(VERIFY_GLOBAL_FAIL)
> +        if verbose:
> +            print_manifest_errors(manifest_validation_data)
> +
>  def verify_single_manifest(cfg_file, manifest_repo, manifest_path,
> verbose=False):
>      manifest = ManifestXml(manifest_path)
>      print(VERIFY_PROJ.format(manifest.project_info.codename))
>      index_path =
> os.path.join(cfg_file.manifest_repo_abs_path(manifest_repo),
> CI_INDEX_FILE_NAME)
> -    proj_val_data = validate_manifestfiles(index_path, [manifest_path])
> +    proj_val_data = validate_manifestfiles([manifest_path])
>      proj_val_error = get_manifest_validation_status(proj_val_data)
>      if proj_val_error:
>          if verbose:
> --
> 2.16.2.windows.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-10  4:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-10  4:21 [edk2-staging/EdkRepo] [PATCH V2] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
2020-05-10  4:45 ` Nate DeSimone
2020-05-10  4:47 ` Nate DeSimone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox