From 26c1128438f076990520b359c078a934232c8cf2 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Tue, 30 Jul 2013 16:58:33 -0700 Subject: [PATCH] Bug 899241 - Add process_install_manifest build action; r=glandium --- .../action/process_install_manifest.py | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 python/mozbuild/mozbuild/action/process_install_manifest.py diff --git a/python/mozbuild/mozbuild/action/process_install_manifest.py b/python/mozbuild/mozbuild/action/process_install_manifest.py new file mode 100644 index 00000000000..33468703145 --- /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))