Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for better RPM packaging (plus tasks) #16

Merged
merged 3 commits into from Mar 11, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,7 @@ build
# Emacs backup files...
*~
.\#*
# (s)rpm building stuff
MANIFEST
dist
rpm-build
1 change: 1 addition & 0 deletions MANIFEST.in
@@ -1,3 +1,4 @@
include README.md AUTHORS.md ansible.spec
include examples/hosts
recursive-include docs *
include Makefile
45 changes: 38 additions & 7 deletions Makefile
@@ -1,9 +1,13 @@
#!/usr/bin/make

NAME = "ansible"
ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
ASCII2HTMLMAN = a2x -D docs/html/man/ -d manpage -f xhtml
MANPAGES := docs/man/man1/ansible.1 docs/man/man1/ansible-playbook.1
SITELIB = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
RPMVERSION := $(shell awk '/Version/{print $$2; exit}' < ansible.spec | cut -d "%" -f1)
RPMRELEASE := $(shell awk '/Release/{print $$2; exit}' < ansible.spec | cut -d "%" -f1)
RPMNVR = "$(NAME)-$(RPMVERSION)-$(RPMRELEASE)"

all: clean python

Expand Down Expand Up @@ -45,20 +49,47 @@ clean:
find ./docs/man -type f \( -name "*.xml" -or -regex ".*\.[0-9]$$" \) -delete
@echo "Cleaning up output from test runs"
-rm -rf test/test_data
@echo "Cleaning up RPM stuff"
-rm MANIFEST
@echo "Cleaning up RPM building stuff"
-rm -rf MANIFEST rpm-build

python: docs
python setup.py build

install: docs
python setup.py install

rpm:
python setup.py sdist
rpmbuild -ta dist/ansible-1.0.tar.gz
sdist: clean
python ./setup.py sdist

rpmcommon: sdist
@mkdir -p rpm-build
@cp dist/*.gz rpm-build/

srpm: rpmcommon
@rpmbuild --define "_topdir %(pwd)/rpm-build" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir %{_topdir}" \
--define "_sourcedir %{_topdir}" \
-bs ansible.spec
@echo "#############################################"
@echo "Ansible SRPM is built:"
@echo " rpm-build/$(RPMNVR).src.rpm"
@echo "#############################################"

rpm: rpmcommon
@rpmbuild --define "_topdir %(pwd)/rpm-build" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir %{_topdir}" \
--define "_sourcedir %{_topdir}" \
-ba ansible.spec
@echo "#############################################"
@echo "Ansible RPM is built:"
@echo " rpm-build/noarch/$(RPMNVR).noarch.rpm"
@echo "#############################################"

.PHONEY: docs manual clean pep8
vpath %.asciidoc docs/man/man1


28 changes: 16 additions & 12 deletions ansible.spec
@@ -1,17 +1,21 @@
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

Summary: Minimal SSH command and control
Name: ansible
Version: 1.0
Release: 1
Source0: ansible-%{version}.tar.gz
License: GPLv3
Group: Development/Libraries
Summary: Minimal SSH command and control
Version: 0.0.1

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Group: Development/Libraries
License: GPLv3
Prefix: %{_prefix}
Source0: https://github.com/downloads/ansible/ansible/%{name}-%{version}.tar.gz
Url: http://ansible.github.com

BuildArch: noarch
Url: http://github.com/mpdehaan/ansible/
BuildRequires: asciidoc
BuildRequires: python-devel

Requires: python-paramiko
Requires: python-jinja2

Expand All @@ -21,7 +25,7 @@ executing commands, running "modules", or executing larger 'playbooks' that
can serve as a configuration management or deployment system.

%prep
%setup -n %{name}-%{version}
%setup -q -n %{name}-%{version}

%build
python setup.py build
Expand All @@ -30,6 +34,7 @@ make docs
%install
python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
mkdir -p $RPM_BUILD_ROOT/etc/ansible/
cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/

%clean
rm -rf $RPM_BUILD_ROOT
Expand All @@ -38,13 +43,12 @@ rm -rf $RPM_BUILD_ROOT
%doc README.md AUTHORS.md PKG-INFO
%defattr(-,root,root)
%{_mandir}/man1/*.gz
%{_mandir}/man5/*.gz
%{python_sitelib}/*
%{_bindir}/ansible*
%{_datadir}/ansible/*
%{_sysconfdir}/ansible/
%config(noreplace) %{_sysconfdir}/ansible/

%changelog
* Mon Mar 5 2012 Seth Vidal <skvidal at fedoraproject.org>
- spec file

%changelog
* Sat Mar 10 2012 <tbielawa@redhat.com> - 0.0.1-1
- Release of 0.0.1
2 changes: 2 additions & 0 deletions docs/man/man1/ansible-playbook.1.asciidoc
Expand Up @@ -82,6 +82,8 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------

*ansible*(1)

Extensive documentation as well as IRC and mailing list info
is available on the ansible home page: <https://ansible.github.com/>

Expand Down
5 changes: 2 additions & 3 deletions docs/man/man1/ansible.1.asciidoc
Expand Up @@ -133,8 +133,7 @@ Ansible is released under the terms of the GPLv3 License.
SEE ALSO
--------

*ansible-playbook*(1)

Extensive documentation as well as IRC and mailing list info
is available on the ansible home page: <https://ansible.github.com/>