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
This commit is contained in:
Martin Pitt 2018-07-17 23:14:52 +02:00
parent cf3e3b7a83
commit 7408422ef0
2 changed files with 10 additions and 3 deletions

View file

@ -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 \

View file

@ -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}