From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com []) by mx.groups.io with SMTP id smtpd.web12.418.1585694573550368246 for ; Tue, 31 Mar 2020 15:43:00 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: erik.c.bjorge@intel.com) IronPort-SDR: AAzxtaGDP4pMEvygssGMCu/vynrhD9GW8kSLB+e0aFlm5jBaxJBkJ8y3xbo+ANjHH6taoqU9z1 nN03sBqFN4ng== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 15:43:00 -0700 IronPort-SDR: wIhusH7BUtmS6mmtHvg5n5Xu+6KhP5AVMAjXnogO1W5mTLx0c20kIH49eG77xuJiHCv09+JY3u qQFX/Z6CF3kA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,329,1580803200"; d="scan'208";a="284168318" Received: from ecbjorge-mobl1.amr.corp.intel.com ([10.134.71.242]) by fmsmga002.fm.intel.com with ESMTP; 31 Mar 2020 15:43:00 -0700 From: "Bjorge, Erik C" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH v1 7/7] EdkRepo: Update List Repos for archived combos Date: Tue, 31 Mar 2020 15:42:03 -0700 Message-Id: <71ddae1f98ff47c8f90e6d9fdf4967d3c1214100.1585694095.git.erik.c.bjorge@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When running the List Repos command archived combos will not be listed unless the archived flag is provided. Signed-off-by: Erik Bjorge Cc: Nate DeSimone Cc: Puja Pandya Cc: Bret Barkelew Cc: Prince Agyeman --- 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.
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
# 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