* [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command
@ 2020-05-06 22:22 Ashley E Desimone
2020-05-06 22:22 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories Ashley E Desimone
2020-05-10 1:24 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Nate DeSimone
0 siblings, 2 replies; 4+ messages in thread
From: Ashley E Desimone @ 2020-05-06 22:22 UTC (permalink / raw)
To: devel
Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
Prince Agyeman
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/commands/manifest_command.py | 79 +++++++++++++++++++++++-------------
1 file changed, 50 insertions(+), 29 deletions(-)
diff --git a/edkrepo/commands/manifest_command.py b/edkrepo/commands/manifest_command.py
index 44218c9..9e7d204 100644
--- a/edkrepo/commands/manifest_command.py
+++ b/edkrepo/commands/manifest_command.py
@@ -3,7 +3,7 @@
## @file
# manifest_command.py
#
-# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -18,6 +18,9 @@ import edkrepo.commands.arguments.manifest_args as arguments
from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceInvalidException
from edkrepo.common.common_repo_functions import pull_latest_manifest_repo, verify_manifest_data
from edkrepo.common.ui_functions import init_color_console
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import list_available_manifest_repos
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_all_manifest_repos
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_source_manifest_repo
from edkrepo.config.config_factory import get_workspace_manifest
from edkrepo_manifest_parser.edk_manifest import CiIndexXml
@@ -44,46 +47,64 @@ class ManifestCommand(EdkrepoCommand):
print()
init_color_console(args.color)
- # Get path to global manifest file
- global_manifest_directory = config['cfg_file'].manifest_repo_abs_local_path
- if args.verbose:
- print("Manifest directory:")
- print(global_manifest_directory)
- print()
- index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+ cfg_file = config['cfg_file']
+ user_cfg = config['user_cfg_file']
+ cfg_man_repos, user_cfg_man_repos, conflicts = list_available_manifest_repos(cfg_file, user_cfg)
+ man_repos = {}
- pull_latest_manifest_repo(args, config)
- print()
+ pull_all_manifest_repos(cfg_file, user_cfg, False)
- ci_index_xml = CiIndexXml(index_path)
+ # Get paths to the global manifest dirs and their index files
+ for repo in cfg_man_repos:
+ global_manifest_directory = cfg_file.manifest_repo_abs_path(repo)
+ index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+ man_repos[repo] = (global_manifest_directory, index_path)
+ for repo in user_cfg_man_repos:
+ global_manifest_directory = user_cfg.manifest_repo_abs_path(repo)
+ index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
+ man_repos[repo] = (global_manifest_directory, index_path)
try:
- current_project = get_workspace_manifest().project_info.codename
+ wkspc_manifest = get_workspace_manifest()
+ current_project = wkspc_manifest.project_info.codename
+ src_man_repo = find_source_manifest_repo(wkspc_manifest, cfg_file, user_cfg, None)
except EdkrepoWorkspaceInvalidException:
current_project = None
+ src_man_repo = None
- # Attempt to make sure the manifest data is good
- try:
- verify_manifest_data(global_manifest_directory, config, verbose=args.verbose, verify_all=True, verify_archived=args.archived)
- except:
+ for repo in man_repos.keys():
print()
-
- print("Projects:")
- for project in ci_index_xml.project_list:
- if project == current_project:
- print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
- else:
- print(" {}".format(project))
+ print("Manifest directory:")
+ print(repo)
if args.verbose:
- print(" -> {}".format(ci_index_xml.get_project_xml(project)))
-
- if args.archived:
+ print('Manifest directory path:')
+ print(man_repos[repo][0])
print()
- print("Archived Projects:")
- for project in ci_index_xml.archived_project_list:
- if project == current_project:
+
+ ci_index_xml = CiIndexXml(man_repos[repo][1])
+
+ # Attempt to make sure the manifest data is good
+ try:
+ verify_manifest_data(global_manifest_directory, config, verbose=args.verbose, verify_all=True, verify_archived=args.archived)
+ except:
+ print()
+
+ print("Projects:")
+ for project in ci_index_xml.project_list:
+ if (project == current_project and src_man_repo == repo) or (not src_man_repo and project == current_project):
print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
else:
print(" {}".format(project))
if args.verbose:
print(" -> {}".format(ci_index_xml.get_project_xml(project)))
+
+ if args.archived:
+ print()
+ print("Archived Projects:")
+ for project in ci_index_xml.archived_project_list:
+ if project == current_project:
+ print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
+ else:
+ print(" {}".format(project))
+ if args.verbose:
+ print(" -> {}".format(ci_index_xml.get_project_xml(project)))
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories
2020-05-06 22:22 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
@ 2020-05-06 22:22 ` Ashley E Desimone
2020-05-10 1:39 ` Nate DeSimone
2020-05-10 1:24 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Nate DeSimone
1 sibling, 1 reply; 4+ messages in thread
From: Ashley E Desimone @ 2020-05-06 22:22 UTC (permalink / raw)
To: devel
Cc: Nate DeSimone, Puja Pandya, Erik Bjorge, Bret Barkelew,
Prince Agyeman
Update the create pin command to select and interact with only
the workspaces source manifest repository.
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/commands/create_pin_command.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/edkrepo/commands/create_pin_command.py b/edkrepo/commands/create_pin_command.py
index f8618e5..5b77649 100644
--- a/edkrepo/commands/create_pin_command.py
+++ b/edkrepo/commands/create_pin_command.py
@@ -12,14 +12,16 @@ from collections import namedtuple
from git import Repo
-from edkrepo.commands.edkrepo_command import EdkrepoCommand
+from edkrepo.commands.edkrepo_command import EdkrepoCommand, SourceManifestRepoArgument
import edkrepo.commands.arguments.create_pin_args as arguments
-from edkrepo.common.common_repo_functions import pull_latest_manifest_repo
from edkrepo.common.edkrepo_exception import EdkrepoManifestInvalidException, EdkrepoInvalidParametersException
from edkrepo.common.edkrepo_exception import EdkrepoWorkspaceCorruptException
from edkrepo.common.humble import WRITING_PIN_FILE, GENERATING_PIN_DATA, GENERATING_REPO_DATA, BRANCH, COMMIT
from edkrepo.common.humble import COMMIT_MESSAGE, PIN_PATH_NOT_PRESENT, PIN_FILE_ALREADY_EXISTS, PATH_AND_FILEPATH_USED
from edkrepo.common.humble import MISSING_REPO
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import find_project_in_all_indices
+from edkrepo.common.workspace_maintenance.manifest_repos_maintenance import pull_workspace_manifest_repo
+from edkrepo.common.workspace_maintenance.humble.manifest_repos_maintenance_humble import PROJ_NOT_IN_REPO, SOURCE_MANIFEST_REPO_NOT_FOUND
from edkrepo.config.config_factory import get_workspace_manifest, get_workspace_path
from edkrepo_manifest_parser.edk_manifest import ManifestXml
@@ -49,6 +51,7 @@ class CreatePinCommand(EdkrepoCommand):
'positional': False,
'required': False,
'help-text': arguments.PUSH_HELP})
+ args.append(SourceManifestRepoArgument)
return metadata
def run_command(self, args, config):
@@ -56,14 +59,25 @@ class CreatePinCommand(EdkrepoCommand):
if args.push and os.path.dirname(args.PinFileName):
raise EdkrepoInvalidParametersException(PATH_AND_FILEPATH_USED)
- pull_latest_manifest_repo(args, config)
workspace_path = get_workspace_path()
manifest = get_workspace_manifest()
+ manifest_repo, cfg, manifest_repo_path = find_project_in_all_indices(manifest.project_info.codename,
+ config['cfg_file'],
+ config['user_cfg_file'],
+ PROJ_NOT_IN_REPO.format(manifest.project_info.codename),
+ SOURCE_MANIFEST_REPO_NOT_FOUND.format(manifest.project_info.codename),
+ args.source_manifest_repo)
+ pull_workspace_manifest_repo(manifest, config['cfg_file'], config['user_cfg_file'], args.source_manifest_repo, False)
+
+ if 'user' not in cfg:
+ manifest_repo_path = config['cfg_file'].manifest_repo_abs_path(manifest_repo)
+ else:
+ manifest_repo_path = config['user_cfg_file'].manifest_repo_abs_path(manifest_repo)
# If the push flag is enabled use general_config.pin_path to determine global manifest relative location to save
# pin file to.
if args.push and manifest.general_config.pin_path is not None:
- pin_dir = os.path.join(config['cfg_file'].manifest_repo_abs_local_path, os.path.normpath(manifest.general_config.pin_path))
+ pin_dir = os.path.join(manifest_repo_path, os.path.normpath(manifest.general_config.pin_path))
pin_file_name = os.path.join(pin_dir, args.PinFileName)
elif args.push and manifest.general_config.pin_path is None:
raise EdkrepoManifestInvalidException(PIN_PATH_NOT_PRESENT)
@@ -104,7 +118,7 @@ class CreatePinCommand(EdkrepoCommand):
# commit and push the pin file
if args.push:
- manifest_repo = Repo(config['cfg_file'].manifest_repo_abs_local_path)
+ manifest_repo = Repo(manifest_repo_path)
# Create a local branch with the same name as the pin file arg and check it out before attempting the push
# to master
master_branch = manifest_repo.active_branch
@@ -124,4 +138,4 @@ class CreatePinCommand(EdkrepoCommand):
manifest_repo.git.push('origin', 'HEAD:master')
finally:
manifest_repo.heads[master_branch.name].checkout()
- manifest_repo.delete_head(local_branch, '-D')
\ No newline at end of file
+ manifest_repo.delete_head(local_branch, '-D')
--
2.16.2.windows.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command
2020-05-06 22:22 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
2020-05-06 22:22 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories Ashley E Desimone
@ 2020-05-10 1:24 ` Nate DeSimone
1 sibling, 0 replies; 4+ messages in thread
From: Nate DeSimone @ 2020-05-10 1:24 UTC (permalink / raw)
To: Desimone, Ashley E, devel@edk2.groups.io
Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince
Hi Ashley,
Feedback inline below.
Thanks,
Nate
> -----Original Message-----
> From: Desimone, Ashley E <ashley.e.desimone@intel.com>
> Sent: Wednesday, May 6, 2020 3:23 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret
> Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince
> <prince.agyeman@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple
> manifest repository support in the manifest command
>
> 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/commands/manifest_command.py | 79
> +++++++++++++++++++++++-------------
> 1 file changed, 50 insertions(+), 29 deletions(-)
>
> diff --git a/edkrepo/commands/manifest_command.py
> b/edkrepo/commands/manifest_command.py
> index 44218c9..9e7d204 100644
> --- a/edkrepo/commands/manifest_command.py
> +++ b/edkrepo/commands/manifest_command.py
> @@ -3,7 +3,7 @@
> ## @file
> # manifest_command.py
> #
> -# Copyright (c) 2017- 2019, Intel Corporation. All rights reserved.<BR>
> +# Copyright (c) 2017- 2020, Intel Corporation. All rights reserved.<BR>
> # SPDX-License-Identifier: BSD-2-Clause-Patent #
>
> @@ -18,6 +18,9 @@ import edkrepo.commands.arguments.manifest_args
> as arguments from edkrepo.common.edkrepo_exception import
> EdkrepoWorkspaceInvalidException from
> edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo, verify_manifest_data from
> edkrepo.common.ui_functions import init_color_console
> +from
> edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> +import list_available_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +pull_all_manifest_repos from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +find_source_manifest_repo
> from edkrepo.config.config_factory import get_workspace_manifest from
> edkrepo_manifest_parser.edk_manifest import CiIndexXml
>
> @@ -44,46 +47,64 @@ class ManifestCommand(EdkrepoCommand):
> print()
> init_color_console(args.color)
>
> - # Get path to global manifest file
> - global_manifest_directory =
> config['cfg_file'].manifest_repo_abs_local_path
> - if args.verbose:
> - print("Manifest directory:")
> - print(global_manifest_directory)
> - print()
> - index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> + cfg_file = config['cfg_file']
> + user_cfg = config['user_cfg_file']
> + cfg_man_repos, user_cfg_man_repos, conflicts =
> list_available_manifest_repos(cfg_file, user_cfg)
> + man_repos = {}
>
> - pull_latest_manifest_repo(args, config)
> - print()
> + pull_all_manifest_repos(cfg_file, user_cfg, False)
>
> - ci_index_xml = CiIndexXml(index_path)
> + # Get paths to the global manifest dirs and their index files
> + for repo in cfg_man_repos:
> + global_manifest_directory = cfg_file.manifest_repo_abs_path(repo)
> + index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> + man_repos[repo] = (global_manifest_directory, index_path)
> + for repo in user_cfg_man_repos:
> + global_manifest_directory =
> user_cfg.manifest_repo_abs_path(repo)
> + index_path = os.path.join(global_manifest_directory, 'CiIndex.xml')
> + man_repos[repo] = (global_manifest_directory, index_path)
>
> try:
> - current_project = get_workspace_manifest().project_info.codename
> + wkspc_manifest = get_workspace_manifest()
> + current_project = wkspc_manifest.project_info.codename
> + src_man_repo = find_source_manifest_repo(wkspc_manifest,
> + cfg_file, user_cfg, None)
With the new find_source_manifest_repo() function, we now need to catch both EdkrepoWorkspaceInvalidException AND EdkrepoManifestNotFoundException just in case this is a "loose manifest".
Please add the following:
except EdkrepoManifestNotFoundException:
src_man_repo = None
> except EdkrepoWorkspaceInvalidException:
> current_project = None
> + src_man_repo = None
>
> - # Attempt to make sure the manifest data is good
> - try:
> - verify_manifest_data(global_manifest_directory, config,
> verbose=args.verbose, verify_all=True, verify_archived=args.archived)
> - except:
> + for repo in man_repos.keys():
> print()
> -
> - print("Projects:")
> - for project in ci_index_xml.project_list:
> - if project == current_project:
> - print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> - else:
> - print(" {}".format(project))
> + print("Manifest directory:")
> + print(repo)
> if args.verbose:
> - print(" -> {}".format(ci_index_xml.get_project_xml(project)))
> -
> - if args.archived:
> + print('Manifest directory path:')
> + print(man_repos[repo][0])
> print()
> - print("Archived Projects:")
> - for project in ci_index_xml.archived_project_list:
> - if project == current_project:
> +
> + ci_index_xml = CiIndexXml(man_repos[repo][1])
> +
> + # Attempt to make sure the manifest data is good
> + try:
> + verify_manifest_data(global_manifest_directory, config,
> verbose=args.verbose, verify_all=True, verify_archived=args.archived)
> + except:
> + print()
> +
> + print("Projects:")
> + for project in ci_index_xml.project_list:
Since you are modifying this anyway, please change this line to "for project in sorted(ci_index_xml.project_list):"
Having the output come out sorted would be a great improvement.
> + if (project == current_project and src_man_repo == repo) or (not
> src_man_repo and project == current_project):
> print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> else:
> print(" {}".format(project))
> if args.verbose:
> print(" -> {}".format(ci_index_xml.get_project_xml(project)))
> +
> + if args.archived:
> + print()
> + print("Archived Projects:")
> + for project in ci_index_xml.archived_project_list:
Same thing here. "for project in sorted(ci_index_xml.archived_project_list):"
> + if project == current_project:
> + print("* {}{}{}".format(Fore.GREEN, project, Fore.RESET))
> + else:
> + print(" {}".format(project))
> + if args.verbose:
> + print(" -> {}".format(ci_index_xml.get_project_xml(project)))
> --
> 2.16.2.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories
2020-05-06 22:22 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories Ashley E Desimone
@ 2020-05-10 1:39 ` Nate DeSimone
0 siblings, 0 replies; 4+ messages in thread
From: Nate DeSimone @ 2020-05-10 1:39 UTC (permalink / raw)
To: Desimone, Ashley E, devel@edk2.groups.io
Cc: Pandya, Puja, Bjorge, Erik C, Bret Barkelew, Agyeman, Prince
Hi Ashley,
Feedback inline below.
Thanks,
Nate
> -----Original Message-----
> From: Desimone, Ashley E <ashley.e.desimone@intel.com>
> Sent: Wednesday, May 6, 2020 3:23 PM
> To: devel@edk2.groups.io
> Cc: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Pandya, Puja
> <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Bret
> Barkelew <Bret.Barkelew@microsoft.com>; Agyeman, Prince
> <prince.agyeman@intel.com>
> Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be
> support multiple manifest repositories
>
> Update the create pin command to select and interact with only the
> workspaces source manifest repository.
>
> 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/commands/create_pin_command.py | 26
> ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/edkrepo/commands/create_pin_command.py
> b/edkrepo/commands/create_pin_command.py
> index f8618e5..5b77649 100644
> --- a/edkrepo/commands/create_pin_command.py
> +++ b/edkrepo/commands/create_pin_command.py
> @@ -12,14 +12,16 @@ from collections import namedtuple
>
> from git import Repo
>
> -from edkrepo.commands.edkrepo_command import EdkrepoCommand
> +from edkrepo.commands.edkrepo_command import EdkrepoCommand,
> +SourceManifestRepoArgument
> import edkrepo.commands.arguments.create_pin_args as arguments -from
> edkrepo.common.common_repo_functions import
> pull_latest_manifest_repo from edkrepo.common.edkrepo_exception
> import EdkrepoManifestInvalidException,
> EdkrepoInvalidParametersException from
> edkrepo.common.edkrepo_exception import
> EdkrepoWorkspaceCorruptException from edkrepo.common.humble import
> WRITING_PIN_FILE, GENERATING_PIN_DATA, GENERATING_REPO_DATA,
> BRANCH, COMMIT from edkrepo.common.humble import
> COMMIT_MESSAGE, PIN_PATH_NOT_PRESENT, PIN_FILE_ALREADY_EXISTS,
> PATH_AND_FILEPATH_USED from edkrepo.common.humble import
> MISSING_REPO
> +from
> edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> +import find_project_in_all_indices from
> +edkrepo.common.workspace_maintenance.manifest_repos_maintenance
> import
> +pull_workspace_manifest_repo from
> +edkrepo.common.workspace_maintenance.humble.manifest_repos_main
> tenance_
> +humble import PROJ_NOT_IN_REPO,
> SOURCE_MANIFEST_REPO_NOT_FOUND
> from edkrepo.config.config_factory import get_workspace_manifest,
> get_workspace_path from edkrepo_manifest_parser.edk_manifest import
> ManifestXml
>
> @@ -49,6 +51,7 @@ class CreatePinCommand(EdkrepoCommand):
> 'positional': False,
> 'required': False,
> 'help-text': arguments.PUSH_HELP})
> + args.append(SourceManifestRepoArgument)
> return metadata
>
> def run_command(self, args, config):
> @@ -56,14 +59,25 @@ class CreatePinCommand(EdkrepoCommand):
> if args.push and os.path.dirname(args.PinFileName):
> raise
> EdkrepoInvalidParametersException(PATH_AND_FILEPATH_USED)
>
> - pull_latest_manifest_repo(args, config)
> workspace_path = get_workspace_path()
> manifest = get_workspace_manifest()
>
> + manifest_repo, cfg, manifest_repo_path =
> find_project_in_all_indices(manifest.project_info.codename,
> + config['cfg_file'],
> + config['user_cfg_file'],
> +
> PROJ_NOT_IN_REPO.format(manifest.project_info.codename),
> +
> SOURCE_MANIFEST_REPO_NOT_FOUND.format(manifest.project_info.cod
> ename),
> + args.source_manifest_repo)
> + pull_workspace_manifest_repo(manifest, config['cfg_file'],
> + config['user_cfg_file'], args.source_manifest_repo, False)
> +
> + if 'user' not in cfg:
> + manifest_repo_path =
> config['cfg_file'].manifest_repo_abs_path(manifest_repo)
> + else:
> + manifest_repo_path =
> + config['user_cfg_file'].manifest_repo_abs_path(manifest_repo)
Please wrap this manifest repo update + manifest repo path retrieval code with "if args.push". We only need to mess around with the manifest repo if we are actually going to push the pin file. If we are not pushing it, then don't bother. There are a bunch of corner cases that could happen here like HTTP/SSH connections not working, loose manifest files, etc. that don't need to work just to create the new XML file. This will also have the side benefit of significantly increasing the performance of this command if the push flag is not given.
> # If the push flag is enabled use general_config.pin_path to determine
> global manifest relative location to save
> # pin file to.
> if args.push and manifest.general_config.pin_path is not None:
> - pin_dir =
> os.path.join(config['cfg_file'].manifest_repo_abs_local_path,
> os.path.normpath(manifest.general_config.pin_path))
> + pin_dir = os.path.join(manifest_repo_path,
> + os.path.normpath(manifest.general_config.pin_path))
> pin_file_name = os.path.join(pin_dir, args.PinFileName)
> elif args.push and manifest.general_config.pin_path is None:
> raise EdkrepoManifestInvalidException(PIN_PATH_NOT_PRESENT)
> @@ -104,7 +118,7 @@ class CreatePinCommand(EdkrepoCommand):
>
> # commit and push the pin file
> if args.push:
> - manifest_repo =
> Repo(config['cfg_file'].manifest_repo_abs_local_path)
> + manifest_repo = Repo(manifest_repo_path)
> # Create a local branch with the same name as the pin file arg and
> check it out before attempting the push
> # to master
> master_branch = manifest_repo.active_branch @@ -124,4 +138,4 @@
> class CreatePinCommand(EdkrepoCommand):
> manifest_repo.git.push('origin', 'HEAD:master')
> finally:
> manifest_repo.heads[master_branch.name].checkout()
> - manifest_repo.delete_head(local_branch, '-D')
> \ No newline at end of file
> + manifest_repo.delete_head(local_branch, '-D')
> --
> 2.16.2.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-10 1:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06 22:22 [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Ashley E Desimone
2020-05-06 22:22 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Update Create-Pin to be support multiple manifest repositories Ashley E Desimone
2020-05-10 1:39 ` Nate DeSimone
2020-05-10 1:24 ` [edk2-staging/EdkRepo] [PATCH] EdkRepo: Integrate multiple manifest repository support in the manifest command Nate DeSimone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox