[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Correct when a sparse reset is triggered during checkout

Desimone, Ashley E posted 1 patch 4 years, 1 month ago
Failed in applying to current master (apply log)
edkrepo/common/common_repo_functions.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Correct when a sparse reset is triggered during checkout
Posted by Desimone, Ashley E 4 years, 1 month ago
Correct an error case in the checkout function defined in:
common/common_repo_functions.py where the need to perform a
sparse reset was not correctly calculated.

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>
---
 edkrepo/common/common_repo_functions.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index d857d09..b9c28e6 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -571,13 +571,22 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
     # Disable sparse checkout
     current_repos = initial_repo_sources
     sparse_enabled = sparse_checkout_enabled(workspace_path, initial_repo_sources)
+    sparse_diff = False
+    for source in initial_repo_sources:
+        for src in repo_sources:
+            if source.root == src.root:
+                if source.sparse != src.sparse:
+                    sparse_diff = True
+        if sparse_diff:
+            break
     # Sparse checkout only needs to be recomputed if
     # the dynamic sparse list is being used instead of the static sparse list
+    # or the sparse settings between two combinations differ
     if sparse_enabled:
         sparse_settings = manifest.sparse_settings
         if sparse_settings is not None:
             sparse_enabled = False
-    if sparse_enabled:
+    if sparse_enabled or sparse_diff:
         print(SPARSE_RESET)
         reset_sparse_checkout(workspace_path, current_repos)
 
@@ -595,7 +604,7 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         # Return to the initial combo, since there was an issue with cheking out the selected combo
         checkout_repos(verbose, override, initial_repo_sources, workspace_path, manifest)
     finally:
-        if sparse_enabled:
+        if sparse_enabled or sparse_diff:
             print(SPARSE_CHECKOUT)
             sparse_checkout(workspace_path, current_repos, manifest)
 
-- 
2.16.2.windows.1


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

View/Reply Online (#55704): https://edk2.groups.io/g/devel/message/55704
Mute This Topic: https://groups.io/mt/71848469/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] EdkRepo: Correct when a sparse reset is triggered during checkout
Posted by Nate DeSimone 4 years, 1 month ago
Please update copyright year on common_repo_functions.py

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

-----Original Message-----
From: Desimone, Ashley E <ashley.e.desimone@intel.com> 
Sent: Monday, March 9, 2020 5:36 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>
Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Correct when a sparse reset is triggered during checkout

Correct an error case in the checkout function defined in:
common/common_repo_functions.py where the need to perform a sparse reset was not correctly calculated.

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>
---
 edkrepo/common/common_repo_functions.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index d857d09..b9c28e6 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -571,13 +571,22 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
     # Disable sparse checkout
     current_repos = initial_repo_sources
     sparse_enabled = sparse_checkout_enabled(workspace_path, initial_repo_sources)
+    sparse_diff = False
+    for source in initial_repo_sources:
+        for src in repo_sources:
+            if source.root == src.root:
+                if source.sparse != src.sparse:
+                    sparse_diff = True
+        if sparse_diff:
+            break
     # Sparse checkout only needs to be recomputed if
     # the dynamic sparse list is being used instead of the static sparse list
+    # or the sparse settings between two combinations differ
     if sparse_enabled:
         sparse_settings = manifest.sparse_settings
         if sparse_settings is not None:
             sparse_enabled = False
-    if sparse_enabled:
+    if sparse_enabled or sparse_diff:
         print(SPARSE_RESET)
         reset_sparse_checkout(workspace_path, current_repos)
 
@@ -595,7 +604,7 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         # Return to the initial combo, since there was an issue with cheking out the selected combo
         checkout_repos(verbose, override, initial_repo_sources, workspace_path, manifest)
     finally:
-        if sparse_enabled:
+        if sparse_enabled or sparse_diff:
             print(SPARSE_CHECKOUT)
             sparse_checkout(workspace_path, current_repos, manifest)
 
--
2.16.2.windows.1


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

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