Skip to content
Snippets Groups Projects
Commit 088bf347 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

Add package_release.py

parent fc7e8f72
No related branches found
No related tags found
1 merge request!31Add package_release.py
Pipeline #8156 passed with stage
in 24 seconds
#!/usr/bin/env python3
import argparse
import glob
import json
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--images-dir",
help="""Yocto images directory""",
dest="images_dir",
required=True,
)
parser.add_argument(
"--release-dir",
help="""release directory""",
dest="release_dir",
required=True,
)
args, _ = parser.parse_known_args()
# Get bitbake variables from testdata.json file
testdata_files = glob.glob(args.images_dir + "/*.testdata.json")
if not testdata_files:
sys.exit("ERROR: no *.testdata.json file found in images directory")
with open(testdata_files[0], "r") as f:
buildvars = json.load(f)
machine = buildvars["MACHINE"]
version = buildvars["DISTRO_VERSION"]
fstypes = buildvars["IMAGE_FSTYPES"].split()
image = buildvars["IMAGE_NAME"] + buildvars["IMAGE_NAME_SUFFIX"]
# Set directories (use relative path)
release_name = "GUF-Yocto-%s" % version
output_dir = "%s/%s/prebuilt_images" % (args.release_dir, release_name)
images_dir = os.path.relpath(args.images_dir, output_dir)
# Create output directory
os.makedirs(output_dir, exist_ok=True)
# Create symlinks for all rootfs images
for fstype in fstypes:
filename = "%s.%s" % (image, fstype)
source_file = "%s/%s" % (images_dir, filename)
target_file = "%s/%s-%s-root.%s" % (output_dir, release_name, machine, fstype)
print("%s -> %s" % (target_file, source_file))
os.symlink(source_file, target_file)
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment