summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2015-04-08 15:20:36 +0200
committerScott Bahling <sbahling@suse.de>2015-04-08 15:20:36 +0200
commita1c54d89aec78c9b797710723797a974ba0cd2b0 (patch)
treec2f3f19dac8310e98ca0076cea6c03cfb386d298 /Makefile
parentd4bdc1c110eaa0f0bd5702c01613a43de326757e (diff)
downloadobsapi-a1c54d89aec78c9b797710723797a974ba0cd2b0.tar.gz
obsapi-a1c54d89aec78c9b797710723797a974ba0cd2b0.tar.xz
obsapi-a1c54d89aec78c9b797710723797a974ba0cd2b0.zip
Setup packageobsapi-0.0.2
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile47
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..40fa280
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+#
+# generate rpm package source from current git branch
+#
+# location of rpm source files. We use dist automatically
+# created by python distutils command
+DISTDIR = ./dist
+# determine current package version
+RELEASE = $(shell git describe --tags --dirty --always)
+TARFILE = $(DISTDIR)/$(RELEASE).tar.bz2
+PREFIX = $(shell echo $(RELEASE) | cut -d '-' -f 1)
+GITVERSION = $(shell echo $(RELEASE) | cut -d '-' -f 2-)
+SPECFILE = $(DISTDIR)/$(PREFIX).spec
+#
+# Replace '-' with '_' in version to be rpm compatible
+# This version is used in the spec file for the rpm
+# version. The rpm version string will be different from
+# the actual package version string. This will only be the
+# case for git snapshot releases. Official releases based
+# on git tagged version will have matching program/rpm version
+# strings.
+VERSION = $(shell echo $(GITVERSION) | tr '-' '_')
+
+.PHONY : clean
+
+all: $(SPECFILE)
+
+info:
+ echo $(TARFILE)
+
+clean:
+ rm -f $(DISTDIR)/*.tar.bz2
+ rm -f $(SPECFILE)
+
+changelog:
+ git log > ChangeLog
+
+$(TARFILE): changelog
+ python setup.py sdist --formats=bztar
+
+$(SPECFILE): $(TARFILE)
+ cat ./spec/python-obsapi.spec.tmpl | sed "s/__version__/$(VERSION)/g" | sed "s/__gitversion__/$(GITVERSION)/g" > $(SPECFILE)
+
+install:
+ python setup.py install --verbose
+
+uninstall:
+ python setup.py uninstall --verbose