diff mbox series

build: add whatdepends target to imagebuilder

Message ID 20200821014451.375982-1-mail@aparcar.org
State Accepted
Delegated to: Daniel Golle
Headers show
Series build: add whatdepends target to imagebuilder | expand

Commit Message

Paul Spooren Aug. 21, 2020, 1:44 a.m. UTC
The package manager `opkg` offers the function `whatdepends` to print
packages that depend on a specific package.

This feature is useful when used in a CI to not only build an upgraded
package but all packages with a dependency.

Usage:
    make whatdepends PACKAGE=libipset

The resulting list can be fed into a SDK building all packages and warn
if anything fails.

Signed-off-by: Paul Spooren <mail@aparcar.org>
---
I'm currently running a CI which determines affected areas as first
step, an example is here where the `fstools` packages was modified:
https://gitlab.com/aparcar/openwrt/-/jobs/696713593#L48

With the whatdepends extension it would be possible to figure out all
affected packages.

 target/imagebuilder/files/Makefile | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index 326dd2ba2f..27d3cfa8df 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -220,4 +220,12 @@  manifest: FORCE
 		$(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
 		$(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)"))
 
-.SILENT: help info image manifest
+whatdepends: FORCE
+ifeq ($(PACKAGE),)
+	@echo 'Variable `PACKAGE` is not set but required by `whatdepends`'
+	@exit 1
+endif
+	@$(MAKE) -s package_reload
+	@$(OPKG) whatdepends -A $(PACKAGE)
+
+.SILENT: help info image manifest whatdepends