Skip to content

Commit 3be6afb

Browse files
jonludlamlindig
authored andcommitted
Switch to newer ocaml-rpc library
Signed-off-by: Jon Ludlam <[email protected]>
1 parent d5d3e33 commit 3be6afb

File tree

16 files changed

+58
-64
lines changed

16 files changed

+58
-64
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ocaml/templates/templateLexer.ml
9898
ocaml/templates/templateParser.ml
9999
ocaml/templates/templateParser.mli
100100
ocaml/xapi/storage_impl_test
101-
ocaml/util/version.ml
101+
ocaml/util/xapi_version.ml
102102

103103
stunnel-4.15/Makefile
104104
stunnel-4.15/config.status

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ clean:
9090
omake clean
9191
omake lib-uninstall
9292
rm -rf dist/staging
93-
rm -f .omakedb .omakedb.lock xapi.spec version.ml
93+
rm -f .omakedb .omakedb.lock xapi.spec xapi_version.ml
9494
find -name '*.omc' -delete
9595

9696
.PHONY: otags
@@ -129,7 +129,7 @@ version:
129129
let build_number () = Inventory.lookup ~default:\"$(BUILD_NUMBER)\" \"BUILD_NUMBER\" \n \
130130
let xapi_version_major = $(shell cut -d. -f1 VERSION) \n \
131131
let xapi_version_minor = $(shell cut -d. -f2 VERSION) \n" \
132-
> ocaml/util/version.ml
132+
> ocaml/util/xapi_version.ml
133133

134134
.PHONY: clean
135135
clean:
@@ -146,7 +146,7 @@ srpm: xapi.spec
146146
cp $(JQUERY) $(JQUERY_TREEVIEW) $(RPM_SOURCESDIR)
147147
make -C $(REPO) version
148148
rm -f $(RPM_SOURCESDIR)/xapi-version.patch
149-
(cd $(REPO); diff -u /dev/null ocaml/util/version.ml > $(RPM_SOURCESDIR)/xapi-version.patch) || true
149+
(cd $(REPO); diff -u /dev/null ocaml/util/xapi_version.ml > $(RPM_SOURCESDIR)/xapi-version.patch) || true
150150
rm -f $(RPM_SOURCESDIR)/0001-Workaround-for-NVIDIA-330.patch
151151
cp scripts/0001-Workaround-for-NVIDIA-330.patch $(RPM_SOURCESDIR)/0001-Workaround-for-NVIDIA-330.patch
152152
cp -f xapi.spec $(RPM_SPECSDIR)/

ocaml/database/OMakefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11

22
OCAMLINCLUDES = ../idl/ocaml_backend ../xapi ../idl ../util ../autogen ..
3-
OCAMLPACKS = xml-light2 stdext stunnel http-svr xcp sexpr rpclib uuid gzip xcp-inventory oUnit
4-
#OCAMLPPFLAGS = -pp "camlp4o"
3+
OCAMLPACKS = xml-light2 stdext stunnel http-svr xcp sexpr rpclib uuid gzip xcp-inventory oUnit ppx_sexp_conv ppx_deriving_rpc
4+
#OCAMLPPFLAGS = -pp "camlp4o"
55
#OCAMLDEPFLAGS = -pp "camlp4o"
66

7-
UseCamlp4(rpclib.syntax, db_rpc_common_v2 db_cache_types db_filter_types)
8-
UseCamlp4(sexplib.syntax, schema)
9-
107
OCamlGeneratedFiles(db_filter_parse.ml db_filter_parse.mli db_filter_lex.ml)
118

129
OCamlProgram(unit_test_sql, unit_test_sql)
@@ -19,7 +16,7 @@ BLOCK_DEVICE_IO_FILES = \
1916

2017
OCamlProgram(block_device_io, $(BLOCK_DEVICE_IO_FILES))
2118

22-
DATABASE_SERVER_FILES = database_server_main test_schemas ../autogen/db_actions
19+
DATABASE_SERVER_FILES = database_server_main test_schemas ../autogen/db_actions
2320
DATABASE_TEST_FILES = db_cache_test test_schemas
2421
section:
2522
#XXX there are lots of interdependencies which we should be aim to remove
@@ -43,4 +40,3 @@ sdk-install: install
4340
clean:
4441
rm -f $(CLEAN_OBJS) xenEnterpriseAPI* gen gen.opt db_filter_parse.ml db_filter_parse.mli db_filter_lex.ml
4542
rm -f block_device_io unit_test_marshall block_device_io.opt unit_test_marshall.opt database_test
46-

ocaml/database/db_cache_types.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ type where_record = {
493493
return: string; (** we'd like to return this field... *)
494494
where_field: string; (** where this other field... *)
495495
where_value: string; (** contains this value *)
496-
} with rpc
496+
} [@@deriving rpc]
497497

498498
type structured_op_t =
499499
| AddSet
500500
| RemoveSet
501501
| AddMap
502502
| RemoveMap
503-
with rpc
503+
[@@deriving rpc]

ocaml/database/db_filter_types.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
type _val =
1616
| Field of string
1717
| Literal of string
18-
with rpc
18+
[@@deriving rpc]
1919

2020
(** Represent a predicate: table row -> bool *)
2121
type expr =
@@ -25,4 +25,4 @@ type expr =
2525
| Eq of _val * _val
2626
| And of expr * expr
2727
| Or of expr * expr
28-
with rpc
28+
[@@deriving rpc]

ocaml/database/db_rpc_common_v2.ml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module Request = struct
3333
| Read_record of string * string
3434
| Read_records_where of string * Db_filter_types.expr
3535
| Process_structured_field of (string * string) * string * string * string * Db_cache_types.structured_op_t
36-
with rpc
36+
[@@deriving rpc]
3737
end
3838

3939
module Response = struct
@@ -61,6 +61,5 @@ module Response = struct
6161
| Uniqueness_constraint_violation of string * string * string
6262
| Read_missing_uuid of string * string * string
6363
| Too_many_values of string * string * string
64-
with rpc
64+
[@@deriving rpc]
6565
end
66-

ocaml/database/schema.ml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module Type = struct
1818
| String
1919
| Set (* of strings *)
2020
| Pairs (* of string * string *)
21-
with sexp
21+
[@@deriving sexp]
2222

2323
exception Error of t * t
2424
let _ = Printexc.register_printer (function
@@ -35,7 +35,7 @@ module Value = struct
3535
| String of string
3636
| Set of string list
3737
| Pairs of (string * string) list
38-
with sexp
38+
[@@deriving sexp]
3939

4040
let marshal = function
4141
| String x -> x
@@ -73,33 +73,33 @@ module Column = struct
7373
default: Value.t option; (** if column is missing, this is default value is used *)
7474
ty: Type.t; (** the type of the value in the column *)
7575
issetref: bool; (** only so we can special case set refs in the interface *)
76-
} with sexp
76+
} [@@deriving sexp]
7777
end
7878

7979
module Table = struct
8080
type t = {
8181
name: string;
8282
columns: Column.t list;
8383
persistent: bool;
84-
} with sexp
84+
} [@@deriving sexp]
8585
let find name t = List.find (fun col -> col.Column.name = name) t.columns
8686
end
8787

8888
type relationship =
8989
| OneToMany of string * string * string * string
90-
with sexp
90+
[@@deriving sexp]
9191

9292
module Database = struct
9393
type t = {
9494
tables: Table.t list;
95-
} with sexp
95+
} [@@deriving sexp]
9696

9797
let find name t = List.find (fun tbl -> tbl.Table.name = name) t.tables
9898
end
9999

100100
(** indexed by table name, a list of (this field, foreign table, foreign field) *)
101101
type foreign = (string * string * string) list
102-
with sexp
102+
[@@deriving sexp]
103103

104104
module ForeignMap = struct
105105
include Map.Make(struct
@@ -108,7 +108,7 @@ module ForeignMap = struct
108108
end)
109109

110110
type t' = (string * foreign) list
111-
with sexp
111+
[@@deriving sexp]
112112

113113
type m = foreign t
114114
let sexp_of_m t : Sexplib.Sexp.t =
@@ -127,7 +127,7 @@ type t = {
127127
(** indexed by table name, a list of (this field, foreign table, foreign field) *)
128128
one_to_many: ForeignMap.m;
129129
many_to_many: ForeignMap.m;
130-
} with sexp
130+
} [@@deriving sexp]
131131

132132
let database x = x.database
133133

@@ -170,4 +170,3 @@ let many_to_many tblname schema =
170170
try
171171
ForeignMap.find tblname schema.many_to_many
172172
with Not_found -> []
173-

ocaml/idl/ocaml_backend/OMakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ SERVER_OBJS = ../../database/escaping locking_helpers \
117117
../../xapi/xapi_extensions
118118

119119
XAPI_CLIENT_OBJS = \
120-
../../util/version \
120+
../../util/xapi_version \
121121
../../xapi/xapi_inventory \
122122
../../xapi/xapi_fist \
123123
../../xapi/features \

ocaml/util/OMakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
OCAMLPACKS = http-svr xcp uuid xcp-inventory
22

33
#OCamlLibrary(util_globs_inventory, util_globs_inventory)
4-
OCamlLibrary(version, version)
4+
OCamlLibrary(xapi_version, xapi_version)
55

66
OCamlLibrary(sanitycheck, sanitycheck)
77
OCamlLibrary(stats, stats)
@@ -22,7 +22,7 @@ OCamlLibrary(encodings, encodings)
2222
.PHONY: clean
2323
clean:
2424
rm -f $(CLEAN_OBJS)
25-
rm -f version.ml
25+
rm -f xapi_version.ml
2626

2727
.PHONY: install
2828
install:
File renamed without changes.

0 commit comments

Comments
 (0)