summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Peukert2023-08-11 14:05:41 +0200
committerDaniel Peukert2023-08-11 14:05:41 +0200
commit6ecb4c98802ef66f244226a6572d0209fcaa3ff8 (patch)
treec263197012085d16ad7a1bda2601f11bb3310595
downloadaur-6ecb4c98802ef66f244226a6572d0209fcaa3ff8.tar.gz
Add ocaml-alcotest
-rw-r--r--.SRCINFO35
-rw-r--r--.editorconfig8
-rw-r--r--.gitignore14
-rw-r--r--PKGBUILD49
-rw-r--r--fix-time_unix-deprecation.diff45
5 files changed, 151 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..a5ee5abddaf1
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,35 @@
+pkgbase = ocaml-alcotest
+ pkgdesc = Lightweight and colourful test framework for OCaml
+ pkgver = 1.7.0
+ pkgrel = 1
+ url = https://github.com/mirage/alcotest
+ arch = x86_64
+ arch = aarch64
+ license = ISC
+ makedepends = dune>=3.0.0
+ depends = ocaml>=4.11.0
+ depends = ocaml-astring
+ depends = ocaml-async>=0.15.0
+ depends = ocaml-async_kernel
+ depends = ocaml-async_unix>=0.15.0
+ depends = ocaml-base
+ depends = ocaml-cmdliner>=1.1.0
+ depends = ocaml-core>=v0.15.0
+ depends = ocaml-core_unix>=0.15.0
+ depends = ocaml-duration
+ depends = ocaml-fmt>=0.8.7
+ depends = ocaml-js_of_ocaml>=3.11.0
+ depends = ocaml-logs
+ depends = ocaml-lwt
+ depends = ocaml-mirage-clock>=2.0.0
+ depends = ocaml-re>=1.7.2
+ depends = ocaml-stdlib-shims
+ depends = ocaml-syntax-shims
+ depends = ocaml-uutf>=1.0.1
+ options = !strip
+ source = ocaml-alcotest-1.7.0.tar.gz::https://github.com/mirage/alcotest/archive/1.7.0.tar.gz
+ source = fix-time_unix-deprecation.diff
+ sha512sums = 6e29cc39109f5d83a175578f48ff1b48fdf13913b7cdd332823a660c681ab0cd5dec41b10322226102b023d7c74620decf964458926abed56ae835e4e565014e
+ sha512sums = 1655ef9f2aff1380d86ecee62853174b4a6ef331151477b6afeacc6fd8af69c3b90c14993cdbea6659107432c1fe543096b73d19c148b3fdd76eb3afd84f1b9f
+
+pkgname = ocaml-alcotest
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 000000000000..a467ee9a97a6
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,8 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = tab
+tab_width = 4
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..82b3c183d5d4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,14 @@
+# from https://github.com/github/gitignore/blob/master/ArchLinuxPackages.gitignore
+*.tar
+*.tar.*
+*.rpm
+*.jar
+*.exe
+*.msi
+*.zip
+*.tgz
+*.log
+*.log.*
+*.sig
+
+*/
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..c50c2ca617e5
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,49 @@
+# Maintainer: Daniel Peukert <daniel@peukert.cc>
+_projectname='alcotest'
+pkgname="ocaml-$_projectname"
+pkgver='1.7.0'
+pkgrel='1'
+pkgdesc='Lightweight and colourful test framework for OCaml'
+arch=('x86_64' 'aarch64')
+url="https://github.com/mirage/$_projectname"
+license=('ISC')
+depends=('ocaml>=4.11.0' 'ocaml-astring' 'ocaml-async>=0.15.0' 'ocaml-async_kernel' 'ocaml-async_unix>=0.15.0' 'ocaml-base' 'ocaml-cmdliner>=1.1.0' 'ocaml-core>=v0.15.0' 'ocaml-core_unix>=0.15.0' 'ocaml-duration' 'ocaml-fmt>=0.8.7' 'ocaml-js_of_ocaml>=3.11.0' 'ocaml-logs' 'ocaml-lwt' 'ocaml-mirage-clock>=2.0.0' 'ocaml-re>=1.7.2' 'ocaml-stdlib-shims' 'ocaml-syntax-shims' 'ocaml-uutf>=1.0.1')
+makedepends=('dune>=3.0.0')
+options=('!strip')
+source=(
+ "$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
+ 'fix-time_unix-deprecation.diff'
+)
+sha512sums=('6e29cc39109f5d83a175578f48ff1b48fdf13913b7cdd332823a660c681ab0cd5dec41b10322226102b023d7c74620decf964458926abed56ae835e4e565014e'
+ '1655ef9f2aff1380d86ecee62853174b4a6ef331151477b6afeacc6fd8af69c3b90c14993cdbea6659107432c1fe543096b73d19c148b3fdd76eb3afd84f1b9f')
+
+_sourcedirectory="$_projectname-$pkgver"
+
+prepare() {
+ cd "$srcdir/$_sourcedirectory/"
+
+ # Fix core_unix.time_unix deprecation (based on https://github.com/mirage/alcotest/commit/289e52b8b2e1df8ca2034ba0d0e855b9f01edf51)
+ patch --forward -p1 < '../fix-time_unix-deprecation.diff'
+}
+
+build() {
+ cd "$srcdir/$_sourcedirectory/"
+ dune build --release --verbose
+}
+
+check() {
+ cd "$srcdir/$_sourcedirectory/"
+ dune runtest --release --verbose
+}
+
+package() {
+ cd "$srcdir/$_sourcedirectory/"
+ DESTDIR="$pkgdir" dune install --prefix '/usr' --libdir '/usr/lib/ocaml' --docdir '/usr/share/doc' --mandir '/usr/share/man' --release --verbose
+
+ for _folder in "$pkgdir/usr/share/doc/"*; do
+ mv "$_folder" "$pkgdir/usr/share/doc/ocaml-$(basename "$_folder")"
+ done
+
+ install -dm755 "$pkgdir/usr/share/licenses/$pkgname"
+ ln -sf "/usr/share/doc/$pkgname/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"
+}
diff --git a/fix-time_unix-deprecation.diff b/fix-time_unix-deprecation.diff
new file mode 100644
index 000000000000..16b0589adc4d
--- /dev/null
+++ b/fix-time_unix-deprecation.diff
@@ -0,0 +1,45 @@
+diff --git a/src/alcotest-async/alcotest_async.ml b/src/alcotest-async/alcotest_async.ml
+index 97ed610..b6a826f 100644
+--- a/src/alcotest-async/alcotest_async.ml
++++ b/src/alcotest-async/alcotest_async.ml
+@@ -7,7 +7,7 @@ let run_test timeout name fn args =
+ | `Timeout ->
+ Alcotest.fail
+ (Printf.sprintf "%s timed out after %s" name
+- (Time_unix.Span.to_string_hum timeout))
++ (Time_float_unix.Span.to_string_hum timeout))
+
+ module Promise = struct
+ include Deferred
+@@ -24,7 +24,7 @@ module V1 = struct
+
+ let test_case_sync n s f = test_case n s (fun x -> Deferred.return (f x))
+
+- let test_case ?(timeout = Time_unix.Span.of_sec 2.) name s f =
++ let test_case ?(timeout = Time_float_unix.Span.of_sec 2.) name s f =
+ test_case name s (run_test timeout name f)
+ end
+
+diff --git a/src/alcotest-async/alcotest_async_intf.ml b/src/alcotest-async/alcotest_async_intf.ml
+index 27df58c..baa55cd 100644
+--- a/src/alcotest-async/alcotest_async_intf.ml
++++ b/src/alcotest-async/alcotest_async_intf.ml
+@@ -2,7 +2,7 @@ module type V1 = sig
+ include Alcotest_engine.V1.Cli.S with type return = unit Async.Deferred.t
+
+ val test_case :
+- ?timeout:Time_unix.Span.t ->
++ ?timeout:Time_float_unix.Span.t ->
+ string ->
+ Alcotest.speed_level ->
+ ('a -> unit Async.Deferred.t) ->
+diff --git a/src/alcotest-async/dune b/src/alcotest-async/dune
+index 9497c26..52ab50c 100644
+--- a/src/alcotest-async/dune
++++ b/src/alcotest-async/dune
+@@ -9,4 +9,4 @@
+ async_unix
+ base
+ core
+- core_unix.time_unix))
++ core_unix.time_float_unix))