[openwrt/openwrt] build: generate index.json

LEDE Commits lede-commits at lists.infradead.org
Thu May 11 04:13:14 PDT 2023


aparcar pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/695a22ab157577a4143f7a76bcbdaa59305905e3

commit 695a22ab157577a4143f7a76bcbdaa59305905e3
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Tue May 9 21:39:58 2023 +0200

    build: generate index.json
    
    The index.json file lies next to Packages index files and contains a
    json dict with the package architecture and a dict of package names and
    versions.
    
    This can be used for downstream project to know what packages in which
    versions are available.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
    (cherry picked from commit 218ce40cd738f3373438aab82467807a8707fb9c)
---
 package/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/package/Makefile b/package/Makefile
index 209be34674..4b8df7f484 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -92,6 +92,10 @@ $(curdir)/index: FORCE
 			$(call ERROR_MESSAGE,WARNING: Applying padding in $$d/Packages to workaround usign SHA-512 bug!); \
 			{ echo ""; echo ""; } >> Packages;; \
 		esac; \
+		echo -n '{"architecture": "$(ARCH_PACKAGES)", "packages":{' > index.json; \
+		sed -n -e 's/^Package: \(.*\)$$/"\1":/p' -e 's/^Version: \(.*\)$$/"\1",/p' Packages | tr '\n' ' ' >> index.json; \
+		echo '}}' >> index.json; \
+		sed -i 's/, }}/}}/' index.json; \
 		gzip -9nc Packages > Packages.gz; \
 	); done
 ifdef CONFIG_SIGNED_PACKAGES




More information about the lede-commits mailing list