Makefile: Use proper file dependencies
Avoid phony dependencies, as they break timestamp comparison and thus always cause rebuilding of the tarball, rpm, and (the very expensive) VM for each `make check`, even if only the tests (or nothing at all) changed. Use `rpmspec` to predict the name of the built rpm. Use the .spec.in file directly, as we can't depend on the generated .spec file in the variable definition. Closes #290
This commit is contained in:
parent
216d7e7436
commit
94da6583dc
1 changed files with 14 additions and 6 deletions
20
Makefile
20
Makefile
|
|
@ -5,6 +5,8 @@ ifeq ($(TEST_OS),)
|
||||||
TEST_OS = centos-7
|
TEST_OS = centos-7
|
||||||
endif
|
endif
|
||||||
export TEST_OS
|
export TEST_OS
|
||||||
|
TARFILE=cockpit-$(PACKAGE_NAME)-$(VERSION).tar.gz
|
||||||
|
RPMFILE=$(shell rpmspec -D"VERSION $(VERSION)" -q cockpit-starter-kit.spec.in).rpm
|
||||||
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
|
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
|
||||||
# stamp file to check if/when npm install ran
|
# stamp file to check if/when npm install ran
|
||||||
NODE_MODULES_TEST=package-lock.json
|
NODE_MODULES_TEST=package-lock.json
|
||||||
|
|
@ -84,12 +86,14 @@ devel-install: $(WEBPACK_TEST)
|
||||||
mkdir -p ~/.local/share/cockpit
|
mkdir -p ~/.local/share/cockpit
|
||||||
ln -s `pwd`/dist ~/.local/share/cockpit/$(PACKAGE_NAME)
|
ln -s `pwd`/dist ~/.local/share/cockpit/$(PACKAGE_NAME)
|
||||||
|
|
||||||
|
dist-gzip: $(TARFILE)
|
||||||
|
|
||||||
# when building a distribution tarball, call webpack with a 'production' environment
|
# when building a distribution tarball, call webpack with a 'production' environment
|
||||||
# we don't ship node_modules for license and compactness reasons; we ship a
|
# we don't ship node_modules for license and compactness reasons; we ship a
|
||||||
# pre-built dist/ (so it's not necessary) and ship packge-lock.json (so that
|
# pre-built dist/ (so it's not necessary) and ship packge-lock.json (so that
|
||||||
# node_modules/ can be reconstructed if necessary)
|
# node_modules/ can be reconstructed if necessary)
|
||||||
dist-gzip: NODE_ENV=production
|
$(TARFILE): NODE_ENV=production
|
||||||
dist-gzip: all cockpit-$(PACKAGE_NAME).spec
|
$(TARFILE): $(WEBPACK_TEST) cockpit-$(PACKAGE_NAME).spec
|
||||||
if type appstream-util >/dev/null 2>&1; then appstream-util validate-relax --nonet *.metainfo.xml; fi
|
if type appstream-util >/dev/null 2>&1; then appstream-util validate-relax --nonet *.metainfo.xml; fi
|
||||||
mv node_modules node_modules.release
|
mv node_modules node_modules.release
|
||||||
touch -r package.json $(NODE_MODULES_TEST)
|
touch -r package.json $(NODE_MODULES_TEST)
|
||||||
|
|
@ -99,13 +103,15 @@ dist-gzip: all cockpit-$(PACKAGE_NAME).spec
|
||||||
$$(git ls-files) package-lock.json cockpit-$(PACKAGE_NAME).spec dist/
|
$$(git ls-files) package-lock.json cockpit-$(PACKAGE_NAME).spec dist/
|
||||||
mv node_modules.release node_modules
|
mv node_modules.release node_modules
|
||||||
|
|
||||||
srpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
srpm: $(TARFILE) cockpit-$(PACKAGE_NAME).spec
|
||||||
rpmbuild -bs \
|
rpmbuild -bs \
|
||||||
--define "_sourcedir `pwd`" \
|
--define "_sourcedir `pwd`" \
|
||||||
--define "_srcrpmdir `pwd`" \
|
--define "_srcrpmdir `pwd`" \
|
||||||
cockpit-$(PACKAGE_NAME).spec
|
cockpit-$(PACKAGE_NAME).spec
|
||||||
|
|
||||||
rpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
rpm: $(RPMFILE)
|
||||||
|
|
||||||
|
$(RPMFILE): $(TARFILE) cockpit-$(PACKAGE_NAME).spec
|
||||||
mkdir -p "`pwd`/output"
|
mkdir -p "`pwd`/output"
|
||||||
mkdir -p "`pwd`/rpmbuild"
|
mkdir -p "`pwd`/rpmbuild"
|
||||||
rpmbuild -bb \
|
rpmbuild -bb \
|
||||||
|
|
@ -119,11 +125,13 @@ rpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
||||||
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec mv {} . \;
|
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec mv {} . \;
|
||||||
rm -r "`pwd`/rpmbuild"
|
rm -r "`pwd`/rpmbuild"
|
||||||
rm -r "`pwd`/output" "`pwd`/build"
|
rm -r "`pwd`/output" "`pwd`/build"
|
||||||
|
# sanity check
|
||||||
|
test -e "$(RPMFILE)"
|
||||||
|
|
||||||
# build a VM with locally built rpm installed
|
# build a VM with locally built rpm installed
|
||||||
$(VM_IMAGE): rpm bots
|
$(VM_IMAGE): $(RPMFILE) bots
|
||||||
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
|
rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2
|
||||||
bots/image-customize -v -i cockpit-ws -i `pwd`/cockpit-$(PACKAGE_NAME)-*$(VERSION)*.noarch.rpm -s $(CURDIR)/test/vm.install $(TEST_OS)
|
bots/image-customize -v -i cockpit-ws -i `pwd`/$(RPMFILE) -s $(CURDIR)/test/vm.install $(TEST_OS)
|
||||||
|
|
||||||
# convenience target for the above
|
# convenience target for the above
|
||||||
vm: $(VM_IMAGE)
|
vm: $(VM_IMAGE)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue