Merge "Basic logging for package-installs-squash"

This commit is contained in:
Jenkins 2017-04-07 13:24:10 +00:00 committed by Gerrit Code Review
commit 1b5045c563

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(