build/lib/tools/info/info-gatherer-artifact.py

38 lines
1.8 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
#
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 Ricardo Pardini <ricardo@pardini.net>
# This file is a part of the Armbian Build Framework https://github.com/armbian/build/
#
import json
import logging
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from common import armbian_utils
# Prepare logging
armbian_utils.setup_logging()
log: logging.Logger = logging.getLogger("info-gatherer-artifact")
# read the targets.json file passed as first argument as a json object
with open(sys.argv[1]) as f:
targets = json.load(f)
# massage the targets into their full info invocations (sans-command)
artifacts = []
for target in targets:
one_artifact = target
one_artifact["vars"] = (target["original_inputs"]["vars"])
one_artifact["vars"]["WHAT"] = target["artifact_name"]
one_artifact["configs"] = (target["original_inputs"]["configs"])
artifacts.append(one_artifact)
every_info = armbian_utils.gather_json_output_from_armbian("artifact-config-dump-json", artifacts)
print(json.dumps(every_info, indent=4, sort_keys=True))