Basic logging for package-installs-squash

Some basic info logging and debugging for package-installs-squash.

Change-Id: If7c227cf0a53b71d334b5f5a6075120f2a7bf3a7
This commit is contained in:
Ian Wienand 2017-01-18 11:14:19 +11:00
parent 10baebe1e4
commit facabe585c

View File

@ -18,10 +18,15 @@ import argparse
import collections import collections
import functools import functools
import json import json
import logging
import os import os
import sys import sys
import yaml import yaml
from diskimage_builder import logging_config
logger = logging.getLogger(__name__)
def get_element_installtype(element_name): def get_element_installtype(element_name):
default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source") default = os.environ.get("DIB_DEFAULT_INSTALLTYPE", "source")
@ -97,6 +102,8 @@ def main():
parser.add_argument('outfile', help="Location of the output file") parser.add_argument('outfile', help="Location of the output file")
args = parser.parse_args() args = parser.parse_args()
logging_config.setup()
# Replicate the logic of finding the first element, because we can't # Replicate the logic of finding the first element, because we can't
# operate on the post-copied hooks dir, since we lose element context # operate on the post-copied hooks dir, since we lose element context
element_dirs = list() element_dirs = list()
@ -106,6 +113,8 @@ def main():
if os.path.exists(potential_path): if os.path.exists(potential_path):
element_dirs.append((elements_dir, element_name)) 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 # Collect the merge of all of the existing install files in the elements
# that are the first on the ELEMENT_PATH # that are the first on the ELEMENT_PATH
final_dict = collections.defaultdict( final_dict = collections.defaultdict(
@ -116,8 +125,11 @@ def main():
elements_dir, element_name, "package-installs.%s" % file_type) elements_dir, element_name, "package-installs.%s" % file_type)
if not os.path.exists(target_file): if not os.path.exists(target_file):
continue continue
logger.info("Squashing install file: %s" % target_file)
final_dict = collect_data(final_dict, target_file, element_name) final_dict = collect_data(final_dict, target_file, element_name)
logger.debug("final_dict -> %s" % final_dict)
# Write the resulting file # Write the resulting file
with open(args.outfile, 'w') as outfile: with open(args.outfile, 'w') as outfile:
json.dump( json.dump(