[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/3] EdkRepo: Fix submodule failures when switching combos.

Bjorge, Erik C posted 3 patches 5 years, 8 months ago
[edk2-devel] [edk2-staging/EdkRepo] [PATCH v2 3/3] EdkRepo: Fix submodule failures when switching combos.
Posted by Bjorge, Erik C 5 years, 8 months ago
When switching combinations or checking out pins the submodule
information may change or have modifications that will cause errors.
Before changing to a new combination all submodules should be removed.

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 |  5 ++---
 edkrepo/common/common_repo_functions.py  | 11 ++++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py b/edkrepo/commands/checkout_pin_command.py
index 9d7346a..39c5aeb 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -22,7 +22,7 @@ from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
 from edkrepo.config.config_factory import get_workspace_path, get_workspace_manifest
 from edkrepo_manifest_parser.edk_manifest import ManifestXml
-from project_utils.submodule import deinit_submodules, maintain_submodules
+from project_utils.submodule import deinit_full, maintain_submodules
 
 
 class CheckoutPinCommand(EdkrepoCommand):
@@ -71,8 +71,7 @@ class CheckoutPinCommand(EdkrepoCommand):
             print(SPARSE_RESET)
             reset_sparse_checkout(workspace_path, manifest_sources)
         submodule_combo = pin.general_config.current_combo
-        deinit_submodules(workspace_path, manifest, manifest.general_config.current_combo,
-                          pin, submodule_combo, args.verbose)
+        deinit_full(workspace_path, manifest, args.verbose)
         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 8c79f3d..59c198f 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -68,7 +68,7 @@ from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestrep
 from edkrepo_manifest_parser.edk_manifest_validation import get_manifest_validation_status
 from edkrepo_manifest_parser.edk_manifest_validation import print_manifest_errors
 from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestfiles
-from project_utils.submodule import deinit_submodules, maintain_submodules
+from project_utils.submodule import deinit_full, maintain_submodules
 
 CLEAR_LINE = '\x1b[K'
 DEFAULT_REMOTE_NAME = 'origin'
@@ -498,10 +498,6 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         log=log)
     initial_repo_sources = manifest.get_repo_sources(manifest.general_config.current_combo)
 
-    # Deinit any submodules that have been removed.
-    deinit_submodules(workspace_path, manifest, manifest.general_config.current_combo,
-                      manifest, submodule_combo, verbose)
-
     # Disable sparse checkout
     current_repos = initial_repo_sources
     sparse_enabled = sparse_checkout_enabled(workspace_path, initial_repo_sources)
@@ -524,6 +520,11 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         print(SPARSE_RESET)
         reset_sparse_checkout(workspace_path, current_repos)
 
+    # 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)
+
     print(CHECKING_OUT_COMBO.format(combo_or_sha))
 
     try:
-- 
2.27.0.windows.1


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

View/Reply Online (#61101): https://edk2.groups.io/g/devel/message/61101
Mute This Topic: https://groups.io/mt/74807390/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 v2 3/3] EdkRepo: Fix submodule failures when switching combos.
Posted by Ashley E Desimone 5 years, 7 months ago
Pushed as: 2392e3fa84883958822e056ae35f5b4afade5a80

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bjorge, Erik C
Sent: Wednesday, June 10, 2020 3:14 PM
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-devel] [edk2-staging/EdkRepo] [PATCH v2 3/3] EdkRepo: Fix submodule failures when switching combos.

When switching combinations or checking out pins the submodule information may change or have modifications that will cause errors.
Before changing to a new combination all submodules should be removed.

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 |  5 ++---  edkrepo/common/common_repo_functions.py  | 11 ++++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/edkrepo/commands/checkout_pin_command.py b/edkrepo/commands/checkout_pin_command.py
index 9d7346a..39c5aeb 100644
--- a/edkrepo/commands/checkout_pin_command.py
+++ b/edkrepo/commands/checkout_pin_command.py
@@ -22,7 +22,7 @@ from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list
 from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo from edkrepo.config.config_factory import get_workspace_path, get_workspace_manifest from edkrepo_manifest_parser.edk_manifest import ManifestXml-from project_utils.submodule import deinit_submodules, maintain_submodules+from project_utils.submodule import deinit_full, maintain_submodules   class CheckoutPinCommand(EdkrepoCommand):@@ -71,8 +71,7 @@ class CheckoutPinCommand(EdkrepoCommand):
             print(SPARSE_RESET)             reset_sparse_checkout(workspace_path, manifest_sources)         submodule_combo = pin.general_config.current_combo-        deinit_submodules(workspace_path, manifest, manifest.general_config.current_combo,-                          pin, submodule_combo, args.verbose)+        deinit_full(workspace_path, manifest, args.verbose)         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 8c79f3d..59c198f 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -68,7 +68,7 @@ from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestrep  from edkrepo_manifest_parser.edk_manifest_validation import get_manifest_validation_status from edkrepo_manifest_parser.edk_manifest_validation import print_manifest_errors from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestfiles-from project_utils.submodule import deinit_submodules, maintain_submodules+from project_utils.submodule import deinit_full, maintain_submodules  CLEAR_LINE = '\x1b[K' DEFAULT_REMOTE_NAME = 'origin'@@ -498,10 +498,6 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         log=log)     initial_repo_sources = manifest.get_repo_sources(manifest.general_config.current_combo) -    # Deinit any submodules that have been removed.-    deinit_submodules(workspace_path, manifest, manifest.general_config.current_combo,-                      manifest, submodule_combo, verbose)-     # Disable sparse checkout     current_repos = initial_repo_sources     sparse_enabled = sparse_checkout_enabled(workspace_path, initial_repo_sources)@@ -524,6 +520,11 @@ def checkout(combination_or_sha, verbose=False, override=False, log=None):
         print(SPARSE_RESET)         reset_sparse_checkout(workspace_path, current_repos) +    # 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)+     print(CHECKING_OUT_COMBO.format(combo_or_sha))      try:-- 
2.27.0.windows.1


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

View/Reply Online (#61101): https://edk2.groups.io/g/devel/message/61101
Mute This Topic: https://groups.io/mt/74807390/1860321
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [ashley.e.desimone@intel.com] -=-=-=-=-=-=


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

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