blob: 2b5552692c9a404320da01bf3f104028f53b1346 [file] [log] [blame]
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -07001NAME = xos
2SPECFILE = $(NAME).spec
3VERSION = $(shell rpm -q --specfile $(SPECFILE) --qf '%{VERSION}\n' | head -n 1)
4RELEASE = $(shell rpm -q --specfile $(SPECFILE) --qf '%{RELEASE}\n' | head -n 1)
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05005
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -07006UPLOAD_SLICE=princeton_planetstack
Scott Bakerab66c772014-04-18 15:24:49 -07007
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -07008PWD = $(shell pwd)
Siobhan Tully44fd4cc2014-02-23 00:07:12 -05009
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070010dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050011
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070012$(NAME)-$(VERSION).tar.gz:
13 mkdir -p $(NAME)-$(VERSION)
14 rsync -av --exclude=.svn --exclude=.git --exclude=*.tar.gz --exclude=*.rpm --exclude=__history --exclude=$(NAME)-$(VERSION)/ ./ $(NAME)-$(VERSION)
15 tar -czf $@ $(NAME)-$(VERSION)
16 rm -fr $(NAME)-$(VERSION)
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050017
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070018$(NAME)-$(VERSION)-$(RELEASE).rpm: $(NAME)-$(VERSION).tar.gz
19 mkdir -p build
20 rpmbuild -bb --define '_sourcedir $(PWD)' \
21 --define '_builddir $(PWD)/build' \
22 --define '_srcrpmdir $(PWD)' \
23 --define '_rpmdir $(PWD)' \
24 --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
25 $(SPECFILE)
26
27srpm: $(NAME)-$(VERSION)-$(RELEASE).src.rpm
28$(NAME)-$(VERSION)-$(RELEASE).src.rpm: $(NAME)-$(VERSION).tar.gz
29 rpmbuild -bs --define "_sourcedir $$(pwd)" \
30 --define "_srcrpmdir $$(pwd)" \
31 $(SPECFILE)
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050032
33clean:
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070034 rm -f $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(NAME)-$(VERSION)-$(RELEASE).noarch.rpm
35 rm -rf build
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050036
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070037upload: $(NAME)-$(VERSION)-$(RELEASE).rpm
38ifndef UPLOAD_HOST
39 $(error please specify UPLOAD_HOST=<hostname> on make command line)
40endif
41 scp $(NAME)-$(VERSION)-$(RELEASE).x86_64.rpm $(UPLOAD_SLICE)@$(UPLOAD_HOST):/root/
Scott Baker19c22db2014-12-19 12:35:37 -080042
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070043install: upload
44 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
45 ssh $(UPLOAD_SLICE)@$(UPLOAD_HOST) rpm --install --upgrade --replacefiles --replacepkgs /root/$(NAME)-$(VERSION)-$(RELEASE).x86_64.rpm
46 scp /opt/planetstack/hpc_wizard/bigquery_credentials.dat /opt/planetstack/hpc_wizard/client_secrets.json $(UPLOAD_SLICE)@$(UPLOAD_HOST):/opt/planetstack/hpc_wizard/
Scott Bakerab66c772014-04-18 15:24:49 -070047
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070048install-keys:
49ifndef UPLOAD_HOST
50 $(error please specify UPLOAD_HOST=<hostname> on make command line)
51endif
52 scp /opt/planetstack/hpc_wizard/bigquery_credentials.dat /opt/planetstack/hpc_wizard/client_secrets.json $(UPLOAD_SLICE)@$(UPLOAD_HOST):/opt/planetstack/hpc_wizard/
Scott Baker94380352014-05-15 15:06:08 -070053
Jeremy Mowerybe7f22a2016-01-05 18:29:32 -070054.PHONY: dist
Siobhan Tully44fd4cc2014-02-23 00:07:12 -050055