diff --git a/package_release.py b/package_release.py index 299c8035886459b9b1c570c42d0ad4321378dce9..88ab9c3724d09ab751c00936aded7506a259bf3c 100755 --- a/package_release.py +++ b/package_release.py @@ -84,6 +84,7 @@ def generate_metadata( """Generates a metainfo.json for the release""" install_script = None + licenses = None image_general = None image_wic = None @@ -100,8 +101,10 @@ def generate_metadata( # Collect metadata and write to metainfo.json for artifact in artifacts_image: - if artifact.endswith("fng-install.sh"): + if artifact == "fng-install.sh": install_script = artifact + elif artifact == "license.manifest": + licenses = artifact elif artifact.endswith(machine + ".tar.gz"): image_general = artifact elif artifact.endswith(machine + ".wic"): @@ -138,6 +141,12 @@ def generate_metadata( new_file["path"] = "sdk/" + sdk + ".sh" metadata["files"].append(new_file) + if licenses is not None: + new_file = dict() + new_file["name"] = "Licenses" + new_file["path"] = licenses + metadata["files"].append(new_file) + with open(filepath, "w", encoding="utf-8") as file: file.write(json.dumps(metadata)) @@ -149,6 +158,11 @@ def main(): help="""Yocto images directory""", dest="images_dir", ) + parser.add_argument( + "--licenses-dir", + help="""Yocto licenses directory""", + dest="licenses_dir", + ) parser.add_argument( "--outputdir-upload", help="""Base directory name for uploaded artifacts""", @@ -247,6 +261,33 @@ def main(): artifacts_all, args.images_dir, machine, output_dir, outlocal_dir ) + # If the path for the licenses is set, we check for the list with all + # licenses. If the list is found, we copy it to the output directory + # and also add it to the artifacts dictionary. + if args.licenses_dir is not None and os.path.isdir(args.licenses_dir): + licenses_dir = None + + for entry in os.listdir(args.licenses_dir): + if entry.startswith("guf-image-"): + fullpath = os.path.join(args.licenses_dir, entry) + + if os.path.isdir(fullpath): + licenses_dir = fullpath + break + + if licenses_dir is not None: + md5sums.update( + copy_files( + ["license.manifest"], + licenses_dir, + machine, + output_dir, + outlocal_dir, + ) + ) + + artifacts_all.append("license.manifest") + # Generate alphaplan FWR articles if args.generate_fwr_articles: alphaplan_fwr.generate_fwr_articles(