Browse Source

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 `<pkg-name>_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 <thomas.perale@mind.be>
Co-authored-by: Matthias Swiggers <matthias.swiggers@mind.be>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
Thomas Perale 5 months ago
parent
commit
180fc4ec96
1 changed files with 13 additions and 0 deletions
  1. 13 0
      package/pkg-utils.mk

+ 13 - 0
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