[edk2-devel] [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Continue checkout on submodule deinit errors

Bjorge, Erik C posted 1 patch 2 weeks ago
Failed in applying to current master (apply log)
edkrepo/commands/checkout_pin_command.py | 9 +++++++--
edkrepo/common/common_repo_functions.py  | 8 +++++++-
edkrepo/common/humble.py                 | 3 +++
3 files changed, 17 insertions(+), 3 deletions(-)

[edk2-devel] [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Continue checkout on submodule deinit errors

Posted by Bjorge, Erik C 2 weeks ago
In some cases submodules may still not be deinitialzied even with the
more aggressive deinit flags.  In these cases the checkout will report a
warning and attempt to continue the checkout process.

Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
---
 edkrepo/commands/checkout_pin_command.py | 9 +++++++--
 edkrepo/common/common_repo_functions.py  | 8 +++++++-
 edkrepo/common/humble.py                 | 3 +++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py b/edkrepo/commands/checkout_pin_command.py
index 39c5aeb..1c58113 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -16,7 +16,7 @@ import edkrepo.commands.arguments.checkout_pin_args as arguments
 import edkrepo.commands.humble.checkout_pin_humble as humble
 from edkrepo.common.common_repo_functions import sparse_checkout_enabled, reset_sparse_checkout, sparse_checkout
 from edkrepo.common.common_repo_functions import check_dirty_repos, checkout_repos, combinations_in_manifest
-from edkrepo.common.humble import SPARSE_CHECKOUT, SPARSE_RESET
+from edkrepo.common.humble import SPARSE_CHECKOUT, SPARSE_RESET, SUBMODULE_DEINIT_FAILED
 from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoProjectMismatchException
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
@@ -71,7 +71,12 @@ class CheckoutPinCommand(EdkrepoCommand):
             print(SPARSE_RESET)
             reset_sparse_checkout(workspace_path, manifest_sources)
         submodule_combo = pin.general_config.current_combo
-        deinit_full(workspace_path, manifest, args.verbose)
+        try:
+            deinit_full(workspace_path, manifest, args.verbose)
+        except Exception as e:
+            print(SUBMODULE_DEINIT_FAILED)
+            if args.verbose:
+                print(e)
         pin_repo_sources = pin.get_repo_sources(pin.general_config.current_combo)
         try:
             checkout_repos(args.verbose, args.override, pin_repo_sources, workspace_path, manifest)
diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index 313a1ca..a6a38cf 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -50,6 +50,7 @@ from edkrepo.common.humble import INCLUDED_URL_LINE, INCLUDED_INSTEAD_OF_LINE, I
 from edkrepo.common.humble import ERROR_WRITING_INCLUDE, MULTIPLE_SOURCE_ATTRIBUTES_SPECIFIED
 from edkrepo.common.humble import VERIFY_GLOBAL, VERIFY_ARCHIVED, VERIFY_PROJ, VERIFY_PROJ_FAIL
 from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_FAIL
+from edkrepo.common.humble import SUBMODULE_DEINIT_FAILED
 from edkrepo.common.pathfix import get_actual_path
 from project_utils.sparse import BuildInfo, process_sparse_checkout
 from edkrepo.config.config_factory import get_workspace_path
@@ -523,7 +524,12 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
     # Deinit all submodules due to the potential for issues when switching
     # branches.
     if combo_or_sha != manifest.general_config.current_combo:
-        deinit_full(workspace_path, manifest, verbose)
+        try:
+            deinit_full(workspace_path, manifest, verbose)
+        except Exception as e:
+            print(SUBMODULE_DEINIT_FAILED)
+            if verbose:
+                print(e)
 
     print(CHECKING_OUT_COMBO.format(combo_or_sha))
 
diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py
index f905357..763b9a6 100644
--- a/edkrepo/common/humble.py
+++ b/edkrepo/common/humble.py
@@ -155,3 +155,6 @@ BRANCH = '    Branch : {0}'
 COMMIT = '    Commit Id: {0}'
 WRITING_PIN_FILE = 'Writing pin file to {0} ...'
 COMMIT_MESSAGE = 'Pin file for project: {0} \nPin Description: {1}'
+
+# Common submodule error messages
+SUBMODULE_DEINIT_FAILED = 'Warning: Unable to remove all submodule content'
-- 
2.21.0.windows.1


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

View/Reply Online (#63135): https://edk2.groups.io/g/devel/message/63135
Mute This Topic: https://groups.io/mt/75730839/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 v1] EdkRepo: Continue checkout on submodule deinit errors

Posted by Ashley E Desimone 2 weeks ago
Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: Bjorge, Erik C <erik.c.bjorge@intel.com> 
Sent: Wednesday, July 22, 2020 11:26 AM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Continue checkout on submodule deinit errors

In some cases submodules may still not be deinitialzied even with the more aggressive deinit flags.  In these cases the checkout will report a warning and attempt to continue the checkout process.

Cc: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Signed-off-by: Erik Bjorge <erik.c.bjorge@intel.com>
---
 edkrepo/commands/checkout_pin_command.py | 9 +++++++--  edkrepo/common/common_repo_functions.py  | 8 +++++++-
 edkrepo/common/humble.py                 | 3 +++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py b/edkrepo/commands/checkout_pin_command.py
index 39c5aeb..1c58113 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -16,7 +16,7 @@ import edkrepo.commands.arguments.checkout_pin_args as arguments  import edkrepo.commands.humble.checkout_pin_humble as humble  from edkrepo.common.common_repo_functions import sparse_checkout_enabled, reset_sparse_checkout, sparse_checkout  from edkrepo.common.common_repo_functions import check_dirty_repos, checkout_repos, combinations_in_manifest -from edkrepo.common.humble import SPARSE_CHECKOUT, SPARSE_RESET
+from edkrepo.common.humble import SPARSE_CHECKOUT, SPARSE_RESET, 
+SUBMODULE_DEINIT_FAILED
 from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, EdkrepoProjectMismatchException  from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos  from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo @@ -71,7 +71,12 @@ class CheckoutPinCommand(EdkrepoCommand):
             print(SPARSE_RESET)
             reset_sparse_checkout(workspace_path, manifest_sources)
         submodule_combo = pin.general_config.current_combo
-        deinit_full(workspace_path, manifest, args.verbose)
+        try:
+            deinit_full(workspace_path, manifest, args.verbose)
+        except Exception as e:
+            print(SUBMODULE_DEINIT_FAILED)
+            if args.verbose:
+                print(e)
         pin_repo_sources = pin.get_repo_sources(pin.general_config.current_combo)
         try:
             checkout_repos(args.verbose, args.override, pin_repo_sources, workspace_path, manifest) diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index 313a1ca..a6a38cf 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -50,6 +50,7 @@ from edkrepo.common.humble import INCLUDED_URL_LINE, INCLUDED_INSTEAD_OF_LINE, I  from edkrepo.common.humble import ERROR_WRITING_INCLUDE, MULTIPLE_SOURCE_ATTRIBUTES_SPECIFIED
 from edkrepo.common.humble import VERIFY_GLOBAL, VERIFY_ARCHIVED, VERIFY_PROJ, VERIFY_PROJ_FAIL  from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_FAIL
+from edkrepo.common.humble import SUBMODULE_DEINIT_FAILED
 from edkrepo.common.pathfix import get_actual_path  from project_utils.sparse import BuildInfo, process_sparse_checkout  from edkrepo.config.config_factory import get_workspace_path @@ -523,7 +524,12 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
     # Deinit all submodules due to the potential for issues when switching
     # branches.
     if combo_or_sha != manifest.general_config.current_combo:
-        deinit_full(workspace_path, manifest, verbose)
+        try:
+            deinit_full(workspace_path, manifest, verbose)
+        except Exception as e:
+            print(SUBMODULE_DEINIT_FAILED)
+            if verbose:
+                print(e)
 
     print(CHECKING_OUT_COMBO.format(combo_or_sha))
 
diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py index f905357..763b9a6 100644
--- a/edkrepo/common/humble.py
+++ b/edkrepo/common/humble.py
@@ -155,3 +155,6 @@ BRANCH = '    Branch : {0}'
 COMMIT = '    Commit Id: {0}'
 WRITING_PIN_FILE = 'Writing pin file to {0} ...'
 COMMIT_MESSAGE = 'Pin file for project: {0} \nPin Description: {1}'
+
+# Common submodule error messages
+SUBMODULE_DEINIT_FAILED = 'Warning: Unable to remove all submodule content'
--
2.21.0.windows.1


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

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