From facabe585c8a34199c351a4a1e8018ff391b8eca Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 18 Jan 2017 11:14:19 +1100 Subject: [PATCH] Basic logging for package-installs-squash Some basic info logging and debugging for package-installs-squash. Change-Id: If7c227cf0a53b71d334b5f5a6075120f2a7bf3a7 --- .../package-installs/bin/package-installs-squash | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/diskimage_builder/elements/package-installs/bin/package-installs-squash b/diskimage_builder/elements/package-installs/bin/package-installs-squash index 949a8ae8..ee142f35 100755 --- a/diskimage_builder/elements/package-installs/bin/package-installs-squash +++ b/diskimage_builder/elements/package-installs/bin/package-installs-squash @@ -18,10 +18,15 @@ import argparse import collections import functools import json +import logging import os import sys import yaml +from diskimage_builder import logging_config + +logger = logging.getLogger(__name__) + def get_element_installtype(element_name): default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source") @@ -97,6 +102,8 @@ def main(): parser.add_argument('outfile', help="Location of the output file") args = parser.parse_args() + logging_config.setup() + # Replicate the logic of finding the first element, because we can't # operate on the post-copied hooks dir, since we lose element context element_dirs = list() @@ -106,6 +113,8 @@ def main(): if os.path.exists(potential_path): element_dirs.append((elements_dir, element_name)) + logger.debug("element_dirs -> %s" % element_dirs) + # Collect the merge of all of the existing install files in the elements # that are the first on the ELEMENT_PATH final_dict = collections.defaultdict( @@ -116,8 +125,11 @@ def main(): elements_dir, element_name, "package-installs.%s" % file_type) if not os.path.exists(target_file): continue + logger.info("Squashing install file: %s" % target_file) final_dict = collect_data(final_dict, target_file, element_name) + logger.debug("final_dict -> %s" % final_dict) + # Write the resulting file with open(args.outfile, 'w') as outfile: json.dump(