public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices
@ 2020-05-08 19:45 Ashley E Desimone
  2020-05-10  3:18 ` [edk2-devel] " Nate DeSimone
  2020-05-10  3:25 ` Nate DeSimone
  0 siblings, 2 replies; 3+ messages in thread
From: Ashley E Desimone @ 2020-05-08 19:45 UTC (permalink / raw)
  To: devel
  Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
	Prince Agyeman

Update find_project_in_all_indices() to only return None values
for the source manifest repo and config file if the project is
truly not found in any manifest repository. In the case a path
to a manifest file is provided recursively call
find_in_all_indices() with the code name from the manifest at
the provided path to generate the source manifest repo and config
values.

Additionally update the call to find_project_in_all_indices() in
find_source_manifest_repo to use the value of man_repo instead of
None.

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>
---
 .../manifest_repos_maintenance.py                  | 26 +++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
index 2a5a70f..08c4fe6 100644
--- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
+++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
@@ -185,9 +185,29 @@ def find_project_in_all_indices (project, edkrepo_cfg, edkrepo_user_cfg, except_
         except KeyError:
             raise EdkrepoInvalidParametersException(except_msg_man_repo)
     elif os.path.isabs(project):
-        return None, None, project
+        manifest = ManifestXml(project)
+        try:
+            found_manifest_repo, found_cfg, found_project = find_project_in_all_indices(manifest.project_info.codename,
+                                                                                        edkrepo_cfg,
+                                                                                        edkrepo_user_cfg,
+                                                                                        except_msg_man_repo,
+                                                                                        except_msg_not_found,
+                                                                                        man_repo)
+            return found_manifest_repo, found_cfg, project
+        except EdkrepoManifestNotFoundException:
+            return None, None, project
     elif os.path.isfile(os.path.join(os.getcwd(), project)):
-        return None, None, os.path.join(os.getcwd(), project)
+        manifest = os.path.join(os.getcwd(), project)
+        try:
+            found_manifest_repo, found_cfg, found_project = find_project_in_all_indices(manifest.project_info.codename,
+                                                                                        edkrepo_cfg,
+                                                                                        edkrepo_user_cfg,
+                                                                                        except_msg_man_repo,
+                                                                                        except_msg_not_found,
+                                                                                        man_repo)
+            return found_manifest_repo, found_cfg, project
+        except EdkrepoManifestNotFoundException:
+            return None, None, os.path.join(os.getcwd(), project)
     elif not os.path.dirname(project):
         for repo in cfg_man_repos:
             if (man_repo and (repo == man_repo)) or not man_repo:
@@ -215,7 +235,7 @@ def find_source_manifest_repo(project_manifest, edkrepo_cfg, edkrepo_user_cfg, m
                                                                              edkrepo_user_cfg,
                                                                              humble.PROJ_NOT_IN_REPO.format(project_manifest.project_info.codename),
                                                                              humble.SOURCE_MANIFEST_REPO_NOT_FOUND.format(project_manifest.project_info.codename),
-                                                                             man_repo=None)
+                                                                             man_repo)
         project_manifest.write_source_manifest_repo(src_man_repo)
         return src_man_repo
 
-- 
2.16.2.windows.1


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

* Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices
  2020-05-08 19:45 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices Ashley E Desimone
@ 2020-05-10  3:18 ` Nate DeSimone
  2020-05-10  3:25 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2020-05-10  3:18 UTC (permalink / raw)
  To: devel@edk2.groups.io, Desimone, Ashley E
  Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince

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

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ashley E
> Desimone
> Sent: Friday, May 8, 2020 12:45 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-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address
> corner cases in find_project_in_all_indices
> 
> Update find_project_in_all_indices() to only return None values for the
> source manifest repo and config file if the project is truly not found in any
> manifest repository. In the case a path to a manifest file is provided
> recursively call
> find_in_all_indices() with the code name from the manifest at the provided
> path to generate the source manifest repo and config values.
> 
> Additionally update the call to find_project_in_all_indices() in
> find_source_manifest_repo to use the value of man_repo instead of None.
> 
> 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>
> ---
>  .../manifest_repos_maintenance.py                  | 26 +++++++++++++++++++--
> -
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> index 2a5a70f..08c4fe6 100644
> ---
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> +++
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> @@ -185,9 +185,29 @@ def find_project_in_all_indices (project,
> edkrepo_cfg, edkrepo_user_cfg, except_
>          except KeyError:
>              raise EdkrepoInvalidParametersException(except_msg_man_repo)
>      elif os.path.isabs(project):
> -        return None, None, project
> +        manifest = ManifestXml(project)
> +        try:
> +            found_manifest_repo, found_cfg, found_project =
> find_project_in_all_indices(manifest.project_info.codename,
> +                                                                                        edkrepo_cfg,
> +                                                                                        edkrepo_user_cfg,
> +                                                                                        except_msg_man_repo,
> +                                                                                        except_msg_not_found,
> +                                                                                        man_repo)
> +            return found_manifest_repo, found_cfg, project
> +        except EdkrepoManifestNotFoundException:
> +            return None, None, project
>      elif os.path.isfile(os.path.join(os.getcwd(), project)):
> -        return None, None, os.path.join(os.getcwd(), project)
> +        manifest = os.path.join(os.getcwd(), project)
> +        try:
> +            found_manifest_repo, found_cfg, found_project =
> find_project_in_all_indices(manifest.project_info.codename,
> +                                                                                        edkrepo_cfg,
> +                                                                                        edkrepo_user_cfg,
> +                                                                                        except_msg_man_repo,
> +                                                                                        except_msg_not_found,
> +                                                                                        man_repo)
> +            return found_manifest_repo, found_cfg, project
> +        except EdkrepoManifestNotFoundException:
> +            return None, None, os.path.join(os.getcwd(), project)
>      elif not os.path.dirname(project):
>          for repo in cfg_man_repos:
>              if (man_repo and (repo == man_repo)) or not man_repo:
> @@ -215,7 +235,7 @@ def find_source_manifest_repo(project_manifest,
> edkrepo_cfg, edkrepo_user_cfg, m
>                                                                               edkrepo_user_cfg,
> 
> humble.PROJ_NOT_IN_REPO.format(project_manifest.project_info.codena
> me),
> 
> humble.SOURCE_MANIFEST_REPO_NOT_FOUND.format(project_manifest.
> project_info.codename),
> -                                                                             man_repo=None)
> +
> + man_repo)
>          project_manifest.write_source_manifest_repo(src_man_repo)
>          return src_man_repo
> 
> --
> 2.16.2.windows.1
> 
> 
> 


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

* Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices
  2020-05-08 19:45 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices Ashley E Desimone
  2020-05-10  3:18 ` [edk2-devel] " Nate DeSimone
@ 2020-05-10  3:25 ` Nate DeSimone
  1 sibling, 0 replies; 3+ messages in thread
From: Nate DeSimone @ 2020-05-10  3:25 UTC (permalink / raw)
  To: devel@edk2.groups.io, Desimone, Ashley E
  Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince

Pushed: b770e4017e889247925b17cfaa064d112eadda32

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ashley E
> Desimone
> Sent: Friday, May 8, 2020 12:45 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-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address
> corner cases in find_project_in_all_indices
> 
> Update find_project_in_all_indices() to only return None values for the
> source manifest repo and config file if the project is truly not found in any
> manifest repository. In the case a path to a manifest file is provided
> recursively call
> find_in_all_indices() with the code name from the manifest at the provided
> path to generate the source manifest repo and config values.
> 
> Additionally update the call to find_project_in_all_indices() in
> find_source_manifest_repo to use the value of man_repo instead of None.
> 
> 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>
> ---
>  .../manifest_repos_maintenance.py                  | 26 +++++++++++++++++++--
> -
>  1 file changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> index 2a5a70f..08c4fe6 100644
> ---
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> +++
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> @@ -185,9 +185,29 @@ def find_project_in_all_indices (project,
> edkrepo_cfg, edkrepo_user_cfg, except_
>          except KeyError:
>              raise EdkrepoInvalidParametersException(except_msg_man_repo)
>      elif os.path.isabs(project):
> -        return None, None, project
> +        manifest = ManifestXml(project)
> +        try:
> +            found_manifest_repo, found_cfg, found_project =
> find_project_in_all_indices(manifest.project_info.codename,
> +                                                                                        edkrepo_cfg,
> +                                                                                        edkrepo_user_cfg,
> +                                                                                        except_msg_man_repo,
> +                                                                                        except_msg_not_found,
> +                                                                                        man_repo)
> +            return found_manifest_repo, found_cfg, project
> +        except EdkrepoManifestNotFoundException:
> +            return None, None, project
>      elif os.path.isfile(os.path.join(os.getcwd(), project)):
> -        return None, None, os.path.join(os.getcwd(), project)
> +        manifest = os.path.join(os.getcwd(), project)
> +        try:
> +            found_manifest_repo, found_cfg, found_project =
> find_project_in_all_indices(manifest.project_info.codename,
> +                                                                                        edkrepo_cfg,
> +                                                                                        edkrepo_user_cfg,
> +                                                                                        except_msg_man_repo,
> +                                                                                        except_msg_not_found,
> +                                                                                        man_repo)
> +            return found_manifest_repo, found_cfg, project
> +        except EdkrepoManifestNotFoundException:
> +            return None, None, os.path.join(os.getcwd(), project)
>      elif not os.path.dirname(project):
>          for repo in cfg_man_repos:
>              if (man_repo and (repo == man_repo)) or not man_repo:
> @@ -215,7 +235,7 @@ def find_source_manifest_repo(project_manifest,
> edkrepo_cfg, edkrepo_user_cfg, m
>                                                                               edkrepo_user_cfg,
> 
> humble.PROJ_NOT_IN_REPO.format(project_manifest.project_info.codena
> me),
> 
> humble.SOURCE_MANIFEST_REPO_NOT_FOUND.format(project_manifest.
> project_info.codename),
> -                                                                             man_repo=None)
> +
> + man_repo)
>          project_manifest.write_source_manifest_repo(src_man_repo)
>          return src_man_repo
> 
> --
> 2.16.2.windows.1
> 
> 
> 


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-08 19:45 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Address corner cases in find_project_in_all_indices Ashley E Desimone
2020-05-10  3:18 ` [edk2-devel] " Nate DeSimone
2020-05-10  3:25 ` Nate DeSimone

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