From nobody Sun May 19 15:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58004+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58004+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1587683402; cv=none; d=zohomail.com; s=zohoarc; b=B4qNxIAwa+650yr4WDuNmEdH12qxbywP32EmcUryKGfpEC46diuRGwKusgejXkcaQ1iL/3q+Q8vHlyWRXd4BUAfjpSaTbnj+kw802eHcT7qcN7rc6zjZZd//r0HaXZh1QN0MoOIHmKS1qHVtoN7HeHtkqUVOvU3opxuESGAUBWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587683402; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=H9JJkdDEz+rn3eCDsqIQz9yIDiONUohv4nuvJUWjFXA=; b=bV9mSCGtxSHtCZSpAa7BXGBBD3c+FHPw2GUg1vVGKTEGKvHkno7unKUX4QUERSIZvj1xNA/BJ7avKGRYHeC/B8Nn0SD57c4YerzgG39I8itizPwtHxJVNjYvH+1bfXbePg9pvFGk/mPXYvulSCD8xEFy03NItSHE9sevfIJ6fSk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58004+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587683402916504.0951328957008; Thu, 23 Apr 2020 16:10:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 8DUtYY1788612xz5J384XLMP; Thu, 23 Apr 2020 16:10:02 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.2173.1587683402016859444 for ; Thu, 23 Apr 2020 16:10:02 -0700 IronPort-SDR: 3PB+j9GzP7oFqQ8K8hyoRQCpufu931FpS9pO4Yx3GvCOp4teaMVDuzOLbV9FNWyEBtM1U6kGb1 GIstTKf1WB8g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 16:10:00 -0700 IronPort-SDR: UmqBnV2X/QWTVz8bMTLBcgfwclsEgeCYUAQa85uC7dSbuhjGJ7kfij9jHB2UO/JNKxHo7Li5DH gf3DW/L8emcg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,309,1583222400"; d="scan'208";a="430533032" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga005.jf.intel.com with ESMTP; 23 Apr 2020 16:10:00 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH V5 1/3] EdkRepo: Initial commit of workspace_maintenance.py Date: Thu, 23 Apr 2020 16:09:55 -0700 Message-Id: <20200423230957.38936-2-ashley.e.desimone@intel.com> In-Reply-To: <20200423230957.38936-1-ashley.e.desimone@intel.com> References: <20200423230957.38936-1-ashley.e.desimone@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: allIQryMNLgVj6wqb1xCeon7x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587683402; bh=zLg43WmUU5fzVx8fShwXA3L5b2uyG4Jz2bpm/C3ia3w=; h=Cc:Date:From:Reply-To:Subject:To; b=kxq4E1ALP1cS3HBxPIu5NBOGbbkE9Y895HKmaU6VuZLzzE0koCBCFedqH4AscSGM3Pv DK4x6QqT8g7C2eQ2RLEPddNsoNi0lVycV9Axp21tRCi1u0/R1esdD5z1nep2kUk2rKI24 jDx45w8fVZcmQOiCwGTrwJlk95CDoGag2Yw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add workspace_maintenance.py including the implementation of generate_name_for_obsolete_backup() Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman Reviewed-by: Nate DeSimone --- .../workspace_maintenance/workspace_maintenance.py | 30 ++++++++++++++++++= ++++ setup.py | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 edkrepo/common/workspace_maintenance/workspace_maintena= nce.py diff --git a/edkrepo/common/workspace_maintenance/workspace_maintenance.py = b/edkrepo/common/workspace_maintenance/workspace_maintenance.py new file mode 100644 index 0000000..d45759a --- /dev/null +++ b/edkrepo/common/workspace_maintenance/workspace_maintenance.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# +## @file +# workspace_maintenance.py +# +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +''' Contains shared workspace maintenance functions. ''' + +import os + +def generate_name_for_obsolete_backup(absolute_path): + if not os.path.exists(absolute_path): + raise ValueError("{} does not exist".format(absolute_path)) + original_name =3D os.path.basename(absolute_path) + dir_name =3D os.path.dirname(absolute_path) + unique_name =3D "" + unique_name_found =3D False + index =3D 1 + while not unique_name_found: + if index =3D=3D 1: + unique_name =3D "{}_old".format(original_name) + else: + unique_name =3D "{}_old{}".format(original_name, index) + if not os.path.exists(os.path.join(dir_name, unique_name)): + unique_name_found =3D True + index +=3D 1 + return unique_name \ No newline at end of file diff --git a/setup.py b/setup.py index 06a382b..af173bb 100755 --- a/setup.py +++ b/setup.py @@ -12,8 +12,8 @@ setup(name=3D'edkrepo', version=3D'2.0.0', description=3D'The edkrepo tools', packages=3D['edkrepo', 'edkrepo.commands', 'edkrepo.commands.argumen= ts', 'edkrepo.commands.humble', - 'edkrepo.git_automation', 'edkrepo.common', 'edkrepo.confi= g', 'edkrepo.config.humble', - 'edkrepo_manifest_parser', 'project_utils'], + 'edkrepo.git_automation', 'edkrepo.common', 'edkrepo.commo= n.workspace_maintenance', + 'edkrepo.config', 'edkrepo.config.humble', 'edkrepo_manife= st_parser', 'project_utils'], package_data=3D{ }, include_package_data=3DTrue, --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58004): https://edk2.groups.io/g/devel/message/58004 Mute This Topic: https://groups.io/mt/73230132/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 15:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58003+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58003+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1587683402; cv=none; d=zohomail.com; s=zohoarc; b=YRFZLSa0F5PU/bLGmNtJPNqPhOeizKyLkmuPys0TSSsy3Ky+8JzJguu7qsftflZLih1y49L9heOKsqM5UXMb5WbUqHf1iKS5SOzCihmrN7VnC5f9o2jZjQ6OFxgzQgLAMWSNsocT6lTEha0X+ys+TMf1YZyZfNNNgjRl5nNAmE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587683402; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=nGiHInonORAHJiJDeEwLCToAkk/4fdR65q78KG5kD88=; b=caYd0TkMPxWTPkW1KVYzjnefLYm8WJXyZSv9hT6VeATPJj+21e9faCxbzWpKrO2f3bCvL3LtTvQDrIBkY7FPRBjPcIYAZ9MnAuvxrvetSTIUO5TqeoYu/Fjhp79HLkTlBSR+8v26p6WbdMFNvvOYyTHonqxDUUUrsbvLufvVSXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58003+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587683402895571.23018696898; Thu, 23 Apr 2020 16:10:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5OhxYY1788612x9mehjXXfkA; Thu, 23 Apr 2020 16:10:02 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.2171.1587683401614848289 for ; Thu, 23 Apr 2020 16:10:01 -0700 IronPort-SDR: YL8cdiXgrr3kHzhHC+SXJOJRC8eWQQfudXZouw7HV4H9YJk607iQdxUkwwiYfJphGEgTvIeSLw 4lK3iObIqvgg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 16:10:00 -0700 IronPort-SDR: /46BRh/oicaX2oxDmsK5M4THf1cqd7//ihvn15E8G+mZXMA0h10KaYX+nsKAHaWcxDP5dV0Azy NzbK1Vt49cbA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,309,1583222400"; d="scan'208";a="430533035" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga005.jf.intel.com with ESMTP; 23 Apr 2020 16:10:00 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH V5 2/3] EdkRepo: Add edkrepo/common/workspace_maintenance/manifest_repos_maintenance Date: Thu, 23 Apr 2020 16:09:56 -0700 Message-Id: <20200423230957.38936-3-ashley.e.desimone@intel.com> In-Reply-To: <20200423230957.38936-1-ashley.e.desimone@intel.com> References: <20200423230957.38936-1-ashley.e.desimone@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: ycRfqx4eFeMZLxLnEa4KkE2Ex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587683402; bh=mui+CzK7Wivp3J8Bn9eWdnkZa0oQhRjigOJrCBPVIMk=; h=Cc:Date:From:Reply-To:Subject:To; b=IKR2nn2fdOUCveqffPFb94AfshWwJ8Zp/FRfURBiEf01SHo9KtrjqiqspH9pg2Hf0mq PClTZMjaXUI2LwELiIxaDWzTeF5crsYqRaPh2uCSMHta56bfnzNhVlFQikM0aORhqc3p3 b9qT2XxUXmOkaZiBh19LIrqN3gmLEg95LTE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a directory to edkrepo/common to store workspace maintenance functionatlity. Add edkrepo/common/workspace_maintenance/humble directory to store related strings and included manifest_repos_maintenance_humble.py Add edkrepo/common/workspace_maintenance/manifest_repos_maitenance.py to support the mmaintenance of multiple manifest repositories. Added pull_single_manifest_repo() to manifest_repos_maintenance.py Updated setup.py to include the new directories. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman Reviewed-by: Nate DeSimone --- .../humble/manifest_repos_maintenance_humble.py | 23 +++++++++ .../manifest_repos_maintenance.py | 59 ++++++++++++++++++= ++++ setup.py | 3 +- 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 edkrepo/common/workspace_maintenance/humble/manifest_re= pos_maintenance_humble.py create mode 100644 edkrepo/common/workspace_maintenance/manifest_repos_mai= ntenance.py diff --git a/edkrepo/common/workspace_maintenance/humble/manifest_repos_mai= ntenance_humble.py b/edkrepo/common/workspace_maintenance/humble/manifest_r= epos_maintenance_humble.py new file mode 100644 index 0000000..440fd8a --- /dev/null +++ b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenanc= e_humble.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +## @file +# manifest_repos_maintenance_humble.py +# +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +''' Contains user facing strings for manifest_repos_mgmt.py ''' + +from colorama import Fore +from colorama import Style + +CLONE_SINGLE_MAN_REPO =3D 'Cloning global manifest repository to: {} from:= {}' +SYNC_SINGLE_MAN_REPO =3D 'Syncing the global manifest repository: {}' +SINGLE_MAN_REPO_DIRTY =3D ('Uncommited changes present in the global manif= est ' + 'repository: {} Resolve these changes and attempt= your' + ' operation again.') +SINGLE_MAN_REPO_NOT_CFG_BRANCH =3D ('The current active branch, {}, is not= the ' + 'specified branch for global manifst rep= ository: {}') +SINGLE_MAN_REPO_CHECKOUT_CFG_BRANCH =3D 'Checking out the specified branch= : {} prior to syncing' +SINGLE_MAN_REPO_MOVED =3D '{}{}WARNING:{}{} The global manifest repository= has moved. Backing up previous global manifest repository to: {{}}{}\n'.fo= rmat(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED, Style.RESET_ALL) diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenanc= e.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py new file mode 100644 index 0000000..6e26d4f --- /dev/null +++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# +## @file +# manifest_repos_maintenance.py +# +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +import os +import traceback +import shutil + +import git +from git import Repo + +import edkrepo.config.config_factory as cfg +from edkrepo.common.edkrepo_exception import EdkrepoUncommitedChangesExcep= tion +from edkrepo.common.progress_handler import GitProgressHandler +import edkrepo.common.workspace_maintenance.humble.manifest_repos_maintena= nce_humble as humble +from edkrepo.common.workspace_maintenance.workspace_maintenance import gen= erate_name_for_obsolete_backup + + +def pull_single_manifest_repo(url, branch, local_path, reset_hard=3DFalse): + ''' + Clones or syncs a single global manifest repository as defined in eith= er + the edkrepo.cfg or the edkrepo_user.cfg + ''' + # If a relative path is used join to the edkrepo global data directory= path + if not os.path.isabs(local_path): + local_path =3D os.path.join(cfg.get_edkrepo_global_data_directory(= ), local_path) + # Clone the repository if it does not exist locally + if not os.path.exists(local_path): + print(humble.CLONE_SINGLE_MAN_REPO.format(local_path, url)) + repo =3D Repo.clone_from(url, local_path, progress=3DGitProgressHa= ndler(), branch=3Dbranch) + # Sync the repository if it exists locally + else: + repo =3D Repo(local_path) + if url in repo.remotes['origin'].urls: + if repo.is_dirty(untracked_files=3DTrue) and not reset_hard: + raise EdkrepoUncommitedChangesException(humble.SINGLE_MAN_= REPO_DIRTY.format(local_path)) + elif repo.is_dirty(untracked_files=3DTrue) and reset_hard: + repo.git.reset('--hard') + print(humble.SYNC_SINGLE_MAN_REPO.format(local_path)) + if repo.active_branch.name !=3D branch: + print(humble.SINGLE_MAN_REPO_NOT_CFG_BRANCH.format(repo.ac= tive_branch.name, local_path)) + print(humble.SINGLE_MAN_REPO_CHECKOUT_CFG_BRANCH.format(br= anch)) + repo.git.checkout(branch) + repo.remotes.origin.pull() + # If the URL specified for this manifest repo has moved back up th= e existing + # local copy and clone the new repository + else: + new_path =3D generate_name_for_obsolete_backup(local_path) + new_path =3D os.path.join(os.path.dirname(local_path), new_pat= h) + print(humble.SINGLE_MAN_REPO_MOVED.format(new_path)) + shutil.move(local_path, new_path) + print (humble.CLONE_SINGLE_MAN_REPO.format(local_path, url)) + repo =3D Repo.clone_from(url, local_path, progress=3DGitProgre= ssHandler(), branch=3Dbranch) + diff --git a/setup.py b/setup.py index af173bb..5053b1a 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,8 @@ setup(name=3D'edkrepo', description=3D'The edkrepo tools', packages=3D['edkrepo', 'edkrepo.commands', 'edkrepo.commands.argumen= ts', 'edkrepo.commands.humble', 'edkrepo.git_automation', 'edkrepo.common', 'edkrepo.commo= n.workspace_maintenance', - 'edkrepo.config', 'edkrepo.config.humble', 'edkrepo_manife= st_parser', 'project_utils'], + 'edkrepo.common.workspace_maintenance.humble', 'edkrepo.co= nfig', 'edkrepo.config.humble', + 'edkrepo_manifest_parser', 'project_utils'], package_data=3D{ }, include_package_data=3DTrue, --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58003): https://edk2.groups.io/g/devel/message/58003 Mute This Topic: https://groups.io/mt/73230130/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 19 15:58:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58005+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58005+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1587683403; cv=none; d=zohomail.com; s=zohoarc; b=HEn7Hdv8GjpBNFecaf+y7tz9NtaZRtu60lXgKVS2QH2nA308muCq0LnpfESEVRLYOgYEeVSWE8COoQqtgACY6/mPquw4MOlYqk46OzANv2jDNfOJ2kKuFhE3Ea2OxpwY6OJVrPIfG2X2Frww83y16hIrbggp8o6JlUf3vBcWvS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587683403; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=da8Cd2zFFuqKUcNas+LbCXJvY5dzeVk6gCTkTqan8Hc=; b=Ur50KJDYhhbYhKLuS2AQDk3CtgGJuu+GtQtOa5TZLTU6QbWmo+Ed5kczIteKXF8cFhSfhSMfDugo+bdxDQng9N7HHyjya9XKMz3CLxSSfogp0tjtycv9Eqe7RTEn5NZ3FHTfSS11Dz6zwh13gO0kZ26a4STMx7mrbyUzGwkJfkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58005+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587683403056489.77198204261936; Thu, 23 Apr 2020 16:10:03 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ojh7YY1788612x0WvBms82Iq; Thu, 23 Apr 2020 16:10:02 -0700 X-Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web12.2171.1587683401614848289 for ; Thu, 23 Apr 2020 16:10:02 -0700 IronPort-SDR: f9Rdd727jhkIvpOCKUbFdlODee5XGEDxpgJgvQJf6fXrROBfTFM+forS36f2aiuY6sYCUffPJ9 vP03DTRaDHdg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 16:10:00 -0700 IronPort-SDR: xte+dSUNbGLOK9ztfCFcByMekChNpafqf324F5k7z6T/yEEMbV34tJ9NsWZ7hVmJJbj6iTQ919 btN4mwu5OgBA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,309,1583222400"; d="scan'208";a="430533038" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga005.jf.intel.com with ESMTP; 23 Apr 2020 16:10:00 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH V5 3/3] EdkRepo: Update pull_latest_manifest_repo to use pull_single_manifest_repo Date: Thu, 23 Apr 2020 16:09:57 -0700 Message-Id: <20200423230957.38936-4-ashley.e.desimone@intel.com> In-Reply-To: <20200423230957.38936-1-ashley.e.desimone@intel.com> References: <20200423230957.38936-1-ashley.e.desimone@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ashley.e.desimone@intel.com X-Gm-Message-State: F1Usv4xxAbhcLT1Nth6M1Mrax1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587683402; bh=ZFFVoEB2QlSH73OTuXcy4GW2DAekTRRQovUOdVyz8a8=; h=Cc:Date:From:Reply-To:Subject:To; b=ocqeYzYKSP4IxgEd7h9zl4YO9zsWRv7swRcEwYLcLpgA/QwiZJ/jD46PqfF+YbStxtr 9eDKRE/lJ9lC9jtdWysk4xpi2kvOq0ev/tI9HOBrHe8k1jAflsRmc0RBlXpaKrQv4J7im bbKgDoV32Wlceegp3pA2TBjXHdHvM2/kYDI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Updates the implementation for pull_latest_manifest_repo to call pull_single_manifest repo. Removes definitions of strings used by pull_latest_manifest_repo from common/humble.py and from the imports of common_repo_functions.py Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman Reviewed-by: Nate DeSimone --- edkrepo/common/common_repo_functions.py | 33 ++++-------------------------= ---- edkrepo/common/humble.py | 8 -------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/commo= n_repo_functions.py index 0d39291..2aa5f5f 100644 --- a/edkrepo/common/common_repo_functions.py +++ b/edkrepo/common/common_repo_functions.py @@ -46,12 +46,10 @@ from edkrepo.common.humble import COMMIT_TEMPLATE_NOT_F= OUND, COMMIT_TEMPLATE_CUS from edkrepo.common.humble import ADD_PRIMARY_REMOTE, REMOVE_PRIMARY_REMOTE from edkrepo.common.humble import FETCH_PRIMARY_REMOTE, MIRROR_PRIMARY_SHA= , TAG_AND_BRANCH_SPECIFIED from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO, HOOK_NOT_FOU= ND_ERROR, SUBMODULE_FAILURE -from edkrepo.common.humble import MANIFEST_REPO_DIRTY, MANIFEST_REPO_MOVED= , CLONING_MANIFEST_REPO, SYNCING_MANIFEST_REPO from edkrepo.common.humble import INCLUDED_URL_LINE, INCLUDED_INSTEAD_OF_L= INE, INCLUDED_FILE_NAME from edkrepo.common.humble import ERROR_WRITING_INCLUDE, MULTIPLE_SOURCE_A= TTRIBUTES_SPECIFIED from edkrepo.common.humble import VERIFY_GLOBAL, VERIFY_ARCHIVED, VERIFY_P= ROJ, VERIFY_PROJ_FAIL -from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_= FAIL, MANIFEST_REPO_NOT_CONFIG_BRANCH -from edkrepo.common.humble import MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH +from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_= FAIL 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 @@ -61,6 +59,7 @@ from edkrepo_manifest_parser.edk_manifest import CiIndexX= ml, ManifestXml from edkrepo.common.edkrepo_exception import EdkrepoNotFoundException, Edk= repoGitException, EdkrepoWarningException from edkrepo.common.edkrepo_exception import EdkrepoFoundMultipleException= , EdkrepoHookNotFoundException from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupExceptio= n, EdkrepoManifestInvalidException +from edkrepo.common.workspace_maintenance.manifest_repos_maintenance impor= t pull_single_manifest_repo from edkrepo.common.ui_functions import init_color_console from edkrepo_manifest_parser import edk_manifest from edkrepo_manifest_parser.edk_manifest_validation import validate_manif= estrepo @@ -77,32 +76,8 @@ def pull_latest_manifest_repo(args, config, reset_hard= =3DFalse): branch =3D config['cfg_file'].manifest_repo_branch local_path =3D config['cfg_file'].manifest_repo_local_path init_color_console(False) - if not (os.path.isabs(local_path)): - #since only a relative path was specified it must be joined to the= Edkrepo Application Data Directory - local_path =3D os.path.join(get_edkrepo_global_data_directory(), l= ocal_path) - if not os.path.exists(local_path): - print (CLONING_MANIFEST_REPO.format(local_path, repo_url)) - repo =3D Repo.clone_from(repo_url, local_path, progress=3DGitProgr= essHandler(), branch=3Dbranch) - else: - repo =3D Repo(local_path) - if repo_url in repo.remotes['origin'].urls: - if repo.is_dirty(untracked_files=3DTrue) and not reset_hard: - raise EdkrepoWarningException(MANIFEST_REPO_DIRTY) - elif repo.is_dirty(untracked_files=3DTrue) and reset_hard: - repo.git.reset('--hard') - print (SYNCING_MANIFEST_REPO) - if repo.active_branch.name !=3D branch: - print(MANIFEST_REPO_NOT_CONFIG_BRANCH.format(repo.active_b= ranch.name)) - print(MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH.format(branch)) - repo.git.checkout(branch) - repo.remotes.origin.pull() - else: - new_path =3D generate_name_for_obsolete_backup(local_path) - new_path =3D os.path.join(os.path.dirname(local_path), new_pat= h) - print(MANIFEST_REPO_MOVED.format(new_path)) - shutil.move(local_path, new_path) - print (CLONING_MANIFEST_REPO.format(local_path, repo_url)) - repo =3D Repo.clone_from(repo_url, local_path, progress=3DGitP= rogressHandler(), branch=3Dbranch) + pull_single_manifest_repo(repo_url, branch, local_path, reset_hard) + =20 def clone_repos(args, workspace_dir, repos_to_clone, project_client_side_h= ooks, config, skip_submodule, manifest): for repo_to_clone in repos_to_clone: diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py index 64b9519..8ca38bb 100644 --- a/edkrepo/common/humble.py +++ b/edkrepo/common/humble.py @@ -34,14 +34,6 @@ MULTIPLE_SOURCE_ATTRIBUTES_SPECIFIED =3D 'BRANCH or TAG = name present with COMMIT I TAG_AND_BRANCH_SPECIFIED =3D 'BRANCH AND TAG name present in combination f= ield for {} repo. Using TAG.\n' CHECKING_CONNECTION =3D 'Checking connection to remote url: {}\n' =20 -# Informational messages and warnings for pull_latest_manifest_repo() -MANIFEST_REPO_DIRTY =3D 'Uncommited changes present in the global manifest= repository. Run edkrepo update-manifest-repo --hard to revert these change= s and sync the global manifest repository.\n' -MANIFEST_REPO_MOVED =3D '{}{}WARNING:{}{} The Global manifest repository h= as moved. Backing up previous global manifest repository to: {{}}{}\n'.form= at(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED, Style.RESET_ALL) -CLONING_MANIFEST_REPO =3D 'Cloning global manifest repository to: {} from:= {}\n' -SYNCING_MANIFEST_REPO =3D 'Syncing the global manifest repository.\n' -MANIFEST_REPO_NOT_CONFIG_BRANCH =3D 'The current active branch, {}, is not= the specified manifest repository branch' -MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH =3D 'Checking out the specified manif= est repository branch, {}, prior to syncing' - #Error messages for sync_command.py SYNC_EXIT =3D 'Exiting without performing sync operations.' SYNC_UNCOMMITED_CHANGES =3D UNCOMMITED_CHANGES + SYNC_EXIT --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58005): https://edk2.groups.io/g/devel/message/58005 Mute This Topic: https://groups.io/mt/73230133/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-