From 0c280996953ad1fbe6549f801d7ff8ddef957a24 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Tue, 27 Aug 2019 16:19:15 +0100 Subject: [PATCH] Support 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 --- tools/repo_pull/repo_pull.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/repo_pull/repo_pull.py b/tools/repo_pull/repo_pull.py index 79b94c506..2042614e2 100755 --- a/tools/repo_pull/repo_pull.py +++ b/tools/repo_pull/repo_pull.py @@ -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