Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 1 | NAME = xos |
| 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) |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 5 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 6 | UPLOAD_SLICE=princeton_planetstack |
Scott Baker | ab66c77 | 2014-04-18 15:24:49 -0700 | [diff] [blame] | 7 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 8 | PWD = $(shell pwd) |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 9 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 10 | dist rpm: $(NAME)-$(VERSION)-$(RELEASE).rpm |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 11 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 12 | $(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 Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 17 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 18 | $(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 | |
| 27 | srpm: $(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 Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 32 | |
| 33 | clean: |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 34 | rm -f $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)-$(RELEASE).src.rpm $(NAME)-$(VERSION)-$(RELEASE).noarch.rpm |
| 35 | rm -rf build |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 36 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 37 | upload: $(NAME)-$(VERSION)-$(RELEASE).rpm |
| 38 | ifndef UPLOAD_HOST |
| 39 | $(error please specify UPLOAD_HOST=<hostname> on make command line) |
| 40 | endif |
| 41 | scp $(NAME)-$(VERSION)-$(RELEASE).x86_64.rpm $(UPLOAD_SLICE)@$(UPLOAD_HOST):/root/ |
Scott Baker | 19c22db | 2014-12-19 12:35:37 -0800 | [diff] [blame] | 42 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 43 | install: 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 Baker | ab66c77 | 2014-04-18 15:24:49 -0700 | [diff] [blame] | 47 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 48 | install-keys: |
| 49 | ifndef UPLOAD_HOST |
| 50 | $(error please specify UPLOAD_HOST=<hostname> on make command line) |
| 51 | endif |
| 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 Baker | 9438035 | 2014-05-15 15:06:08 -0700 | [diff] [blame] | 53 | |
Jeremy Mowery | be7f22a | 2016-01-05 18:29:32 -0700 | [diff] [blame] | 54 | .PHONY: dist |
Siobhan Tully | 44fd4cc | 2014-02-23 00:07:12 -0500 | [diff] [blame] | 55 | |