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.web11.4932.1588309989257688147 for ; Thu, 30 Apr 2020 22:13:09 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: CfW7dRopnc5DHut0ETT3XJD1yC98Ohn+6FOFKSH2Emli3eyc6deU2PKoNWibgpd9YUqOf36/fg 5LQQ27JpEjrA== 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: +g8RnGUASIWhy6SyW4j5O3qhH/Cznk5nb31XMMhf+B+k1BbUicV0PNRXPgMHYRe8rrGpHqzaGL TpAjhmPGrHRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,338,1583222400"; d="scan'208";a="283096075" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.210.118]) by fmsmga004.fm.intel.com with ESMTP; 30 Apr 2020 22:12:48 -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 1/8] EdkRepo: Add check for conflicting/duplicated manifest repo definitions Date: Thu, 30 Apr 2020 22:12:32 -0700 Message-Id: <20200501051239.13976-2-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 a functions to check for conflicting or duplicated manifest repository definitions in the edkrepo.cfg and the edkrepo_user.cfg files. Two manifest repositories definitions are considered conflicting if they have the same name and at least one of URL, branch or local path differ. Two manifest repository definitions are considered duplicates if the name, URL, branch and local path are the same. 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 | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py index 6e26d4f..ad6ddbc 100644 --- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py +++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py @@ -57,3 +57,28 @@ def pull_single_manifest_repo(url, branch, local_path, reset_hard=False): print (humble.CLONE_SINGLE_MAN_REPO.format(local_path, url)) repo = Repo.clone_from(url, local_path, progress=GitProgressHandler(), branch=branch) +def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): + ''' + Determines whether there is are conflicting or duplicated manifest + repositories listed in the edkrepo.cfg and the edkrepo_user.cfg. + ''' + conflicts = [] + duplicates = [] + if not edkrepo_user_cfg.manifest_repo_list: + return conflicts, duplicates + else: + config_repos = set(edkrepo_cfg.manifest_repo_list) + user_cfg_repos = set(edkrepo_user_cfg.manifest_repo_list) + if config_repos.isdisjoint(user_cfg_repos): + return conflicts, duplicates + else: + for repo in config_repos.intersection(user_cfg_repos): + if edkrepo_cfg.get_manifest_repo_url(repo) != edkrepo_user_cfg.get_manifest_repo_url(repo): + conflicts.append(repo) + elif edkrepo_cfg.get_manifest_repo_branch(repo) != edkrepo_user_cfg.get_manifest_repo_branch(repo): + conflicts.append(repo) + elif edkrepo_cfg.get_manifest_repo_local_path(repo) != edkrepo_user_cfg.get_manifest_repo_local_path(repo): + conflicts.append(repo) + else: + duplicates.append(repo) + return conflicts, duplicates -- 2.16.2.windows.1