From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.25747.1595442416626890970 for ; Wed, 22 Jul 2020 11:26:56 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: erik.c.bjorge@intel.com) IronPort-SDR: OYb/QMxlmU6jxDSX/XUcOvPtGs8MJyf+Wq/FjXtV7R6d5yzaWBJhvMS3YtbtazSXEUBa0VsLtC 00mp8qLRxZkA== X-IronPort-AV: E=McAfee;i="6000,8403,9690"; a="235273390" X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="235273390" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2020 11:26:45 -0700 IronPort-SDR: yFkL7zMD46iO0SR8ZKjKQC8NB5j5vb1kxHVimii1zN/xtUIFWYqJtS6VzZzJP6bEXR9c7Mq6/r hYKCWLXBItXw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,383,1589266800"; d="scan'208";a="310730031" Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.251.144.204]) by fmsmga004.fm.intel.com with ESMTP; 22 Jul 2020 11:26:45 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Ashley E Desimone , Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH v1] EdkRepo: Continue checkout on submodule deinit errors Date: Wed, 22 Jul 2020 11:26:28 -0700 Message-Id: X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Cc: Erik Bjorge Signed-off-by: Erik Bjorge --- 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