# # 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)/python-$(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