public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Desimone, Ashley E" <ashley.e.desimone@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Bjorge, Erik C" <erik.c.bjorge@intel.com>
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>
Subject: Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos for archived combos
Date: Wed, 1 Apr 2020 22:16:19 +0000	[thread overview]
Message-ID: <DM6PR11MB36288AB6D71D5D0990E678E7B2C90@DM6PR11MB3628.namprd11.prod.outlook.com> (raw)
In-Reply-To: <71ddae1f98ff47c8f90e6d9fdf4967d3c1214100.1585694095.git.erik.c.bjorge@intel.com>

Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bjorge, Erik C
Sent: Tuesday, March 31, 2020 3:42 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>
Subject: [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos for archived combos

When running the List Repos command archived combos will not be listed unless the archived flag is provided.

Signed-off-by: Erik Bjorge <erik.c.bjorge@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>
---
 edkrepo/commands/list_repos_command.py | 37 ++++++++++++++++++--------
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/edkrepo/commands/list_repos_command.py b/edkrepo/commands/list_repos_command.py
index caf0373..b06a493 100644
--- a/edkrepo/commands/list_repos_command.py
+++ b/edkrepo/commands/list_repos_command.py
@@ -3,7 +3,7 @@
 ## @file
 # list_repos_command.py
 #
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights 
+reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent  #
 
@@ -74,7 +74,10 @@ class ListReposCommand(EdkrepoCommand):
             xml_file = ci_index_xml.get_project_xml(project)
             manifest = ManifestXml(os.path.normpath(os.path.join(global_manifest_directory, xml_file)))
             manifests[project] = manifest
-            for combo in [c.name for c in manifest.combinations]:
+            combo_list = [c.name for c in manifest.combinations]
+            if args.archived:
+                combo_list.extend([c.name for c in manifest.archived_combinations])
+            for combo in combo_list:
                 sources = manifest.get_repo_sources(combo)
                 for source in sources:
                     repo_urls.add(self.get_repo_url(source.remote_url))
@@ -84,7 +87,7 @@ class ListReposCommand(EdkrepoCommand):
         project_justify = len(max(manifests.keys(), key=len))
 
         #Determine the names of the repositories
-        self.generate_repo_names(repo_urls, manifests)
+        self.generate_repo_names(repo_urls, manifests, args.archived)
         print(humble.REPOSITORIES)
 
         #If the user provided a list of repositories to view, check to make sure @@ -103,7 +106,10 @@ class ListReposCommand(EdkrepoCommand):
             #Determine the list of branches that used by any branch combination in any manifest
             branches = set()
             for project_name in manifests:
-                for combo in [c.name for c in manifests[project_name].combinations]:
+                combo_list = [c.name for c in manifests[project_name].combinations]
+                if args.archived:
+                    combo_list.extend([c.name for c in manifests[project_name].archived_combinations])
+                for combo in combo_list:
                     sources = manifests[project_name].get_repo_sources(combo)
                     for source in sources:
                         if self.get_repo_url(source.remote_url) == repo:
@@ -124,7 +130,10 @@ class ListReposCommand(EdkrepoCommand):
                 #Determine the branch combinations that use that branch
                 for project_name in manifests:
                     combos = []
-                    for combo in [c.name for c in manifests[project_name].combinations]:
+                    combo_list = [c.name for c in manifests[project_name].combinations]
+                    if args.archived:
+                        combo_list.extend([c.name for c in manifests[project_name].archived_combinations])
+                    for combo in combo_list:
                         sources = manifests[project_name].get_repo_sources(combo)
                         for source in sources:
                             if self.get_repo_url(source.remote_url) == repo and source.branch == branch:
@@ -165,11 +174,11 @@ class ListReposCommand(EdkrepoCommand):
                 return name
         raise EdkrepoInvalidParametersException(humble.REPO_NAME_NOT_FOUND)
 
-    def generate_repo_names(self, repo_urls, manifests):
+    def generate_repo_names(self, repo_urls, manifests, archived=False):
         #Determine the names of the repositories
         self.repo_names = collections.OrderedDict()
         for repo_url in repo_urls:
-            self.__repo_name_worker(repo_url, manifests)
+            self.__repo_name_worker(repo_url, manifests, archived)
 
         #Sort the git repositories so they will be displayed alphabetically
         self.repo_names = collections.OrderedDict(sorted(self.repo_names.items()))
@@ -188,12 +197,15 @@ class ListReposCommand(EdkrepoCommand):
         for name_to_move in names_to_move:
             self.repo_names.move_to_end(name_to_move, False)
 
-    def __repo_name_worker(self, repo_url, manifests):
+    def __repo_name_worker(self, repo_url, manifests, archived=False):
         #This is a heuristic that guesses the "name" of a repository by looking
         #at the name given to it by the most manifest files.
         names = collections.defaultdict(int)
         for project_name in manifests:
-            for combo in [c.name for c in manifests[project_name].combinations]:
+            combo_list = [c.name for c in manifests[project_name].combinations]
+            if archived:
+                combo_list.extend([c.name for c in manifests[project_name].archived_combinations])
+            for combo in combo_list:
                 sources = manifests[project_name].get_repo_sources(combo)
                 for source in sources:
                     if self.get_repo_url(source.remote_url) == repo_url:
@@ -209,7 +221,10 @@ class ListReposCommand(EdkrepoCommand):
                     #If only 1 project uses this name, then append the project
                     #name to the directory name to create the repo name
                     for project_name in manifests:
-                        for combo in [c.name for c in manifests[project_name].combinations]:
+                        combo_list = [c.name for c in manifests[project_name].combinations]
+                        if archived:
+                            combo_list.extend([c.name for c in manifests[project_name].archived_combinations])
+                        for combo in combo_list:
                             sources = manifests[project_name].get_repo_sources(combo)
                             for source in sources:
                                 if self.get_repo_url(source.remote_url) == repo_url and source.root == original_best_name:
@@ -239,7 +254,7 @@ class ListReposCommand(EdkrepoCommand):
                         del self.repo_names[best_name]
                         found_unique_name = True
                         self.repo_names[best_name] = (repo_url, best_name_frequency)
-                        self.__repo_name_worker(old_repo_url, manifests)
+                        self.__repo_name_worker(old_repo_url, 
+ manifests, archived)
                     else:
                         #Use the name given by the second most manifest files
                         del names[best_name]
--
2.21.0.windows.1





  reply	other threads:[~2020-04-01 22:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 22:41 [edk2-staging/EdkRepo] [PATCH v1 0/7] Adding support for archiving branch combos Bjorge, Erik C
2020-03-31 22:41 ` [edk2-staging/EdkRepo] [PATCH v1 1/7] EdkRepo: Adding support for archiving combos Bjorge, Erik C
2020-04-01 21:39   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:41 ` [edk2-staging/EdkRepo] [PATCH v1 2/7] EdkRepo: Added ability to display archived combinations Bjorge, Erik C
2020-04-01 21:54   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:41 ` [edk2-staging/EdkRepo] [PATCH v1 3/7] EdkRepo: Update Checkout for archived combos Bjorge, Erik C
2020-04-01 22:00   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:42 ` [edk2-staging/EdkRepo] [PATCH v1 4/7] EdkRepo: Update Sync " Bjorge, Erik C
2020-04-01 22:05   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:42 ` [edk2-staging/EdkRepo] [PATCH v1 5/7] EdkRepo: Update Checkout Pin " Bjorge, Erik C
2020-04-01 22:08   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:42 ` [edk2-staging/EdkRepo] [PATCH v1 6/7] EdkRepo: Update clone " Bjorge, Erik C
2020-04-01 22:10   ` [edk2-devel] " Desimone, Ashley E
2020-03-31 22:42 ` [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos " Bjorge, Erik C
2020-04-01 22:16   ` Desimone, Ashley E [this message]
2020-04-02  5:59 ` [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1 0/7] Adding support for archiving branch combos Nate DeSimone
2020-04-02 17:02   ` Bjorge, Erik C
2020-04-03 22:27 ` 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=DM6PR11MB36288AB6D71D5D0990E678E7B2C90@DM6PR11MB3628.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