diff mbox series

[bug#50476,03/10] gnu: guile-dbi: Search for dbd libraries using native-search-paths.

Message ID 20210908145413.4652-3-arunisaac@systemreboot.net
State Accepted
Headers show
Series Update guile-dbi and guile-dbd-* | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Arun Isaac Sept. 8, 2021, 2:54 p.m. UTC
* gnu/packages/guile-xyz.scm (guile-dbi)[arguments]: Do not set LDFLAGS and
RPATH in #:make-flags.
[inputs]: Remove guile-dbd-sqlite3 and guile-dbd-postgresql.
[native-search-paths]: Add LD_LIBRARY_PATH.
---
 gnu/packages/guile-xyz.scm | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Ludovic Courtès Sept. 21, 2021, 12:53 p.m. UTC | #1
Hello!

Arun Isaac <arunisaac@systemreboot.net> skribis:

> * gnu/packages/guile-xyz.scm (guile-dbi)[arguments]: Do not set LDFLAGS and
> RPATH in #:make-flags.
> [inputs]: Remove guile-dbd-sqlite3 and guile-dbd-postgresql.
> [native-search-paths]: Add LD_LIBRARY_PATH.

[...]

> +    (native-search-paths
> +     (list (search-path-specification
> +            (variable "LD_LIBRARY_PATH")
> +            (files '("lib")))))))

I think we should not add LD_LIBRARY_PATH as a search path spec as it
can have undesirable side effects; it’s just too broad and risky.

The difficulty here is that we want guile-dbi to be able to find its
guile-dbd-* plugins, right?  The previous method, which was to set the
RUNPATH of guile-dbi pointing to guile-dbd-*, sounds preferable to me:
it’s localized and does the job.

The downside of the RUNPATH method is that these are no longer really
“plugins”: you end up pulling them whether or not you use them.  Perhaps
you were concerned about the closure size?

If that really is a concern, I’d recommend taking a different approach,
such as using/defining a dedicated search path variable.

WDYT?

Thanks,
Ludo’.
Arun Isaac Sept. 22, 2021, 8:23 p.m. UTC | #2
Hi Ludo,

>> +    (native-search-paths
>> +     (list (search-path-specification
>> +            (variable "LD_LIBRARY_PATH")
>> +            (files '("lib")))))))
>
> I think we should not add LD_LIBRARY_PATH as a search path spec as it
> can have undesirable side effects; it’s just too broad and risky.

This makes sense.

> The difficulty here is that we want guile-dbi to be able to find its
> guile-dbd-* plugins, right?  The previous method, which was to set the
> RUNPATH of guile-dbi pointing to guile-dbd-*, sounds preferable to me:
> it’s localized and does the job.
>
> The downside of the RUNPATH method is that these are no longer really
> “plugins”: you end up pulling them whether or not you use them.  Perhaps
> you were concerned about the closure size?

Yes, I was concerned about the closure size, but not merely about the
closure size in MB, but also the closure size in number of packages. It
does look a bit awkward when we're pulling in dependencies that are not
really required.

> If that really is a concern, I’d recommend taking a different approach,
> such as using/defining a dedicated search path variable.

That sounds good. How about I create a GUILE_DBD_LD_LIBRARY_PATH
environment variable?

Regards,
Arun
Ludovic Courtès Sept. 27, 2021, 3:59 p.m. UTC | #3
Hi,

Arun Isaac <arunisaac@systemreboot.net> skribis:

>> If that really is a concern, I’d recommend taking a different approach,
>> such as using/defining a dedicated search path variable.
>
> That sounds good. How about I create a GUILE_DBD_LD_LIBRARY_PATH
> environment variable?

Or just GUILE_DBD_PATH?  But yes, that’d be great.

Ludo’.
Ludovic Courtès Oct. 2, 2021, 2:04 p.m. UTC | #4
Hi Arun,

Arun Isaac <arunisaac@systemreboot.net> skribis:

> The fix was surprisingly simple. It turns out that guile-dbi already supports
> a GUILE_DBD_PATH environment variable. See line 312 of
> guile-dbi/src/guile-dbi.c. So, I just had to fix patch 03/10 to set
> GUILE_DBD_PATH in the native-search-paths of the guile-dbi package. Otherwise,
> this patchset is the same.

Wonderful.

>   gnu: guile-dbi: Update upstream source.
>   gnu: guile-dbi: Remove hard-coded guile effective version.
>   gnu: guile-dbi: Search for dbd libraries using native-search-paths.
>   gnu: guile-dbi: Do not return #t from custom phases.
>   gnu: guile-dbi: Update to 2.1.8.
>   gnu: guile-dbd-sqlite3: Inherit from guile-dbi.
>   gnu: guile-dbd-postgresql: Inherit from guile-dbi.
>   gnu: guile-dbi-bootstrap: Remove package.
>   gnu: Add guile-dbd-mysql.
>   gnu: guile-dbd-sqlite3: Use normal variable instead of @ reference.

LGTM!

Thanks,
Ludo’.
Arun Isaac Oct. 3, 2021, 3:03 p.m. UTC | #5
Pushed to master, thanks!
diff mbox series

Patch

diff --git a/gnu/packages/guile-xyz.scm b/gnu/packages/guile-xyz.scm
index c40eea07a9..e8a7fded14 100644
--- a/gnu/packages/guile-xyz.scm
+++ b/gnu/packages/guile-xyz.scm
@@ -1512,11 +1512,6 @@  library}.")
        (list (string-append
               "--with-guile-site-dir=" %output "/share/guile/site/"
               (target-guile-effective-version (assoc-ref %build-inputs "guile"))))
-       #:make-flags
-       (list (string-append
-              "LDFLAGS=-Wl,-rpath=" %output "/lib:"
-              (assoc-ref %build-inputs "guile-dbd-sqlite3") "/lib" ":"
-              (assoc-ref %build-inputs "guile-dbd-postgresql") "/lib"))
        #:phases
        (modify-phases %standard-phases
          (add-after 'install 'patch-extension-path
@@ -1529,9 +1524,6 @@  library}.")
                     (ext (string-append out "/lib/libguile-dbi")))
                (substitute* dbi.scm (("libguile-dbi") ext))
                #t))))))
-    (inputs
-     `(("guile-dbd-sqlite3" ,guile-dbd-sqlite3)
-       ("guile-dbd-postgresql" ,guile-dbd-postgresql))) ; only shared library, no scheme files
     (native-inputs
      `(("autoconf" ,autoconf)
        ("automake" ,automake)
@@ -1547,7 +1539,11 @@  library}.")
 SQL databases.  Database programming with guile-dbi is generic in that the same
 programming interface is presented regardless of which database system is used.
 It currently supports MySQL, Postgres and SQLite3.")
-    (license license:gpl2+)))
+    (license license:gpl2+)
+    (native-search-paths
+     (list (search-path-specification
+            (variable "LD_LIBRARY_PATH")
+            (files '("lib")))))))
 
 (define guile-dbi-bootstrap
   (package