From 8817969d16badf06cb13b9a4560698444f9125ea Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 3 Apr 2023 09:54:30 +0200 Subject: [PATCH] packaging: Declare bundled NPM dependencies in spec file See https://bugzilla.redhat.com/show_bug.cgi?id=2180520 Turn the pattern make rule into an explicit one, as pattern rules don't support dependencies. We only need it for our single spec file anyway. --- Makefile | 5 +++-- packaging/cockpit-starter-kit.spec.in | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 38ed13f..e590c8f 100644 --- a/Makefile +++ b/Makefile @@ -77,8 +77,9 @@ po/LINGUAS: # Build/Install/dist # -%.spec: packaging/%.spec.in - sed -e 's/%{VERSION}/$(VERSION)/g' $< > $@ +$(SPEC): packaging/$(SPEC).in $(NODE_MODULES_TEST) + provides=$$(npm ls --omit dev --package-lock-only --depth=Infinity | grep -Eo '[^[:space:]]+@[^[:space:]]+' | sort -u | sed 's/^/Provides: bundled(npm(/; s/\(.*\)@/\1)) = /'); \ + awk -v p="$$provides" '{gsub(/%{VERSION}/, "$(VERSION)"); gsub(/%{NPM_PROVIDES}/, p)}1' $< > $@ $(DIST_TEST): $(NODE_MODULES_TEST) $(COCKPIT_REPO_STAMP) $(shell find src/ -type f) package.json webpack.config.js NODE_ENV=$(NODE_ENV) node_modules/.bin/webpack diff --git a/packaging/cockpit-starter-kit.spec.in b/packaging/cockpit-starter-kit.spec.in index a2ea969..fc6141f 100644 --- a/packaging/cockpit-starter-kit.spec.in +++ b/packaging/cockpit-starter-kit.spec.in @@ -18,6 +18,8 @@ BuildRequires: libappstream-glib-devel Requires: cockpit-bridge +%{NPM_PROVIDES} + %description Cockpit Starter Kit Example Module