diff --git a/Makefile b/Makefile index 292e7db..05087c5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,37 @@ +# +# Copyright 2011, Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# + .PHONY: test test-ci pylint pep8 docs clean virtualenv +# general variables VENV=test_env SRC=blockerbugs +# Variables used for packaging +SPECFILE=$(SRC).spec +BASEARCH:=$(shell uname -i) +DIST:=$(shell rpm --eval '%{dist}') +TARGETDIST:=el6 +VERSION:=$(shell rpmspec -q --queryformat="%{VERSION}" $(SPECFILE)) +RELEASE:=$(subst $(DIST),,$(shell rpmspec -q --queryformat="%{RELEASE}" $(SPECFILE))) +NVR:=$(SRC)-$(VERSION)-$(RELEASE) +GITBRANCH:=$(shell git rev-parse --abbrev-ref HEAD) + test: $(VENV) sh -c "TEST='true' . $(VENV)/bin/activate; py.test --cov $(SRC) testing/; deactivate" @@ -28,6 +57,20 @@ clean: rm -f pep8.out rm -f pylint.out +archive: $(SRC)-$(VERSION).tar.gz + +$(SRC)-$(VERSION).tar.gz: + git archive $(GITBRANCH) --prefix=$(SRC)-$(VERSION)/ | gzip -c9 > $@ + +mockbuild: archive + mock -r epel-6-x86_64 --buildsrpm --spec $(SPECFILE) --sources . + cp /var/lib/mock/epel-6-x86_64/result/$(NVR).$(TARGETDIST).src.rpm . + mock -r epel-6-x86_64 --no-clean --rebuild $(NVR).$(TARGETDIST).src.rpm + cp /var/lib/mock/epel-6-x86_64/result/$(NVR).$(TARGETDIST).noarch.rpm . + +nvr: + @echo $(NVR) + cleanvenv: rm -rf $(VENV)