From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.4313.1587594961996971331 for ; Wed, 22 Apr 2020 15:36:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=ym8tagef; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: prince.agyeman@intel.com) IronPort-SDR: ryYDo/1bpl5hY7vih45PScGzq2YEKzEZDL7Lfe+J9GQTwDRrz+TZrCA0dg5FJAppfwoYNq+CfP FcFcG0tKfTHA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2020 15:36:00 -0700 IronPort-SDR: flBI5GRka30HyIp/iZfHXwVKqrMSsfIPmFTpRD6SFdVhnnnPCCfCkw8GjsOZ542RwckS/p3KfP +QEoLzgOamCQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,304,1583222400"; d="scan'208";a="365819616" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 22 Apr 2020 15:36:00 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 Apr 2020 15:35:47 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 22 Apr 2020 15:35:46 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 22 Apr 2020 15:35:46 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.53) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 22 Apr 2020 15:35:43 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwB8/YFP+h4nxM9mMV65YNYw+bGnwsqn1okpGXr4DacjXLEqIhfI5odQ9KWqHpxngtHZhdQDmZ6mTtddwCYDSbUzIpwiCtSf+SDz1IIE65fhn8Nt9bfSRDpNlLkMWL1XICtUKiOYOIuazf1xmfXgDx/V3w6lIUVx3dtvFzYxQtWgSwKZQaSG83rqXCMvuoTrlYjS04w1ZgxNQ84RGoJr0vyddle3WkkV80wGbD7uywHZiD9HYeX61gHTbiShxxGvsFWSN5suZLSew8EKlo+yGncqEq6kWTTkpV5/7JMPqqY7g6I28jMnbPKwCRlu58H/+jyJHWa0kvVDC+Ve9cwjYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xQ/eqsxmaF0DJtw2aCRxUeZ1+ydeYzC/eRMJPZyTatk=; b=PkUbnebh9Qz4TJ2z5SPFgT4XA1ejP/sXgpXf3EqM5KVtpRiGvJDKpeVJLWPS8QTZEnwqsaMJC1U+3Muhgm/5PIgR0WOW/EiqAMGxVwYUSVTzNgOXz0+gWtbSWjSRp2+gMfuBUYwQMcEyx5h03S+mYjc+0kbfg2mFg3GDH0Ln8b2UthAvl/kFn6VrhQW58cjO/Y3nRwRdd9T55j5EGtor+GQpxn00uJQs0Qasgvh7/QW2aBHw1aNbDFurzxPaWIa02EG/RpdpZ9sW1V1NDsMNh/zPvCydTGvbI/ZeILy+ZDAzZKw8kd5Iq597JN+27vcbC6TIUogidyScA+1f4rdSJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xQ/eqsxmaF0DJtw2aCRxUeZ1+ydeYzC/eRMJPZyTatk=; b=ym8tagef1s0ld9GOiQDA9Yo20Am4At2JDpWBBdyzr7fAo9xm/YK3iWYtQIOKhFpskOdfSBCY79+Qcq9JSECPLmPcjgygWMdH8Xx6mNZR9ohTCjbPl2K1kboSqRWRyu5jjUh5hcF6+dRM6SLArRb6JeVHSnjEuJl/vKJ73vU49wA= Received: from DM6PR11MB3465.namprd11.prod.outlook.com (2603:10b6:5:b::18) by DM6PR11MB2745.namprd11.prod.outlook.com (2603:10b6:5:c7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Wed, 22 Apr 2020 22:35:42 +0000 Received: from DM6PR11MB3465.namprd11.prod.outlook.com ([fe80::5c8b:e97b:85a2:12bc]) by DM6PR11MB3465.namprd11.prod.outlook.com ([fe80::5c8b:e97b:85a2:12bc%7]) with mapi id 15.20.2937.012; Wed, 22 Apr 2020 22:35:42 +0000 From: "Agyeman, Prince" To: "Desimone, Ashley E" , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Pandya, Puja" , "Bjorge, Erik C" , "Bret Barkelew" Subject: Re: [edk2-staging/EdkRepo] [PATCH V2 2/3] EdkRepo: Add edkrepo/common/workspace_maitenance/manifest_repos_maitenance Thread-Topic: [edk2-staging/EdkRepo] [PATCH V2 2/3] EdkRepo: Add edkrepo/common/workspace_maitenance/manifest_repos_maitenance Thread-Index: AQHWGO4T7x/SNOmpw0yGgqcUGAIe2qiFuIgQ Date: Wed, 22 Apr 2020 22:35:41 +0000 Message-ID: References: <20200422213523.44888-1-ashley.e.desimone@intel.com> <20200422213523.44888-3-ashley.e.desimone@intel.com> In-Reply-To: <20200422213523.44888-3-ashley.e.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.2.0.6 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: spf=none (sender IP is ) smtp.mailfrom=prince.agyeman@intel.com; x-originating-ip: [134.134.136.202] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16ea4b1d-9273-44e7-3276-08d7e70d7d5f x-ms-traffictypediagnostic: DM6PR11MB2745: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2150; x-forefront-prvs: 03818C953D x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3465.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(136003)(39860400002)(346002)(366004)(376002)(396003)(52536014)(33656002)(9686003)(66556008)(66476007)(66946007)(478600001)(64756008)(5660300002)(76116006)(55016002)(66446008)(2906002)(186003)(4326008)(316002)(110136005)(6506007)(26005)(81156014)(7696005)(86362001)(8936002)(54906003)(53546011)(71200400001)(8676002);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NPT2EsBq3ENSv9p4w/RobSj/XIpA9jfX8tK9FOhLw/14BPNoZ2zJXXONorBbuCpVq6GyjOVDFXztSkzECK1YXlXOBvfC5wNdPRWndBJyZfZ5U+TNPZ/4fvexC+x88z7ECHwkz7wcKJTJNZ+Gq5WKJ06D0as44z1E0lGkUC2H3bV7WkrjBy7/4vUVvI+14WtD53zmXIM7rdCuBM5CFLbddKptw4cNM6+HhXT+S1L28YVD/gbaxVG65mhXmBZa6z++d5t3sWCocNxgcJrAUU9bywBwn3FmvM5UOzKmvIXRj5IknpxeX+ixvlEq/1xs2ElJBaPI/vIs2Xp6lSevbBKSaNj4j7n1FndqKOjntq93LDU3+NWln8AFhjJVxlNbmt/Z8Mv3RgzXCE/StxRYMA7Hve4vahAnnz+lmciV36R4lOXzKjTx77KgY1TpWMo7BWgk x-ms-exchange-antispam-messagedata: pcm8KjQhz7TKqyN12A3au92eaip0RwHbah5APz90SxtUKEkK2namSlr+xV2R8aFsr8pEHtOO0iLVVGBpYjGLMSPZ2jZOtwLC7YPv9UZRINtUzq/MJVGsgeegXsHsqtWbVHhgA+tcDwPI/ZMQaFryJw== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 16ea4b1d-9273-44e7-3276-08d7e70d7d5f X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Apr 2020 22:35:41.8187 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: QNqLoY43nfe5r5U83w5SsXru0FPqsRWbbH8LZFukX0yazWb4YZyPAB0lnNXZaAN3ocGVrCU7iE3imgYm0CisxsyGGU0a9ooa2G6QusWMRGQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2745 Return-Path: prince.agyeman@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Ashley, Comment below Prince -----Original Message----- From: Desimone, Ashley E =20 Sent: Wednesday, April 22, 2020 2:35 PM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Pandya, Puja ; Bjorge, Erik C ; Bret Barke= lew ; Agyeman, Prince Subject: [edk2-staging/EdkRepo] [PATCH V2 2/3] EdkRepo: Add edkrepo/common/= workspace_maitenance/manifest_repos_maitenance Add a directory to edkrepo/common to store workspace maitenance functionatl= ity. Add edkrepo/common/workspace_matenance/humble directory to store related st= rings and included manifest_repos_maitenance_humble.py Add edkrepo/common/workspace_maitenance/manifest_repos_maitenance.py to support the maitenance of multiple manifest repositories. Added pull_single_manifest_repo() to manifest_repos_maitenance.py Updated s= etup.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 --- .../humble/manifest_repos_maitenance_humble.py | 23 +++++++++ .../manifest_repos_maitenance.py | 59 ++++++++++++++++++= ++++ setup.py | 5 +- 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 edkr= epo/common/workspace_maitenance/humble/manifest_repos_maitenance_humble.py create mode 100644 edkrepo/common/workspace_maitenance/manifest_repos_mait= enance.py diff --git a/edkrepo/common/workspace_maitenance/humble/manifest_repos_mait= enance_humble.py b/edkrepo/common/workspace_maitenance/humble/manifest_repo= s_maitenance_humble.py new file mode 100644 index 0000000..ee7b4bb --- /dev/null +++ b/edkrepo/common/workspace_maitenance/humble/manifest_repos_maitenan +++ ce_humble.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +## @file +# manifest_repos_mgmt_humble.py +# +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
=20 +# 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.')=20 +SINGLE_MAN_REPO_NOT_CFG_BRANCH =3D ('The current active branch, {}, is not= the ' + 'specified branch for global manifst=20 +repository: {}') SINGLE_MAN_REPO_CHECKOUT_CFG_BRANCH =3D 'Checking out the= specified branch: {} prior to syncing' +SINGLE_MAN_REPO_MOVED =3D '{}{}WARNING:{}{} The global manifest=20 +repository has moved. Backing up previous global manifest repository=20 +to: {{}}{}\n'.format(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED,=20 +Style.RESET_ALL) \ No newline at end of file diff --git a/edkrepo/common/workspace_maitenance/manifest_repos_maitenance.= py b/edkrepo/common/workspace_maitenance/manifest_repos_maitenance.py new file mode 100644 index 0000000..8944492 --- /dev/null +++ b/edkrepo/common/workspace_maitenance/manifest_repos_maitenance.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +# +## @file +# manifest_repos_mgmt.py +# +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.
=20 +# 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=20 +edkrepo.common.edkrepo_exception import=20 +EdkrepoUncommitedChangesException from edkrepo.common.progress_handler=20 +import GitProgressHandler import=20 +edkrepo.common.workspace_maitenance.humble.manifest_repos_maitenance_hu +mble as humble from=20 +edkrepo.common.workspace_maitenance.workspace_maitenance import=20 +generate_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) Typo SINGLE_MANE_REPO_MOVED , should be SINGLE_MAN_REPO_MOVED + print(humble.SINGLE_MANE_REPO_MOVED.format(new_path)) + shutil.move(local_path, new_path) + print (humble.CLONE_SIGNLE_MAN_REPO.format(local_path, url)) + repo =3D Repo.clone_from(url, local_path,=20 +progress=3DGitProgressHandler(), branch=3Dbranch) + diff --git a/setup.py b/setup.py index 06a382b..f8bb0fc 100755 --- a/setup.py +++ b/setup.py @@ -12,8 +12,9 @@ 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_maitenance', + 'edkrepo.common.workspace_maitenance.humble', 'edkrepo.con= fig', 'edkrepo.config.humble', + 'edkrepo_manifest_parser', 'project_utils'], package_data=3D{ }, include_package_data=3DTrue, -- 2.16.2.windows.1