all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Roman Scherer <roman.scherer@burningswell.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 54581@debbugs.gnu.org
Subject: [bug#54581] Add emacs-sqlite3-api package
Date: Sun, 27 Mar 2022 19:55:16 +0200	[thread overview]
Message-ID: <87zglbs1hp.fsf@burningswell.com> (raw)
In-Reply-To: <b7e207ad3c7410aab5452ca59d3117b64d4e3797.camel@telenet.be>


[-- Attachment #1.1: Type: text/plain, Size: 1676 bytes --]


Hi Maxime,

thanks for the review. I attached 2 patches.

0001-Add-emacs-sqlite3-api-package.patch

In this one I addressed your following comments:

- I changed the synopsis and the description
- Removed the make flags
- I'm using cc-for-target now
- Enabled tests

The tests are passing, and I tested it manually by evaluating the Emacs
Lisp code snippets in [1]. Everything seems to work fine.

0001-Add-emacs-sqlite3-api-package-generate-constants.patch

In this patch I did the same as above, and I generated the consts.c file
by running make in the "tools" directory. The tests are passing fine,
but when I manually test it by evaluating the Elisp snippets in [1] I
get an error that the sqlite-open-readwrite and sqlite-open-create are
not defined in Emacs. The .so file is loaded by Emacs but somehow it
does not work.

I looked at the diff between the consts.c committed in the repository
and the generated one, but I could not see any changes related to those
functions. I'm still a bit lost about this and could need some help.

But I also wonder if generating the consts.c file is actually better
than just using the checked in consts.c file. The command to generate
the file fetches a web page from the Sqlite website and builds the
consts.c file with this information. And I think this is kind of a
brittle approach. How would this approach would even work with Software
heritage?

I think my preference would be to go without generating the consts.c
file, the patch works, it uses the same file the maintainer of the
packages is using, and I believe it is less brittle. :)

What do you think?

[1] https://github.com/pekingduck/emacs-sqlite3-api#introduction


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Add-emacs-sqlite3-api-package.patch --]
[-- Type: text/x-patch, Size: 3361 bytes --]

From b1568732c8aa95aa8f6cd914a903be2f807c252d Mon Sep 17 00:00:00 2001
From: r0man <roman@burningswell.com>
Date: Sat, 26 Mar 2022 14:59:01 +0100
Subject: [PATCH] Add emacs-sqlite3-api package

This patch adds the emacs-sqlite3-api package to Guix.

The package provides a dynamic module for Emacs that allows direct access to
the SQLite C interface.  It only exposes a subset of the full SQLite C
interface, but should satisfy most user's needs.
---
 gnu/packages/emacs-xyz.scm | 48 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 42fc13f4c2..dad0fe62e8 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -5731,6 +5731,54 @@ (define-public emacs-sqlite
 It is not intended as a user interface.")
       (license license:gpl3+))))
 
+(define-public emacs-sqlite3-api
+  (let ((version "0.15")
+        (revision "0")
+        (commit "7cb4b660fe30deb8a4229f3abb18bd99ca9c971c"))
+    (package
+      (name "emacs-sqlite3-api")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/pekingduck/emacs-sqlite3-api")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1b7if1dp6i5kqwhq25gna89xbca66i4mmgx1a5yn12kncfdgs6d7"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:modules ((guix build emacs-build-system)
+                    (guix build emacs-utils)
+                    (guix build utils))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-module-load
+             (lambda* (#:key outputs #:allow-other-keys)
+               (chmod "sqlite3.el" #o644)
+               (emacs-substitute-sexps "sqlite3.el"
+                 ("(require 'sqlite3-api nil t)"
+                  `(module-load ,(string-append (assoc-ref outputs "out")
+                                                "/lib/sqlite3-api.so"))))))
+           (add-before 'check 'build-emacs-module
+             (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+               ;; Compile the shared object file.
+               (invoke "make" (string-append "CC=" ,(cc-for-target)))
+               ;; Move the shared object file into /lib.
+               (install-file "sqlite3-api.so"
+                             (string-append (assoc-ref outputs "out")
+                                            "/lib")))))
+         #:tests? #t
+         #:test-command '("make" "test" "EMACS=emacs")))
+      (inputs (list sqlite))
+      (home-page "https://github.com/pekingduck/emacs-sqlite3-api")
+      (synopsis "SQLite dynamic module for Emacs Lisp")
+      (description "This package provides a dynamic module for Emacs that allows
+direct access to the SQLite C interface.  It only exposes a subset of the full
+SQLite C interface, but should satisfy most user's needs.")
+      (license license:gpl3+))))
+
 (define-public emacs-sr-speedbar
   (let ((commit "77a83fb50f763a465c021eca7343243f465b4a47")
         (revision "0"))
-- 
2.34.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.3: 0001-Add-emacs-sqlite3-api-package-generate-constants.patch --]
[-- Type: text/x-patch, Size: 3512 bytes --]

From f2726c3c87d890dfb547e7e9de880c5c57954ccf Mon Sep 17 00:00:00 2001
From: r0man <roman@burningswell.com>
Date: Sat, 26 Mar 2022 14:59:01 +0100
Subject: [PATCH] Add emacs-sqlite3-api package

This patch adds the emacs-sqlite3-api package to Guix.

The package provides a dynamic module for Emacs that allows direct access to
the SQLite C interface.  It only exposes a subset of the full SQLite C
interface, but should satisfy most user's needs.
---
 gnu/packages/emacs-xyz.scm | 51 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 42fc13f4c2..87595db74c 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -5731,6 +5731,57 @@ (define-public emacs-sqlite
 It is not intended as a user interface.")
       (license license:gpl3+))))
 
+(define-public emacs-sqlite3-api
+  (let ((version "0.15")
+        (revision "0")
+        (commit "7cb4b660fe30deb8a4229f3abb18bd99ca9c971c"))
+    (package
+      (name "emacs-sqlite3-api")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/pekingduck/emacs-sqlite3-api")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1b7if1dp6i5kqwhq25gna89xbca66i4mmgx1a5yn12kncfdgs6d7"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:modules ((guix build emacs-build-system)
+                    (guix build emacs-utils)
+                    (guix build utils))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-module-load
+             (lambda* (#:key outputs #:allow-other-keys)
+               (chmod "sqlite3.el" #o644)
+               (emacs-substitute-sexps "sqlite3.el"
+                 ("(require 'sqlite3-api nil t)"
+                  `(module-load ,(string-append (assoc-ref outputs "out")
+                                                "/lib/sqlite3-api.so"))))))
+           (add-before 'check 'build-emacs-module
+             (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+               ;; Generate the consts.c file.
+               (invoke "make" "--directory=tools")
+               ;; Compile the shared object file.
+               (invoke "make" (string-append "CC=" ,(cc-for-target)))
+               ;; Move the shared object file into /lib.
+               (install-file "sqlite3-api.so"
+                             (string-append (assoc-ref outputs "out")
+                                            "/lib")))))
+         #:tests? #t
+         #:test-command '("make" "test" "EMACS=emacs")))
+      (inputs (list sqlite))
+      (native-inputs (list curl pandoc python))
+      (home-page "https://github.com/pekingduck/emacs-sqlite3-api")
+      (synopsis "SQLite dynamic module for Emacs Lisp")
+      (description "This package provides a dynamic module for Emacs that allows
+direct access to the SQLite C interface.  It only exposes a subset of the full
+SQLite C interface, but should satisfy most user's needs.")
+      (license license:gpl3+))))
+
 (define-public emacs-sr-speedbar
   (let ((commit "77a83fb50f763a465c021eca7343243f465b4a47")
         (revision "0"))
-- 
2.34.0


[-- Attachment #1.4: Type: text/plain, Size: 305 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
>> +         #:phases
>> +         (modify-phases %standard-phases
>
> Could consts.c be built from source?
>
> [[End of PGP Signed Part]]

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

  reply	other threads:[~2022-03-27 18:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26 14:09 [bug#54581] Add emacs-sqlite3-api package Roman Scherer
2022-03-26 21:17 ` Maxime Devos
2022-03-26 21:20 ` Maxime Devos
2022-03-26 21:21 ` Maxime Devos
2022-03-26 21:23 ` Maxime Devos
2022-03-26 21:25 ` Maxime Devos
2022-03-27 17:55   ` Roman Scherer [this message]
2022-03-27 19:19     ` Maxime Devos
2022-03-27 19:20     ` Maxime Devos
2022-03-27 19:34     ` Maxime Devos
2022-03-27 19:45     ` Maxime Devos
2022-04-01  9:07       ` Roman Scherer
2022-04-01  9:57         ` Maxime Devos
2022-04-01 10:11           ` Roman Scherer
2022-05-05  7:46             ` Roman Scherer
2022-05-05 10:51               ` Maxime Devos
2022-09-18 12:44             ` bug#54581: " Nicolas Goaziou
2022-09-19  6:46               ` [bug#54581] " Roman Scherer
2022-04-01  9:59         ` Maxime Devos
2022-04-01 10:13           ` Roman Scherer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zglbs1hp.fsf@burningswell.com \
    --to=roman.scherer@burningswell.com \
    --cc=54581@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.