all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#68696] [PATCH] gnu: Add guile-lmdb.
@ 2024-01-24 19:21 Artyom Bologov
  2024-01-25 22:14 ` Sharlatan Hellseher
  2024-01-26 22:17 ` bug#68696: " Sharlatan Hellseher
  0 siblings, 2 replies; 4+ messages in thread
From: Artyom Bologov @ 2024-01-24 19:21 UTC (permalink / raw)
  To: 68696

[-- Attachment #1: Type: text/plain, Size: 49 bytes --]

Hello Guix,

This patch adds guile-lmdb module.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnu: add guile-lmdb. --]
[-- Type: text/x-patch, Size: 2488 bytes --]

From 9d67b6438d8e5c42d6d4e9c8eca46038c80f05ea Mon Sep 17 00:00:00 2001
From: Artyom Bologov <aartaka@protonmail.com>
Date: Wed, 24 Jan 2024 23:20:52 +0400
Subject: [PATCH] gnu: Add guile-lmdb.

* gnu/packages/guile-xyz.scm (guile-lmdb): New variable.
---
 gnu/packages/guile-xyz.scm | 41 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 9c4c308d05..08f4a67d07 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2012,6 +2012,47 @@ (define-public guile-dbd-mysql
 for MySQL.")
     (license license:gpl2+)))
 
+(define-public guile-lmdb
+  (package
+    (name "guile-lmdb")
+    (version "0.0.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/aartaka/guile-lmdb")
+                    (commit "438143ca9ba157faec6f4c2740092c31c733fbfe")))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0p43c8ppbhzpi944in0z2jqr7acl8pm7s1x0p5f0idqda6n6f828"))))
+    (build-system guile-build-system)
+    (arguments
+     '(#:source-directory "modules"
+       #:phases (modify-phases %standard-phases
+                  (add-before 'build 'substitute-lmdb-so
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (let ((lmdb (string-append (assoc-ref inputs "lmdb")
+                                                 "/lib/liblmdb.so")))
+                        (substitute*
+                            '("modules/lmdb/lmdb.scm")
+                          (("liblmdb.so")
+                           lmdb))
+                        #t))))))
+    (native-inputs (list guile-3.0))
+    (inputs (list guile-3.0 lmdb))
+    (home-page "https://github.com/aartaka/guile-lmdb")
+    (synopsis "Bindings for LMDB (Lightning Memory-Mapped Database) in Guile.")
+    (description "Scheme wrapper around liblmdb.so.
+Most name are the same as LMDB ones, except for prefix absence.
+Several conveniences are added on top:
+@itemize
+@item @code{call-with-env-and-txn} and @code{call-with-cursor} wrappers.
+@item @code{for-cursor} procedure for cursor iteration.
+@item @code{val} and @code{stat} types.
+@item Error signaling instead of integer return values.
+@end itemize\n")
+    (license license:gpl3+)))
+
 (define-public guile-config
   (package
     (name "guile-config")
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 28 bytes --]


Thanks,
-- 
Artyom Bologov

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#68696] [PATCH] gnu: Add guile-lmdb.
  2024-01-24 19:21 [bug#68696] [PATCH] gnu: Add guile-lmdb Artyom Bologov
@ 2024-01-25 22:14 ` Sharlatan Hellseher
  2024-01-26 15:50   ` Artyom Bologov
  2024-01-26 22:17 ` bug#68696: " Sharlatan Hellseher
  1 sibling, 1 reply; 4+ messages in thread
From: Sharlatan Hellseher @ 2024-01-25 22:14 UTC (permalink / raw)
  To: Artyom Bologov; +Cc: 68696

[-- Attachment #1: Type: text/plain, Size: 3264 bytes --]


Hi,

Thank you for patch!

>+  (package
>+    (name "guile-lmdb")
>+    (version "0.0.1")
>+    (source (origin
>+              (method git-fetch)
>+              (uri (git-reference
>+                    (url "https://github.com/aartaka/guile-lmdb")
>+                    (commit "438143ca9ba157faec6f4c2740092c31c733fbfe")))
>+              (file-name (git-file-name name version))
>+              (sha256
>+               (base32
>+                "0p43c8ppbhzpi944in0z2jqr7acl8pm7s1x0p5f0idqda6n6f828"))))
As this project has no version tags, take a look at how the package
style may be altered in this case. (gnu packages lisp-xyz) contains
quite a lot of examples without releases.

--8<---------------cut here---------------start------------->8---
  (let ((commit "438143ca9ba157faec6f4c2740092c31c733fbfe")
        (revision "0"))
    (package
      (name "guile-lmdb")
      (version (git-version "0.0.1" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/aartaka/guile-lmdb")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "0p43c8ppbhzpi944in0z2jqr7acl8pm7s1x0p5f0idqda6n6f828"))))
--8<---------------cut here---------------end--------------->8---
- revision :: bumps on every package update in guix, starting from 0.

> +    (arguments
> +     '(#:source-directory "modules"
> +       #:phases (modify-phases %standard-phases
> +                  (add-before 'build 'substitute-lmdb-so
> +                    (lambda* (#:key inputs #:allow-other-keys)
> +                      (let ((lmdb (string-append (assoc-ref inputs "lmdb")
> +                                                 "/lib/liblmdb.so")))
> +                        (substitute*
> +                            '("modules/lmdb/lmdb.scm")
> +                          (("liblmdb.so")
> +                           lmdb))
> +                        #t))))))
You may simplify this part a little by using G-Expressions:

--8<---------------cut here---------------start------------->8---
    (arguments
     (list
      #:source-directory "modules"
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'build 'substitute-lmdb-so
            (lambda _
              (let ((lmdb (string-append
                           #$(this-package-input "lmdb") "/lib/liblmdb.so")))
                (substitute* "modules/lmdb/lmdb.scm"
                  (("liblmdb.so") lmdb))))))))
--8<---------------cut here---------------end--------------->8---
- this-package-input commonly used replacement for (string-append
    (assoc-ref inputs ...
- lambdas in phases don't need trailing #t.

> + (synopsis "Bindings for LMDB (Lightning Memory-Mapped Database) in Guile.")
You need to drop full stop in the end of synopsis, and may use full
description instead of acronym+description.

> (description "Scheme wrapper around liblmdb.so.
It may be rephrased as "This package provides a scheme wrapper for liblmdb.so."

> +@end itemize\n")
You may drop \n here.

Please take a look at review points, and apply guix lint in the end.
Looking forward for V2!

Thans,
Oleg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#68696] [PATCH] gnu: Add guile-lmdb.
  2024-01-25 22:14 ` Sharlatan Hellseher
@ 2024-01-26 15:50   ` Artyom Bologov
  0 siblings, 0 replies; 4+ messages in thread
From: Artyom Bologov @ 2024-01-26 15:50 UTC (permalink / raw)
  To: Sharlatan Hellseher; +Cc: 68696, Artyom Bologov

[-- Attachment #1: Type: text/plain, Size: 224 bytes --]

Hi Oleg,

Thanks for your patience in this review! I addressed most of comments
and ran guix lint on the installed package (not sure how exactly that
should work, but it didn't error at least). Find the new patch attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnu: Add guile-lmdb. --]
[-- Type: text/x-patch, Size: 2477 bytes --]

From 3f708d6977e238616e73f0aa11f7de66487754b3 Mon Sep 17 00:00:00 2001
From: Artyom Bologov <mail@aartaka.me>
Date: Wed, 24 Jan 2024 23:20:52 +0400
Subject: [PATCH] gnu: Add guile-lmdb.

* gnu/packages/guile-xyz.scm (guile-lmdb): New variable.
---
 gnu/packages/guile-xyz.scm | 42 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index 9c4c308d05..b175a16c41 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -2012,6 +2012,48 @@ (define-public guile-dbd-mysql
 for MySQL.")
     (license license:gpl2+)))
 
+(define-public guile-lmdb
+  (let ((commit "438143ca9ba157faec6f4c2740092c31c733fbfe")
+        (revision "0"))
+    (package
+      (name "guile-lmdb")
+      (version (git-version "0.0.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/aartaka/guile-lmdb")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0p43c8ppbhzpi944in0z2jqr7acl8pm7s1x0p5f0idqda6n6f828"))))
+      (build-system guile-build-system)
+      (arguments
+       (list
+        #:source-directory "modules"
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'build 'substitute-lmdb-so
+              (lambda _
+                (let ((lmdb (string-append
+                             #$(this-package-input "lmdb") "/lib/liblmdb.so")))
+                  (substitute* "modules/lmdb/lmdb.scm"
+                    (("liblmdb.so") lmdb))))))))
+      (native-inputs (list guile-3.0))
+      (inputs (list guile-3.0 lmdb))
+      (home-page "https://github.com/aartaka/guile-lmdb")
+      (synopsis "Bindings for Lightning Memory-Mapped Database in Guile")
+      (description "This package provides a Scheme wrapper around liblmdb.so.
+Most names are the same as LMDB ones, except for prefix absence.
+Several conveniences are added on top:
+@itemize
+@item @code{call-with-env-and-txn} and @code{call-with-cursor} wrappers.
+@item @code{for-cursor} procedure for cursor iteration.
+@item @code{val} and @code{stat} types.
+@item Error signaling instead of integer return values.
+@end itemize")
+      (license license:gpl3+))))
+
 (define-public guile-config
   (package
     (name "guile-config")
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 275 bytes --]


> You may simplify this part a little by using G-Expressions:

That's on my learning TODO list, haven't got to them yet!

> You may drop \n here.

Did it out of pure mimicking for other packages. Nice that I don't need
to cargo-cult it 😃

Thanks,
--
Artyom.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#68696: [PATCH] gnu: Add guile-lmdb.
  2024-01-24 19:21 [bug#68696] [PATCH] gnu: Add guile-lmdb Artyom Bologov
  2024-01-25 22:14 ` Sharlatan Hellseher
@ 2024-01-26 22:17 ` Sharlatan Hellseher
  1 sibling, 0 replies; 4+ messages in thread
From: Sharlatan Hellseher @ 2024-01-26 22:17 UTC (permalink / raw)
  To: 68696-done

[-- Attachment #1: Type: text/plain, Size: 83 bytes --]


Pushed as d9d97e26c152d7b5ff13f8aa7a030fee2004bf79 to master. 

Thanks,
Oleg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-26 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 19:21 [bug#68696] [PATCH] gnu: Add guile-lmdb Artyom Bologov
2024-01-25 22:14 ` Sharlatan Hellseher
2024-01-26 15:50   ` Artyom Bologov
2024-01-26 22:17 ` bug#68696: " Sharlatan Hellseher

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.