Can not build rpm from src

I have some problems building rpms from the source. This is what I did.

wget https://github.com/downloads/ansible/ansible/ansible-0.3.1.tar.gz
tar zxvf ansible-0.3.1.tar.gz
cd ansible-0.3.1
make rpm

Then I get the following output, and I know for a fact that at least the examples/hosts file is there:

cat: VERSION: No such file or directory
Cleaning up distutils stuff
rm -rf build
rm -rf dist
Cleaning up byte compiled python stuff
find . -type f -regex ".*\.py[co]$" -delete
Cleaning up editor backup files
find . -type f \( -name "*~" -or -name "#*" \) -delete
find . -type f \( -name "*.swp" \) -delete
Cleaning up asciidoc to man transformations and results
find ./docs/man -type f -name "*.xml" -delete
find ./docs/man -type f -name "*.asciidoc" -delete
Cleaning up output from test runs
rm -rf test/test_data
Cleaning up RPM building stuff
rm -rf MANIFEST rpm-build
Cleaning up Debian building stuff
rm -rf debian
rm -rf deb-build
python setup.py sdist -t MANIFEST.in
/usr/lib/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running sdist
warning: sdist: manifest template 'MANIFEST.in' does not exist (using default file list)
warning: sdist: standard file not found: should have one of README, README.txt
writing manifest file 'MANIFEST'
creating ansible-0.3.1
creating ansible-0.3.1/bin
creating ansible-0.3.1/lib
creating ansible-0.3.1/lib/ansible
making hard links in ansible-0.3.1...
hard linking setup.py -> ansible-0.3.1
hard linking bin/ansible -> ansible-0.3.1/bin
hard linking bin/ansible-playbook -> ansible-0.3.1/bin
hard linking lib/ansible/__init__.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/callbacks.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/connection.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/constants.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/errors.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/inventory.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/playbook.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/runner.py -> ansible-0.3.1/lib/ansible
hard linking lib/ansible/utils.py -> ansible-0.3.1/lib/ansible
creating dist
tar -cf dist/ansible-0.3.1.tar ansible-0.3.1
gzip -f9 dist/ansible-0.3.1.tar
removing 'ansible-0.3.1' (and everything under it)
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.92254
+ umask 022
+ cd /tmp/ansible-0.3.1/rpm-build
+ cd /tmp/ansible-0.3.1/rpm-build
+ rm -rf ansible-0.3.1
+ /bin/gzip -dc /tmp/ansible-0.3.1/rpm-build/ansible-0.3.1.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd ansible-0.3.1
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.92254
+ umask 022
+ cd /tmp/ansible-0.3.1/rpm-build
+ cd ansible-0.3.1
+ /usr/bin/python setup.py build
/usr/lib/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running build
running build_py
creating build
creating build/lib
creating build/lib/ansible
copying lib/ansible/connection.py -> build/lib/ansible
copying lib/ansible/utils.py -> build/lib/ansible
copying lib/ansible/inventory.py -> build/lib/ansible
copying lib/ansible/playbook.py -> build/lib/ansible
copying lib/ansible/callbacks.py -> build/lib/ansible
copying lib/ansible/errors.py -> build/lib/ansible
copying lib/ansible/runner.py -> build/lib/ansible
copying lib/ansible/__init__.py -> build/lib/ansible
copying lib/ansible/constants.py -> build/lib/ansible
running build_scripts
creating build/scripts-2.4
copying and adjusting bin/ansible -> build/scripts-2.4
copying and adjusting bin/ansible-playbook -> build/scripts-2.4
changing mode of build/scripts-2.4/ansible from 644 to 755
changing mode of build/scripts-2.4/ansible-playbook from 644 to 755
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.92254
+ umask 022
+ cd /tmp/ansible-0.3.1/rpm-build
+ cd ansible-0.3.1
+ /usr/bin/python setup.py install -O1 --root=
/usr/lib/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running build_scripts
running install_lib
creating usr
creating usr/lib
creating usr/lib/python2.4
creating usr/lib/python2.4/site-packages
creating usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/connection.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/utils.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/inventory.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/playbook.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/callbacks.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/errors.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/runner.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/__init__.py -> usr/lib/python2.4/site-packages/ansible
copying build/lib/ansible/constants.py -> usr/lib/python2.4/site-packages/ansible
byte-compiling usr/lib/python2.4/site-packages/ansible/connection.py to connection.pyc
  File "usr/lib/python2.4/site-packages/ansible/connection.py", line 24
    with warnings.catch_warnings():
                ^
SyntaxError: invalid syntax
byte-compiling usr/lib/python2.4/site-packages/ansible/utils.py to utils.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/inventory.py to inventory.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/playbook.py to playbook.pyc
  File "usr/lib/python2.4/site-packages/ansible/playbook.py", line 371
    raise errors.AnsibleError("action is required for each item in tasks: offending task is %s" % name if name else "unknown")
                                                                                                        ^
SyntaxError: invalid syntax
byte-compiling usr/lib/python2.4/site-packages/ansible/callbacks.py to callbacks.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/errors.py to errors.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/runner.py to runner.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/__init__.py to __init__.pyc
byte-compiling usr/lib/python2.4/site-packages/ansible/constants.py to constants.pyc
writing byte-compilation script '/tmp/tmpwk_M97.py'
/usr/bin/python -O /tmp/tmpwk_M97.py
  File "usr/lib/python2.4/site-packages/ansible/connection.py", line 24
    with warnings.catch_warnings():
                ^
SyntaxError: invalid syntax
  File "usr/lib/python2.4/site-packages/ansible/playbook.py", line 371
    raise errors.AnsibleError("action is required for each item in tasks: offending task is %s" % name if name else "unknown")
                                                                                                        ^
SyntaxError: invalid syntax
removing /tmp/tmpwk_M97.py
running install_scripts
creating usr/bin
copying build/scripts-2.4/ansible-playbook -> usr/bin
copying build/scripts-2.4/ansible -> usr/bin
changing mode of usr/bin/ansible-playbook to 755
changing mode of usr/bin/ansible to 755
+ mkdir -p /etc/ansible/
+ cp examples/hosts /etc/ansible/
cp: cannot stat `examples/hosts': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.92254 (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.92254 (%install)
make: *** [rpm] Error 1

0.3.1 is actually packaged in Fedora, so I’m not sure what’s up with what you have here.

That being said, 0.4 will be out most likely tonight, so you probably can just do a “make rpm” from the git checkout of the devel branch if you want and should be good to go.

–Michael

For clarification, you can also find Ansible in EPEL 6.

[1 <text/plain; utf-8 (7bit)>]
0.3.1 is actually packaged in Fedora, so I'm not sure what's up with
what you have here.

This is done on a RHEL5 machine.

That being said, 0.4 will be out most likely *tonight*, so you
probably can just do a "make rpm" from the git checkout of the devel
branch if you want and should be good to go.

I tried the same from a git clone, git checkout 0.3.1 and then copied that tree to the RHEL machine. That gave some other weird results, though.

Now I did try the 0.4 branch, though, and it worked. I was under the impression that it was next Wednesday, and not this one so I thought I'd stay with 0.3.1 instead. Apparently 0.4 was the way to go. Thanks.

-andreas