Browse Source

build: fix spec file and srpm/rpm generation

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Fabio M. Di Nitto 15 years ago
parent
commit
538936fb8a
1 changed files with 18 additions and 7 deletions
  1. 18 7
      Makefile.am

+ 18 - 7
Makefile.am

@@ -94,13 +94,24 @@ $(SPEC): $(SPEC).in
 	git update-index --refresh > /dev/null 2>&1 || true && \
 	git update-index --refresh > /dev/null 2>&1 || true && \
 	dirty=`git diff-index --name-only HEAD 2>/dev/null` && \
 	dirty=`git diff-index --name-only HEAD 2>/dev/null` && \
 	if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
 	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
 	chmod a-w $@-t
 	mv $@-t $@
 	mv $@-t $@