Subject: [bug#46929] [PATCH v2] gnu: maths: dune-*: Update to version 2.7.1

From: Felix Gruber <[email-masked]>
Date: Thu, 20 May 2021 22:06:03 +0000

* gnu/packages/maths.scm (dune-alugrid, dune-common, dune-functions,
dune-geometry, dune-grid, dune-istl, dune-localfunctions, dune-pdelab,
dune-subgrid, dune-typetree, dune-uggrid): Update to version 2.7.1.
(dune-istl)[source](patches) Remove patch that is no longer needed.
(dune-alugrid, dune-subgrid, dune-pdelab)[version]: Use `git-version` to
compute the version string.
* gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Remove above patch.
---

Since v1 of the patch, I've made the following changes:
* Use git-version to generate versions.
* Add comments to explain that some of the packages didn't have a recent
  release tag.
* Update dune-alugrid to use the latest commit from the releases/2.7
  branch.

(The simd tests in dune-common take ages to complete, I wonder if I
should disable them to significantly cut down the build time.)

 gnu/local.mk                                  |   1 -
 gnu/packages/maths.scm                        | 280 +++++++++---------
 .../dune-istl-2.7-fix-non-mpi-tests.patch     |  82 -----
 3 files changed, 144 insertions(+), 219 deletions(-)
 delete mode 100644 gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index dd68bb5957..0d676dcf69 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -955,7 +955,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/doxygen-1.8.17-runtests.patch		\
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch	\
   %D%/packages/patches/dstat-skip-devices-without-io.patch	\
-  %D%/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch	\
   %D%/packages/patches/dvd+rw-tools-add-include.patch 		\
   %D%/packages/patches/ecl-16-format-directive-limit.patch	\
   %D%/packages/patches/ecl-16-ignore-stderr-write-error.patch	\
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 6b3f5cf41c..65ae445efb 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -5346,7 +5346,7 @@ linear algebra primitives specifically targeting graph analytics.")
 (define-public dune-common
   (package
     (name "dune-common")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method url-fetch)
@@ -5354,7 +5354,7 @@ linear algebra primitives specifically targeting graph analytics.")
                            version "/dune-common-" version ".tar.gz"))
        (sha256
         (base32
-         "140q1zh44cr5yrjwg4b5ga803rkqv55vk30l2cqm29aklj1wb0rw"))))
+         "0sidwdkyrrqjkqhpvrlc991pzi5xzlvxk91s2n7qk3widwy7fch2"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5384,7 +5384,7 @@ Differences} (FD).")
 (define-public dune-geometry
   (package
     (name "dune-geometry")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method url-fetch)
@@ -5392,7 +5392,7 @@ Differences} (FD).")
                            version "/dune-geometry-" version ".tar.gz"))
        (sha256
         (base32
-         "1cicvlwbyyw76npicnblxckyvhbfn3ip8isydiv3hlrlz8zcg5nr"))))
+         "068mh3fd110xl27rwxqlqy4d9cpqw2vqm2pzfrripiaqscb3byfy"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5424,7 +5424,7 @@ This package contains the basic DUNE geometry classes.")
 (define-public dune-uggrid
   (package
     (name "dune-uggrid")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method git-fetch)
@@ -5434,7 +5434,7 @@ This package contains the basic DUNE geometry classes.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "192miqgmfj6jwk969gydzpbv9ki7jg5nky3ydnrwa2nq29b5xkh0"))))
+         "11qz52g9d5k96fqik2lyi80xryw174rnny074pj70ardl6zzz83p"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5461,7 +5461,7 @@ This package contains the DUNE UG grid classes.")
 (define-public dune-grid
   (package
     (name "dune-grid")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method url-fetch)
@@ -5469,7 +5469,7 @@ This package contains the DUNE UG grid classes.")
                            version "/dune-grid-" version ".tar.gz"))
        (sha256
         (base32
-         "17fjz30qazjgl11sryyxnw9klai4yz1ji4bs68013xcxc5hdv27s"))))
+         "15iws03hkbmr4a4rqqb0rriz1m8szl96wdr7gw0jmrcnlzbdbbx5"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5504,7 +5504,7 @@ This package contains the basic DUNE grid classes.")
 (define-public dune-istl
   (package
     (name "dune-istl")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method url-fetch)
@@ -5512,8 +5512,7 @@ This package contains the basic DUNE grid classes.")
                            version "/dune-istl-" version ".tar.gz"))
        (sha256
         (base32
-         "0gl3wgz5rs6sb4m83440ny45sbx7z7lnbi3gx6r9nm3rvy5j33f9"))
-       (patches (search-patches "dune-istl-2.7-fix-non-mpi-tests.patch"))))
+         "1cy69s1266hvnh8blznlvvkrf8i2g640rc3mf7kp872wgvdz4nb9"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5563,7 +5562,7 @@ aggregation-based algebraic multigrid.")
 (define-public dune-localfunctions
   (package
     (name "dune-localfunctions")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method url-fetch)
@@ -5571,7 +5570,7 @@ aggregation-based algebraic multigrid.")
                            version "/dune-localfunctions-" version ".tar.gz"))
        (sha256
         (base32
-         "1yih59h6vngii696bx1c2vil02lriij4kz0nc583mjn9kiaqxfqd"))))
+         "031i42anrhi0ngpvp42rdjbkic7v3008fwild9xg7flffwvnpshg"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5616,99 +5615,105 @@ assemble global function spaces on finite-element grids.")
     (license license:gpl2)))
 
 (define-public dune-alugrid
-  (package
-    (name "dune-alugrid")
-    (version "2.7.0-git-81d35682")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
-             (commit "81d356827c84454b971937db02c02b90bbcd7fe5")))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         "0z54lwfp53prcrs94k8gwh047l9z642jll3l56xlyfr69z0b2zz1"))))
-    (build-system cmake-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'patch-include
-           (lambda _
-             (substitute* "dune/alugrid/test/test-alugrid.cc"
-               (("doc/grids/gridfactory/testgrids")
-                "doc/dune-grid/grids/gridfactory/testgrids"))
-             #t))
-         (add-after 'build 'build-tests
-           (lambda* (#:key inputs make-flags #:allow-other-keys)
-             (setenv "CPLUS_INCLUDE_PATH"
-                     (string-append (assoc-ref inputs "dune-grid") "/share"))
-             (apply invoke "make" "build_tests" make-flags))))))
-    (inputs
-     `(("dune-common" ,dune-common)
-       ("dune-geometry" ,dune-geometry)
-       ("dune-grid" ,dune-grid)
-       ;; Optional
-       ("metis" ,metis)
-       ("openblas" ,openblas)
-       ("python" ,python)
-       ("superlu" ,superlu)
-       ("gmp" ,gmp)
-       ("zlib" ,zlib)))
-    (native-inputs
-     `(("gfortran" ,gfortran)
-       ("pkg-config" ,pkg-config)))
-    (home-page "https://dune-project.org/")
-    (synopsis "Distributed and Unified Numerics Environment")
-    (description "ALUGrid is an adaptive, loadbalancing, unstructured
+  ;; This was the last commit on the releases/2.7 branch as of 2021-05-20,
+  ;; unfortunately there was no tag for any 2.7 release.
+  (let ((commit "51bde29a2dfa7cfac4fb73d40ffd42b9c1eb1d3d"))
+    (package
+      (name "dune-alugrid")
+      (version (git-version "2.7.1" "0" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gitlab.dune-project.org/extensions/dune-alugrid.git")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0z16wg6llzxs7vjg2yilg31vwnkz8k050j6bspg3blbym0razy15"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-include
+             (lambda _
+               (substitute* "dune/alugrid/test/test-alugrid.cc"
+                 (("doc/grids/gridfactory/testgrids")
+                  "doc/dune-grid/grids/gridfactory/testgrids"))
+               #t))
+           (add-after 'build 'build-tests
+             (lambda* (#:key inputs make-flags #:allow-other-keys)
+               (setenv "CPLUS_INCLUDE_PATH"
+                       (string-append (assoc-ref inputs "dune-grid") "/share"))
+               (apply invoke "make" "build_tests" make-flags))))))
+      (inputs
+       `(("dune-common" ,dune-common)
+         ("dune-geometry" ,dune-geometry)
+         ("dune-grid" ,dune-grid)
+         ;; Optional
+         ("metis" ,metis)
+         ("openblas" ,openblas)
+         ("python" ,python)
+         ("superlu" ,superlu)
+         ("gmp" ,gmp)
+         ("zlib" ,zlib)))
+      (native-inputs
+       `(("gfortran" ,gfortran)
+         ("pkg-config" ,pkg-config)))
+      (home-page "https://dune-project.org/")
+      (synopsis "Distributed and Unified Numerics Environment")
+      (description "ALUGrid is an adaptive, loadbalancing, unstructured
 implementation of the DUNE grid interface supporting either simplices or
 cubes.")
-    (license license:gpl2+)))
+      (license license:gpl2+))))
 
 (define-public dune-subgrid
-  (package
-    (name "dune-subgrid")
-    (version "2.7.0-git-2103a363")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-         (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
-         (commit "2103a363f32e8d7b60e66eee7ddecf969f6cf762")))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-          "1wsjlypd3835c3arqjkw836cxx5q67zy447wa65q634lf6f6v9ia"))))
-    (build-system cmake-build-system)
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'build 'build-tests
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "build_tests" make-flags))))))
-    (inputs
-     `(("dune-common" ,dune-common)
-       ("dune-geometry" ,dune-geometry)
-       ("dune-grid" ,dune-grid)
-       ;; Optional
-       ("metis" ,metis)
-       ("openblas" ,openblas)
-       ("gmp" ,gmp)))
-    (native-inputs
-     `(("gfortran" ,gfortran)
-       ("pkg-config" ,pkg-config)))
-    (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
-    (synopsis "Distributed and Unified Numerics Environment")
-    (description "The dune-subgrid module marks elements of
+  ;; This was the last commit on the releases/2.7 branch as of 2021-05-20.
+  ;; Unfortunately the dune-subgrid repository contains no release tags.
+  (let ((commit "45d1ee9f3f711e209695deee97912f4954f7f280"))
+    (package
+      (name "dune-subgrid")
+      (version (git-version "2.7.1" "0" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+           (url "https://git.imp.fu-berlin.de/agnumpde/dune-subgrid")
+           (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+            "0xjf7865wil7kzym608kv3nc3ff3m3nlqich4k9wjyvy3lz6panh"))))
+      (build-system cmake-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (add-after 'build 'build-tests
+             (lambda* (#:key make-flags #:allow-other-keys)
+               (apply invoke "make" "build_tests" make-flags))))))
+      (inputs
+       `(("dune-common" ,dune-common)
+         ("dune-geometry" ,dune-geometry)
+         ("dune-grid" ,dune-grid)
+         ;; Optional
+         ("metis" ,metis)
+         ("openblas" ,openblas)
+         ("gmp" ,gmp)))
+      (native-inputs
+       `(("gfortran" ,gfortran)
+         ("pkg-config" ,pkg-config)))
+      (home-page "http://numerik.mi.fu-berlin.de/dune-subgrid/index.php")
+      (synopsis "Distributed and Unified Numerics Environment")
+      (description "The dune-subgrid module marks elements of
 another hierarchical dune grid.  The set of marked elements can then be
 accessed as a hierarchical dune grid in its own right.  Dune-Subgrid
 provides the full grid interface including adaptive mesh refinement.")
-    (license license:gpl2+)))
+      (license license:gpl2+))))
 
 (define-public dune-typetree
   (package
     (name "dune-typetree")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method git-fetch)
@@ -5718,7 +5723,7 @@ provides the full grid interface including adaptive mesh refinement.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "1rhv25yg0q1hw50c8wlfqhgwrjl4mh62zq9v14ilwgzbfgxmpiy7"))))
+         "1kx9k8i7pdw6l6ny6nq85v5p1nd6yxldzaj8k3nizaz3q1j407pv"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5747,7 +5752,7 @@ operating on statically typed trees of objects.")
 (define-public dune-functions
   (package
     (name "dune-functions")
-    (version "2.7.0")
+    (version "2.7.1")
     (source
      (origin
        (method git-fetch)
@@ -5757,7 +5762,7 @@ operating on statically typed trees of objects.")
        (file-name (git-file-name name version))
        (sha256
         (base32
-         "1na4gcih0kin37ksj2xj07ds04v7zx53pjdhm1hzy55jjfqdjk8h"))))
+         "04dhr4asnl38bf1gp8hrk31maav33m7q71lhl2n5yk1q1x6i77nw"))))
     (build-system cmake-build-system)
     (arguments
      `(#:phases
@@ -5795,45 +5800,48 @@ implemented as callable objects, and bases of finite element spaces.")
     (license (list license:lgpl3+ license:gpl2))))
 
 (define-public dune-pdelab
-  (package
-    (name "dune-pdelab")
-    (version "2.7.0-git-476fe437")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
-             (commit "476fe43763fa6f459c5e4658e2a2b4b5582db834")))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         "0cs36piqzn6rq0j2ih3ab3q3q9yg199wk72k5qi86pkzh7i7fdn1"))))
-    (build-system cmake-build-system)
-    (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
-    (inputs
-     `(("dune-common" ,dune-common)
-       ("dune-istl" ,dune-istl)
-       ("dune-localfunctions" ,dune-localfunctions)
-       ("dune-geometry" ,dune-geometry)
-       ("dune-grid" ,dune-grid)
-       ("dune-typetree" ,dune-typetree)
-       ("dune-functions" ,dune-functions)
-       ;; Optional
-       ("openblas" ,openblas)
-       ("eigen" ,eigen)
-       ("metis" ,metis)
-       ("python" ,python)
-       ("superlu" ,superlu)
-       ("gmp" ,gmp)))
-    (native-inputs
-     `(("gfortran" ,gfortran)
-       ("pkg-config" ,pkg-config)))
-    (home-page "https://dune-project.org/")
-    (synopsis "Differential equations solver toolbox")
-    (description "PDELab is a partial differential equations solver toolbox
+  ;; This was the last commit on the releases/2.7 branch as of 2021-05-20,
+  ;; unfortunately there was no tag for any 2.7 release.
+  (let ((commit "3435f7f1f4d05e3f6e8d9fe8a06a09569c7244be"))
+    (package
+      (name "dune-pdelab")
+      (version (git-version "2.7.1" "0" commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://gitlab.dune-project.org/pdelab/dune-pdelab")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "0akllyj4qh686h1xs53n102vf70ydxa7g6ha5gj3wdlig2ny4vik"))))
+      (build-system cmake-build-system)
+      (arguments '(#:tests? #f)) ; XXX: the tests cannot be compiled
+      (inputs
+       `(("dune-common" ,dune-common)
+         ("dune-istl" ,dune-istl)
+         ("dune-localfunctions" ,dune-localfunctions)
+         ("dune-geometry" ,dune-geometry)
+         ("dune-grid" ,dune-grid)
+         ("dune-typetree" ,dune-typetree)
+         ("dune-functions" ,dune-functions)
+         ;; Optional
+         ("openblas" ,openblas)
+         ("eigen" ,eigen)
+         ("metis" ,metis)
+         ("python" ,python)
+         ("superlu" ,superlu)
+         ("gmp" ,gmp)))
+      (native-inputs
+       `(("gfortran" ,gfortran)
+         ("pkg-config" ,pkg-config)))
+      (home-page "https://dune-project.org/")
+      (synopsis "Differential equations solver toolbox")
+      (description "PDELab is a partial differential equations solver toolbox
 built on top of DUNE, the Distributed and Unified Numerics Environment.")
-    ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
-    (license (list license:lgpl3+ license:gpl2))))
+      ;; Either GPL version 2 with "runtime exception" or LGPLv3+.
+      (license (list license:lgpl3+ license:gpl2)))))
 
 (define add-openmpi-to-dune-package
   (let ((dune-package?
diff --git a/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch b/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch
deleted file mode 100644
index ee2bb8f676..0000000000
--- a/gnu/packages/patches/dune-istl-2.7-fix-non-mpi-tests.patch
+++ /dev/null
@@ -1,82 +0,0 @@
-Fix build of dune-istl's tests
-
-Patch copied from upstream source repository:
-
-https://gitlab.dune-project.org/core/dune-istl/-/commit/9eee3462df5a64881c08574f9291e76db398de0a
-
-From 9eee3462df5a64881c08574f9291e76db398de0a Mon Sep 17 00:00:00 2001
-From: Felix Gruber <[email-masked]>
-Date: Sat, 4 Apr 2020 15:27:09 +0200
-Subject: [PATCH] make tests succeed when MPI is disabled
-
-When MPI is not available or explicitly disabled with the CMake build
-option -DCMAKE_IDSABLE_FIND_PACKAGE_MPI=TRUE, some tests were unable to
-build.
-
-The tests created from solverfactorytest.cc.in and part of
-scalarproductstest.cc use Dune::OwnerOverlapCopyCommunication which is
-defined behind `#if HAVE_MPI` and is thus not available in a non-MPI
-build. I've thus disabled those tests when MPI is unavailable.
-
-The matrixmarkettest did not work without MPI, as it contained some code
-using the wrong template parameters when HAVE_MPI was not set. Those
-template paramters have been fixed now.
-
-I've confirmed, that after my changes `make build_tests` succeeds to
-build all tests and that those tests run without failure.
----
- dune/istl/test/CMakeLists.txt        | 3 ++-
- dune/istl/test/matrixmarkettest.cc   | 2 +-
- dune/istl/test/scalarproductstest.cc | 2 ++
- 3 files changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/dune/istl/test/CMakeLists.txt b/dune/istl/test/CMakeLists.txt
-index ffd87969..2c7b2387 100644
---- a/dune/istl/test/CMakeLists.txt
-+++ b/dune/istl/test/CMakeLists.txt
-@@ -77,7 +77,8 @@ set(DUNE_TEST_FACTORY_BLOCK_SIZES
- function(add_factory_test BLOCK)
-   STRING(REGEX REPLACE "[^a-zA-Z0-9]" "" BLOCK_CLEAN ${BLOCK})
-   configure_file(solverfactorytest.cc.in solverfactorytest_${BLOCK_CLEAN}.cc)
--  dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc)
-+  dune_add_test(SOURCES ${CMAKE_CURRENT_BINARY_DIR}/solverfactorytest_${BLOCK_CLEAN}.cc
-+                CMAKE_GUARD HAVE_MPI)
- endfunction(add_factory_test)
-
- foreach(FIELD_TYPE ${DUNE_TEST_FACTORY_FIELD_TYPES})
-diff --git a/dune/istl/test/matrixmarkettest.cc b/dune/istl/test/matrixmarkettest.cc
-index b335afe6..ce30e8ae 100644
---- a/dune/istl/test/matrixmarkettest.cc
-+++ b/dune/istl/test/matrixmarkettest.cc
-@@ -52,7 +52,7 @@ int testMatrixMarket(int N)
-   storeMatrixMarket(mat, std::string("testmat"), comm);
-   storeMatrixMarket(bv, std::string("testvec"), comm, false);
- #else
--  typedef Dune::MatrixAdapter<BCRSMat,BVector,BVector> Operator;
-+  typedef Dune::MatrixAdapter<Matrix,Vector,Vector> Operator;
-   Operator op(mat);
-   op.apply(bv, cv);
-
-diff --git a/dune/istl/test/scalarproductstest.cc b/dune/istl/test/scalarproductstest.cc
-index 452b1d89..f46ce2a9 100644
---- a/dune/istl/test/scalarproductstest.cc
-+++ b/dune/istl/test/scalarproductstest.cc
-@@ -115,6 +115,7 @@ int main(int argc, char** argv)
-     scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
-   }
-
-+#if HAVE_MPI
-   // Test the ParallelScalarProduct class
-   {
-     using Vector = BlockVector<FieldVector<double,BlockSize> >;
-@@ -139,6 +140,7 @@ int main(int argc, char** argv)
-     ScalarProduct scalarProduct(communicator,SolverCategory::nonoverlapping);
-     scalarProductTest<ScalarProduct, Vector>(scalarProduct,numBlocks);
-   }
-+#endif
-
-   return t.exit();
- }
---
-2.25.1
-
-- 
2.30.2