Merge pull request #156 from tbielawa/packaging

Packaging fixes
This commit is contained in:
Michael DeHaan 2012-04-17 08:08:54 -07:00
commit 401ce5eb0d
11 changed files with 77 additions and 46 deletions

View file

@ -1,25 +1,36 @@
#!/usr/bin/make #!/usr/bin/make
NAME = "ansible" NAME = "ansible"
# This doesn't evaluate until it's called. The -D argument is the
# directory of the target file ($@), kinda like `dirname`.
ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $< ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
ASCII2HTMLMAN = a2x -D docs/html/man/ -d manpage -f xhtml ASCII2HTMLMAN = a2x -D docs/html/man/ -d manpage -f xhtml
# Space separated list of all the manpages we want to end up with.
MANPAGES := docs/man/man1/ansible.1 docs/man/man1/ansible-playbook.1 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()") SITELIB = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
VERSION := $(shell cat VERSION)
# These are for building the RPM.
RPMVERSION := $(shell awk '/Version/{print $$2; exit}' < ansible.spec | cut -d "%" -f1) RPMVERSION := $(shell awk '/Version/{print $$2; exit}' < ansible.spec | cut -d "%" -f1)
RPMRELEASE := $(shell awk '/Release/{print $$2; exit}' < ansible.spec | cut -d "%" -f1) RPMRELEASE := $(shell awk '/Release/{print $$2; exit}' < ansible.spec | cut -d "%" -f1)
RPMNVR = "$(NAME)-$(RPMVERSION)-$(RPMRELEASE)" RPMDIST = $(shell rpm --eval '%dist')
RPMNVR = "$(NAME)-$(RPMVERSION)-$(RPMRELEASE)$(RPMDIST)"
all: clean python all: clean python
tests: tests:
PYTHONPATH=./lib nosetests -v PYTHONPATH=./lib nosetests -v
# To force a rebuild of the docs run 'touch VERSION && make docs'
docs: $(MANPAGES) docs: $(MANPAGES)
%.1: %.1.asciidoc # Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
$(ASCII2MAN) # recently than %.1.asciidoc.
%.1.asciidoc: %.1.asciidoc.in
sed "s/%VERSION%/$(VERSION)/" $< > $@
%.5: %.5.asciidoc # Regenerate %.1 if %.1.asciidoc or VERSION has been modified more
# recently than %.1. (Implicitly runs the %.1.asciidoc recipe)
%.1: %.1.asciidoc VERSION
$(ASCII2MAN) $(ASCII2MAN)
loc: loc:
@ -36,19 +47,20 @@ pyflakes:
clean: clean:
@echo "Cleaning up distutils stuff" @echo "Cleaning up distutils stuff"
-rm -rf build rm -rf build
-rm -rf dist rm -rf dist
@echo "Cleaning up byte compiled python stuff" @echo "Cleaning up byte compiled python stuff"
find . -regex ".*\.py[co]$$" -delete find . -type f -regex ".*\.py[co]$$" -delete
@echo "Cleaning up editor backup files" @echo "Cleaning up editor backup files"
find . -type f \( -name "*~" -or -name "#*" \) -delete find . -type f \( -name "*~" -or -name "#*" \) -delete
find . -type f \( -name "*.swp" \) -delete find . -type f \( -name "*.swp" \) -delete
@echo "Cleaning up asciidoc to man transformations and results" @echo "Cleaning up asciidoc to man transformations and results"
find ./docs/man -type f -name "*.xml" -delete find ./docs/man -type f -name "*.xml" -delete
find ./docs/man -type f -name "*.asciidoc" -delete
@echo "Cleaning up output from test runs" @echo "Cleaning up output from test runs"
-rm -rf test/test_data rm -rf test/test_data
@echo "Cleaning up RPM building stuff" @echo "Cleaning up RPM building stuff"
-rm -rf MANIFEST rpm-build rm -rf MANIFEST rpm-build
python: python:
python setup.py build python setup.py build
@ -90,6 +102,3 @@ rpm: rpmcommon
@echo "Ansible RPM is built:" @echo "Ansible RPM is built:"
@echo " rpm-build/noarch/$(RPMNVR).noarch.rpm" @echo " rpm-build/noarch/$(RPMNVR).noarch.rpm"
@echo "#############################################" @echo "#############################################"
.PHONEY: docs manual clean pep8
vpath %.asciidoc docs/man/man1

1
VERSION Normal file
View file

@ -0,0 +1 @@
0.0.2

View file

@ -1,40 +1,44 @@
%if 0%{?rhel} <= 5
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%endif
Name: ansible Name: ansible
Release: 1%{?dist} Release: 1%{?dist}
Summary: Minimal SSH command and control Summary: Minimal SSH command and control
Version: 0.0.2 Version: 0.0.2
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Group: Development/Libraries Group: Development/Libraries
License: GPLv3 License: GPLv3
Prefix: %{_prefix}
Source0: https://github.com/downloads/ansible/ansible/%{name}-%{version}.tar.gz Source0: https://github.com/downloads/ansible/ansible/%{name}-%{version}.tar.gz
Url: http://ansible.github.com Url: http://ansible.github.com
BuildArch: noarch BuildArch: noarch
BuildRequires: asciidoc BuildRequires: python2-devel
BuildRequires: python-devel
Requires: python-paramiko Requires: python-paramiko
Requires: python-jinja2 Requires: python-jinja2
%description %description
Ansible is a extra-simple tool/API for doing 'parallel remote things' over SSH
executing commands, running "modules", or executing larger 'playbooks' that Ansible is a radically simple model-driven configuration management,
can serve as a configuration management or deployment system. multi-node deployment, and remote task execution system. Ansible works
over SSH and does not require any software or daemons to be installed
on remote nodes. Extension modules can be written in any language and
are transferred to managed machines automatically.
%prep %prep
%setup -q -n %{name}-%{version} %setup -q
%build %build
python setup.py build %{__python} setup.py build
%install %install
python setup.py install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES %{__python} setup.py install -O1 --root=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/ansible/ mkdir -p $RPM_BUILD_ROOT/etc/ansible/
cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/ cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/ mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1/
cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/ansible mkdir -p $RPM_BUILD_ROOT/%{_datadir}/ansible
cp -v library/* $RPM_BUILD_ROOT/%{_datadir}/ansible/ cp -v library/* $RPM_BUILD_ROOT/%{_datadir}/ansible/
@ -43,14 +47,13 @@ cp -v library/* $RPM_BUILD_ROOT/%{_datadir}/ansible/
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%files %files
%doc README.md PKG-INFO
%defattr(-,root,root) %defattr(-,root,root)
%{_mandir}/man1/*.gz %{python_sitelib}/ansible*
%{python_sitelib}/*
%{_bindir}/ansible* %{_bindir}/ansible*
%{_datadir}/ansible/* %{_datadir}/ansible
%config(noreplace) /etc/ansible/hosts %config(noreplace) %{_sysconfdir}/ansible
%config(noreplace) %{_sysconfdir}/ansible/ %doc README.md PKG-INFO
%doc %{_mandir}/man1/ansible*
%changelog %changelog

1
docs/man/.gitignore vendored
View file

@ -1 +1,2 @@
*.xml *.xml
*.asciidoc

View file

@ -1,13 +1,22 @@
'\" t '\" t
.\" Title: ansible-playbook .\" Title: ansible-playbook
.\" Author: [see the "AUTHOR" section] .\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 04/16/2012 .\" Date: 04/17/2012
.\" Manual: System administration commands .\" Manual: System administration commands
.\" Source: Ansible 0.0.2 .\" Source: Ansible 0.0.2
.\" Language: English .\" Language: English
.\" .\"
.TH "ANSIBLE\-PLAYBOOK" "1" "04/16/2012" "Ansible 0\&.0\&.2" "System administration commands" .TH "ANSIBLE\-PLAYBOOK" "1" "04/17/2012" "Ansible 0\&.0\&.2" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * set default formatting .\" * set default formatting
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------

View file

@ -2,7 +2,7 @@ ansible-playbook(1)
=================== ===================
:doctype:manpage :doctype:manpage
:man source: Ansible :man source: Ansible
:man version: 0.0.2 :man version: %VERSION%
:man manual: System administration commands :man manual: System administration commands
NAME NAME

View file

@ -1,13 +1,22 @@
'\" t '\" t
.\" Title: ansible .\" Title: ansible
.\" Author: [see the "AUTHOR" section] .\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/> .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
.\" Date: 04/16/2012 .\" Date: 04/17/2012
.\" Manual: System administration commands .\" Manual: System administration commands
.\" Source: Ansible 0.0.2 .\" Source: Ansible 0.0.2
.\" Language: English .\" Language: English
.\" .\"
.TH "ANSIBLE" "1" "04/16/2012" "Ansible 0\&.0\&.2" "System administration commands" .TH "ANSIBLE" "1" "04/17/2012" "Ansible 0\&.0\&.2" "System administration commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
.\" * set default formatting .\" * set default formatting
.\" ----------------------------------------------------------------- .\" -----------------------------------------------------------------
@ -25,7 +34,7 @@ ansible \- run a command somewhere else
ansible <host\-pattern> [\-f forks] [\-m module_name] [\-a args] ansible <host\-pattern> [\-f forks] [\-m module_name] [\-a args]
.SH "DESCRIPTION" .SH "DESCRIPTION"
.sp .sp
\fBAnsible\fR is an extra\-simple tool/framework/API for doing \'remote things\' over SSH\&. \fBAnsible\fR is an extra\-simple tool/framework/API for doing \*(Aqremote things\*(Aq over SSH\&.
.SH "ARGUMENTS" .SH "ARGUMENTS"
.PP .PP
\fBhost\-pattern\fR \fBhost\-pattern\fR
@ -63,7 +72,7 @@ to load modules from\&. The default is
\fI/usr/share/ansible\fR\&. \fI/usr/share/ansible\fR\&.
.RE .RE
.PP .PP
\fB\-a\fR \'\fIARGUMENTS\fR\', \fB\-\-args=\fR\'\fIARGUMENTS\fR\' \fB\-a\fR \*(Aq\fIARGUMENTS\fR\*(Aq, \fB\-\-args=\fR\*(Aq\fIARGUMENTS\fR\*(Aq
.RS 4 .RS 4
The The
\fIARGUMENTS\fR \fIARGUMENTS\fR

View file

@ -2,7 +2,7 @@ ansible(1)
========= =========
:doctype:manpage :doctype:manpage
:man source: Ansible :man source: Ansible
:man version: 0.0.2 :man version: %VERSION%
:man manual: System administration commands :man manual: System administration commands
NAME NAME

View file

@ -6,6 +6,3 @@ To use it from the root of a checkout:
$ . ./hacking/env-setup $ . ./hacking/env-setup
Note the space between the '.' and the './' Note the space between the '.' and the './'
Man pages will not load until you run 'make docs' from the root of the
checkout.

View file

@ -4,14 +4,17 @@
PREFIX_PYTHONPATH="$PWD/lib" PREFIX_PYTHONPATH="$PWD/lib"
PREFIX_PATH="$PWD/bin" PREFIX_PATH="$PWD/bin"
PREFIX_MANPATH="$PWD/docs/man"
export PYTHONPATH=$PREFIX_PYTHONPATH:$PYTHONPATH export PYTHONPATH=$PREFIX_PYTHONPATH:$PYTHONPATH
export PATH=$PREFIX_PATH:$PATH export PATH=$PREFIX_PATH:$PATH
export ANSIBLE_LIBRARY="$PWD/library" export ANSIBLE_LIBRARY="$PWD/library"
export MANPATH=$PREFIX_MANPATH:$MANPATH
echo "PATH=$PATH" echo "PATH=$PATH"
echo "PYTHONPATH=$PYTHONPATH" echo "PYTHONPATH=$PYTHONPATH"
echo "ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY" echo "ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY"
echo "MANPATH=$MANPATH"
echo "reminder: specify your host file with -i" echo "Reminder: specify your host file with -i"
echo "done." echo "Done."

View file

@ -10,8 +10,7 @@ This software may be freely redistributed under the terms of the GNU
general public license. general public license.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program. If not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
""" """
VIRT_FAILED = 1 VIRT_FAILED = 1