From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.4894.1588309989753910554 for ; Thu, 30 Apr 2020 22:13:09 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: 3xxxsGlTMem4z0U5oNu5RKyaHmbk4bbB0RO+RYzc0oRp19H5UN1s1gzJcD/ExZinSF25tc/YEX QSlEl49pbjRA== 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: UIhhpO+PYm0gGh+jAMNQS+HhncjT0BjgIGAZ2YBDDghdgB8ibTflSofc8mZQxGGEucrWkHUkRQ RdSd+0gPZ96A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,338,1583222400"; d="scan'208";a="283096078" 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 2/8] EdkRepo: Add downloading all available manifest repositories Date: Thu, 30 Apr 2020 22:12:33 -0700 Message-Id: <20200501051239.13976-3-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 function that will download all available manifest repositories defined in either the edkrepo.cfg or the edkrepo_user.cfg Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- .../humble/manifest_repos_maintenance_humble.py | 4 +++ .../manifest_repos_maintenance.py | 38 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py index 440fd8a..e592f19 100644 --- a/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py +++ b/edkrepo/common/workspace_maintenance/humble/manifest_repos_maintenance_humble.py @@ -21,3 +21,7 @@ SINGLE_MAN_REPO_NOT_CFG_BRANCH = ('The current active branch, {}, is not the ' 'specified branch for global manifst repository: {}') SINGLE_MAN_REPO_CHECKOUT_CFG_BRANCH = 'Checking out the specified branch: {} prior to syncing' SINGLE_MAN_REPO_MOVED = '{}{}WARNING:{}{} The global manifest repository has moved. Backing up previous global manifest repository to: {{}}{}\n'.format(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED, Style.RESET_ALL) +CONFLICT_NO_CLONE = ('The definition of global manifest repository, {}, ' + 'in the edkrepo_user.cfg does not match the definition in the edkrepo.cfg. ' + 'This global manifest repository will not be downloaded or updated. ' + 'Resolve the conflict and then re-run the failed operation') diff --git a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py index ad6ddbc..24ad76a 100644 --- a/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py +++ b/edkrepo/common/workspace_maintenance/manifest_repos_maintenance.py @@ -57,6 +57,44 @@ 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 pull_all_manifest_repos(edkrepo_cfg, edkrepo_user_cfg, reset_hard=False): + ''' + Clones or syncs all global manifest repositories defined in both the + edkrepo_cfg and the edkrepo_user.cfg) + ''' + 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) + for repo in cfg_man_repos: + pull_single_manifest_repo(edkrepo_cfg.get_manifest_repo_url(repo), + edkrepo_cfg.get_manifest_repo_branch(repo), + edkrepo_cfg.get_manifest_repo_local_path(repo), + reset_hard) + for repo in user_cfg_man_repos: + pull_single_manifest_repo(edkrepo_user_cfg.get_manifest_repo_url(repo), + edkrepo_user_cfg.get_manifest_repo_branch(repo), + edkrepo_user_cfg.get_manifest_repo_local_path(repo), + reset_hard) + + def detect_man_repo_conflicts_duplicates(edkrepo_cfg, edkrepo_user_cfg): ''' Determines whether there is are conflicting or duplicated manifest -- 2.16.2.windows.1