unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: help-guix@gnu.org, Gary Johnson <lambdatronic@disroot.org>,
	help-guix <help-guix@gnu.org>
Subject: Re: How do I correctly relocate PostGIS control files?
Date: Mon, 02 Nov 2020 21:23:42 -0500	[thread overview]
Message-ID: <58ED72A6-E00F-4E9F-A111-6E4C082212D3@lepiller.eu> (raw)
In-Reply-To: <87y2jjgz7a.fsf@disroot.org>

The service simply builds a union-build of the postgis and postgresql packages, because postgresql looks for its extensions in the directory it's run from.

It could be that this behavior changed, or that the postgis package doesn't build its extension as expected.

To cgeck these hypothesis: can you check the error message contains the store path of the union (as opposed to only postresql). You should be able to find some of postgis files there in addition to postgresql files. For the second hypothesis, can you find the postgis.control file in the postgis package itself?

Le 2 novembre 2020 17:40:09 GMT-05:00, Gary Johnson <lambdatronic@disroot.org> a écrit :
>Hi Guix,
>
>I use Postgresql with PostGIS extensively for geospatial software
>development. While the default set of postgresql (v10.13) and postgis
>(v3.0.2) packages in Guix have worked well for me for some time, I am
>now in need of upgrading to the latest version in order to utilize
>newer
>functionality in the database software.
>
>To do this, I created a derivative package for postgresql (v13.0) as
>well as a derivative postgis package that uses the new postgresql
>package as an input. These packages compile and install correctly with
>"guix package -i".
>
>Here's my code:
>
>;;=============================================================================================================================
>
>(define-module (my-packages postgresql-13)
>#:use-module ((guix packages)          #:select (package origin
>base32))
>  #:use-module ((guix download)          #:select (url-fetch))
>  #:use-module ((gnu packages databases) #:select (postgresql))
>#:use-module ((gnu packages geo)       #:select (postgis gdal geos
>proj))
>  #:use-module ((gnu packages image)     #:select (giflib))
>  #:use-module ((gnu packages web)       #:select (json-c))
>  #:use-module ((gnu packages image)     #:select (libjpeg-turbo))
>  #:use-module ((gnu packages xml)       #:select (libxml2))
>  #:use-module ((gnu packages pcre)      #:select (pcre)))
>
>(define-public postgresql-13
>  (package
>   (inherit postgresql)
>   (name "postgresql")
>   (version "13.0")
>   (source (origin
>            (method url-fetch)
>          (uri (string-append "https://ftp.postgresql.org/pub/source/v"
>                            version "/postgresql-" version ".tar.bz2"))
>            (sha256
>             (base32
>           "15i2b7m9a9430idqdgvrcyx66cpxz0v2d81nfqcm8ss3inz51rw0"))))))
>
>(define-public postgis-for-postgresql-13
>  (package
>   (inherit postgis)
>   (name "postgis")
>   (version "3.0.2")
>   (inputs
>    `(("gdal" ,gdal)
>      ("geos" ,geos)
>      ("giflib" ,giflib)
>      ("json-c" ,json-c)
>      ("libjpeg" ,libjpeg-turbo)
>      ("libxml2" ,libxml2)
>      ("pcre" ,pcre)
>      ("postgresql" ,postgresql-13)
>      ("proj" ,proj)))))
>
>;;=============================================================================================================================
>
>Next, I moved to my OS config.scm file to set up the Postgresql
>Shepherd
>service and add PostGIS as an extension package for the DB, which
>should
>make its control files available to Postgresql at runtime.
>
>Here are the relevant sections:
>
>;;=============================================================================================================================
>
>(use-modules ...             
>((gnu services databases)    #:select (postgresql-service-type
>postgresql-configuration postgresql-config-file))
>((my-packages postgresql-13) #:select (postgresql-13
>postgis-for-postgresql-13)))
>
>(operating-system
> ...
> (packages (cons* ...
>postgresql-13 postgis-for-postgresql-13 ; psql, raster2pgsql,
>shp2pgsql, etc.
>                  %base-packages))
> (services (cons* ...
>             (service postgresql-service-type (postgresql-configuration
>                                             (postgresql postgresql-13)
>                  (extension-packages (list postgis-for-postgresql-13))
>                                   (config-file (postgresql-config-file
>                                             (hba-file my-postgres-hba)
>                          (extra-config '(("max_worker_processes" "12")
>                                          ("max_parallel_workers" "40")
>                               ("max_parallel_maintenance_workers" "8")
>                                ("max_parallel_workers_per_gather" "4")
>                           ("parallel_leader_participation" "on")))))))
>                  %desktop-services)))
>
>;;=============================================================================================================================
>
>This compiles and installs successfully with "guix system reconfigure".
>
>However, when I connect to the Postgresql server with "psql -U
>postgres"
>and attempt to add the PostGIS extension to a database, I get the
>dreaded "could not open extension control file" error:
>
>;;=============================================================================================================================
>
>db=# create extension postgis;
>ERROR:  could not open extension control file
>"/gnu/store/8m48v5132qpmxim9s4g9vca59qgay2d9-postgresql-13.0/share/extension/postgis.control":
>No such file or directory
>
>;;=============================================================================================================================
>
>This error does not occur when using the stock postgresql (v10.13) and
>postgis (v3.0.2) packages that come with the current Guix, so something
>is going wrong with the "extension-packages" code from my config.scm's
>"postgresql-configuration" record.
>
>I am very much hoping that one of the Guix maintainers can look into
>this and help me resolve the issue as I suspect it may be affecting any
>user that wants to use a different version of Postgres.
>
>Thanks in advance,
>  Gary
>
>-- 
>GPG Key ID: 7BC158ED
>Use `gpg --search-keys lambdatronic' to find me
>Protect yourself from surveillance: https://emailselfdefense.fsf.org
>=======================================================================
>()  ascii ribbon campaign - against html e-mail
>/\  www.asciiribbon.org   - against proprietary attachments
>
>Please avoid sending me MS-Office attachments.
>See http://www.gnu.org/philosophy/no-word-attachments.html

  reply	other threads:[~2020-11-03  2:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 22:40 How do I correctly relocate PostGIS control files? Gary Johnson
2020-11-03  2:23 ` Julien Lepiller [this message]
2020-11-04  0:38   ` Gary Johnson
2020-11-09 23:56     ` Gary Johnson
2020-11-10  1:45       ` Julien Lepiller
2020-11-10  2:14       ` Carlo Zancanaro
2020-11-10 17:45         ` Gary Johnson

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=58ED72A6-E00F-4E9F-A111-6E4C082212D3@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=help-guix@gnu.org \
    --cc=lambdatronic@disroot.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).