git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] rpmbuild doesn't like '-' in version strings

From
JEJohn Ellson <ellson@research.att.com>
Date
Dec 30, 2005, 17:29 UTC
Message-ID
<dp3qpb$7uk$1@sea.gmane.org>
Problem:
	ellson@ellson:git> make rpm
	GIT_VERSION = 1.0.6-g58e3
	sed -e 's/@@VERSION@@/1.0.6-g58e3/g' < git.spec.in > git.spec
	./git-tar-tree HEAD git-1.0.6-g58e3 > git-1.0.6-g58e3.tar
	tar rf git-1.0.6-g58e3.tar git-1.0.6-g58e3/git.spec
	gzip -f -9 git-1.0.6-g58e3.tar
	rpmbuild -ta git-1.0.6-g58e3.tar.gz
	error: line 3: Illegal char '-' in version: Version:    1.0.6-g58e3
	make: *** [rpm] Error 1
Suggested fix:  Use '_' instead of '-'
There is probably a cleaner implementation of the fix, but this works for me.
----------------------------------------
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 845b9dc..e4e0ab1 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -3,7 +3,9 @@
  GVF=GIT-VERSION-FILE

  VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT
-VN=$(expr "$VN" : v'\(.*\)')
+VN1=$(expr "$VN" : '[^-]*-\(.*\)')
+VN=$(expr "$VN" : v'\([^-]*\)')
+test "$VN1" = "" || VN="$VN"_"$VN1"
  if test -r $GVF
  then
         VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)


--------------------------------------------


Signed-off-by: John Ellson <ellson@research.att.com>
Next: Junio C Hamano
Message 1 of 11 in “rpmbuild doesn't like '-' in version strings”
  1. rpmbuild doesn't like '-' in version stringsJohn Ellson, Dec 30, 2005
  2. Junio C HamanoJan 6, 2006
  3. Andreas EricssonJan 7, 2006
  4. Johannes SchindelinJan 7, 2006
  5. Ryan AndersonJan 7, 2006
  6. John EllsonJan 14, 2006
  7. Linus TorvaldsJan 14, 2006
  8. Junio C HamanoJan 14, 2006
  9. John EllsonJan 14, 2006
  10. Junio C HamanoJan 14, 2006
  11. Junio C HamanoJan 16, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.