Add script that sets current revisions in manifest
- Uses git rev-parse to fetch the current HEAD for each project in the
manifest
- Outputs a new copy of the manifest with revision= set to the values
Change-Id: Ibf1a488e6b23fa76455173e8a30d57b20679c41c
diff --git a/create_release_manifest.py b/create_release_manifest.py
new file mode 100755
index 0000000..7909afb
--- /dev/null
+++ b/create_release_manifest.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+import argparse
+import subprocess
+import xml.etree.ElementTree as ET
+
+def main():
+ parser = argparse.ArgumentParser(description='Check out the revisions belonging to a release build.')
+ parser.add_argument('-input', type=str, required=True)
+ parser.add_argument('-output', type=str, required=True)
+ args = parser.parse_args()
+
+ tree = ET.parse(args.input)
+ root = tree.getroot()
+ for project in root.findall('project'):
+ # This repo gives 'fatal: no matching remote head' if you specify a rev.
+ # May be able to remove this when/if we fork the project.
+ if 'aarch64-linux-android' in project.get('path'):
+ continue
+ path = project.get('path')
+ git_output = subprocess.run(['git', '-C', path, 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)
+ revision = git_output.stdout.decode('utf-8').strip()
+ project.set('revision', revision)
+
+ tree.write(args.output)
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file