Hi,
Ki-Hyun Sung wrote:
I am trying to create my own Ansible rpm from the tarball. I am on Centos 7, with asciidoc, epel-release and rpmbuild packages installed.
However I get this error when I try to 'make rpm' from the root of the extracted tarball (ansible version 2.4.0.0)
*error: line 10: Illegal char '"' in: Release: 100.git201711240000"".el7.centos*
Just wondering if anyone know what the issue is here?
I am also not familiar with rpm build, or Linux in general - any help would be much appreciated!
It looks like the `make rpm` target is a bit broken by default. I tested in a centos 7 docker container. I needed to install the following packages to build:
asciidoc
epel-release
python2-devel
python2-jinja2
python-jinja2
python-setuptools
python-yaml
rpm-build
And to get around the error you mentioned, I had to pass OFFICIAL=yes to the make command:
make OFFICIAL=yes rpm
Without OFFICIAL=yes, the Makefile uses 100.git$(DATE)$(GITINFO) as the release tag. If git is not installed, it sets
GITINFO ""
If git is installed, then the Makefile sets
GITINFO = .$(GIT_HASH).$(GIT_BRANCH)
And from a tarball, this results in GITINFO = .., which is also invalid in the release tag:
error: line 10: Illegal sequence ".." in: Release: 100.git201711240000...el7.centos
So I'd just build with 'make OFFICIAL=yes rpm'.
The Makefile seems like it needs several fixes to make this work as documented. One is to drop the "" from GITINFO when git is not found:
--- Makefile~ 2017-11-24 03:32:55.848113798 +0000
+++ Makefile 2017-11-24 03:33:12.178749893 +0000
@@ -45,7 +45,7 @@
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/[-_.\/]//g')
GITINFO = .$(GIT_HASH).$(GIT_BRANCH)
else
-GITINFO = ""
+GITINFO =
endif
ifeq ($(shell echo $(OS) | egrep -c 'Darwin|FreeBSD|OpenBSD|DragonFly'),1)
Fixing things if git is installed and 'make rpm' is run from a tarball is more work than I'm looking to do tonight. It should likely test whether .git exists and/or that both GIT_HASH and GIT_BRANCH are not empty before using them to set GITNFO.