From nobody Mon Feb 9 08:28:15 2026 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+57999+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+57999+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1587668979; cv=none; d=zohomail.com; s=zohoarc; b=GlZRxZ4Xc/0iDwmn+R6xy6l6ixPhfybX/XWzdDqsvT0tPB02Hs9X8tcpNFUOCPVirG5B+NoGsACDPSYWx6DDHoAkjgliDuDYFQw6ckC8OkCYCQG+Ihh4qGJa+Rhe3eErYFQ9XDXVScDUgErv9hM2g//BC/aOaxEXdIA2GMLrdn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587668979; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=mRjPtr7hJv19giGUhq/6UiAf1NazQWjZUJZUbYAbMYE=; b=hKfsPVDFB8YCDNFFz5/FmoGy+yV3uABwT08SZfDyFyZBmLH4qECHPCKHNmMS94UPOXahBa7hgzIqU2Ee8iIdX/h9Bnavn2k9Qm/DJ5l5eKhlJ3liJouOi+FpSI7XC38KYxxk776UGTD5EcQV7h3N6LTHBOa7XKvOaFM/+mm3IPs= 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+57999+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 1587668979163264.7222234873133; Thu, 23 Apr 2020 12:09:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id QrxRYY1788612xIEPOa0iP4s; Thu, 23 Apr 2020 12:09:38 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.1692.1587668978278145002 for ; Thu, 23 Apr 2020 12:09:38 -0700 IronPort-SDR: vFrcrN+HNQJc4o+DQ+ELzA7OIWq/dUNmRvScDbiifk+LLh7pJL65pMmpzpjTlXY/5Z4QyXkSaT wiUplXLxX+wA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 12:09:36 -0700 IronPort-SDR: grMxvv3AiTra3tTJ0cwcUTOwGsG2vZgAMYoLTVxkOv2qKcj5OT2djjfNHF0jbRi3QDXDgoHxCg qSVRp2wPgN7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,307,1583222400"; d="scan'208";a="403019345" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.7.159.171]) by orsmga004.jf.intel.com with ESMTP; 23 Apr 2020 12:09:36 -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 V4 2/3] EdkRepo: Add edkrepo/common/workspace_maintenance/manifest_repos_maintenance Date: Thu, 23 Apr 2020 12:09:32 -0700 Message-Id: <20200423190933.43108-3-ashley.e.desimone@intel.com> In-Reply-To: <20200423190933.43108-1-ashley.e.desimone@intel.com> References: <20200423190933.43108-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: RrzFLjMvrdb2EIPj9s7jB7Pqx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587668978; bh=i7ZmlOEZQgqZJ82Nr/zownTsBowvhgH3q+peCXH/9fE=; h=Cc:Date:From:Reply-To:Subject:To; b=ZePLDrrTQ3b0qqkJBsW3xjgvSbCROw0LqJ+BEPgp/ddy0lywbagp5zQr/Cf2ZufrP8b pG2Dw0AYunstbpph73M/QiFA4GfT2yjwxzqwb63XUAfNY++KCGbvBQ3mPLY+q6JMCOmQ1 rEcDFC8NeH67kf3Kr/tPDAkKWZ8b1y54XFw= 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 --- .../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 (#57999): https://edk2.groups.io/g/devel/message/57999 Mute This Topic: https://groups.io/mt/73225537/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-