Move spec file into packaging/

This is cleaner once projects add debian and arch packaging.

Factorize the spec name/path in the Makefile.
This commit is contained in:
Martin Pitt 2022-02-04 06:53:35 +01:00 committed by Martin Pitt
parent 0493621504
commit 799d8f5cc9
2 changed files with 11 additions and 10 deletions

View file

@ -8,7 +8,8 @@ endif
export TEST_OS
TARFILE=$(RPM_NAME)-$(VERSION).tar.xz
NODE_CACHE=$(RPM_NAME)-node-$(VERSION).tar.xz
RPMFILE=$(shell rpmspec -D"VERSION $(VERSION)" -q $(RPM_NAME).spec.in).rpm
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
@ -53,7 +54,7 @@ update-po: po/$(PACKAGE_NAME).pot
# Build/Install/dist
#
%.spec: %.spec.in
%.spec: packaging/%.spec.in
sed -e 's/%{VERSION}/$(VERSION)/g' $< > $@
$(WEBPACK_TEST): $(NODE_MODULES_TEST) $(LIB_TEST) $(shell find src/ -type f) package.json webpack.config.js
@ -64,7 +65,7 @@ watch:
clean:
rm -rf dist/
rm -f $(RPM_NAME).spec
rm -f $(SPEC)
install: $(WEBPACK_TEST)
mkdir -p $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME)
@ -88,28 +89,28 @@ dist: $(TARFILE)
# pre-built dist/ (so it's not necessary) and ship packge-lock.json (so that
# node_modules/ can be reconstructed if necessary)
$(TARFILE): export NODE_ENV=production
$(TARFILE): $(WEBPACK_TEST) $(RPM_NAME).spec
$(TARFILE): $(WEBPACK_TEST) $(SPEC)
if type appstream-util >/dev/null 2>&1; then appstream-util validate-relax --nonet *.metainfo.xml; fi
touch -r package.json $(NODE_MODULES_TEST)
touch dist/*
tar --xz -cf $(TARFILE) --transform 's,^,$(RPM_NAME)/,' \
--exclude $(RPM_NAME).spec.in --exclude node_modules \
$$(git ls-files) src/lib package-lock.json $(RPM_NAME).spec dist/
--exclude packaging/$(SPEC).in --exclude node_modules \
$$(git ls-files) src/lib package-lock.json $(SPEC) dist/
$(NODE_CACHE): $(NODE_MODULES_TEST)
tar --xz -cf $@ node_modules
node-cache: $(NODE_CACHE)
srpm: $(TARFILE) $(NODE_CACHE) $(RPM_NAME).spec
srpm: $(TARFILE) $(NODE_CACHE) $(SPEC)
rpmbuild -bs \
--define "_sourcedir `pwd`" \
--define "_srcrpmdir `pwd`" \
$(RPM_NAME).spec
$(SPEC)
rpm: $(RPMFILE)
$(RPMFILE): $(TARFILE) $(NODE_CACHE) $(RPM_NAME).spec
$(RPMFILE): $(TARFILE) $(NODE_CACHE) $(SPEC)
mkdir -p "`pwd`/output"
mkdir -p "`pwd`/rpmbuild"
rpmbuild -bb \
@ -119,7 +120,7 @@ $(RPMFILE): $(TARFILE) $(NODE_CACHE) $(RPM_NAME).spec
--define "_srcrpmdir `pwd`" \
--define "_rpmdir `pwd`/output" \
--define "_buildrootdir `pwd`/build" \
$(RPM_NAME).spec
$(SPEC)
find `pwd`/output -name '*.rpm' -printf '%f\n' -exec mv {} . \;
rm -r "`pwd`/rpmbuild"
rm -r "`pwd`/output" "`pwd`/build"