rpmbuild of ansible tarball results in error: line 9: Illegal char '$' in: Version: $VERSION

Hi

I’m not experienced in RPMbuilds so I may simply be doing this wrong

I have downloaded both ansible-latest.tr.gz and ansible-2.0.2.0-0.3.rc3.tar.gz from http://releases.ansible.com/ansible/

I have tried to build an RPM using rpmbuild -ta for both files and both result in the error: line 9: Illegal char ‘$’ in: Version: $VERSION

I have never tried this before so I don’t know if I am simply doing this the wrong way or if there is a problem in the tarball

Centos 7

thanks
Paul

Looks like the macros ($VERSION) do not get filled in. Do you need to
run automake or configure or similar in the source directory (unpacked
tarball) before that?

Is there no rpm of the version you would like to have?

The opensuse build service has a package for RHEL7, but it seems
broken atm:
https://build.opensuse.org/package/show/systemsmanagement/ansible

But maybe you can take a look at how it is packaged there...

Johannes

I built a version of ansible for CentOS_7 on the opensuse
buildservice, if you want to give it a try:

http://download.opensuse.org/repositories/home:/ojkastl_buildservice:/CentOS_Zeug/CentOS_7/

Johannes

For reference:
make rpm

Hi Johannes

I get this error when building from the tarball (ansible version 2.4.0.0), also on Centos 7

error: line 10: Illegal char ‘"’ in: Release: 100.git201711240000"".el7.centos

Just wondering if you ran into a similar issue? Googling that error message presents me with just two search results!
One of which is this forum.

Basically I have installed epel-release, asciidoc and rpmbuild packages.
Then extracted the tarball, cd into the root of it, and ran make rpm.

That is when I hit that issue.

I am also not familiar with rpm build, or Linux in general - any help would be much appreciated!

-Darren

This looks like you aren’t getting the tarballs from the official source: https://releases.ansible.com/ansible/

Note that we also are building nightly rpms (repositories for centos and fedora). Look in https://releases.ansible.com/ansible/rpm

-Toshio

Toshio Kuratomi wrote:

This looks like you aren't getting the tarballs from the official source:
https://releases.ansible.com/ansible/

This still happens with the offical tarballs. The 'make rpm' target does not work as documented due to numerous issues, which I tried to document in my reply last night.

Why the OP isn't using the officially provided rpm packages is another question, of course. But the documentation does tell users that 'make rpm' should work from both a git clone and a tarball.

    http://docs.ansible.com/ansible/latest/intro_installation.html#latest-release-via-yum

    "You can also build an RPM yourself. From the
    root of a checkout or tarball, use the make rpm
    command to build an RPM you can distribute and
    install."

If you try that with 2.0.2.0-0.3.rc3 as the OP in this thread, 2.4.0.0 as the poster you replied to, or even with 2.4.1.0, it fails.

I don't get the error mentioned in the subject, but I wouldn't be surprised to find that system differences could tickle the Makefile to produce a bogus string in the version tag as opposed to the broken release tag that is easily reproducible:

# yum -d0 -e0 install -y epel-release
# yum -d0 -e0 install -y asciidoc python2-devel python-jinja2 python-setuptools python-yaml rpm-build
# useradd rpmbuild
# su -l rpmbuild
$ curl -s -O https://releases.ansible.com/ansible/ansible-2.0.2.0-0.3.rc3.tar.gz
$ tar -xf ansible-2.0.2.0-0.3.rc3.tar.gz
$ cd ansible-2.0.2.0/
$ make rpm
...
error: line 10: Illegal char '"' in: Release: 0.git201711240000"".el7.centos
make: *** [rpm] Error 1

Without passing OFFICIAL=yes to make rpm, the process can't work. I put more details in an earlier reply to another thread, here:

    https://groups.google.com/forum/#!topic/ansible-project/NTmpFBEr9Rg

I poked a little to see about fixing this, but it requires more than just fixing the GITINFO var and I didn't have the time to untangle things and submit a properly tested patch.

Basically, the Makefile assumes that if git is installed, you must be in a git clone rather than a tarball. That's clearly a faulty assumption. Fixing it requires a number of changes to the logic to ensure that the required variables are set appropriately for either a git clone or a tarball build.