added install target
[plstackapi.git] / Makefile
1 NAME = opencloud
2 SPECFILE = $(NAME).spec
3 VERSION = $(shell rpm -q --specfile $(SPECFILE) --qf '%{VERSION}\n' | head -n 1)
4 RELEASE = $(shell rpm -q --specfile $(SPECFILE) --qf '%{RELEASE}\n' | head -n 1)
5
6 UPLOAD_SLICE=princeton_planetstack
7 UPLOAD_HOST=node36.princeton.vicci.org
8
9 PWD = $(shell pwd)
10
11 dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm
12
13 $(NAME)-$(VERSION).tar.gz:
14         mkdir -p $(NAME)-$(VERSION)
15         rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=__history --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION)
16         tar -czf $@ $(NAME)-$(VERSION)
17         rm -fr $(NAME)-$(VERSION)
18
19 $(NAME)-$(VERSION)-$(RELEASE).rpm: $(NAME)-$(VERSION).tar.gz
20         mkdir -p build
21         rpmbuild -bb --define '_sourcedir $(PWD)' \
22                 --define '_builddir $(PWD)/build' \
23                 --define '_srcrpmdir $(PWD)' \
24                 --define '_rpmdir $(PWD)' \
25                 --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
26                 $(SPECFILE)
27
28 srpm: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
29 $(NAME)-$(VERSION)-$(RELEASE).src.rpm: $(NAME)-$(VERSION).tar.gz
30         rpmbuild -bs --define "_sourcedir $$(pwd)" \
31                 --define "_srcrpmdir $$(pwd)" \
32                 $(SPECFILE)
33
34 clean:
35         rm -f $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(NAME)-$(VERSION)-$(RELEASE).noarch.rpm
36         rm -rf build
37
38 install: $(NAME)-$(VERSION)-$(RELEASE).rpm
39         scp $(NAME)-$(VERSION)-$(RELEASE).x86_64.rpm $(UPLOAD_SLICE)@$(UPLOAD_HOST):/root/
40         ssh $(UPLOAD_SLICE)@$(UPLOAD_HOST) yum -y install gcc graphviz-devel graphviz-python postgresql postgresql-server python-pip python-psycopg2 libxslt-devel python-httplib2 GeoIP
41         ssh $(UPLOAD_SLICE)@$(UPLOAD_HOST) rpm --install --upgrade --replacepkgs /root/$(NAME)-$(VERSION)-$(RELEASE).x86_64.rpm   
42         scp /opt/planetstack/hpc_wizard/bigquery_credentials.dat /opt/planetstack/hpc_wizard/client_secrets.json $(UPLOAD_SLICE)@$(UPLOAD_HOST):/opt/planetstack/hpc_wizard/ 
43
44 .PHONY: dist
45