[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH] [packaging] make a xapi-client library usable with ocmalfind.
# HG changeset patch # User Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx> [packaging] make a xapi-client library usable with ocmalfind. Signed-off-by: Thomas Gazagnaire <thomas.gazagnaire@xxxxxxxxxx> diff -r 1224932ff7ea Makefile --- a/Makefile Tue Nov 03 16:58:38 2009 +0000 +++ b/Makefile Fri Nov 06 15:29:36 2009 +0000 @@ -13,6 +13,8 @@ all: omake ocaml/util/version.ml omake phase1 phase2 + omake lib-uninstall + omake lib-install omake phase3 .PHONY: phase3 @@ -39,6 +41,14 @@ install: omake install +.PHONY: lib-install +lib-install: + omake DESTDIR=$(DESTDIR) lib-install + +.PHONY: lib-uninstall +lib-uninstall: + omake lib-uninstall + .PHONY: sdk-install sdk-install: omake sdk-install @@ -50,6 +60,7 @@ .PHONY: clean clean: omake clean + omake lib-uninstall rm -rf dist/staging rm -f .omakedb .omakedb.lock diff -r 1224932ff7ea OMakefile --- a/OMakefile Tue Nov 03 16:58:38 2009 +0000 +++ b/OMakefile Fri Nov 06 15:29:36 2009 +0000 @@ -82,7 +82,7 @@ # Ocaml ############################################################################# OCAML_PHASE1= -OCAML_PHASE2= autogen_idl +OCAML_PHASE2= autogen_idl ocaml/idl/ocaml_backend/xapi_client.cmxa # JS ################################################################################ JS_PHASE1= @@ -124,7 +124,6 @@ ocaml/license/v6d-reopen-logs OCAML_PHASE3_NOXEN = \ - ocaml/fdhelper/closeandexec \ ocaml/auth/testauthx \ ocaml/xe-cli/xe \ ocaml/xsh/xsh \ diff -r 1224932ff7ea mk/Makefile --- a/mk/Makefile Tue Nov 03 16:58:38 2009 +0000 +++ b/mk/Makefile Fri Nov 06 15:29:36 2009 +0000 @@ -5,67 +5,70 @@ include $(B_BASE)/common.mk include $(B_BASE)/rpmbuild.mk -OUTPUT_PKG := $(MY_MAIN_PACKAGES)/xapi.tar.bz2 -OUTPUT_XAPI := $(MY_OUTPUT_DIR)/xapi -OUTPUT_CLI := $(MY_OUTPUT_DIR)/xe -OUTPUT_CLI_RT := $(MY_OUTPUT_DIR)/cli-regress.tar.gz -OUTPUT_CLI_RT_GENEVA := $(MY_OUTPUT_DIR)/cli-regress-geneva.tar.gz -OUTPUT_FAKESERVER := $(MY_OUTPUT_DIR)/fakeserver.tar.bz2 -OUTPUT_DOCS := $(MY_OUTPUT_DIR)/sdkiso -OUTPUT_WEBZIP := $(MY_OUTPUT_DIR)/sdk-html.zip -OUTPUT_SRC := $(MY_OUTPUT_DIR)/xen-api-src.tar.bz2 -OUTPUT_PATCH := $(MY_OUTPUT_DIR)/testpatch.asc -OUTPUT_DATAMODEL_DIR := $(MY_OUTPUT_DIR)/datamodel +REPO = $(call hg_loc,xen-api) -CLI_RPM_SOURCES := -CLI_RPM_SOURCES += $(RPM_SOURCESDIR)/xe -CLI_RPM_SOURCES += $(RPM_SOURCESDIR)/bash-completion +STAGING = $(REPO)/dist/staging +OUTPUT_XAPI = $(MY_MAIN_PACKAGES)/xapi.tar.bz2 +OUTPUT_XAPI_DEVEL = $(MY_OUTPUT_DIR)/xapi-devel.tar.gz +OUTPUT_XAPI_SRC = $(MY_SOURCES)/xen-api-src.tar.bz2 -JQUERY_PACK_DIST=$(CARBON_DISTFILES)/javascript/jquery/jquery-1.1.3.1.pack.js -JQUERY_TV_DIST=$(CARBON_DISTFILES)/javascript/jquery/treeview/jquery.treeview.zip +STAGING_CLI_RT = $(REPO)/dist/cli-rt +OUTPUT_CLI_RT = $(MY_OUTPUT_DIR)/cli-regress.tar.gz +OUTPUT_CLI_RPM_SOURCES = $(RPM_SOURCESDIR)/xe $(RPM_SOURCESDIR)/bash-completion + +OUTPUT_DOCS = $(MY_OUTPUT_DIR)/sdkiso +OUTPUT_WEBZIP = $(MY_OUTPUT_DIR)/sdk-html.zip + +JQUERY_PACK_DIST = $(CARBON_DISTFILES)/javascript/jquery/jquery-1.1.3.1.pack.js +JQUERY_TV_DIST = $(CARBON_DISTFILES)/javascript/jquery/treeview/jquery.treeview.zip + +OUTPUT_P2V_DIR = $(MY_OUTPUT_DIR) +OUTPUT_DATAMODEL_DIR = $(MY_OUTPUT_DIR)/datamodel + +OUTPUT_SDK_DIR = $(MY_OUTPUT_DIR) +OUTPUT_SDK = $(MY_OUTPUT_DIR)/sdk.tar.gz export BUILD_NUMBER export PRODUCT_BRAND export PRODUCT_VERSION -REPO=$(call hg_loc,xen-api) - .PHONY: build -build: $(OUTPUT_PKG) $(MY_OBJ_DIR)/.rpmbuild.cli.stamp $(MY_SOURCES)/MANIFEST +build: $(OUTPUT_XAPI) $(OUTPUT_XAPI_DEVEL) $(OUTPUT_CLI_RT) $(MY_OBJ_DIR)/.rpmbuild.cli.stamp $(MY_SOURCES)/MANIFEST $(call mkdir_clean,$(MY_LINUX_CDFILES)/client_install) install -m 755 -o root -g root $(RPM_RPMSDIR)/i386/xe-cli-*.rpm $(MY_LINUX_CDFILES)/client_install/ -$(MY_SOURCES)/MANIFEST: $(MY_SOURCES_DIRSTAMP) $(OUTPUT_SRC) - echo api gpl+lgpl-with-linking-exception file $(OUTPUT_SRC) > $@ +$(MY_SOURCES)/MANIFEST: $(MY_SOURCES_DIRSTAMP) $(OUTPUT_XAPI_SRC) + echo api gpl+lgpl-with-linking-exception file $(OUTPUT_XAPI_SRC) > $@ echo api gpl file $(JQUERY_PACK_DIST) >> $@ echo api gpl file $(JQUERY_TV_DIST) >> $@ -$(OUTPUT_SRC): +$(OUTPUT_XAPI_SRC): cd $(REPO) && hg archive -t tbz2 $(HG_EXCLUDE) $@ -$(OUTPUT_PKG) $(OUTPUT_FAKESERVER) $(OUTPUT_XAPI) $(OUTPUT_CLI): $(call hg_req,xen-api) $(MY_MAIN_PACKAGES)/.dirstamp - rm -rf $(REPO)/dist +$(OUTPUT_XAPI) $(OUTPUT_XAPI_DEVEL) $(OUTPUT_CLI_RT): $(call hg_req,xen-api) $(MY_MAIN_PACKAGES)/.dirstamp $(MAKE) clean $(MAKE) -C $(REPO) - install -m 755 -o root -g root $(REPO)/ocaml/p2v/p2v $(MY_OUTPUT_DIR)/p2v-server - install -m 755 -o root -g root $(REPO)/ocaml/p2v/closeandexec_static $(MY_OUTPUT_DIR)/closeandexec_static + + rm -rf $(STAGING) $(STAGING_CLI_RT) $(MAKE) -C $(REPO) install - mkdir -p $(REPO)/dist/staging/var/xapi - mkdir -p $(REPO)/dist/staging/var/log/xen - mkdir -p $(REPO)/dist/staging/var/opt/xen/iso_import - cp $(REPO)/dist/staging/opt/xensource/bin/xapi $(OUTPUT_XAPI) - tar -C $(REPO)/dist/staging -jcf $(OUTPUT_PKG) . - tar -C $(REPO)/dist/cli-rt -zcf $(OUTPUT_CLI_RT) . - tar -C $(REPO)/dist/cli-regress-geneva -zcf $(OUTPUT_CLI_RT_GENEVA) . - install -m 755 -o root -g root $(REPO)/dist/staging/opt/xensource/bin/xe $(MY_OUTPUT_DIR)/xe - rm -rf $(REPO)/dist + mkdir -p $(MY_MAIN_PACKAGES) + tar -C $(STAGING) -jcf $(OUTPUT_XAPI) . + mkdir -p $(MY_OUTPUT_DIR) + tar -C $(STAGING_CLI_RT) -zcf $(OUTPUT_CLI_RT) . + + rm -rf $(STAGING) + $(MAKE) -C $(REPO) DESTDIR=$(STAGING) lib-install + tar -C $(STAGING) -zcf $(OUTPUT_XAPI_DEVEL) . + + rm -rf $(STAGING) $(MAKE) -C $(REPO) sdk-install $(call mkdir_clean,$(OUTPUT_DOCS)) - cp $(REPO)/dist/staging/SDK/README.html $(OUTPUT_DOCS)/ - cp -a $(REPO)/dist/staging/SDK/docs $(OUTPUT_DOCS)/ - cd $(REPO)/dist/staging/SDKwww && zip -9rv $(OUTPUT_WEBZIP) . - tar -C $(REPO)/dist/staging --exclude=etc/xensource/license -jcf $(OUTPUT_FAKESERVER) . - install -m 644 -o root -g root $(REPO)/ocaml/xe-cli/rt/geneva/testpatch.asc $(OUTPUT_PATCH) + cp $(STAGING)/SDK/README.html $(OUTPUT_DOCS)/ + cp -a $(STAGING)/SDK/docs $(OUTPUT_DOCS)/ + cd $(STAGING)/SDKwww && zip -9rv $(OUTPUT_WEBZIP) . + mkdir -p $(OUTPUT_SDK_DIR) + tar -C $(STAGING) -zcf $(OUTPUT_SDK) . + rm -rf $(OUTPUT_DATAMODEL_DIR) mkdir -p $(OUTPUT_DATAMODEL_DIR) install -m 644 -o root -g root $(REPO)/ocaml/idl/datamodel.a $(OUTPUT_DATAMODEL_DIR) @@ -76,7 +79,11 @@ install -m 644 -o root -g root $(REPO)/ocaml/idl/dm_api.cmi $(OUTPUT_DATAMODEL_DIR) install -m 644 -o root -g root $(REPO)/ocaml/idl/api_messages.cmi $(OUTPUT_DATAMODEL_DIR) -$(RPM_SOURCESDIR)/xe: $(OUTPUT_CLI) + mkdir -p $(OUTPUT_P2V_DIR) + install -m 755 -o root -g root $(REPO)/ocaml/p2v/p2v $(OUTPUT_P2V_DIR)/p2v-server + install -m 755 -o root -g root $(REPO)/ocaml/p2v/closeandexec_static $(OUTPUT_P2V_DIR)/closeandexec_static + +$(RPM_SOURCESDIR)/xe: $(REPO)/ocaml/xe-cli/xe mkdir -p $(RPM_SOURCESDIR) cp $< $@ @@ -88,11 +95,12 @@ mkdir -p $(RPM_SPECSDIR) $(call brand,xe.spec.in) > $@ -$(MY_OBJ_DIR)/.rpmbuild.cli.stamp: $(RPM_DIRECTORIES) $(RPM_SPECSDIR)/xe.spec $(CLI_RPM_SOURCES) +$(MY_OBJ_DIR)/.rpmbuild.cli.stamp: $(RPM_DIRECTORIES) $(RPM_SPECSDIR)/xe.spec $(OUTPUT_CLI_RPM_SOURCES) $(RPMBUILD) --target i386 -ba $(RPM_SPECSDIR)/xe.spec touch $@ .PHONY: clean clean: - rm -f $(OUTPUT_PKG) $(OUTPUT_FAKESERVER) $(OUTPUT_CLI) $(OUTPUT_WEBZIP) $(OUTPUT_SRC) + rm -f $(OUTPUT_XAPI) $(OUTPUT_XAPI_DEVEL) $(OUTPUT_XAPI_SRC) $(OUTPUT_CLI_RT) $(OUTPUT_WEBZIP) + rm -rf $(OUTPUT_DATAMODEL_DIR) $(OUTPUT_P2V_DIR) $(OUTPUT_DOCS) $(MAKE) -C $(REPO) clean diff -r 1224932ff7ea ocaml/OMakefile --- a/ocaml/OMakefile Tue Nov 03 16:58:38 2009 +0000 +++ b/ocaml/OMakefile Fri Nov 06 15:29:36 2009 +0000 @@ -5,7 +5,6 @@ OCAMLPACKS = stdext log .SUBDIRS: \ - fdhelper \ autogen \ xe-cli \ xapimon \ diff -r 1224932ff7ea ocaml/fdhelper/OMakefile --- a/ocaml/fdhelper/OMakefile Tue Nov 03 16:58:38 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ - -# Don't link with threads -OCAMLPACKS = stdext - -section: - OCAMLFLAGS += -cclib -static - OCamlProgram(closeandexec_static, closeandexec) - -OCamlProgram(closeandexec, closeandexec) - -.PHONY: install -install: - mkdir -p $(LIBEXEC) - $(IPROG) closeandexec $(LIBEXEC) - -.PHONY: sdk-install -sdk-install: install - -.PHONY: clean -clean: - rm -rf $(CLEAN_OBJS) *.aux *.log *.fig closeandexec diff -r 1224932ff7ea ocaml/fdhelper/closeandexec.ml --- a/ocaml/fdhelper/closeandexec.ml Tue Nov 03 16:58:38 2009 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -(* - * Copyright (C) 2006-2009 Citrix Systems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; version 2.1 only. with the special - * exception on linking described in file LICENSE. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - *) - -(** Take a list of file descriptors, a program and a set of arguments. Close - all fds except the set provided and then exec the supplied program. *) - - -let usage () = - Printf.printf "Usage:\n"; - Printf.printf " %s fd0 .. fdN -- argv0 .. argvN\n" Sys.argv.(0); - exit 1 - -let _ = - let fds = ref [] in - let args = ref [] in - let found_dash = ref false in - for i = 1 to Array.length(Sys.argv) - 1 do - let x = Sys.argv.(i) in - if x = "--" - then found_dash := true - else if !found_dash then args := x :: !args else fds := x :: !fds - done; - let fds = List.map (fun x -> Unixext.file_descr_of_int (int_of_string x)) !fds in - let args = List.rev !args in - - if List.length args < 1 then usage(); - - Unixext.close_all_fds_except fds; - let cmd = List.hd args in - (* CA-18955: xapi now runs with priority -3. We then set his sons priority to 0. *) - Unix.nice (-(Unix.nice 0)); - - let rec doit n = - if n=0 then failwith "Max retries exceeded"; - try - Unix.execv cmd (Array.of_list args) - with - | Unix.Unix_error (Unix.EUNKNOWNERR x,b,c) as e -> - Printf.fprintf stderr "Unix error: %s (%s,%s)\n" (Unix.error_message (Unix.EUNKNOWNERR x)) b c; - if x=26 (* ETXTBSY *) then - (Thread.delay 1.0; doit (n-1)) else raise e - | Unix.Unix_error (a,b,c) as e -> - Printf.fprintf stderr "Unix error: %s (%s,%s)\n" (Unix.error_message a) b c; - raise e - in - doit 5 diff -r 1224932ff7ea ocaml/idl/ocaml_backend/META.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ocaml/idl/ocaml_backend/META.in Fri Nov 06 15:29:36 2009 +0000 @@ -0,0 +1,4 @@ +version = "@VERSION@" +description = "XenAPI client bindings for OCaml" +requires = "xml-light2,stdext,stunnel,http-svr,log" +archive(native) = "xapi_client.cmxa" diff -r 1224932ff7ea ocaml/idl/ocaml_backend/OMakefile --- a/ocaml/idl/ocaml_backend/OMakefile Tue Nov 03 16:58:38 2009 +0000 +++ b/ocaml/idl/ocaml_backend/OMakefile Fri Nov 06 15:29:37 2009 +0000 @@ -19,25 +19,25 @@ FILTER = closed # or opensource or closed or debug or implementation -$(AUTOGEN_DIR)/client.ml: gen_api_main +$(AUTOGEN_DIR)/client.ml: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal true -filter $(FILTER) -mode client > $(AUTOGEN_DIR)/client.ml $(AUTOGEN_DIR)/aPI.ml: gen_api_main ./gen_api_main -filterinternal true -filter $(FILTER) -mode api > $(AUTOGEN_DIR)/aPI.ml -$(AUTOGEN_DIR)/server.ml: gen_api_main +$(AUTOGEN_DIR)/server.ml: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal true -gendebug -filter $(FILTER) -mode server > $(AUTOGEN_DIR)/server.ml -$(AUTOGEN_DIR)/db_actions.ml: gen_api_main +$(AUTOGEN_DIR)/db_actions.ml: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal false -filter nothing -mode db > $(AUTOGEN_DIR)/db_actions.ml # note: we do not filter internal fields/messages here -$(AUTOGEN_DIR)/custom_actions.ml: gen_api_main +$(AUTOGEN_DIR)/custom_actions.ml: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal true -filter $(FILTER) -mode actions > $(AUTOGEN_DIR)/custom_actions.ml -$(AUTOGEN_DIR)/rbac_static.ml: gen_api_main +$(AUTOGEN_DIR)/rbac_static.ml: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal true -filter $(FILTER) -mode rbac > $(AUTOGEN_DIR)/rbac_static.ml -$(AUTOGEN_DIR)/rbac_static.csv: gen_api_main +$(AUTOGEN_DIR)/rbac_static.csv: gen_api_main $(AUTOGEN_DIR)/aPI.ml ./gen_api_main -filterinternal true -gendebug -filter $(FILTER) -mode rbac > $(AUTOGEN_DIR)/rbac_static.csv .PHONY:autogen_idl @@ -104,12 +104,18 @@ ../../xapi/helper_process \ ../../xapi/xmlrpc_sexpr +XAPI_CLIENT_OBJS = \ + ../../util/version \ + $(COMMON_OBJS) \ + $(CLIENT_OBJS) + _OCAMLPACKS = $(OCAMLPACKS) OCAMLPACKS = OCamlLibrary(common, $(COMMON_OBJS)) OCamlLibrary(client, $(CLIENT_OBJS)) OCamlLibrary(server, $(SERVER_OBJS)) +OCamlLibrary(xapi_client, $(XAPI_CLIENT_OBJS)) OCamlLibrary(htmldoc, htmldoc) @@ -122,3 +128,22 @@ .PHONY: clean clean: rm -f *~ *.opt *.run *.a *.cma *.cmxa *.cmo *.cmi *.o *.cmx *.omc *.annot doc/* xmlrpc_doc/* aPI.ml client.ml server.ml rbac_static.ml rbac_static.csv gen_api gen_api.run gen_api.opt write_out_api write_out_client write_out_db_actions write_out_server gen_api_main + +.PHONY: lib-install +META: META.in + sed 's/@VERSION@/$(PRODUCT_VERSION)/g' < $< > $@ + +if $(defined DESTDIR) + INSTALL_PATH = $(DESTDIR)/$(shell ocamlfind printconf destdir) + export +else + INSTALL_PATH = $(shell ocamlfind printconf destdir) + export + +lib-install: META + mkdir -p $(INSTALL_PATH) + ocamlfind install -destdir $(INSTALL_PATH) -ldconf ignore xapi-client META xapi_client.{cmxa,a} $(addsuffixes .cmi .cmx, $(XAPI_CLIENT_OBJS)) + +.PHONY: lib-uninstall +lib-uninstall: + ocamlfind remove xapi-client Attachment:
api-make-a-xapi-client-library _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |