Skip to content

Commit e6d3f41

Browse files
authored
Merge pull request #132 from robhoes/transform
Add v6 interface
2 parents 8ef6624 + b670dd8 commit e6d3f41

File tree

9 files changed

+207
-218
lines changed

9 files changed

+207
-218
lines changed

_oasis

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ Library xcp_memory
6262
Modules: Memory_interface, Memory_client
6363
BuildDepends: xcp, threads, rpclib, rpclib.syntax
6464

65+
Library xapi_v6
66+
CompiledObject: best
67+
Path: v6
68+
Findlibname: v6
69+
Findlibparent: xcp
70+
Modules: V6_interface, V6_client
71+
BuildDepends: xcp, threads, rpclib, rpclib.syntax
72+
6573
Executable channel_helper
6674
CompiledObject: best
6775
Path: lib

_tags

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 81cad0ff981440e9ded0e9f52c8ea879)
2+
# DO NOT EDIT (digest: 2a0befa551f398e32c56a759b1351c69)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -158,6 +158,26 @@ true: annot, bin_annot
158158
<memory/*.ml{,i,y}>: pkg_xcp-inventory
159159
<memory/*.ml{,i,y}>: pkg_xmlm
160160
<memory/*.ml{,i,y}>: use_xcp
161+
# Library xapi_v6
162+
"v6/xapi_v6.cmxs": use_xapi_v6
163+
<v6/*.ml{,i,y}>: pkg_cmdliner
164+
<v6/*.ml{,i,y}>: pkg_cohttp
165+
<v6/*.ml{,i,y}>: pkg_fd-send-recv
166+
<v6/*.ml{,i,y}>: pkg_message_switch
167+
<v6/*.ml{,i,y}>: pkg_message_switch.unix
168+
<v6/*.ml{,i,y}>: pkg_re
169+
<v6/*.ml{,i,y}>: pkg_rpclib
170+
<v6/*.ml{,i,y}>: pkg_rpclib.syntax
171+
<v6/*.ml{,i,y}>: pkg_rpclib.xml
172+
<v6/*.ml{,i,y}>: pkg_sexplib
173+
<v6/*.ml{,i,y}>: pkg_sexplib.syntax
174+
<v6/*.ml{,i,y}>: pkg_threads
175+
<v6/*.ml{,i,y}>: pkg_unix
176+
<v6/*.ml{,i,y}>: pkg_uri
177+
<v6/*.ml{,i,y}>: pkg_xapi-backtrace
178+
<v6/*.ml{,i,y}>: pkg_xcp-inventory
179+
<v6/*.ml{,i,y}>: pkg_xmlm
180+
<v6/*.ml{,i,y}>: use_xcp
161181
# Executable channel_helper
162182
<lib/channel_helper.{native,byte}>: pkg_cmdliner
163183
<lib/channel_helper.{native,byte}>: pkg_cohttp
@@ -301,5 +321,6 @@ true: annot, bin_annot
301321
<network/network_interface.ml>: pkg_rpclib.idl
302322
<rrd/data_source.ml>: pkg_rpclib.idl
303323
<rrd/rrd_interface.ml>: pkg_rpclib.idl
324+
<v6/v6_interface.ml>: pkg_rpclib.idl
304325
<lib/xcp_channel.ml>: pkg_rpclib.syntax
305326
<lib/channel_helper.ml>: pkg_lwt.syntax

lib/META

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: d0b737f17a49130e1b0fc0d82c3f4307)
2+
# DO NOT EDIT (digest: 4c2fff058ec9d19d5bacfab9163ebe98)
33
version = "1.2.0"
44
description =
55
"Interface definitions and common boilerplate for the xapi toolstack"
@@ -22,6 +22,18 @@ package "xen" (
2222
exists_if = "xcp_xen.cma"
2323
)
2424

25+
package "v6" (
26+
version = "1.2.0"
27+
description =
28+
"Interface definitions and common boilerplate for the xapi toolstack"
29+
requires = "xcp threads rpclib rpclib.syntax"
30+
archive(byte) = "xapi_v6.cma"
31+
archive(byte, plugin) = "xapi_v6.cma"
32+
archive(native) = "xapi_v6.cmxa"
33+
archive(native, plugin) = "xapi_v6.cmxs"
34+
exists_if = "xapi_v6.cma"
35+
)
36+
2537
package "storage" (
2638
version = "1.2.0"
2739
description =

myocamlbuild.ml

Lines changed: 10 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(* OASIS_START *)
2-
(* DO NOT EDIT (digest: 4f11ff746aff43b8a7f3260b62d4b8d4) *)
2+
(* DO NOT EDIT (digest: 1c35a77ee4b7460c9a976af0c323b7ea) *)
33
module OASISGettext = struct
44
(* # 22 "src/oasis/OASISGettext.ml" *)
55

@@ -29,166 +29,6 @@ module OASISGettext = struct
2929

3030
end
3131

32-
module OASISString = struct
33-
(* # 22 "src/oasis/OASISString.ml" *)
34-
35-
36-
(** Various string utilities.
37-
38-
Mostly inspired by extlib and batteries ExtString and BatString libraries.
39-
40-
@author Sylvain Le Gall
41-
*)
42-
43-
44-
let nsplitf str f =
45-
if str = "" then
46-
[]
47-
else
48-
let buf = Buffer.create 13 in
49-
let lst = ref [] in
50-
let push () =
51-
lst := Buffer.contents buf :: !lst;
52-
Buffer.clear buf
53-
in
54-
let str_len = String.length str in
55-
for i = 0 to str_len - 1 do
56-
if f str.[i] then
57-
push ()
58-
else
59-
Buffer.add_char buf str.[i]
60-
done;
61-
push ();
62-
List.rev !lst
63-
64-
65-
(** [nsplit c s] Split the string [s] at char [c]. It doesn't include the
66-
separator.
67-
*)
68-
let nsplit str c =
69-
nsplitf str ((=) c)
70-
71-
72-
let find ~what ?(offset=0) str =
73-
let what_idx = ref 0 in
74-
let str_idx = ref offset in
75-
while !str_idx < String.length str &&
76-
!what_idx < String.length what do
77-
if str.[!str_idx] = what.[!what_idx] then
78-
incr what_idx
79-
else
80-
what_idx := 0;
81-
incr str_idx
82-
done;
83-
if !what_idx <> String.length what then
84-
raise Not_found
85-
else
86-
!str_idx - !what_idx
87-
88-
89-
let sub_start str len =
90-
let str_len = String.length str in
91-
if len >= str_len then
92-
""
93-
else
94-
String.sub str len (str_len - len)
95-
96-
97-
let sub_end ?(offset=0) str len =
98-
let str_len = String.length str in
99-
if len >= str_len then
100-
""
101-
else
102-
String.sub str 0 (str_len - len)
103-
104-
105-
let starts_with ~what ?(offset=0) str =
106-
let what_idx = ref 0 in
107-
let str_idx = ref offset in
108-
let ok = ref true in
109-
while !ok &&
110-
!str_idx < String.length str &&
111-
!what_idx < String.length what do
112-
if str.[!str_idx] = what.[!what_idx] then
113-
incr what_idx
114-
else
115-
ok := false;
116-
incr str_idx
117-
done;
118-
if !what_idx = String.length what then
119-
true
120-
else
121-
false
122-
123-
124-
let strip_starts_with ~what str =
125-
if starts_with ~what str then
126-
sub_start str (String.length what)
127-
else
128-
raise Not_found
129-
130-
131-
let ends_with ~what ?(offset=0) str =
132-
let what_idx = ref ((String.length what) - 1) in
133-
let str_idx = ref ((String.length str) - 1) in
134-
let ok = ref true in
135-
while !ok &&
136-
offset <= !str_idx &&
137-
0 <= !what_idx do
138-
if str.[!str_idx] = what.[!what_idx] then
139-
decr what_idx
140-
else
141-
ok := false;
142-
decr str_idx
143-
done;
144-
if !what_idx = -1 then
145-
true
146-
else
147-
false
148-
149-
150-
let strip_ends_with ~what str =
151-
if ends_with ~what str then
152-
sub_end str (String.length what)
153-
else
154-
raise Not_found
155-
156-
157-
let replace_chars f s =
158-
let buf = Buffer.create (String.length s) in
159-
String.iter (fun c -> Buffer.add_char buf (f c)) s;
160-
Buffer.contents buf
161-
162-
let lowercase_ascii =
163-
replace_chars
164-
(fun c ->
165-
if (c >= 'A' && c <= 'Z') then
166-
Char.chr (Char.code c + 32)
167-
else
168-
c)
169-
170-
let uncapitalize_ascii s =
171-
if s <> "" then
172-
(lowercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1))
173-
else
174-
s
175-
176-
let uppercase_ascii =
177-
replace_chars
178-
(fun c ->
179-
if (c >= 'a' && c <= 'z') then
180-
Char.chr (Char.code c - 32)
181-
else
182-
c)
183-
184-
let capitalize_ascii s =
185-
if s <> "" then
186-
(uppercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1))
187-
else
188-
s
189-
190-
end
191-
19232
module OASISExpr = struct
19333
(* # 22 "src/oasis/OASISExpr.ml" *)
19434

@@ -289,7 +129,7 @@ module OASISExpr = struct
289129
end
290130

291131

292-
# 292 "myocamlbuild.ml"
132+
# 132 "myocamlbuild.ml"
293133
module BaseEnvLight = struct
294134
(* # 22 "src/base/BaseEnvLight.ml" *)
295135

@@ -394,7 +234,7 @@ module BaseEnvLight = struct
394234
end
395235

396236

397-
# 397 "myocamlbuild.ml"
237+
# 237 "myocamlbuild.ml"
398238
module MyOCamlbuildFindlib = struct
399239
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
400240

@@ -676,7 +516,7 @@ module MyOCamlbuildBase = struct
676516
| nm, [], intf_modules ->
677517
ocaml_lib nm;
678518
let cmis =
679-
List.map (fun m -> (OASISString.uncapitalize_ascii m) ^ ".cmi")
519+
List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
680520
intf_modules in
681521
dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
682522
| nm, dir :: tl, intf_modules ->
@@ -689,7 +529,7 @@ module MyOCamlbuildBase = struct
689529
["compile"; "infer_interface"; "doc"])
690530
tl;
691531
let cmis =
692-
List.map (fun m -> dir^"/"^(OASISString.uncapitalize_ascii m)^".cmi")
532+
List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
693533
intf_modules in
694534
dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
695535
cmis)
@@ -763,7 +603,7 @@ module MyOCamlbuildBase = struct
763603
end
764604

765605

766-
# 766 "myocamlbuild.ml"
606+
# 606 "myocamlbuild.ml"
767607
open Ocamlbuild_plugin;;
768608
let package_default =
769609
{
@@ -774,13 +614,15 @@ let package_default =
774614
("xcp_network", ["network"], []);
775615
("xcp_rrd", ["rrd"], []);
776616
("xcp_xen", ["xen"], []);
777-
("xcp_memory", ["memory"], [])
617+
("xcp_memory", ["memory"], []);
618+
("xapi_v6", ["v6"], [])
778619
];
779620
lib_c = [("xcp", "lib", [])];
780621
flags = [];
781622
includes =
782623
[
783624
("xen", ["lib"]);
625+
("v6", ["lib"]);
784626
("storage", ["lib"]);
785627
("rrd", ["lib"]);
786628
("network", ["lib"]);
@@ -795,6 +637,6 @@ let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
795637

796638
let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
797639

798-
# 799 "myocamlbuild.ml"
640+
# 641 "myocamlbuild.ml"
799641
(* OASIS_STOP *)
800642
Ocamlbuild_plugin.dispatch dispatch_default;;

0 commit comments

Comments
 (0)