summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fahlgren2025-07-01 21:02:41 +0000
committerRobert Marko2025-07-03 10:45:59 +0000
commit23dc466969f3364dfa7ab480e7745480a2e816f9 (patch)
tree50403b2908f3e700e759866280f978b3bbbf2d57
parent9d31db2833fd3d2995488a6c28017b115d910a7c (diff)
downloadopenwrt-23dc466969f3364dfa7ab480e7745480a2e816f9.tar.gz
imagebuilder: implement STRIP_ABI option for manifest target
When using apk as the package manager, imagebuilder make command make manifest STRIP_ABI=1 does not strip package names of their ABI-version suffix. The ASU server relies on this to validate builds, so many snapshot build requests are failing. Fix this by using the already existing package data parser in make-index-json.py and augment it to write the result in manifest format. Fixes: https://github.com/openwrt/openwrt/issues/19274 Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com> Link: https://github.com/openwrt/openwrt/pull/19278 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rwxr-xr-xscripts/make-index-json.py24
-rw-r--r--target/imagebuilder/files/Makefile3
2 files changed, 19 insertions, 8 deletions
diff --git a/scripts/make-index-json.py b/scripts/make-index-json.py
index 4d71c3fca3..7751cde810 100755
--- a/scripts/make-index-json.py
+++ b/scripts/make-index-json.py
@@ -31,6 +31,8 @@ def parse_args():
help="Required device architecture: like 'x86_64' or 'aarch64_generic'")
parser.add_argument("-f", "--source-format", required=True, choices=source_format,
help="Required source format of input: 'apk' or 'opkg'")
+ parser.add_argument("-m", "--manifest", action="store_true", default=False,
+ help="Print output in manifest format, as package:version pairs")
parser.add_argument(dest="source",
help="File name for input, '-' for stdin")
# fmt: on
@@ -42,7 +44,11 @@ def parse_apk(text: str) -> dict:
packages: dict = {}
data = json.loads(text)
- for package in data.get("packages", []):
+ if isinstance(data, dict) and "packages" in data:
+ # Extract 'apk adbdump' dict field to 'apk query' package list
+ data = data["packages"]
+
+ for package in data:
package_name: str = package["name"]
for tag in package.get("tags", []):
@@ -83,9 +89,13 @@ if __name__ == "__main__":
text: str = input.read()
packages = parse_apk(text) if args.source_format == "apk" else parse_opkg(text)
- index = {
- "version": 2,
- "architecture": args.architecture,
- "packages": packages,
- }
- print(json.dumps(index, indent=2))
+ if args.manifest:
+ for name, version in packages.items():
+ print(name, version)
+ else:
+ index = {
+ "version": 2,
+ "architecture": args.architecture,
+ "packages": packages,
+ }
+ print(json.dumps(index, indent=2))
diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index d8c1c3c5e8..3f919a0658 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -168,7 +168,8 @@ _call_manifest: FORCE
ifeq ($(CONFIG_USE_APK),)
$(OPKG) list-installed $(if $(STRIP_ABI),--strip-abi)
else
- $(APK) list --quiet --manifest --no-network
+ $(APK) query --format json --fields name,version,$(if $(STRIP_ABI),tags) --installed '*' | \
+ $(SCRIPT_DIR)/make-index-json.py -a $(ARCH_PACKAGES) -f apk --manifest -
endif
package_index: FORCE