From: "Ashley E Desimone" <ashley.e.desimone@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
Puja Pandya <puja.pandya@intel.com>,
Erik Bjorge <erik.c.bjorge@intel.com>,
Bret Barkelew <Bret.Barkelew@microsoft.com>,
Prince Agyeman <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH 3/4] EdkRepo: Add support for multiple manifest repostories to command completions
Date: Sun, 10 May 2020 17:50:25 -0700 [thread overview]
Message-ID: <20200511005026.23532-4-ashley.e.desimone@intel.com> (raw)
In-Reply-To: <20200511005026.23532-1-ashley.e.desimone@intel.com>
Update the command completions for the checkout pin command to support
multiple manifest repositories. If a source manifest repository cannot
be found for the current workspace then no completions will be provided.
Signed-off-by: Ashley E Desimone <ashley.e.desimone@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
---
edkrepo/command_completion_edkrepo.py | 48 +++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/edkrepo/command_completion_edkrepo.py b/edkrepo/command_completion_edkrepo.py
index 1220924..8a2c0e6 100644
--- a/edkrepo/command_completion_edkrepo.py
+++ b/edkrepo/command_completion_edkrepo.py
@@ -15,6 +15,9 @@ import traceback
from edkrepo_manifest_parser.edk_manifest import ManifestXml
from edkrepo.common.common_repo_functions import combinations_in_manifest
+from edkrepo.common.edkrepo_exception import EdkrepoManifestNotFoundException
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
from edkrepo.config import config_factory
from edkrepo.config.config_factory import get_workspace_manifest
@@ -28,23 +31,36 @@ def current_combo(parsed_args, config):
def checkout_pin(parsed_args, config):
pins = []
- manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
manifest = get_workspace_manifest()
- pin_folder = os.path.normpath(os.path.join(manifest_directory, manifest.general_config.pin_path))
- for dirpath, _, filenames in os.walk(pin_folder):
- for file in filenames:
- pin_file = os.path.join(dirpath, file)
- # Capture error output from manifest parser stdout so it is hidden unless verbose is enabled
- stdout = sys.stdout
- sys.stdout = io.StringIO()
- pin = ManifestXml(pin_file)
- parse_output = sys.stdout.getvalue()
- sys.stdout = stdout
- if parsed_args.verbose and parse_output.strip() != '':
- print('Pin {} Parsing Errors: {}\n'.format(file, parse_output.strip()))
- if pin.project_info.codename == manifest.project_info.codename:
- pins.append(file)
- print(' '.join(pins))
+ manifest_directory = None
+ try:
+ source_manifest_repo = find_source_manifest_repo(manifest, config['cfg_file'], config['user_cfg_file'], )
+ if source_manifest_repo:
+ cfg, user_cfg, conflicts = list_available_manifest_repos(config['cfg_file'], config['user_cfgFile'])
+ if source_manifest_repo in cfg:
+ manifest_directory = config['cfg_file'].manifest_repo_abs_path(source_manifest_repo)
+ elif source_manifest_repo in user_cfg:
+ manifest_directory = config['user_cfg_file'].manifest_repo_abs_path(source_manifest_repo)
+ else:
+ manifest_directory = None
+ except EdkrepoManifestNotFoundException:
+ manifest_directory = None
+ if manifest_directory:
+ pin_folder = os.path.normpath(os.path.join(manifest_directory, manifest.general_config.pin_path))
+ for dirpath, _, filenames in os.walk(pin_folder):
+ for file in filenames:
+ pin_file = os.path.join(dirpath, file)
+ # Capture error output from manifest parser stdout so it is hidden unless verbose is enabled
+ stdout = sys.stdout
+ sys.stdout = io.StringIO()
+ pin = ManifestXml(pin_file)
+ parse_output = sys.stdout.getvalue()
+ sys.stdout = stdout
+ if parsed_args.verbose and parse_output.strip() != '':
+ print('Pin {} Parsing Errors: {}\n'.format(file, parse_output.strip()))
+ if pin.project_info.codename == manifest.project_info.codename:
+ pins.append(file)
+ print(' '.join(pins))
# To add command completions for a new command, add an entry to this dictionary.
command_completions = {
--
2.16.2.windows.1
next prev parent reply other threads:[~2020-05-11 0:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 0:50 [edk2-staging/EdkRepo] [PATCH 0/4] EdkRepo: Finalize multiple manifest repository support Ashley E Desimone
2020-05-11 0:50 ` [edk2-stagin/EdkRepo] [PATCH 1/4] EdkRepo: Update sync to support multiple manifest repositories Ashley E Desimone
2020-05-11 0:50 ` [edk2-staing/EdkRepo] [PATCH 2/4] EdkRepo: Remove unused functions from common_repo_functions.py Ashley E Desimone
2020-05-11 0:50 ` Ashley E Desimone [this message]
2020-05-11 0:50 ` [edk2-staging/EdkRepo] [PATCH 4/4] EdkRepo: Remove support for deprecated Manifest-Repo content in edkrepo.cfg Ashley E Desimone
2020-05-11 6:10 ` [edk2-devel] [edk2-staging/EdkRepo] [PATCH 0/4] EdkRepo: Finalize multiple manifest repository support Nate DeSimone
2020-05-11 6:33 ` Nate DeSimone
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=20200511005026.23532-4-ashley.e.desimone@intel.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