From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com []) by mx.groups.io with SMTP id smtpd.web10.4894.1588309989753910554 for ; Thu, 30 Apr 2020 22:13:10 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: EaThAuhfy8/CmvC/sypI9cuKB12tE5eLs5zkRmKDY05IzIIfqH49ovjd41hxonXSNh/HCMP6mh Das2WA+q763Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 22:13:08 -0700 IronPort-SDR: GnNLlZj5I4jZj6Zczz5esXYa3Hupu6BzSqDQgWE+dCP3f0uT2ChiUDQGBHfYgGHo9dSrEvlKuA /s5RSmWn5REw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,338,1583222400"; d="scan'208";a="283096084" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.210.118]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2020 22:12:49 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH V2 4/8] EdkRepo: Add list_available_manifest_repos() Date: Thu, 30 Apr 2020 22:12:35 -0700 Message-Id: <20200501051239.13976-5-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20200501051239.13976-1-ashley.e.desimone@intel.com> References: <20200501051239.13976-1-ashley.e.desimone@intel.com> Add the ability to calculate a list of available manifest repositories from the contents of the edkrepo.cfg and the edkrepo_user.cfg files. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- .../manifest_repos_maintenance.py | 53 ++++++++++++++-------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py index 24ad76a..4bded46 100644 --- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py +++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py @@ -64,25 +64,10 @@ def pull_all_manifest_repos(edkrepo_cfg, edkrepo_user_cfg, reset_hard=False): ''' cfg_man_repos = [] user_cfg_man_repos = [] - conflicts, duplicates = detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg) - if not conflicts and not duplicates: - cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) - user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) - elif conflicts: - for conflict in conflicts: - # In the case of a conflict do not pull conflicting repo - print(humble.CONFLICT_NO_CLONE.format(conflict)) - cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) - cfg_man_repos.remove(conflict) - user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) - user_cfg_man_repos.remove(conflict) - elif duplicates: - for duplicate in duplicates: - # the duplicate needs to be ignored in on of the repo lists so it is - # not cloned/pulled twice - cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) - user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) - user_cfg_man_repos.remove(conflict) + conflicts = [] + cfg_man_repos, user_cfg_man_repos, conflicts = list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg) + for conflict in conflicts: + print(humble.CONFLICT_NO_CLONE.format(conflict)) for repo in cfg_man_repos: pull_single_manifest_repo(edkrepo_cfg.get_manifest_repo_url(repo), edkrepo_cfg.get_manifest_repo_branch(repo), @@ -120,3 +105,33 @@ def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): else: duplicates.append(repo) return conflicts, duplicates + +def list_available_man_repos(edkrepo_cfg, edkrepo_user_cfg): + ''' + Checks for conflicts/duplicates within all manifest repositories defined in + both the edkrepo.cfg and the edkrepo_user.cfg and resturns a list of available + manifest_repos for each and a list of conflicting manifest repository entries. + ''' + cfg_man_repos = [] + user_cfg_man_repos = [] + conflicts, duplicates = detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg) + if not conflicts and not duplicates: + cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) + user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) + elif conflicts: + for conflict in conflicts: + # In the case of a conflict do not pull conflicting repo + cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) + cfg_man_repos.remove(conflict) + user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) + user_cfg_man_repos.remove(conflict) + elif duplicates: + for duplicate in duplicates: + # the duplicate needs to be ignored in on of the repo lists so it is + # not cloned/pulled twice + cfg_man_repos.extend(edkrepo_cfg.manifest_repo_list) + user_cfg_man_repos.extend(edkrepo_user_cfg.manifest_repo_list) + user_cfg_man_repos.remove(duplicate) + return cfg_man_repos, user_cfg_man_repos, conflicts + + -- 2.16.2.windows.1