Permalink
Please sign in to comment.
Browse files
Include spec file and infrastructure for making RPMS.
Special thanks to Kaleb Keithley for his wizard RPM skills.
- Loading branch information...
Showing
with
194 additions
and 7 deletions.
- +1 −0 .gitignore
- +138 −2 Makefile
- +1 −0 VERSION
- +49 −0 puppet-gluster.spec.in
- +1 −1 vagrant/gluster/puppet/modules/common
- +1 −1 vagrant/gluster/puppet/modules/keepalived
- +1 −1 vagrant/gluster/puppet/modules/puppet
- +1 −1 vagrant/gluster/puppet/modules/shorewall
- +1 −1 vagrant/gluster/puppet/modules/yum
| @@ -1,10 +1,146 @@ | ||
| -.PHONY: all docs | ||
| +# GlusterFS module by James | ||
| +# Copyright (C) 2010-2013+ James Shubin | ||
| +# Written by James Shubin <james@shubin.ca> | ||
| +# | ||
| +# This program is free software: you can redistribute it and/or modify | ||
| +# it under the terms of the GNU Affero General Public License as published by | ||
| +# the Free Software Foundation, either version 3 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 Affero General Public License for more details. | ||
| +# | ||
| +# You should have received a copy of the GNU Affero General Public License | ||
| +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| + | ||
| +.PHONY: all docs rpm srpm spec tar upload upload-sources upload-srpms upload-rpms | ||
| .SILENT: | ||
| -all: docs | ||
| +# version of the program | ||
| +VERSION := $(shell cat VERSION) | ||
| +RELEASE = 1 | ||
| +SPEC = rpmbuild/SPECS/puppet-gluster.spec | ||
| +SOURCE = rpmbuild/SOURCES/puppet-gluster-$(VERSION).tar.bz2 | ||
| +SRPM = rpmbuild/SRPMS/puppet-gluster-$(VERSION)-$(RELEASE).src.rpm | ||
| +RPM = rpmbuild/RPMS/puppet-gluster-$(VERSION)-$(RELEASE).rpm | ||
| +SERVER = 'download.gluster.org' | ||
| +REMOTE_PATH = 'purpleidea/puppet-gluster' | ||
| + | ||
| +all: docs rpm | ||
| docs: puppet-gluster-documentation.pdf | ||
| puppet-gluster-documentation.pdf: DOCUMENTATION.md | ||
| pandoc DOCUMENTATION.md -o 'puppet-gluster-documentation.pdf' | ||
| +# | ||
| +# aliases | ||
| +# | ||
| +# TODO: does making an rpm depend on making a .srpm first ? | ||
| +rpm: $(SRPM) $(RPM) | ||
| + # do nothing | ||
| + | ||
| +srpm: $(SRPM) | ||
| + # do nothing | ||
| + | ||
| +spec: $(SPEC) | ||
| + # do nothing | ||
| + | ||
| +tar: $(SOURCE) | ||
| + # do nothing | ||
| + | ||
| +upload: upload-sources upload-srpms upload-rpms | ||
| + # do nothing | ||
| + | ||
| +# | ||
| +# rpmbuild | ||
| +# | ||
| +$(RPM): $(SPEC) $(SOURCE) | ||
| + @echo Running rpmbuild -bb... | ||
| + rpmbuild --define '_topdir $(shell pwd)/rpmbuild' -bb $(SPEC) && \ | ||
| + mv rpmbuild/RPMS/noarch/puppet-gluster-$(VERSION)-$(RELEASE).*.rpm $(RPM) | ||
| + | ||
| +$(SRPM): $(SPEC) $(SOURCE) | ||
| + @echo Running rpmbuild -bs... | ||
| + rpmbuild --define '_topdir $(shell pwd)/rpmbuild' -bs $(SPEC) | ||
| + # renaming is not needed because we aren't using the dist variable | ||
| + #mv rpmbuild/SRPMS/puppet-gluster-$(VERSION)-$(RELEASE).*.src.rpm $(SRPM) | ||
| + | ||
| +# | ||
| +# spec | ||
| +# | ||
| +$(SPEC): rpmbuild/ puppet-gluster.spec.in | ||
| + @echo Running templater... | ||
| + #cat puppet-gluster.spec.in > $(SPEC) | ||
| + sed -e s/__VERSION__/$(VERSION)/ -e s/__RELEASE__/$(RELEASE)/ < puppet-gluster.spec.in > $(SPEC) | ||
| + # append a changelog to the .spec file | ||
| + git log --format="* %cd %aN <%aE>%n- (%h) %s%d%n" --date=local | sed -r 's/[0-9]+:[0-9]+:[0-9]+ //' >> $(SPEC) | ||
| + | ||
| +# | ||
| +# archive | ||
| +# | ||
| +$(SOURCE): rpmbuild/ | ||
| + @echo Running git archive... | ||
| + # use HEAD if tag doesn't exist yet, so that development is easier... | ||
| + git archive --prefix=puppet-gluster-$(VERSION)/ -o $(SOURCE) $(VERSION) 2> /dev/null || (echo 'Warning: $(VERSION) does not exist.' && git archive --prefix=puppet-gluster-$(VERSION)/ -o $(SOURCE) HEAD) | ||
| + | ||
| +# TODO: ensure that each sub directory exists | ||
| +rpmbuild/: | ||
| + mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} | ||
| + | ||
| +# | ||
| +# sha256sum | ||
| +# | ||
| +rpmbuild/SOURCES/SHA256SUMS: rpmbuild/SOURCES/ $(SOURCE) | ||
| + @echo Running SOURCES sha256sum... | ||
| + cd rpmbuild/SOURCES/ && sha256sum *.tar.bz2 > SHA256SUMS; cd - | ||
| + | ||
| +rpmbuild/SRPMS/SHA256SUMS: rpmbuild/SRPMS/ $(SRPM) | ||
| + @echo Running SRPMS sha256sum... | ||
| + cd rpmbuild/SRPMS/ && sha256sum *src.rpm > SHA256SUMS; cd - | ||
| + | ||
| +rpmbuild/RPMS/SHA256SUMS: rpmbuild/RPMS/ $(RPM) | ||
| + @echo Running RPMS sha256sum... | ||
| + cd rpmbuild/RPMS/ && sha256sum *.rpm > SHA256SUMS; cd - | ||
| + | ||
| +# | ||
| +# gpg | ||
| +# | ||
| +rpmbuild/SOURCES/SHA256SUMS.asc: rpmbuild/SOURCES/SHA256SUMS | ||
| + @echo Running SOURCES gpg... | ||
| + # the --yes forces an overwrite of the SHA256SUMS.asc if necessary | ||
| + gpg2 --yes --clearsign rpmbuild/SOURCES/SHA256SUMS | ||
| + | ||
| +rpmbuild/SRPMS/SHA256SUMS.asc: rpmbuild/SRPMS/SHA256SUMS | ||
| + @echo Running SRPMS gpg... | ||
| + gpg2 --yes --clearsign rpmbuild/SRPMS/SHA256SUMS | ||
| + | ||
| +rpmbuild/RPMS/SHA256SUMS.asc: rpmbuild/RPMS/SHA256SUMS | ||
| + @echo Running RPMS gpg... | ||
| + gpg2 --yes --clearsign rpmbuild/RPMS/SHA256SUMS | ||
| + | ||
| +# | ||
| +# upload | ||
| +# | ||
| +# upload to public server | ||
| +upload-sources: rpmbuild/SOURCES/ rpmbuild/SOURCES/SHA256SUMS rpmbuild/SOURCES/SHA256SUMS.asc | ||
| + if [ "`cat rpmbuild/SOURCES/SHA256SUMS`" != "`ssh $(SERVER) 'cd $(REMOTE_PATH)/SOURCES/ && cat SHA256SUMS'`" ]; then \ | ||
| + echo Running SOURCES upload...; \ | ||
| + rsync -avz rpmbuild/SOURCES/ $(SERVER):$(REMOTE_PATH)/SOURCES/; \ | ||
| + fi | ||
| + | ||
| +upload-srpms: rpmbuild/SRPMS/ rpmbuild/SRPMS/SHA256SUMS rpmbuild/SRPMS/SHA256SUMS.asc | ||
| + if [ "`cat rpmbuild/SRPMS/SHA256SUMS`" != "`ssh $(SERVER) 'cd $(REMOTE_PATH)/SRPMS/ && cat SHA256SUMS'`" ]; then \ | ||
| + echo Running SRPMS upload...; \ | ||
| + rsync -avz rpmbuild/SRPMS/ $(SERVER):$(REMOTE_PATH)/SRPMS/; \ | ||
| + fi | ||
| + | ||
| +upload-rpms: rpmbuild/RPMS/ rpmbuild/RPMS/SHA256SUMS rpmbuild/RPMS/SHA256SUMS.asc | ||
| + if [ "`cat rpmbuild/RPMS/SHA256SUMS`" != "`ssh $(SERVER) 'cd $(REMOTE_PATH)/RPMS/ && cat SHA256SUMS'`" ]; then \ | ||
| + echo Running RPMS upload...; \ | ||
| + rsync -avz --prune-empty-dirs rpmbuild/RPMS/ $(SERVER):$(REMOTE_PATH)/RPMS/; \ | ||
| + fi | ||
| + | ||
| +# vim: ts=8 |
| @@ -0,0 +1,49 @@ | ||
| +# special thanks to kkeithley for using his wizard rpm skills to get this going | ||
| +%global puppet_module_version __VERSION__ | ||
| + | ||
| +Name: puppet-gluster | ||
| +Version: __VERSION__ | ||
| +#Release: __RELEASE__%{?dist} # use this to make dist specific builds | ||
| +Release: __RELEASE__ | ||
| +Summary: A puppet module for GlusterFS | ||
| +License: AGPLv3+ | ||
| +URL: https://github.com/purpleidea/puppet-gluster | ||
| +Source0: https://download.gluster.org/pub/gluster/purpleidea/puppet-gluster/SOURCES/puppet-gluster-%{puppet_module_version}.tar.bz2 | ||
| +BuildArch: noarch | ||
| + | ||
| +Requires: puppet >= 3.0.0 | ||
| +Requires: puppetlabs-stdlib >= 4.1.0 | ||
| + | ||
| +# these should be 'Suggests:' or similar, since they aren't absolutely required | ||
| +#Requires: puppetlabs-apt >= 1.4.0 | ||
| +Requires: puppet-common >= 0.0.1 | ||
| +Requires: puppet-keepalived >= 0.0.1 | ||
| +Requires: puppet-puppet >= 0.0.1 | ||
| +Requires: puppet-shorewall >= 0.0.1 | ||
| +Requires: puppet-yum >= 0.0.1 | ||
| + | ||
| +%description | ||
| +A puppet module used for installing, configuring and managing GlusterFS. | ||
| + | ||
| +%prep | ||
| +%setup -c -q -T -D -a 0 | ||
| + | ||
| +find %{_builddir} -type f -name ".*" -exec rm {} + | ||
| +find %{_builddir} -size 0 -exec rm {} + | ||
| +find %{_builddir} \( -name "*.pl" -o -name "*.sh" \) -exec chmod +x {} + | ||
| +find %{_builddir} \( -name "*.pp" -o -name "*.py" \) -exec chmod -x {} + | ||
| +find %{_builddir} \( -name "*.rb" -o -name "*.erb" \) -exec chmod -x {} + -exec sed -i "/^#!/{d;q}" {} + | ||
| + | ||
| +%build | ||
| + | ||
| +%install | ||
| +rm -rf %{buildroot} | ||
| +# _datadir is typically /usr/share/ | ||
| +install -d -m 0755 %{buildroot}/%{_datadir}/puppet/modules/ | ||
| +cp -r puppet-gluster-%{puppet_module_version} %{buildroot}/%{_datadir}/puppet/modules/gluster | ||
| + | ||
| +%files | ||
| +%{_datadir}/puppet/modules/* | ||
| + | ||
| +# this changelog is auto-generated by git log | ||
| +%changelog |
Submodule common
updated
5 files
| +3 −0 | .gitignore | |
| +146 −0 | Makefile | |
| +1 −0 | VERSION | |
| +3 −1 | manifests/again/delta.pp | |
| +40 −0 | puppet-common.spec.in |
Submodule keepalived
updated
4 files
| +2 −0 | .gitignore | |
| +146 −0 | Makefile | |
| +1 −0 | VERSION | |
| +40 −0 | puppet-keepalived.spec.in |
Submodule puppet
updated
4 files
| +1 −0 | .gitignore | |
| +146 −0 | Makefile | |
| +1 −0 | VERSION | |
| +40 −0 | puppet-puppet.spec.in |
Submodule shorewall
updated
4 files
| +2 −0 | .gitignore | |
| +146 −0 | Makefile | |
| +1 −0 | VERSION | |
| +40 −0 | puppet-shorewall.spec.in |
Submodule yum
updated
4 files
| +2 −0 | .gitignore | |
| +146 −0 | Makefile | |
| +1 −0 | VERSION | |
| +40 −0 | puppet-yum.spec.in |
0 comments on commit
2419569