From 180fc4ec96e280a6f1caaf043b11430a13c1bf0b Mon Sep 17 00:00:00 2001 From: Thomas Perale Date: Thu, 6 Feb 2025 19:06:13 +0100 Subject: [PATCH] package/pkg-utils.mk: add patches to show-info json This commit adds support for listing the patches path or url applied to a package when calling `show-info`. To avoid making `show-info` dependant on having to download and patch the packages there is a known limitation with the patch listing of `show-info`: * If a package applies patches in the pre/post hook, they won't be listed (for instance: `android-tool`, `libmad`, `gcc-initial`, `gcc-final`, `linux-header`, ...). * Patches defined in the `_PATCH` variable will be listed as an URL instead of listing the content with a path. For individual patches this is probably OK, but it's not so ideal if it's a tarball containing patches Signed-off-by: Thomas Perale Co-authored-by: Matthias Swiggers Signed-off-by: Arnout Vandecappelle --- package/pkg-utils.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk index ca736da597..0266f66b42 100644 --- a/package/pkg-utils.mk +++ b/package/pkg-utils.mk @@ -168,6 +168,12 @@ pkg-patches-dirs = \ $(or $(wildcard $(dir)/$($(1)_VERSION)),$(dir)),\ $(dir)))) +pkg-patches-url = $(foreach patch,$($(1)_PATCH),\ + $(if $(findstring ://,$(patch)),$(patch),\ + $($(1)_SITE_METHOD)+$($(1)_SITE)/$(patch))) + +pkg-patches-list = $(foreach patchdir,$(call pkg-patches-dirs,$(1)),$(wildcard $(addsuffix /*.patch,$(patchdir)))) $(call pkg-patches-url,$(1)) + define _json-info-pkg-details "version": $(call mk-json-str,$($(1)_DL_VERSION)), "licenses": $(call mk-json-str,$($(1)_LICENSE)), @@ -190,6 +196,13 @@ define _json-info-pkg-details }, ) ], + "patches": [ + $(foreach patch, \ + $(call pkg-patches-list,$(1)), \ + $(call mk-json-str,$(patsubst $(CONFIG_DIR)/%,%,$(patch)))$(comma) \ + + ) + ], endef define _json-info-fs