From nobody Thu May 2 02:07:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+67320+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+67320+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1605133792; cv=none; d=zohomail.com; s=zohoarc; b=gueyYjZlbHXeWFXwCpO3qgaWyUiibi89GVvmJ8PuMN1ny6LPYvYBCwqHUtQeRUp/UtTJpc3R8Ygw3se+AK7zFo0GsmKI+X7O4Jvv7G1hh4HuOCKgWw62gZOTSQ/+XFjnUjqH2t5YufSYumLxhyw3RFX+XrAd0mt6F++MP6f4W+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605133792; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=sXL7maJkY8YLd0Py+yf2qL7hSBENoR6OBQE1nyOMlaI=; b=WtT0REbdzn9YdnsDqZYb3d9RxDDKms1OQ2PyPiZA+HygPaGLbehfAy7YHsCC0FAyrJoMjqjS0nXQsrOMoDcqKMLvVcmlntWSmatOIFSjOn7l0x0p/cusaf+Q4pn5rVuqGrDYWzrNu2nDqHjptNW0OxgvD5ck3APIvSiT2NQm7WM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+67320+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 160513379291071.34125695508408; Wed, 11 Nov 2020 14:29:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id RPJmYY1788612xmDALiR41vW; Wed, 11 Nov 2020 14:29:52 -0800 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web09.14536.1605133791958753580 for ; Wed, 11 Nov 2020 14:29:52 -0800 IronPort-SDR: b/vfI3ysf+BbwbdePt0sUFkshy9zvW+mNV+tgUbt3wqquHWqWGQZXlmeumy2E5C2Rkb6GMmDEJ JL0qwCo7XtHw== X-IronPort-AV: E=McAfee;i="6000,8403,9802"; a="231848724" X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="231848724" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:29:51 -0800 IronPort-SDR: htzygmiX/Vr0trTqr1gpYENPL23Yciw+wce8rZEGHyyHmyxboyYO0Yd559X43CEMj5povETKgI I23ROW4VJliQ== X-IronPort-AV: E=Sophos;i="5.77,470,1596524400"; d="scan'208";a="366396639" X-Received: from aedesimo-desk.amr.corp.intel.com ([10.212.245.21]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2020 14:29:51 -0800 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman , Erik Bjorge Subject: [edk2-devel] [edk2-staging/EdkRepo][PATCH] EdkRepo: Remove unused checkout sha functionality Date: Wed, 11 Nov 2020 14:29:39 -0800 Message-Id: <20201111222939.1433-1-ashley.e.desimone@intel.com> MIME-Version: 1.0 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: hP6Vaub1h3eC4p3reKKfyhnBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1605133792; bh=jmP2G2EXCW0R/uVcXbrWUlwW6y5wsJ0k6C+sHig9XbE=; h=Cc:Date:From:Reply-To:Subject:To; b=sglyK9f2VG3VOnw8mzWYNx5ITrKjRFo/wxidC2TBo9O6Hfjue5lvQCHYTVn8Ee7xlt6 ijDVYSOsgtWXkh2i3Q5Rv4o0O2JwukpwlfkzhLiBlu7yQUbbhf7bLwwINFvDnA4MQr4so JcnO4rPG66YsAVn2u/Qbp+WY95X/UXjVC2U= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The SHA parameter for the checkout command has been removed previously. This commit removes the calculations which supported this functionality and amends the checkout function to raise an EdkRepoInvalidParameters exception if a valid combo name is not passed in. Cc: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman Cc: Erik Bjorge Signed-off-by: Ashley E Desimone Reviewed-by: Nate DeSimone --- edkrepo/common/common_repo_functions.py | 78 ++++--------------------- 1 file changed, 12 insertions(+), 66 deletions(-) diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/commo= n_repo_functions.py index 0d54bbf..2277c1e 100644 --- a/edkrepo/common/common_repo_functions.py +++ b/edkrepo/common/common_repo_functions.py @@ -427,76 +427,22 @@ def combination_is_in_manifest(combination, manifest): return combination in combination_names =20 =20 -def get_target_sources(combination_or_sha, manifest, workspace_path, log= =3DNone): - if combination_is_in_manifest(combination_or_sha, manifest): - return manifest.get_repo_sources(combination_or_sha) - - current_combo =3D manifest.general_config.current_combo - # look for a pin file that is named combination_or_sha.xml - pin_filename =3D os.path.join( - workspace_path, - 'repo', - combination_or_sha+'.xml') - if os.path.exists(pin_filename): - return ManifestXml(pin_filename).get_repo_sources(current_combo) - - print ("Search repositories for '{}'".format(combination_or_sha)) - commit_map =3D { - x.root : None - for x in manifest.get_repo_sources(current_combo) - } - found =3D False - if not log: - log =3D sort_commits(manifest, workspace_path) - for commit in log: - root =3D os.path.basename(commit.repo.working_dir) - if combination_or_sha =3D=3D commit.hexsha: - found =3D True - commit_map[root] =3D commit.hexsha - continue - if not found: - continue - if not commit_map[root]: - commit_map[root] =3D commit.hexsha - if not found: - raise EdkrepoInvalidParametersException(CHECKOUT_INVALID_COMBO) - - # Create a new pin file - old_sources =3D manifest.get_repo_sources(current_combo) - new_sources =3D [] - for repo_source in old_sources: - new_sources.append( - repo_source._replace(commit=3Dcommit_map[repo_source.root])) - manifest.generate_pin_xml( - combination_or_sha, - current_combo, - new_sources, - filename=3Dpin_filename) - - return ManifestXml(pin_filename).get_repo_sources(current_combo) - - -def checkout(combination_or_sha, verbose=3DFalse, override=3DFalse, log=3D= None): +def checkout(combination, verbose=3DFalse, override=3DFalse, log=3DNone): workspace_path =3D get_workspace_path() manifest =3D get_workspace_manifest() =20 - # Create combo_or_sha so we have original input and do not introduce a= ny + # Create combo so we have original input and do not introduce any # unintended behavior by messing with parameters. - combo_or_sha =3D combination_or_sha + combo =3D combination submodule_combo =3D manifest.general_config.current_combo try: # Try to handle normalize combo name to match the manifest file. - combo_or_sha =3D case_insensitive_single_match(combo_or_sha, combi= nations_in_manifest(manifest)) - submodule_combo =3D combo_or_sha + combo =3D case_insensitive_single_match(combo, combinations_in_man= ifest(manifest)) + submodule_combo =3D combo except: - # No match so leave it alone. It must be a SHA1 or a bad combo na= me. - pass + raise EdkrepoInvalidParametersException(CHECKOUT_INVALID_COMBO) =20 - repo_sources =3D get_target_sources( - combo_or_sha, - manifest, - workspace_path, - log=3Dlog) + repo_sources =3D manifest.get_repo_sources(combo) initial_repo_sources =3D manifest.get_repo_sources(manifest.general_co= nfig.current_combo) =20 # Disable sparse checkout @@ -523,7 +469,7 @@ def checkout(combination_or_sha, verbose=3DFalse, overr= ide=3DFalse, log=3DNone): =20 # Deinit all submodules due to the potential for issues when switching # branches. - if combo_or_sha !=3D manifest.general_config.current_combo: + if combo !=3D manifest.general_config.current_combo: try: deinit_full(workspace_path, manifest, verbose) except Exception as e: @@ -531,19 +477,19 @@ def checkout(combination_or_sha, verbose=3DFalse, ove= rride=3DFalse, log=3DNone): if verbose: print(e) =20 - print(CHECKING_OUT_COMBO.format(combo_or_sha)) + print(CHECKING_OUT_COMBO.format(combo)) =20 try: checkout_repos(verbose, override, repo_sources, workspace_path, ma= nifest) current_repos =3D repo_sources # Update the current checkout combo in the manifest only if this # combination exists in the manifest - if combination_is_in_manifest(combo_or_sha, manifest): - manifest.write_current_combo(combo_or_sha) + if combination_is_in_manifest(combo, manifest): + manifest.write_current_combo(combo) except: if verbose: traceback.print_exc() - print (CHECKOUT_COMBO_UNSUCCESSFULL.format(combo_or_sha)) + print (CHECKOUT_COMBO_UNSUCCESSFULL.format(combo)) # Return to the initial combo, since there was an issue with cheki= ng out the selected combo checkout_repos(verbose, override, initial_repo_sources, workspace_= path, manifest) finally: --=20 2.26.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 (#67320): https://edk2.groups.io/g/devel/message/67320 Mute This Topic: https://groups.io/mt/78194709/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-