# HG changeset patch # User David Scott # Date 1273789406 -3600 # Node ID 6a5c68b92b8b6e33464aa18986046e4ac1f30160 # Parent 4bde1604fc1795fe826574335f34b5e2c3c75594 Move the generation of ocaml/util/version.ml into the Makefile so that it can be done before the main build. This unbreaks the rpm build since 'hg id' will fail when run in a plain non-repo directory of sources. Signed-off-by: David Scott diff -r 4bde1604fc17 -r 6a5c68b92b8b Makefile --- a/Makefile Thu Apr 29 10:22:35 2010 +0100 +++ b/Makefile Thu May 13 23:23:26 2010 +0100 @@ -20,6 +20,10 @@ .PHONY: phase3 phase3: omake phase3 + +.PHONY: version +version: + omake version .PHONY: api api: all diff -r 4bde1604fc17 -r 6a5c68b92b8b mk/Makefile --- a/mk/Makefile Thu Apr 29 10:22:35 2010 +0100 +++ b/mk/Makefile Thu May 13 23:23:26 2010 +0100 @@ -46,6 +46,7 @@ $(OUTPUT_XAPI) $(OUTPUT_XAPI_DEVEL) $(OUTPUT_CLI_RT) $(OUTPUT_SDK): $(call hg_req,xen-api) $(MY_MAIN_PACKAGES)/.dirstamp $(MAKE) clean + $(MAKE) -C $(REPO) version $(MAKE) -C $(REPO) rm -rf $(STAGING) $(STAGING_CLI_RT) diff -r 4bde1604fc17 -r 6a5c68b92b8b ocaml/util/OMakefile --- a/ocaml/util/OMakefile Thu Apr 29 10:22:35 2010 +0100 +++ b/ocaml/util/OMakefile Thu May 13 23:23:26 2010 +0100 @@ -19,14 +19,14 @@ OCamlLibrary(encodings, encodings) -version.ml: version.template - sed -e "s/@@@HG_ID@@@/$(shell hg id | sed -r 's/(.+)\s.*/\1/g')/" \ - -e "s/@@@HOSTNAME@@@/$(shell hostname)/" \ - -e "s/@@@DATE@@@/$(shell date -u +%Y-%m-%d)/" \ - -e "s/@@@PRODUCT_VERSION@@@/$(PRODUCT_VERSION)/" \ - -e "s/@@@PRODUCT_BRAND@@@/$(PRODUCT_BRAND)/" \ - -e "s/@@@BUILD_NUMBER@@@/$(BUILD_NUMBER)/" \ - < $< > $@ +.PHONY: version +version: + echo "let hg_id = \\"$(shell hg id | sed -r 's/(.+)\s.*/\1/g')\\"" > version.ml + echo "let hostname = \\"$(shell hostname)\\"" >> version.ml + echo "let date = \\"$(shell date -u +%Y-%m-%d)\\"" >> version.ml + echo "let product_version = \\"$(PRODUCT_VERSION)\\"" >> version.ml + echo "let product_brand = \\"$(PRODUCT_BRAND)\\"" >> version.ml + echo "let build_number = \\"$(BUILD_NUMBER)\\"" >> version.ml .PHONY: clean clean: diff -r 4bde1604fc17 -r 6a5c68b92b8b ocaml/util/version.template --- a/ocaml/util/version.template Thu Apr 29 10:22:35 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -let hg_id = "@@@HG_ID@@@" -let hostname = "@@@HOSTNAME@@@" -let date = "@@@DATE@@@" -let product_version = "@@@PRODUCT_VERSION@@@" -let product_brand = "@@@PRODUCT_BRAND@@@" -let build_number = "@@@BUILD_NUMBER@@@"