Support <include> directives in manifests.

Test: "development/tools/repo_pull/repo_pull.py pull ..." on a large topic
  from a manifest with includes.
Bug: 140113116
Change-Id: I781c9a3ca0bcdf53cc8ed1896b3ec12389e4e797
This commit is contained in:
Martin Stjernholm
2019-08-27 16:19:15 +01:00
parent 49768683cd
commit 0c28099695

View File

@@ -26,6 +26,7 @@ import itertools
import json
import multiprocessing
import os
import os.path
import re
import sys
import xml.dom.minidom
@@ -170,6 +171,15 @@ def build_project_name_dir_dict(manifest_path):
directory path."""
project_dirs = {}
parsed_xml = xml.dom.minidom.parse(manifest_path)
includes = parsed_xml.getElementsByTagName('include')
for include in includes:
include_path = include.getAttribute('name')
if not os.path.isabs(include_path):
manifest_dir = os.path.dirname(os.path.realpath(manifest_path))
include_path = os.path.join(manifest_dir, include_path)
project_dirs.update(build_project_name_dir_dict(include_path))
projects = parsed_xml.getElementsByTagName('project')
for project in projects:
name = project.getAttribute('name')
@@ -178,6 +188,7 @@ def build_project_name_dir_dict(manifest_path):
project_dirs[name] = path
else:
project_dirs[name] = name
return project_dirs