Skip to content

Commit 97e82c9

Browse files
authored
opam: generate xapi-log with dune (#6532)
And remove the testing dependency to threadext to avoid a circular dependency
2 parents b56df25 + c35e8e2 commit 97e82c9

File tree

6 files changed

+42
-53
lines changed

6 files changed

+42
-53
lines changed

dune-project

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,17 @@
221221
(name xapi-nbd))
222222

223223
(package
224-
(name xapi-log))
224+
(name xapi-log)
225+
(synopsis "A Logs library required by xapi")
226+
(description
227+
"This package is provided for backwards compatibility only. No new package should use it.")
228+
(depends
229+
astring
230+
fmt
231+
logs
232+
mtime
233+
xapi-backtrace
234+
(xapi-stdext-pervasives (= :version))))
225235

226236
(package
227237
(name xapi-idl))

ocaml/libs/log/test/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(executable
22
(name log_test)
3-
(libraries log xapi-stdext-threads threads.posix xapi-backtrace))
3+
(libraries log threads.posix xapi-backtrace))
44

55
(cram
66
(package xapi-log)

ocaml/libs/log/test/log_test.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ let a = [||]
66

77
let buggy () = a.(1) <- 0
88

9+
let with_lock mutex f =
10+
let finally () = Mutex.unlock mutex in
11+
Mutex.lock mutex ; Fun.protect ~finally f
12+
913
let () =
1014
Printexc.record_backtrace true ;
1115
Debug.log_to_stdout () ;
1216
()
1317
|> Debug.with_thread_associated "main" @@ fun () ->
14-
try Xapi_stdext_threads.Threadext.Mutex.execute m buggy
18+
try with_lock m buggy
1519
with e ->
1620
D.log_backtrace e ;
1721
D.warn "Got exception: %s" (Printexc.to_string e)

ocaml/libs/log/test/log_test.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[|error||0 |main|backtrace] 1/4 log_test.exe Raised at file ocaml/libs/log/test/log_test.ml, line 7
44
[|error||0 |main|backtrace] 2/4 log_test.exe Called from file fun.ml, line 33
55
[|error||0 |main|backtrace] 3/4 log_test.exe Called from file fun.ml, line 38
6-
[|error||0 |main|backtrace] 4/4 log_test.exe Called from file ocaml/libs/log/test/log_test.ml, line 14
6+
[|error||0 |main|backtrace] 4/4 log_test.exe Called from file ocaml/libs/log/test/log_test.ml, line 18
77
[|error||0 |main|backtrace]
88
[| warn||0 |main|log_test.ml] Got exception: Invalid_argument("index out of bounds")
99

opam/xapi-log.opam

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
# This file is generated by dune, edit dune-project instead
2-
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
32
opam-version: "2.0"
4-
maintainer: "[email protected]"
5-
3+
synopsis: "A Logs library required by xapi"
4+
description:
5+
"This package is provided for backwards compatibility only. No new package should use it."
6+
maintainer: ["Xapi project maintainers"]
7+
authors: ["[email protected]"]
8+
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
69
homepage: "https://xapi-project.github.io/"
7-
bug-reports: "https://github.com/xapi-project/xen-api.git"
8-
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
9-
build: [
10-
["dune" "build" "-p" name "-j" jobs]
11-
["dune" "runtest" "-p" name "-j" jobs] {with-test}
12-
]
13-
available: [ os = "linux" ]
10+
bug-reports: "https://github.com/xapi-project/xen-api/issues"
1411
depends: [
15-
"ocaml"
1612
"dune" {>= "3.15"}
1713
"astring"
1814
"fmt"
1915
"logs"
2016
"mtime"
2117
"xapi-backtrace"
22-
"xapi-stdext-pervasives"
18+
"xapi-stdext-pervasives" {= version}
19+
"odoc" {with-doc}
20+
]
21+
build: [
22+
["dune" "subst"] {dev}
23+
[
24+
"dune"
25+
"build"
26+
"-p"
27+
name
28+
"-j"
29+
jobs
30+
"@install"
31+
"@runtest" {with-test}
32+
"@doc" {with-doc}
33+
]
2334
]
24-
synopsis: "Library required by xapi"
25-
description: """
26-
These libraries are provided for backwards compatibility only.
27-
No new code should use these libraries."""
28-
url {
29-
src:
30-
"https://github.com/xapi-project/xen-api/archive/master.tar.gz"
31-
}
35+
dev-repo: "git+https://github.com/xapi-project/xen-api.git"

opam/xapi-log.opam.template

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)