summaryrefslogtreecommitdiffstats
path: root/tools/repopick.py
diff options
context:
space:
mode:
authorTom Powell <tpowell@cyngn.com>2015-09-25 14:23:26 -0700
committerTom Powell <zifnab@zifnab06.net>2015-10-08 15:20:39 -0700
commit8b3a67d5e68a49a03e4bf854fa166a1c37956d33 (patch)
tree604ac909bd3345dd7ffe124e412a4dd367e523dd /tools/repopick.py
parent9c1a3c3096e1a47b30346e4481e87eff7b856521 (diff)
downloadbuild-8b3a67d5e68a49a03e4bf854fa166a1c37956d33.zip
build-8b3a67d5e68a49a03e4bf854fa166a1c37956d33.tar.gz
build-8b3a67d5e68a49a03e4bf854fa166a1c37956d33.tar.bz2
repopick: support projects which get checked out multiple times
see: caf branches for multimedia, where different branches get checked out under different paths. Change removes hacks needed for -caf branches, as this data is taken directly out of 'repo manifest' Change-Id: Id7aa24709c3dc6bc874899ef605e58271fec082c
Diffstat (limited to 'tools/repopick.py')
-rwxr-xr-xtools/repopick.py60
1 files changed, 23 insertions, 37 deletions
diff --git a/tools/repopick.py b/tools/repopick.py
index a2ee36e..ac8875a 100755
--- a/tools/repopick.py
+++ b/tools/repopick.py
@@ -28,6 +28,7 @@ import subprocess
import re
import argparse
import textwrap
+from xml.etree import ElementTree
try:
# For python3
@@ -198,17 +199,27 @@ if __name__ == '__main__':
if not args.quiet:
print('')
- # Get the list of projects that repo knows about
- # - convert the project name to a project path
- project_name_to_path = {}
- plist = subprocess.check_output(['repo', 'list']).split('\n')
+ # Get the master manifest from repo
+ # - convert project name and revision to a path
+ project_name_to_data = {}
+ manifest = subprocess.check_output(['repo', 'manifest'])
+ xml_root = ElementTree.fromstring(manifest)
+ projects = xml_root.findall('project')
+ default_revision = xml_root.findall('default')[0].get('revision').split('/')[-1]
- for pline in plist:
- if not pline:
- break
- ppaths = pline.split(' : ')
+ #dump project data into the a list of dicts with the following data:
+ #{project: {path, revision}}
- project_name_to_path[ppaths[1]] = ppaths[0]
+ for project in projects:
+ name = project.get('name')
+ path = project.get('path')
+ revision = project.get('revision')
+ if revision is None:
+ revision = default_revision
+
+ if not name in project_name_to_data:
+ project_name_to_data[name] = {}
+ project_name_to_data[name][revision] = path
# get data on requested changes
reviews = []
@@ -263,33 +274,9 @@ if __name__ == '__main__':
# Convert the project name to a project path
# - check that the project path exists
project_path = None
- if item['project'] in project_name_to_path:
- project_path = project_name_to_path[item['project']]
-
- if project_path.startswith('hardware/qcom/'):
- split_path = project_path.split('/')
- # split_path[2] might be display or it might be display-caf, trim the -caf
- split_path[2] = split_path[2].split('-')[0]
-
- # Need to treat hardware/qcom/{audio,display,media} specially
- if split_path[2] == 'audio' or split_path[2] == 'display' or split_path[2] == 'media':
- split_branch = item['branch'].split('-')
-
- # display is extra special
- if split_path[2] == 'display' and len(split_path) == 3:
- project_path = '/'.join(split_path)
- else:
- project_path = '/'.join(split_path[:-1])
-
- if len(split_branch) == 4 and split_branch[0] == 'cm' and split_branch[2] == 'caf':
- project_path += '-caf/msm' + split_branch[3]
- # audio and media are different from display
- elif split_path[2] == 'audio' or split_path[2] == 'media':
- project_path += '/default'
- elif project_path.startswith('hardware/ril'):
- project_path = project_path.rstrip('-caf')
- if item["branch"].split('-')[-1] == 'caf':
- project_path += '-caf'
+
+ if item['project'] in project_name_to_data and item['branch'] in project_name_to_data[item['project']]:
+ project_path = project_name_to_data[item['project']][item['branch']]
elif args.path:
project_path = args.path
elif args.ignore_missing:
@@ -366,4 +353,3 @@ if __name__ == '__main__':
sys.exit(result)
if not args.quiet:
print('')
-