From f5e31b1d3567162d834d2bb49163a199c672da5c Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Tue, 1 Sep 2020 13:51:42 +0200 Subject: gnu: Add mito. * gnu/packages/lisp-xyz.scm (cl-mito, sbcl-mito): New variables. --- gnu/packages/lisp-xyz.scm | 112 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 'gnu') diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm index cfac25ec6c..f681153477 100644 --- a/gnu/packages/lisp-xyz.scm +++ b/gnu/packages/lisp-xyz.scm @@ -13602,3 +13602,115 @@ (define-public cl-envy (define-public ecl-envy (sbcl-package->ecl-package sbcl-envy)) + +(define sbcl-mito-core + (let ((commit "d3b9e375ef364a65692da2185085a08c969ac88a") + (revision "1")) + (package + (name "sbcl-mito-core") + (version (git-version "0.1" revision commit)) + (home-page "https://github.com/fukamachi/mito") + (source + (origin + (method git-fetch) + (uri (git-reference + (url home-page) + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "08mncgzjnbbsf1a6am3l73iw4lyfvz5ldjg5g84awfaxml4p73mb")))) + (build-system asdf-build-system/sbcl) + (inputs + `(("dbi" ,sbcl-dbi) + ("sxql" ,sbcl-sxql) + ("cl-ppcre" ,sbcl-cl-ppcre) + ("closer-mop" ,sbcl-closer-mop) + ("dissect" ,sbcl-dissect) + ("optima" ,sbcl-optima) + ("cl-reexport" ,sbcl-cl-reexport) + ("local-time" ,sbcl-local-time) + ("uuid" ,sbcl-uuid) + ("alexandria" ,sbcl-alexandria))) + (synopsis "ORM for Common Lisp with migrations and relationships support") + (description "Mito is yet another object relational mapper, and it aims +to be a successor of Integral. + +@itemize +@item Support MySQL, PostgreSQL and SQLite3. +@item Add id (serial/uuid primary key), created_at and updated_at by default +like Ruby's ActiveRecord. +@item Migrations. +@item Database schema versioning. +@end itemize\n") + (license license:llgpl)))) + +(define sbcl-mito-migration + (package + (inherit sbcl-mito-core) + (name "sbcl-mito-migration") + (inputs + `(("mito-core" ,sbcl-mito-core) + ("dbi" ,sbcl-dbi) + ("sxql" ,sbcl-sxql) + ("closer-mop" ,sbcl-closer-mop) + ("cl-reexport" ,sbcl-cl-reexport) + ("uuid" ,sbcl-uuid) + ("alexandria" ,sbcl-alexandria) + ("esrap" ,sbcl-esrap))))) + +(define sbcl-lack-middleware-mito + (package + (inherit sbcl-mito-core) + (name "sbcl-lack-middleware-mito") + (inputs + `(("mito-core" ,sbcl-mito-core) + ("dbi" ,sbcl-dbi))) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-build + (lambda _ + (substitute* "lack-middleware-mito.asd" + (("cl-dbi") "dbi")) + #t))))))) + +(define-public sbcl-mito + (package + (inherit sbcl-mito-core) + (name "sbcl-mito") + (inputs + `(("mito-core" ,sbcl-mito-core) + ("mito-migration" ,sbcl-mito-migration) + ("lack-middleware-mito" ,sbcl-lack-middleware-mito) + ("cl-reexport" ,sbcl-cl-reexport))) + (native-inputs + `(("prove" ,sbcl-prove) + ("prove-asdf" ,sbcl-prove-asdf) + ("dbd-mysql" ,sbcl-dbd-mysql) + ("dbd-postgres" ,sbcl-dbd-postgres) + ("dbd-sqlite3" ,sbcl-dbd-sqlite3))) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'remove-non-functional-tests + (lambda _ + (substitute* "mito-test.asd" + ;; (("\\(:test-file \"migration/mysql\"\\)") "") + (("\\(:test-file \"db/mysql\"\\)") "") + (("\\(:test-file \"db/postgres\"\\)") "") + (("\\(:test-file \"dao\"\\)") "") + ;; TODO: migration/sqlite3 should work, re-enable once + ;; upstream has fixed it: + ;; https://github.com/fukamachi/mito/issues/70 + (("\\(:test-file \"migration/sqlite3\"\\)") "") + (("\\(:test-file \"migration/mysql\"\\)") "") + (("\\(:test-file \"migration/postgres\"\\)") "") + (("\\(:test-file \"postgres-types\"\\)") "") + (("\\(:test-file \"mixin\"\\)") "")) + #t))) + ;; TODO: While all enabled tests pass, the phase fails with: + ;; Component MITO-ASD::MITO-TEST not found, required by # + #:tests? #f)))) + +(define-public cl-mito + (sbcl-package->cl-source-package sbcl-mito)) -- cgit v1.2.3