From c835c88f734aa06b2c8fa42fac3cbf5a5c1d66a1 Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Wed, 10 Nov 2010 17:31:36 +0100 Subject: [PATCH] build: fix spec file and srpm/rpm generation Signed-off-by: Fabio M. Di Nitto Reviewed-by: Steven Dake --- Makefile.am | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6d9e009e..fc7a4f19 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,13 +114,24 @@ $(SPEC): $(SPEC).in git update-index --refresh > /dev/null 2>&1 || true && \ dirty=`git diff-index --name-only HEAD 2>/dev/null` && \ if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \ - sed \ - -e "s#@version@#$$rpmver#g" \ - -e "s#@alphatag@#$$alphatag#g" \ - -e "s#@numcomm@#$$numcomm#g" \ - -e "s#@dirty@#$$dirty#g" \ - -e "s#@date@#$$date#g" \ - $< > $@-t + if [ "$$numcomm" = "0" ]; then \ + sed \ + -e "s#@version@#$$rpmver#g" \ + -e "s#%glo.*alpha.*##g" \ + -e "s#%glo.*numcomm.*##g" \ + -e "s#@dirty@#$$dirty#g" \ + -e "s#@date@#$$date#g" \ + $< > $@-t; \ + else \ + sed \ + -e "s#@version@#$$rpmver#g" \ + -e "s#@alphatag@#$$alphatag#g" \ + -e "s#@numcomm@#$$numcomm#g" \ + -e "s#@dirty@#$$dirty#g" \ + -e "s#@date@#$$date#g" \ + $< > $@-t; \ + fi; \ + if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi chmod a-w $@-t mv $@-t $@