public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bjorge, Erik C" <erik.c.bjorge@intel.com>
To: devel@edk2.groups.io
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>,
	Puja Pandya <puja.pandya@intel.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Prince Agyeman <prince.agyeman@intel.com>
Subject: [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos for archived combos
Date: Tue, 31 Mar 2020 15:42:03 -0700	[thread overview]
Message-ID: <71ddae1f98ff47c8f90e6d9fdf4967d3c1214100.1585694095.git.erik.c.bjorge@intel.com> (raw)
In-Reply-To: <cover.1585694095.git.erik.c.bjorge@intel.com>

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


  parent reply	other threads:[~2020-03-31 22:43 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 ` Bjorge, Erik C [this message]
2020-04-01 22:16   ` [edk2-devel] [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos " Desimone, Ashley E
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=71ddae1f98ff47c8f90e6d9fdf4967d3c1214100.1585694095.git.erik.c.bjorge@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