From b2662eeebdb623395ca7d6ccacdd1c2746db7c42 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 4 Feb 2022 06:57:26 +0100 Subject: [PATCH] Use image-customize --build to build/install distribution packages This centralizes/factorizes the rpm package builds, and builds RPM packages in the VM instead of on the host, which is cleaner. It also paves the way for supporting Debian and arch builds. Drop the `make srpm` rule, as it's not very useful. Keep the `make rpm` rule, as sometimes developers do this manually. This might be replaced later on with another image-customize feature which copies the built rpm out of the VM. --- Makefile | 24 ++++++++---------------- test/vm.install | 4 ++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 9ae9f3d..aab874c 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ export TEST_OS TARFILE=$(RPM_NAME)-$(VERSION).tar.xz NODE_CACHE=$(RPM_NAME)-node-$(VERSION).tar.xz SPEC=$(RPM_NAME).spec -RPMFILE=$(shell rpmspec -D"VERSION $(VERSION)" -q packaging/$(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 @@ -102,15 +101,8 @@ $(NODE_CACHE): $(NODE_MODULES_TEST) node-cache: $(NODE_CACHE) -srpm: $(TARFILE) $(NODE_CACHE) $(SPEC) - rpmbuild -bs \ - --define "_sourcedir `pwd`" \ - --define "_srcrpmdir `pwd`" \ - $(SPEC) - -rpm: $(RPMFILE) - -$(RPMFILE): $(TARFILE) $(NODE_CACHE) $(SPEC) +# convenience target for developers +rpm: $(TARFILE) $(NODE_CACHE) $(SPEC) mkdir -p "`pwd`/output" mkdir -p "`pwd`/rpmbuild" rpmbuild -bb \ @@ -124,13 +116,13 @@ $(RPMFILE): $(TARFILE) $(NODE_CACHE) $(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): $(RPMFILE) bots +# build a VM with locally built distro pkgs installed +$(VM_IMAGE): $(TARFILE) $(NODE_CACHE) bots rm -f $(VM_IMAGE) $(VM_IMAGE).qcow2 - bots/image-customize -v -i cockpit-ws -i `pwd`/$(RPMFILE) -s $(CURDIR)/test/vm.install $(TEST_OS) + bots/image-customize --verbose --upload $(NODE_CACHE):/var/tmp/ --build $(TARFILE) \ + --install cockpit-ws \ + --script $(CURDIR)/test/vm.install $(TEST_OS) # convenience target for the above vm: $(VM_IMAGE) @@ -172,4 +164,4 @@ $(NODE_MODULES_TEST): package.json env -u NODE_ENV npm install env -u NODE_ENV npm prune -.PHONY: all clean install devel-install print-version dist node-cache srpm rpm check vm update-po +.PHONY: all clean install devel-install print-version dist node-cache rpm check vm update-po diff --git a/test/vm.install b/test/vm.install index 55e548d..7f3d134 100644 --- a/test/vm.install +++ b/test/vm.install @@ -1,6 +1,6 @@ #!/bin/sh -# image-customize script to enable cockpit in test VMs -# The application RPM will be installed separately +# image-customize script to prepare a bots VM for testing this application +# The application package will be installed separately set -eu # don't force https:// (self-signed cert)