Patchwork : gnu: Add guile-dbi.

login
register
mail settings
Submitter =?utf-8?B?5a6L5paH5q2m?=
Date June 18, 2016, 8:09 a.m.
Message ID <87bn2yc3zu.fsf@member.fsf.org>
Download mbox | patch
Permalink /patch/13211/
State New
Headers show

Comments

=?utf-8?B?5a6L5paH5q2m?= - June 18, 2016, 8:09 a.m.
Here are 'guile-dbi' and 'guile-dbd-sqlite3':
Unfortunately, Guile DBI loads its backends using `dlopen',
so I have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib'
for loading it.
Ludovic Courtès - June 20, 2016, 8:24 a.m.
iyzsong@member.fsf.org (宋文武) skribis:

> From 8e73c3e1a798b134e341c71c4b1c17d60956e3d5 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Fri, 17 Jun 2016 22:44:56 +0800
> Subject: [PATCH 1/2] gnu: Add guile-dbi.
>
> * gnu/packages/guile.scm (guile-dbi): New variable.

LGTM!

> From 87c3ef658e24035715b48606fb9ef24d55aaddfa Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Sat, 18 Jun 2016 15:49:36 +0800
> Subject: [PATCH 2/2] gnu: Add guile-dbd-sqlite3.
>
> * gnu/packages/guile.scm (guile-dbd-sqlite3): New variable.

LGTM.

> Unfortunately, Guile DBI loads its backends using `dlopen',
> so I have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib'
> for loading it.

I don’t have any great ideas.

If it uses lt_dlopen, then we should recommend setting LTDL_LIBRARY_PATH
instead of LD_LIBRARY_PATH, which is a lesser evil.

Otherwise, we could also hard-code the file name of, say,
guile-dbd-sqlite in guile-dbi, such that there’s always at least one
backend available.

WDYT?

Thanks,
Ludo’.
Maurizio Boriani - June 21, 2016, 8:35 a.m.
>>>>> "Ludovic" == Ludovic Courtès <ludo@gnu.org> writes:

hi,
  I'm the maintainer and first author of guile-dbi

[...]

    >> Unfortunately, Guile DBI loads its backends using `dlopen', so I
    >> have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib' for
    >> loading it.

    Ludovic> I don’t have any great ideas.

    Ludovic> If it uses lt_dlopen, then we should recommend setting
    Ludovic> LTDL_LIBRARY_PATH instead of LD_LIBRARY_PATH, which is a
    Ludovic> lesser evil.

    Ludovic> Otherwise, we could also hard-code the file name of, say,
    Ludovic> guile-dbd-sqlite in guile-dbi, such that there’s always at
    Ludovic> least one backend available.

may be ok for you if I introduce and 'hardcoded' default search path
for library lookup in guile-dbi source code and do a new release? 

thanks for your great work,

bye
Ludovic Courtès - June 21, 2016, 2:14 p.m.
Hi!

Maurizio Boriani <baux@gnu.org> skribis:

>   I'm the maintainer and first author of guile-dbi

Good to see you here!  :-)

>     >> Unfortunately, Guile DBI loads its backends using `dlopen', so I
>     >> have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib' for
>     >> loading it.
>
>     Ludovic> I don’t have any great ideas.
>
>     Ludovic> If it uses lt_dlopen, then we should recommend setting
>     Ludovic> LTDL_LIBRARY_PATH instead of LD_LIBRARY_PATH, which is a
>     Ludovic> lesser evil.
>
>     Ludovic> Otherwise, we could also hard-code the file name of, say,
>     Ludovic> guile-dbd-sqlite in guile-dbi, such that there’s always at
>     Ludovic> least one backend available.
>
> may be ok for you if I introduce and 'hardcoded' default search path
> for library lookup in guile-dbi source code and do a new release? 

I don’t think there’s any good default search path that we could hard
code, though, except arbitrarily choosing one of the backends as I
suggested above.

Ideas?

So I’m tempted to think that it’s best for you not to change anything.

On the Guix side, another thing we could do is a ‘LTDL_LIBRARY_PATH’ as
a ‘native-search-path’ for guile-dbi.

Thoughts?

Ludo’.
=?utf-8?B?5a6L5paH5q2m?= - June 21, 2016, 3:09 p.m.
ludo@gnu.org (Ludovic Courtès) writes:

> Hi!
>
> Maurizio Boriani <baux@gnu.org> skribis:
>
>>   I'm the maintainer and first author of guile-dbi
>
> Good to see you here!  :-)
>
Oh, nice!

>>     >> Unfortunately, Guile DBI loads its backends using `dlopen', so I
>>     >> have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib' for
>>     >> loading it.
>>
>>     Ludovic> I don’t have any great ideas.
>>
>>     Ludovic> If it uses lt_dlopen, then we should recommend setting
>>     Ludovic> LTDL_LIBRARY_PATH instead of LD_LIBRARY_PATH, which is a
>>     Ludovic> lesser evil.
>>
>>     Ludovic> Otherwise, we could also hard-code the file name of, say,
>>     Ludovic> guile-dbd-sqlite in guile-dbi, such that there’s always at
>>     Ludovic> least one backend available.
>>
>> may be ok for you if I introduce and 'hardcoded' default search path
>> for library lookup in guile-dbi source code and do a new release? 
>
> I don’t think there’s any good default search path that we could hard
> code, though, except arbitrarily choosing one of the backends as I
> suggested above.
>
> Ideas?
I think it will be great to introduce a new search path (eg: GUILE_DBD_PATH)
in addition to LD_LIBRARY_PATH.  Find the absolute so filepath in it
ourself, then pass to dlopen.  


Another idea is changing dbd libraries to scheme modules.  Then dbi will
use the '(dbi dbd mysql)' module, the module may use 'load-extension'.
So we can patch the scheme file of each dbd module.
Ludovic Courtès - June 21, 2016, 8:56 p.m.
iyzsong@member.fsf.org (宋文武) skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hi!
>>
>> Maurizio Boriani <baux@gnu.org> skribis:
>>
>>>   I'm the maintainer and first author of guile-dbi
>>
>> Good to see you here!  :-)
>>
> Oh, nice!
>
>>>     >> Unfortunately, Guile DBI loads its backends using `dlopen', so I
>>>     >> have to set 'LD_LIBRARY_PATH' to '$guile-dbd-sqlite/lib' for
>>>     >> loading it.
>>>
>>>     Ludovic> I don’t have any great ideas.
>>>
>>>     Ludovic> If it uses lt_dlopen, then we should recommend setting
>>>     Ludovic> LTDL_LIBRARY_PATH instead of LD_LIBRARY_PATH, which is a
>>>     Ludovic> lesser evil.
>>>
>>>     Ludovic> Otherwise, we could also hard-code the file name of, say,
>>>     Ludovic> guile-dbd-sqlite in guile-dbi, such that there’s always at
>>>     Ludovic> least one backend available.
>>>
>>> may be ok for you if I introduce and 'hardcoded' default search path
>>> for library lookup in guile-dbi source code and do a new release? 
>>
>> I don’t think there’s any good default search path that we could hard
>> code, though, except arbitrarily choosing one of the backends as I
>> suggested above.
>>
>> Ideas?
> I think it will be great to introduce a new search path (eg: GUILE_DBD_PATH)
> in addition to LD_LIBRARY_PATH.  Find the absolute so filepath in it
> ourself, then pass to dlopen.  

Why not, but then it would be redundant with LD_LIBRARY_PATH and
LTDL_LIBRARY_PATH, which would further complicate the search rules.

> Another idea is changing dbd libraries to scheme modules.  Then dbi will
> use the '(dbi dbd mysql)' module, the module may use 'load-extension'.
> So we can patch the scheme file of each dbd module.

I like this approach!

Ludo’.

Patch

From 87c3ef658e24035715b48606fb9ef24d55aaddfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Sat, 18 Jun 2016 15:49:36 +0800
Subject: [PATCH 2/2] gnu: Add guile-dbd-sqlite3.

* gnu/packages/guile.scm (guile-dbd-sqlite3): New variable.
---
 gnu/packages/guile.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 284b123..29c7ed2 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -996,4 +996,31 @@  programming interface is presented regardless of which database system is used.
 It currently supports MySQL, Postgres and SQLite3.")
     (license gpl2+)))
 
+(define-public guile-dbd-sqlite3
+  (package
+    (name "guile-dbd-sqlite3")
+    (version "2.1.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://download.gna.org/guile-dbi/guile-dbd-sqlite3-"
+                    version ".tar.gz"))
+              (sha256
+               (base32
+                "0rg71jchxd2y8x496s8zmfmikr5g8zxi8zv2ar3f7a23pph92iw2"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("sqlite" ,sqlite)
+       ("zlib" ,(@ (gnu packages compression) zlib))))
+    (propagated-inputs
+     `(("guile-dbi" ,guile-dbi)))
+    (synopsis "Guile DBI driver for SQLite")
+    (home-page "https://github.com/jkalbhenn/guile-dbd-sqlite3")
+    (description
+     "guile-dbi is a library for Guile that provides a convenient interface to
+SQL databases.  This package implements the interface for SQLite.")
+    (license gpl2+)))
+
 ;;; guile.scm ends here
-- 
2.8.4