[edk2-devel] [edk2-staging/EdkRepo] [PATCH 4/7] EdkRepo: Add list_available_manifest_repos()

Ashley E Desimone posted 7 patches 5 years, 9 months ago
[edk2-devel] [edk2-staging/EdkRepo] [PATCH 4/7] EdkRepo: Add list_available_manifest_repos()
Posted by Ashley E Desimone 5 years, 9 months ago
Add the ability to calculate a list of available
manifest repositories from the contents of the
edkrepo.cfg and the edkrepo_user.cfg files.

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                  | 53 ++++++++++++++--------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
index 24ad76a..4bded46 100644
--- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
+++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
@@ -64,25 +64,10 @@ def pull_all_manifest_repos(edkrepo_cfg, edkrepo_user_cfg, reset_hard=False):
     '''
     cfg_man_repos = []
     user_cfg_man_repos = []
-    conflicts, duplicates = detect_man_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)
-    elif conflicts:
-        for conflict in conflicts:
-            # In the case of a conflict do not pull conflicting repo
-            print(humble.CONFLICT_NO_CLONE.format(conflict))
-            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
-            cfg_man_repos.remove(conflict)
-            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
-            user_cfg_man_repos.remove(conflict)
-    elif duplicates:
-        for duplicate in duplicates:
-            # the duplicate needs to be ignored in on of the repo lists so it is
-            # not cloned/pulled twice
-            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
-            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
-            user_cfg_man_repos.remove(conflict)
+    conflicts = []
+    cfg_man_repos, user_cfg_man_repos, conflicts = list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg)
+    for conflict in conflicts:
+        print(humble.CONFLICT_NO_CLONE.format(conflict))
     for repo in cfg_man_repos:
         pull_single_manifest_repo(edkrepo_cfg.get_manifest_repo_url(repo),
                                   edkrepo_cfg.get_manifest_repo_branch(repo),
@@ -120,3 +105,33 @@ def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg):
             else:
                 duplicates.append(repo)
     return conflicts, duplicates
+
+def list_available_man_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
+    manifest_repos for each and a list of conflicting manifest repository entries.
+    '''
+    cfg_man_repos = []
+    user_cfg_man_repos = []
+    conflicts, duplicates = detect_man_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)
+    elif conflicts:
+        for conflict in conflicts:
+            # In the case of a conflict do not pull conflicting repo
+            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
+            cfg_man_repos.remove(conflict)
+            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
+            user_cfg_man_repos.remove(conflict)
+    elif duplicates:
+        for duplicate in duplicates:
+            # the duplicate needs to be ignored in on of the repo lists so it is
+            # not cloned/pulled twice
+            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
+            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
+            user_cfg_man_repos.remove(duplicate)
+    return cfg_man_repos, user_cfg_man_repos, conflicts
+
+
-- 
2.16.2.windows.1


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

View/Reply Online (#58270): https://edk2.groups.io/g/devel/message/58270
Mute This Topic: https://groups.io/mt/73340191/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 4/7] EdkRepo: Add list_available_manifest_repos()
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 4/7] EdkRepo: Add
> list_available_manifest_repos()
> 
> Add the ability to calculate a list of available manifest repositories from the
> contents of the edkrepo.cfg and the edkrepo_user.cfg files.
> 
> 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                  | 53 ++++++++++++++--------
>  1 file changed, 34 insertions(+), 19 deletions(-)
> 
> diff --git
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> index 24ad76a..4bded46 100644
> ---
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> +++
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> @@ -64,25 +64,10 @@ def pull_all_manifest_repos(edkrepo_cfg,
> edkrepo_user_cfg, reset_hard=False):
>      '''
>      cfg_man_repos = []
>      user_cfg_man_repos = []
> -    conflicts, duplicates =
> detect_man_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)
> -    elif conflicts:
> -        for conflict in conflicts:
> -            # In the case of a conflict do not pull conflicting repo
> -            print(humble.CONFLICT_NO_CLONE.format(conflict))
> -            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
> -            cfg_man_repos.remove(conflict)
> -            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
> -            user_cfg_man_repos.remove(conflict)
> -    elif duplicates:
> -        for duplicate in duplicates:
> -            # the duplicate needs to be ignored in on of the repo lists so it is
> -            # not cloned/pulled twice
> -            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
> -            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
> -            user_cfg_man_repos.remove(conflict)
> +    conflicts = []
> +    cfg_man_repos, user_cfg_man_repos, conflicts =
> list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg)
> +    for conflict in conflicts:
> +        print(humble.CONFLICT_NO_CLONE.format(conflict))
>      for repo in cfg_man_repos:
>          pull_single_manifest_repo(edkrepo_cfg.get_manifest_repo_url(repo),
>                                    edkrepo_cfg.get_manifest_repo_branch(repo),
> @@ -120,3 +105,33 @@ def
> detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg):
>              else:
>                  duplicates.append(repo)
>      return conflicts, duplicates
> +
> +def list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg):

Your commit message says that you are adding "list_available_manifest_repos()" but in actuality you are not. You are adding "list_available_man_repos()" Given that all the pre-existing EdkRepo code tends to spell out "manifest" please rename this function to "list_available_manifest_repos()"

> +    '''
> +    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
> +    manifest_repos for each and a list of conflicting manifest repository
> entries.
> +    '''
> +    cfg_man_repos = []
> +    user_cfg_man_repos = []
> +    conflicts, duplicates =
> detect_man_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)
> +    elif conflicts:
> +        for conflict in conflicts:
> +            # In the case of a conflict do not pull conflicting repo
> +            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
> +            cfg_man_repos.remove(conflict)
> +            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
> +            user_cfg_man_repos.remove(conflict)
> +    elif duplicates:
> +        for duplicate in duplicates:
> +            # the duplicate needs to be ignored in on of the repo lists so it is
> +            # not cloned/pulled twice
> +            cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list)
> +            user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list)
> +            user_cfg_man_repos.remove(duplicate)
> +    return cfg_man_repos, user_cfg_man_repos, conflicts
> +
> +
> --
> 2.16.2.windows.1


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

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