public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Desimone, Ashley E" <ashley.e.desimone@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Pandya, Puja" <puja.pandya@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	"Agyeman, Prince" <prince.agyeman@intel.com>,
	"Bjorge, Erik C" <erik.c.bjorge@intel.com>
Subject: Re: [edk2-staging/EdkRepo][PATCH] EdkRepo: Remove unused checkout sha functionality
Date: Sun, 15 Nov 2020 02:56:43 +0000	[thread overview]
Message-ID: <MWHPR1101MB216072BD7B6FBD52BF8A043FCDE40@MWHPR1101MB2160.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201111222939.1433-1-ashley.e.desimone@intel.com>

Pushed: https://github.com/tianocore/edk2-staging/commit/0777b85

> -----Original Message-----
> From: Ashley E Desimone <ashley.e.desimone@intel.com>
> Sent: Wednesday, November 11, 2020 2:30 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>;
> Agyeman, Prince <prince.agyeman@intel.com>; Bjorge, Erik C
> <erik.c.bjorge@intel.com>
> Subject: [edk2-staging/EdkRepo][PATCH] EdkRepo: Remove unused
> checkout sha functionality
> 
> 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 <ashley.e.desimone@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Puja Pandya <puja.pandya@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Cc: Prince Agyeman <prince.agyeman@intel.com>
> Cc: Erik Bjorge <erik.c.bjorge@intel.com>
> Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
> ---
>  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/common_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
> 
> 
> -def get_target_sources(combination_or_sha, manifest, workspace_path,
> log=None):
> -    if combination_is_in_manifest(combination_or_sha, manifest):
> -        return manifest.get_repo_sources(combination_or_sha)
> -
> -    current_combo = manifest.general_config.current_combo
> -    # look for a pin file that is named combination_or_sha.xml
> -    pin_filename = 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 = {
> -        x.root : None
> -        for x in manifest.get_repo_sources(current_combo)
> -    }
> -    found = False
> -    if not log:
> -        log = sort_commits(manifest, workspace_path)
> -    for commit in log:
> -        root = os.path.basename(commit.repo.working_dir)
> -        if combination_or_sha == commit.hexsha:
> -            found = True
> -            commit_map[root] = commit.hexsha
> -            continue
> -        if not found:
> -            continue
> -        if not commit_map[root]:
> -            commit_map[root] = commit.hexsha
> -    if not found:
> -        raise
> EdkrepoInvalidParametersException(CHECKOUT_INVALID_COMBO)
> -
> -    # Create a new pin file
> -    old_sources = manifest.get_repo_sources(current_combo)
> -    new_sources = []
> -    for repo_source in old_sources:
> -        new_sources.append(
> -            repo_source._replace(commit=commit_map[repo_source.root]))
> -    manifest.generate_pin_xml(
> -        combination_or_sha,
> -        current_combo,
> -        new_sources,
> -        filename=pin_filename)
> -
> -    return ManifestXml(pin_filename).get_repo_sources(current_combo)
> -
> -
> -def checkout(combination_or_sha, verbose=False, override=False,
> log=None):
> +def checkout(combination, verbose=False, override=False, log=None):
>      workspace_path = get_workspace_path()
>      manifest = get_workspace_manifest()
> 
> -    # Create combo_or_sha so we have original input and do not introduce
> any
> +    # Create combo so we have original input and do not introduce any
>      # unintended behavior by messing with parameters.
> -    combo_or_sha = combination_or_sha
> +    combo = combination
>      submodule_combo = manifest.general_config.current_combo
>      try:
>          # Try to handle normalize combo name to match the manifest file.
> -        combo_or_sha = case_insensitive_single_match(combo_or_sha,
> combinations_in_manifest(manifest))
> -        submodule_combo = combo_or_sha
> +        combo = case_insensitive_single_match(combo,
> combinations_in_manifest(manifest))
> +        submodule_combo = combo
>      except:
> -        # No match so leave it alone.  It must be a SHA1 or a bad combo name.
> -        pass
> +        raise
> EdkrepoInvalidParametersException(CHECKOUT_INVALID_COMBO)
> 
> -    repo_sources = get_target_sources(
> -        combo_or_sha,
> -        manifest,
> -        workspace_path,
> -        log=log)
> +    repo_sources = manifest.get_repo_sources(combo)
>      initial_repo_sources =
> manifest.get_repo_sources(manifest.general_config.current_combo)
> 
>      # Disable sparse checkout
> @@ -523,7 +469,7 @@ def checkout(combination_or_sha, verbose=False,
> override=False, log=None):
> 
>      # Deinit all submodules due to the potential for issues when switching
>      # branches.
> -    if combo_or_sha != manifest.general_config.current_combo:
> +    if combo != 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=False,
> override=False, log=None):
>              if verbose:
>                  print(e)
> 
> -    print(CHECKING_OUT_COMBO.format(combo_or_sha))
> +    print(CHECKING_OUT_COMBO.format(combo))
> 
>      try:
>          checkout_repos(verbose, override, repo_sources, workspace_path,
> manifest)
>          current_repos = 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 cheking out
> the selected combo
>          checkout_repos(verbose, override, initial_repo_sources,
> workspace_path, manifest)
>      finally:
> --
> 2.26.2.windows.1


      parent reply	other threads:[~2020-11-15  2:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 22:29 [edk2-staging/EdkRepo][PATCH] EdkRepo: Remove unused checkout sha functionality Ashley E Desimone
2020-11-15  2:54 ` Nate DeSimone
2020-11-15  2:56 ` Nate DeSimone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MWHPR1101MB216072BD7B6FBD52BF8A043FCDE40@MWHPR1101MB2160.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox