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 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(