summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-06-11 11:02:52 +0200
committerLars-Dominik Braun <lars@6xq.net>2023-02-26 10:19:35 +0100
commit3e3f888dd3d3c06f20e566263f55791dd2316c25 (patch)
treea4697029c277fb667a234ad26d79271900bad9f4
parentc08e9599ef2b3d55cf5a766729335c8c6e8bf107 (diff)
downloadguix-3e3f888dd3d3c06f20e566263f55791dd2316c25.tar.gz
import: hackage: Allow version at the beginning of cabal file.
Fix a corner case, uncovered by the hedgehog package, which has the
version field at the beginning of its cabal file. This causes a pattern
match failure.

* guix/import/hackage.scm (latest-release): Match version at beginning
of expression too.
-rw-r--r--guix/import/hackage.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 7bc2908405..e915aac58d 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -378,7 +378,10 @@ respectively."
                "warning: failed to parse ~a~%"
                (hackage-cabal-url hackage-name))
        #f)
-      ((_ *** ("version" (version)))
+      ;; Cabal files have no particular order and while usually the version
+      ;; as somewhere in the middle it can also be at the beginning,
+      ;; requiring two pattern.
+      ((or (_ *** ("version" (version))) (("version" (version)) _ ...))
        (let ((url (hackage-uri hackage-name version)))
          (upstream-source
           (package (package-name package))