[edk2-devel] [edk2-staging/EdkRepo] [PATCH 1/7] EdkRepo: Add check for conflicting/duplicated manifest repo definitions

Ashley E Desimone posted 7 patches 5 years, 9 months ago
[edk2-devel] [edk2-staging/EdkRepo] [PATCH 1/7] EdkRepo: Add check for conflicting/duplicated manifest repo definitions
Posted by Ashley E Desimone 5 years, 9 months ago
Add a functions to check for conflicting or duplicated manifest
repository definitions in the edkrepo.cfg and the edkrepo_user.cfg
files. Two manifest repositories definitions are
considered conflicting if they have the same name and at least one
of URL, branch or local path differ. Two manifest repository
definitions are considered duplicates if the name, URL, branch
and local path are the same.

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                  | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
index 6e26d4f..ad6ddbc 100644
--- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
+++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py
@@ -57,3 +57,28 @@ def pull_single_manifest_repo(url, branch, local_path, reset_hard=False):
             print (humble.CLONE_SINGLE_MAN_REPO.format(local_path, url))
             repo = Repo.clone_from(url, local_path, progress=GitProgressHandler(), branch=branch)
 
+def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg):
+    '''
+    Determines whether there is are conflicting or duplicated manifest
+    repositories listed in the edkrepo.cfg and the edkrepo_user.cfg.
+    '''
+    conflicts = []
+    duplicates = []
+    if not edkrepo_user_cfg.manifest_repo_list:
+        return conflicts, duplicates
+    else:
+        config_repos = set(edkrepo_cfg.manifest_repo_list)
+        user_cfg_repos = set(edkrepo_user_cfg.manifest_repo_list)
+    if config_repos.isdisjoint(user_cfg_repos):
+        return conflicts, duplicates
+    else:
+        for repo in config_repos.intersection(user_cfg_repos):
+            if edkrepo_cfg.get_manifest_repo_url(repo) != edkrepo_user_cfg.get_manifest_repo_url(repo):
+                conflicts.append(repo)
+            elif edkrepo_cfg.get_manifest_repo_branch(repo) != edkrepo_user_cfg.get_manifest_repo_branch(repo):
+                conflicts.append(repo)
+            elif edkrepo_cfg.get_manifest_repo_local_path(repo) != edkrepo_user_cfg.get_manifest_repo_local_path(repo):
+                conflicts.append(repo)
+            else:
+                duplicates.append(repo)
+    return conflicts, duplicates
-- 
2.16.2.windows.1


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

View/Reply Online (#58267): https://edk2.groups.io/g/devel/message/58267
Mute This Topic: https://groups.io/mt/73340188/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 1/7] EdkRepo: Add check for conflicting/duplicated manifest repo definitions
Posted by Nate DeSimone 5 years, 9 months ago
Hi Ashley,

Please see comments inline.

Thanks,
Nate

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ashley E
> Desimone
> 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-devel] [edk2-staging/EdkRepo] [PATCH 1/7] EdkRepo: Add
> check for conflicting/duplicated manifest repo definitions
> 
> Add a functions to check for conflicting or duplicated manifest repository
> definitions in the edkrepo.cfg and the edkrepo_user.cfg files. Two manifest
> repositories definitions are considered conflicting if they have the same
> name and at least one of URL, branch or local path differ. Two manifest
> repository definitions are considered duplicates if the name, URL, branch and
> local path are the same.
> 
> 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                  | 25
> ++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> index 6e26d4f..ad6ddbc 100644
> ---
> a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> +++
> b/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc
> e.py
> @@ -57,3 +57,28 @@ def pull_single_manifest_repo(url, branch, local_path,
> reset_hard=False):
>              print (humble.CLONE_SINGLE_MAN_REPO.format(local_path, url))
>              repo = Repo.clone_from(url, local_path,
> progress=GitProgressHandler(), branch=branch)
> 
> +def detect_man_repo_conflicts_duplicates(edkrepo_cfg,
> edkrepo_user_cfg):

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

> +    '''
> +    Determines whether there is are conflicting or duplicated manifest
> +    repositories listed in the edkrepo.cfg and the edkrepo_user.cfg.
> +    '''
> +    conflicts = []
> +    duplicates = []
> +    if not edkrepo_user_cfg.manifest_repo_list:
> +        return conflicts, duplicates
> +    else:
> +        config_repos = set(edkrepo_cfg.manifest_repo_list)
> +        user_cfg_repos = set(edkrepo_user_cfg.manifest_repo_list)
> +    if config_repos.isdisjoint(user_cfg_repos):
> +        return conflicts, duplicates
> +    else:
> +        for repo in config_repos.intersection(user_cfg_repos):
> +            if edkrepo_cfg.get_manifest_repo_url(repo) !=
> edkrepo_user_cfg.get_manifest_repo_url(repo):
> +                conflicts.append(repo)
> +            elif edkrepo_cfg.get_manifest_repo_branch(repo) !=
> edkrepo_user_cfg.get_manifest_repo_branch(repo):
> +                conflicts.append(repo)
> +            elif edkrepo_cfg.get_manifest_repo_local_path(repo) !=
> edkrepo_user_cfg.get_manifest_repo_local_path(repo):
> +                conflicts.append(repo)
> +            else:
> +                duplicates.append(repo)
> +    return conflicts, duplicates
> --
> 2.16.2.windows.1
> 
> 
> 


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

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