[edk2-devel] [edk2-staging/EdkRepo] [PATCH 6/7] EdkRepo: Add ability to determine the source manifest of a workspace

Ashley E Desimone posted 7 patches 5 years, 9 months ago
[edk2-devel] [edk2-staging/EdkRepo] [PATCH 6/7] EdkRepo: Add ability to determine the source manifest of a workspace
Posted by Ashley E Desimone 5 years, 9 months ago
Add find_source_man_repo() to check if for the source manifest
repo is contained in the workspaces project manifest file.
If it is not determine the value and write it to the manifest.

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 ++
 .../workspace_maintenance/manifest_repos_maintenance.py   | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

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 e592f19..05e76b1 100644
--- a/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py
+++ b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py
@@ -25,3 +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: {}'
+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 9b441ac..7b3f866 100644
--- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
+++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
@@ -199,5 +199,20 @@ def find_project_in_all_indices (project, edkrepo_cfg, edkrepo_user_cfg, except_
                         return repo, 'edkrepo_user_cfg', os.path.join(dirpath, project)
 
 
+def find_source_man_repo (project_manifest, edkrepo_cfg, edkrepo_user_cfg):
+    '''
+    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
+    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),
+                                                                             man_repo=None)
+        project_manifest.write_source_manifest_repo(src_man_repo)
+        return src_man_repo    
 
 
-- 
2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58269): https://edk2.groups.io/g/devel/message/58269
Mute This Topic: https://groups.io/mt/73340190/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH 6/7] EdkRepo: Add ability to determine the source manifest of a workspace
Posted by Nate DeSimone 5 years, 9 months ago
Hi Ashley,

Please see comments inline.

Thanks,
Nate

> -----Original Message-----
> From: Desimone, Ashley E <ashley.e.desimone@intel.com>
> Sent: Tuesday, April 28, 2020 2:57 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 6/7] EdkRepo: Add ability to
> determine the source manifest of a workspace
> 
> Add find_source_man_repo() to check if for the source manifest repo is
> contained in the workspaces project manifest file.
> If it is not determine the value and write it to the manifest.
> 
> 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 ++
>  .../workspace_maintenance/manifest_repos_maintenance.py   | 15
> +++++++++++++++
>  2 files changed, 17 insertions(+)
> 
> diff --git
> a/edkrepo/common/workspace_maintenance/humble/manifest_repos_ma
> intenance_humble.py
> b/edkrepo/common/workspace_maintenance/humble/manifest_repos_ma
> intenance_humble.py
> index e592f19..05e76b1 100644
> ---
> a/edkrepo/common/workspace_maintenance/humble/manifest_repos_ma
> intenance_humble.py
> +++
> b/edkrepo/common/workspace_maintenance/humble/manifest_repos_ma
> inten
> +++ ance_humble.py
> @@ -25,3 +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: {}'
> +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_maintenanc
> e.py
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> index 9b441ac..7b3f866 100644
> ---
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> +++
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> @@ -199,5 +199,20 @@ def find_project_in_all_indices (project,
> edkrepo_cfg, edkrepo_user_cfg, except_
>                          return repo, 'edkrepo_user_cfg', os.path.join(dirpath, project)
> 
> 
> +def find_source_man_repo (project_manifest, edkrepo_cfg,
> edkrepo_user_cfg):

All the pre-existing EdkRepo code tends to spell out "manifest" please rename this function to "find_source_manifest_repo()"

> +    '''
> +    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
> +    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.codena
> me),
> +
> humble.SOURCE_MAN_REPO_NOT_FOUND.format(project_manifest.proje
> ct_info.codename),
> +                                                                             man_repo=None)
> +        project_manifest.write_source_manifest_repo(src_man_repo)
> +        return src_man_repo
> 
> 
> --
> 2.16.2.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58477): https://edk2.groups.io/g/devel/message/58477
Mute This Topic: https://groups.io/mt/73340190/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-