mirror of
				https://github.com/optim-enterprises-bv/openwrt-ipq.git
				synced 2025-10-31 02:08:28 +00:00 
			
		
		
		
	 b36068d35d
			
		
	
	b36068d35d
	
	
	
		
			
			The commit "1bf2b3fe90 build,json: fixup missing arch_packages" fixes
the missing package architecture locally but runs $(TOPDIR)/Makefile
rather than a target specific one. While this works on local builds just
fine, it causes the buildbots to add garbage to the `arch_packages`
variable:
    cd \"/builder/shared-workdir/build\"; git log --format=%h -1
    toolchain > /builder/shared-workdir/build/tmp/.ver_check\ncmp -s
    /builder/shared-workdir/build/tmp/.ver_check
    /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp/.ver_check
    || { \\\n\trm -rf
    /builder/shared-workdir/build/build_dir/target-x86_64_musl
    /builder/shared-workdir/build/staging_dir/target-x86_64_musl
    /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl
    /builder/shared-workdir/build/build_dir/toolchain-x86_64_gcc-8.4.0_musl;
    \\\n\tmkdir -p
    /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp;
    \\\n\tmv /builder/shared-workdir/build/tmp/.ver_check
    /builder/shared-workdir/build/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/stamp/.ver_check;
    \\\n}\nx86_64
Only the last line contains the desired string.
Future investigation should check why the build system prints this to
stdout rather than stderr.
Signed-off-by: Paul Spooren <mail@aparcar.org>
		
	
		
			
				
	
	
		
			70 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env python3
 | |
| 
 | |
| from os import getenv, environ
 | |
| from pathlib import Path
 | |
| from subprocess import run, PIPE
 | |
| from sys import argv
 | |
| import json
 | |
| 
 | |
| if len(argv) != 2:
 | |
|     print("JSON info files script requires ouput file as argument")
 | |
|     exit(1)
 | |
| 
 | |
| output_path = Path(argv[1])
 | |
| 
 | |
| assert getenv("WORK_DIR"), "$WORK_DIR required"
 | |
| 
 | |
| work_dir = Path(getenv("WORK_DIR"))
 | |
| 
 | |
| output = {}
 | |
| 
 | |
| for json_file in work_dir.glob("*.json"):
 | |
|     image_info = json.loads(json_file.read_text())
 | |
|     if not output:
 | |
|         output.update(image_info)
 | |
|     else:
 | |
|         # get first (and only) profile in json file
 | |
|         device_id = next(iter(image_info["profiles"].keys()))
 | |
|         if device_id not in output["profiles"]:
 | |
|             output["profiles"].update(image_info["profiles"])
 | |
|         else:
 | |
|             output["profiles"][device_id]["images"].append(
 | |
|                 image_info["profiles"][device_id]["images"][0]
 | |
|             )
 | |
| 
 | |
| if output:
 | |
|     output["default_packages"] = run(
 | |
|         [
 | |
|             "make",
 | |
|             "--no-print-directory",
 | |
|             "-C",
 | |
|             "target/linux/{}".format(output["target"].split("/")[0]),
 | |
|             "val.DEFAULT_PACKAGES",
 | |
|             "DUMP=1",
 | |
|         ],
 | |
|         stdout=PIPE,
 | |
|         stderr=PIPE,
 | |
|         check=True,
 | |
|         env=environ.copy().update({"TOPDIR": Path().cwd()}),
 | |
|         universal_newlines=True,
 | |
|     ).stdout.split()
 | |
| 
 | |
|     output["arch_packages"] = run(
 | |
|         [
 | |
|             "make",
 | |
|             "--no-print-directory",
 | |
|             "-C",
 | |
|             "target/linux/{}".format(output["target"].split("/")[0]),
 | |
|             "val.ARCH_PACKAGES",
 | |
|         ],
 | |
|         stdout=PIPE,
 | |
|         stderr=PIPE,
 | |
|         check=True,
 | |
|         env=environ.copy().update({"TOPDIR": Path().cwd()}),
 | |
|         universal_newlines=True,
 | |
|     ).stdout.strip()
 | |
| 
 | |
|     output_path.write_text(json.dumps(output, sort_keys=True, separators=(",", ":")))
 | |
| else:
 | |
|     print("JSON info file script could not find any JSON files for target")
 |