west update: don't update projects twice
Track which projects we've already updated via update_importer() and don't do it twice if it's already done. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
85f2aa90ac
commit
900711acd0
|
@ -641,22 +641,31 @@ class Update(_ProjectCommand):
|
||||||
# call our importer whenever it encounters an import statement
|
# call our importer whenever it encounters an import statement
|
||||||
# in a project, allowing us to control the recursion so it
|
# in a project, allowing us to control the recursion so it
|
||||||
# always uses the latest manifest data.
|
# always uses the latest manifest data.
|
||||||
|
self.updated = set()
|
||||||
|
|
||||||
manifest = Manifest.from_file(importer=self.update_importer,
|
manifest = Manifest.from_file(importer=self.update_importer,
|
||||||
import_flags=ImportFlag.FORCE_PROJECTS)
|
import_flags=ImportFlag.FORCE_PROJECTS)
|
||||||
|
|
||||||
failed = []
|
failed = []
|
||||||
for project in manifest.projects:
|
for project in manifest.projects:
|
||||||
if isinstance(project, ManifestProject):
|
if (isinstance(project, ManifestProject) or
|
||||||
|
project.name in self.updated):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
self.update(project)
|
self.update(project)
|
||||||
|
self.updated.add(project.name)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
failed.append(project)
|
failed.append(project)
|
||||||
self._handle_failed(args, failed)
|
self._handle_failed(args, failed)
|
||||||
|
|
||||||
def update_importer(self, project, path):
|
def update_importer(self, project, path):
|
||||||
|
if isinstance(project, ManifestProject):
|
||||||
|
if not project.is_cloned():
|
||||||
|
log.die("manifest repository {project.abspath} was deleted")
|
||||||
|
else:
|
||||||
self.update(project)
|
self.update(project)
|
||||||
|
self.updated.add(project.name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return _manifest_content_at(project, path)
|
return _manifest_content_at(project, path)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
|
Loading…
Reference in New Issue