build: generate index.json
authorPaul Spooren <mail@aparcar.org>
Tue, 9 May 2023 19:39:58 +0000 (21:39 +0200)
committerPaul Spooren <mail@aparcar.org>
Tue, 9 May 2023 22:07:15 +0000 (00:07 +0200)
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@aparcar.org>
(cherry picked from commit 218ce40cd738f3373438aab82467807a8707fb9c)

package/Makefile

index 209be34674747a728606f0c8b2d7dbcd2930ba7b..4b8df7f484de6e63e276c0cecf8aad5cdd96035c 100644 (file)
@@ -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