GNU bug report logs - #38150
[WIP] gnu: Add grass.

Previous Next

Package: guix-patches;

Reported by: Wiktor Żelazny <wz <at> freeshell.de>

Date: Sat, 9 Nov 2019 11:34:01 UTC

Severity: normal

Merged with 38178

Done: Guillaume Le Vaillant <glv <at> posteo.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38150 in the body.
You can then email your comments to 38150 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#38150; Package guix-patches. (Sat, 09 Nov 2019 11:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wiktor Żelazny <wz <at> freeshell.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 09 Nov 2019 11:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Wiktor Żelazny <wz <at> freeshell.de>
To: guix-patches <at> gnu.org
Subject: [WIP] gnu: Add grass.
Date: Sat,  9 Nov 2019 12:31:54 +0100
From: Wiktor Żelazny <wzelazny <at> vurv.cz>

* gnu/packages/geo.scm (grass): New variable.
No GUI due to wxpython not found on runtime.
---
Another GIS beast. This one builds, at least on my machine, but
   $ grass78
   Starting GRASS GIS...
   ERROR: wxGUI requires wxPython. No module named 'wx'
Perhaps this is something specific to Python module treatment by Guix.
Only one of these
   guix environment python python-wxpython
   guix environment python --ad-hoc python-wxpython
   guix environment --ad-hoc python python-wxpython
, for instance, gives a desired result.
 gnu/packages/geo.scm | 79 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 78 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index dfb00c7547..7d3dea9d79 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -40,16 +40,20 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix utils)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages astronomy)
   #:use-module (gnu packages autotools)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
@@ -67,7 +71,9 @@
   #:use-module (gnu packages web)
   #:use-module (gnu packages webkit)
   #:use-module (gnu packages wxwidgets)
-  #:use-module (gnu packages xml))
+  #:use-module (gnu packages xml)
+  #:use-module (gnu packages xorg)
+  #:use-module (ice-9 match))
 
 (define-public geos
   (package
@@ -1037,3 +1043,74 @@ persisted.
 @end itemize
 ")
     (license license:expat)))
+
+(define-public grass
+  (package
+    (name "grass")
+    (version "7.8.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append
+               "https://grass.osgeo.org/" name
+               (match (string-split version #\.)
+                      ((major minor _ ...)
+                       (string-append major minor)))
+               "/source/" name "-" version ".tar.gz"))
+        ;; md5sum checked
+        (sha256
+          (base32
+            "1ynclznkpnm18vi0brmbfcplgi15yd7lwd424abgv7wm9qlr44ab"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         ;; Replace configure phase as the ./configure script does not like
+         ;; CONFIG_SHELL and SHELL passed as parameters
+         (replace 'configure
+           (lambda* (#:key outputs build target #:allow-other-keys)
+             (let* ((out   (assoc-ref outputs "out"))
+                    (bash  (which "bash"))
+                    (flags `(,(string-append "--prefix=" out)
+                             ,(string-append "--build=" build)
+                             ;; Fix `Unable to locate FreeType includes.'
+                             ,(string-append
+                                  "--with-freetype-includes="
+                                  (assoc-ref %build-inputs "freetype")
+                                  "/include/freetype2")
+                             ;; Fix `Unable to locate PROJ data files.'
+                             ,(string-append
+                                  "--with-proj-share="
+                                  (assoc-ref %build-inputs "proj.4")
+                                  "/share/proj")
+                             ,"--with-postgres")))
+               (setenv "CONFIG_SHELL" bash)
+               (apply invoke bash "./configure" flags)))))
+        #:tests? #f))  ;no check target
+    (native-inputs
+      `(("flex" ,flex)
+        ("bison" ,bison)
+        ("pkg-config" ,pkg-config)
+        ("python" ,python)
+        ("python-six" ,python-six)))
+    (inputs
+      `(("proj.4" ,proj.4)
+        ("gdal" ,gdal)
+        ("zlib" ,zlib)
+        ("zstd:lib" ,zstd "lib")
+        ("libtiff" ,libtiff)
+        ("libpng" ,libpng)
+        ("sqlite" ,sqlite)
+        ("freeglut" ,freeglut)
+        ("fftw" ,fftw)
+        ("cairo" ,cairo)
+        ("freetype" ,freetype)
+        ("libxt" ,libxt)
+        ("python-wxpython" ,python-wxpython) ;; for gui
+        ("postgresql" ,postgresql)))
+    (home-page "https://grass.osgeo.org/")
+    (synopsis "Geographic Resources Analysis Support System")
+    (description "GRASS is a @dfn{Geographic Information System} (GIS) software
+suite used for geospatial data management and analysis, image processing,
+graphics and maps production, spatial modeling, and visualization.")
+    (license license:gpl2+)))
-- 
2.24.0





Information forwarded to guix-patches <at> gnu.org:
bug#38150; Package guix-patches. (Sat, 09 Nov 2019 22:48:02 GMT) Full text and rfc822 format available.

Message #8 received at 38150 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Wiktor Żelazny <wz <at> freeshell.de>, 38150 <at> debbugs.gnu.org
Subject: Re: [bug#38150] [WIP] gnu: Add grass.
Date: Sat, 09 Nov 2019 23:46:55 +0100
[Message part 1 (text/plain, inline)]
Hello Wiktor,

Wiktor Żelazny <wz <at> freeshell.de> writes:

> From: Wiktor Żelazny <wzelazny <at> vurv.cz>
>
> * gnu/packages/geo.scm (grass): New variable.
> No GUI due to wxpython not found on runtime.
> ---
> Another GIS beast. This one builds, at least on my machine, but
>    $ grass78
>    Starting GRASS GIS...
>    ERROR: wxGUI requires wxPython. No module named 'wx'
> Perhaps this is something specific to Python module treatment by Guix.

No doubt!

> Only one of these
>    guix environment python python-wxpython
>    guix environment python --ad-hoc python-wxpython
>    guix environment --ad-hoc python python-wxpython
> , for instance, gives a desired result.

I'm guessing it's the latter?  :-)

The issue has to do with how Python modules are located at run-time.
Adding 'python' to the environment will populate the PYTHONPATH variable
with all packages in the profile that have a
'/lib/python3.7/site-packages' directory in its output.  Without
'python', Guix does not know that this variable should exist (see
<https://bugs.gnu.org/22138>).

To overcome this, the common approach is to wrap the executable with the
required variables, along these lines:

(wrap-program (string-append out "/bin/grass")
  `("PYTHONPATH" ":" prefix (,(string-append wxpython "/lib/python"
                                             (python-version python)
                                             "/site-packages"))))

Can you try that?

Some comments on the patch itself:

> +(define-public grass
> +  (package
> +    (name "grass")
> +    (version "7.8.0")
> +    (source
> +      (origin
> +        (method url-fetch)
> +        (uri (string-append
> +               "https://grass.osgeo.org/" name
> +               (match (string-split version #\.)
> +                      ((major minor _ ...)
> +                       (string-append major minor)))
> +               "/source/" name "-" version ".tar.gz"))
> +        ;; md5sum checked

We don't really need to acknowledge that we've verified checksums; it's
explicitly part of the packaging process per the "Submitting patches"
section of the manual.  Besides, MD5SUMs are not useful for security
these days, as it has become trivial to forge.

> +        (sha256
> +          (base32
> +            "1ynclznkpnm18vi0brmbfcplgi15yd7lwd424abgv7wm9qlr44ab"))))

Indentation seems to be off here.  If you are not using Emacs, please
run ./etc/indent-code.el on this file.

> +    (build-system gnu-build-system)
> +    (arguments
> +     '(#:phases
> +       (modify-phases %standard-phases
> +         ;; Replace configure phase as the ./configure script does not like
> +         ;; CONFIG_SHELL and SHELL passed as parameters
> +         (replace 'configure
> +           (lambda* (#:key outputs build target #:allow-other-keys)
> +             (let* ((out   (assoc-ref outputs "out"))
> +                    (bash  (which "bash"))
> +                    (flags `(,(string-append "--prefix=" out)

Note: you can use (list (string-append ...) ...) here instead of
quote/unquote.

> +                             ,(string-append "--build=" build)
> +                             ;; Fix `Unable to locate FreeType includes.'
> +                             ,(string-append
> +                                  "--with-freetype-includes="
> +                                  (assoc-ref %build-inputs "freetype")
> +                                  "/include/freetype2")
> +                             ;; Fix `Unable to locate PROJ data files.'

I'm not sure this (and the previous) comment add anything: it's fairly
obvious that these flags are here to tell the build system where to find
these files.

> +                             ,(string-append
> +                                  "--with-proj-share="
> +                                  (assoc-ref %build-inputs "proj.4")
> +                                  "/share/proj")
> +                             ,"--with-postgres")))
                                ^
This line does not need to be unquoted.

> +               (setenv "CONFIG_SHELL" bash)
> +               (apply invoke bash "./configure" flags)))))
> +        #:tests? #f))  ;no check target
> +    (native-inputs
> +      `(("flex" ,flex)
> +        ("bison" ,bison)
> +        ("pkg-config" ,pkg-config)
> +        ("python" ,python)
> +        ("python-six" ,python-six)))

I'm surprised to see python-six as a native-input, do you know what it's
used for?

> +    (inputs
> +      `(("proj.4" ,proj.4)
> +        ("gdal" ,gdal)
> +        ("zlib" ,zlib)
> +        ("zstd:lib" ,zstd "lib")
> +        ("libtiff" ,libtiff)
> +        ("libpng" ,libpng)
> +        ("sqlite" ,sqlite)
> +        ("freeglut" ,freeglut)
> +        ("fftw" ,fftw)
> +        ("cairo" ,cairo)
> +        ("freetype" ,freetype)
> +        ("libxt" ,libxt)
> +        ("python-wxpython" ,python-wxpython) ;; for gui
                                                ^
Nit-pick: Only one semicolon in margin comments.

Apart from these minor remarks, the patch looks great :-)
[signature.asc (application/pgp-signature, inline)]

Merged 38150 38178. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 19 Nov 2019 09:37:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 22 Apr 2020 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.