Add git tag derived version to tarball and spec
Stop hardcoding the version in the spec file, and put the version into dist tarballs. Closes #27
This commit is contained in:
parent
7260f5c01f
commit
f26741e269
3 changed files with 11 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
*.rpm
|
*.rpm
|
||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
|
/*.spec
|
||||||
/.vagrant
|
/.vagrant
|
||||||
package-lock.json
|
package-lock.json
|
||||||
Test*FAIL*
|
Test*FAIL*
|
||||||
|
|
|
||||||
11
Makefile
11
Makefile
|
|
@ -1,4 +1,5 @@
|
||||||
PACKAGE_NAME := $(shell python3 -c "import json; print(json.load(open('package.json'))['name'])")
|
PACKAGE_NAME := $(shell python3 -c "import json; print(json.load(open('package.json'))['name'])")
|
||||||
|
VERSION := $(shell git describe 2>/dev/null || echo 1)
|
||||||
ifeq ($(TEST_OS),)
|
ifeq ($(TEST_OS),)
|
||||||
TEST_OS = centos-7
|
TEST_OS = centos-7
|
||||||
endif
|
endif
|
||||||
|
|
@ -54,12 +55,16 @@ dist/po.%.js: po/%.po
|
||||||
# Build/Install/dist
|
# Build/Install/dist
|
||||||
#
|
#
|
||||||
|
|
||||||
|
%.spec: %.spec.in
|
||||||
|
sed -e 's/@VERSION@/$(VERSION)/g' $< > $@
|
||||||
|
|
||||||
dist/index.js: node_modules/react-lite $(wildcard src/*) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS))
|
dist/index.js: node_modules/react-lite $(wildcard src/*) package.json webpack.config.js $(patsubst %,dist/po.%.js,$(LINGUAS))
|
||||||
NODE_ENV=$(NODE_ENV) npm run build
|
NODE_ENV=$(NODE_ENV) npm run build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf dist/
|
rm -rf dist/
|
||||||
rm -rf _install
|
rm -rf _install
|
||||||
|
rm -f $(PACKAGE_NAME).spec
|
||||||
|
|
||||||
install: dist/index.js
|
install: dist/index.js
|
||||||
mkdir -p $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME)
|
mkdir -p $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME)
|
||||||
|
|
@ -75,15 +80,15 @@ devel-install: dist/index.js
|
||||||
# when building a distribution tarball, call webpack with a 'production' environment
|
# when building a distribution tarball, call webpack with a 'production' environment
|
||||||
dist-gzip: NODE_ENV=production
|
dist-gzip: NODE_ENV=production
|
||||||
dist-gzip: clean all
|
dist-gzip: clean all
|
||||||
tar czf cockpit-$(PACKAGE_NAME).tar.gz --transform 's,^,cockpit-$(PACKAGE_NAME)/,' $$(git ls-files) dist/
|
tar czf cockpit-$(PACKAGE_NAME)-$(VERSION).tar.gz --transform 's,^,cockpit-$(PACKAGE_NAME)/,' $$(git ls-files) dist/
|
||||||
|
|
||||||
srpm: dist-gzip
|
srpm: dist-gzip 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
|
rpm: dist-gzip cockpit-$(PACKAGE_NAME).spec
|
||||||
mkdir -p "`pwd`/output"
|
mkdir -p "`pwd`/output"
|
||||||
mkdir -p "`pwd`/rpmbuild"
|
mkdir -p "`pwd`/rpmbuild"
|
||||||
rpmbuild -bb \
|
rpmbuild -bb \
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
Name: cockpit-starter-kit
|
Name: cockpit-starter-kit
|
||||||
Version: 1
|
Version: @VERSION@
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Cockpit Starter Kit Example Module
|
Summary: Cockpit Starter Kit Example Module
|
||||||
License: LGPLv2.1+
|
License: LGPLv2.1+
|
||||||
|
|
||||||
Source: cockpit-starter-kit.tar.gz
|
Source: cockpit-starter-kit-%{version}.tar.gz
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%define debug_package %{nil}
|
%define debug_package %{nil}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue