From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.61500.1598902082104036535 for ; Mon, 31 Aug 2020 12:28:02 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: yJ2TDiLGnAH4JVyz2ubC3g/2ZsBh1jvHK5qwnjfvd+nT/1p5xhS2BkRIiwOWAK5DDmGnzluQf6 bCoiuRJcKE1A== X-IronPort-AV: E=McAfee;i="6000,8403,9730"; a="158057154" X-IronPort-AV: E=Sophos;i="5.76,376,1592895600"; d="scan'208";a="158057154" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2020 12:28:00 -0700 IronPort-SDR: bU6ty9w7VQi2MHj2K4QX2aEeuKOsinnjHkTDeE8Az2/tAo1rLMWeHawfGhuNVXwBQOaiA+sYeu 9ZEHbQ33sfdQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,376,1592895600"; d="scan'208";a="501458992" Received: from nldesimo-desk1.amr.corp.intel.com ([10.209.78.110]) by fmsmga006.fm.intel.com with ESMTP; 31 Aug 2020 12:27:59 -0700 From: "Nate DeSimone" To: devel@edk2.groups.io Cc: Ashley E Desimone , Puja Pandya , Bret Barkelew , Prince Agyeman , Erik Bjorge Subject: [edk2-staging/EdkRepo] [PATCH V2 2/2] EdkRepo: Add support for subst drives Date: Mon, 31 Aug 2020 12:27:44 -0700 Message-Id: <20200831192744.1836-3-nathaniel.l.desimone@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20200831192744.1836-1-nathaniel.l.desimone@intel.com> References: <20200831192744.1836-1-nathaniel.l.desimone@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit get_workspace_path() now converts a virtual drive path to a real path before any git repo operations are done. Cc: Ashley E Desimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Cc: Erik Bjorge Signed-off-by: Nate DeSimone --- edkrepo/commands/clone_command.py | 6 ++++++ edkrepo/config/config_factory.py | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/edkrepo/commands/clone_command.py b/edkrepo/commands/clone_command.py index f638090..be5ad86 100644 --- a/edkrepo/commands/clone_command.py +++ b/edkrepo/commands/clone_command.py @@ -20,6 +20,7 @@ from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException, from edkrepo.common.edkrepo_exception import EdkrepoManifestNotFoundException from edkrepo.common.humble import CLONE_INVALID_WORKSPACE, CLONE_INVALID_PROJECT_ARG, CLONE_INVALID_COMBO_ARG from edkrepo.common.humble import SPARSE_CHECKOUT, CLONE_INVALID_LOCAL_ROOTS +from edkrepo.common.pathfix import get_subst_drive_dict from edkrepo.common.workspace_maintenance.workspace_maintenance import case_insensitive_single_match from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_all_manifest_repos, find_project_in_all_indices from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos @@ -77,6 +78,11 @@ class CloneCommand(EdkrepoCommand): workspace_dir = os.getcwd() else: workspace_dir = os.path.abspath(workspace_dir) + subst = get_subst_drive_dict() + for drive in subst.keys(): + if '{}:'.format(drive) == os.path.splitdrive(workspace_dir)[0].upper(): + workspace_dir = os.path.join(subst[drive], os.path.splitdrive(workspace_dir)[1][1:]) + workspace_dir = os.path.normpath(workspace_dir) if os.path.isdir(workspace_dir) and os.listdir(workspace_dir): raise EdkrepoInvalidParametersException(CLONE_INVALID_WORKSPACE) if not os.path.isdir(workspace_dir): diff --git a/edkrepo/config/config_factory.py b/edkrepo/config/config_factory.py index a82a438..1cb6eb7 100644 --- a/edkrepo/config/config_factory.py +++ b/edkrepo/config/config_factory.py @@ -11,13 +11,16 @@ import os import sys import configparser import collections -from ctypes import * +if sys.platform == "win32": + from ctypes import oledll, c_void_p, c_uint32, c_wchar_p + from ctypes import create_unicode_buffer import edkrepo.config.humble.config_factory_humble as humble from edkrepo.common.edkrepo_exception import EdkrepoGlobalConfigNotFoundException, EdkrepoConfigFileInvalidException from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceInvalidException, EdkrepoGlobalDataDirectoryNotFoundException from edkrepo.common.edkrepo_exception import EdkrepoConfigFileReadOnlyException from edkrepo.common.humble import MIRROR_PRIMARY_REPOS_MISSING, MIRROR_DECODE_WARNING, MAX_PATCH_SET_INVALID +from edkrepo.common.pathfix import get_subst_drive_dict from edkrepo_manifest_parser import edk_manifest from edkrepo.common.pathfix import expanduser @@ -238,6 +241,11 @@ def get_workspace_path(): while True: if os.path.isdir(os.path.join(path, "repo")): if os.path.isfile(os.path.join(os.path.join(path, "repo"), "Manifest.xml")): + if sys.platform == "win32": + subst = get_subst_drive_dict() + for drive in subst.keys(): + if '{}:'.format(drive) == os.path.splitdrive(path)[0].upper(): + path = os.path.join(subst[drive], os.path.splitdrive(path)[1][1:]) return path if os.path.dirname(path) == path: break -- 2.27.0.windows.1