From e9635620c57b78c784827c0ae65b661c9b459be2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 17 Jul 2018 23:14:52 +0200 Subject: [PATCH] spec: Don't try to rebuild webpack when building released tarballs Release tarballs already have dist/. We can't rebuild the webpack in an RPM as that requires npm and network access for `npm install`. But we also don't want to ship the entire `node_modules/` as that is huge and would require lots of careful license review. So ship a stub node_modules/ that satisfies the Makefile dependency. Make sure that this is not newer than package.json or anything in dist/, so that none of the Makefile's rebuild rules trigger. Closes #36 --- Makefile | 11 +++++++++-- cockpit-starter-kit.spec.in | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 43050ab..2082c2b 100644 --- a/Makefile +++ b/Makefile @@ -81,11 +81,18 @@ devel-install: $(WEBPACK_TEST) ln -s `pwd`/dist ~/.local/share/cockpit/$(PACKAGE_NAME) # when building a distribution tarball, call webpack with a 'production' environment +# ship a stub node_modules/ so that `make` works without re-running `npm install` dist-gzip: NODE_ENV=production -dist-gzip: $(NODE_MODULES_TEST) all cockpit-$(PACKAGE_NAME).spec +dist-gzip: all cockpit-$(PACKAGE_NAME).spec + mv node_modules node_modules.release + mkdir -p $(NODE_MODULES_TEST) + touch -r package.json $(NODE_MODULES_TEST) + touch dist/* tar czf cockpit-$(PACKAGE_NAME)-$(VERSION).tar.gz --transform 's,^,cockpit-$(PACKAGE_NAME)/,' \ --exclude cockpit-$(PACKAGE_NAME).spec.in \ - $$(git ls-files) cockpit-$(PACKAGE_NAME).spec dist/ + $$(git ls-files) cockpit-$(PACKAGE_NAME).spec dist/ node_modules + rm -rf node_modules + mv node_modules.release node_modules srpm: dist-gzip cockpit-$(PACKAGE_NAME).spec rpmbuild -bs \ diff --git a/cockpit-starter-kit.spec.in b/cockpit-starter-kit.spec.in index eb6c7b2..574bf0d 100644 --- a/cockpit-starter-kit.spec.in +++ b/cockpit-starter-kit.spec.in @@ -17,7 +17,7 @@ Cockpit Starter Kit Example Module %setup -n cockpit-starter-kit %build -make +# There is nothing to do, release tarballs already have dist/. %install make install DESTDIR=%{buildroot}