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
|
||||
endif
|
||||
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)
|
||||
# stamp file to check if/when npm install ran
|
||||
NODE_MODULES_TEST=package-lock.json
|
||||
|
|
@ -84,12 +86,14 @@ devel-install: $(WEBPACK_TEST)
|
|||
mkdir -p ~/.local/share/cockpit
|
||||
ln -s `pwd`/dist ~/.local/share/cockpit/$(PACKAGE_NAME)
|
||||
|
||||
dist-gzip: $(TARFILE)
|
||||
|
||||
# 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
|
||||
# pre-built dist/ (so it's not necessary) and ship packge-lock.json (so that
|
||||
# node_modules/ can be reconstructed if necessary)
|
||||
dist-gzip: NODE_ENV=production
|
||||
dist-gzip: all cockpit-$(PACKAGE_NAME).spec
|
||||
$(TARFILE): NODE_ENV=production
|
||||
$(TARFILE): $(WEBPACK_TEST) cockpit-$(PACKAGE_NAME).spec
|
||||
if type appstream-util >/dev/null 2>&1; then appstream-util validate-relax --nonet *.metainfo.xml; fi
|
||||
mv node_modules node_modules.release
|
||||
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/
|
||||
mv node_modules.release node_modules
|
||||
|
||||
srpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
||||
srpm: $(TARFILE) cockpit-$(PACKAGE_NAME).spec
|
||||
rpmbuild -bs \
|
||||
--define "_sourcedir `pwd`" \
|
||||
--define "_srcrpmdir `pwd`" \
|
||||
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`/rpmbuild"
|
||||
rpmbuild -bb \
|
||||
|
|
@ -119,11 +125,13 @@ rpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
|||
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec mv {} . \;
|
||||
rm -r "`pwd`/rpmbuild"
|
||||
rm -r "`pwd`/output" "`pwd`/build"
|
||||
# sanity check
|
||||
test -e "$(RPMFILE)"
|
||||
|
||||
# build a VM with locally built rpm installed
|
||||
$(VM_IMAGE): rpm bots
|
||||
$(VM_IMAGE): $(RPMFILE) bots
|
||||
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
|
||||
vm: $(VM_IMAGE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue