Bug 899241 - Add process_install_manifest build action; r=glandium
authorGregory Szorc <gps@mozilla.com>
Tue, 30 Jul 2013 16:58:33 -0700
changeset 140646 e7d81c2597f2fc731d6cf3adec406c6c98e3ac01
parent 140645 c2b375f3a909fed4dd66947b88bd63e414c8d97e
child 140647 77fcbb01366c192ba85567cf361de2a073eb45c3
push id31815
push usergszorc@mozilla.com
push dateWed, 31 Jul 2013 00:36:23 +0000
treeherdermozilla-inbound@77fcbb01366c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs899241
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 899241 - Add process_install_manifest build action; r=glandium
python/mozbuild/mozbuild/action/process_install_manifest.py
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/action/process_install_manifest.py
@@ -0,0 +1,41 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function, unicode_literals
+
+import argparse
+from mozpack.copier import FileCopier
+from mozpack.manifests import InstallManifest
+
+
+COMPLETE = 'From {dest}: Kept {existing} existing; Added/updated {updated}; ' \
+    'Removed {rm_files} files and {rm_dirs} directories.'
+
+
+def process_manifest(destdir, *paths):
+    manifest = InstallManifest()
+    for path in paths:
+        manifest |= InstallManifest(path=path)
+
+    copier = FileCopier()
+    manifest.populate_registry(copier)
+    return copier.copy(destdir)
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(
+        description='Process install manifest files.')
+
+    parser.add_argument('destdir', help='Destination directory.')
+    parser.add_argument('manifests', nargs='+', help='Path to manifest file(s).')
+
+    args = parser.parse_args()
+
+    result = process_manifest(args.destdir, *args.manifests)
+
+    print(COMPLETE.format(dest=args.destdir,
+        existing=result.existing_files_count,
+        updated=result.updated_files_count,
+        rm_files=result.removed_files_count,
+        rm_dirs=result.removed_directories_count))