Subject: [PATCH 2/3] gnu: Update cl-lack to 0.3.0.

From: Konrad Hinsen <[email-masked]>
Date: Thu, 12 Sep 2024 16:06:15 +0200

* gnu/packages/lisp-xyz.scm (sbcl-lack cl-lack ecl-lack): Update to 0.3.0.
* gnu/packages/patches/lack.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.

Change-Id: I4285cf208b76d6f461735fff04293833ef163e08
---
 gnu/local.mk                    |   1 +
 gnu/packages/lisp-xyz.scm       |  50 +++++--
 gnu/packages/patches/lack.patch | 243 ++++++++++++++++++++++++++++++++
 3 files changed, 280 insertions(+), 14 deletions(-)
 create mode 100644 gnu/packages/patches/lack.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index ed630041ff..580b42333a 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1588,6 +1588,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/json-c-0.12-CVE-2020-12762.patch		\
   %D%/packages/patches/julia-SOURCE_DATE_EPOCH-mtime.patch	\
   %D%/packages/patches/julia-Use-MPFR-4.2.patch	                \
+  %D%/packages/patches/lack.patch	                \
   %D%/packages/patches/libcall-ui-make-it-installable.patch	\
   %D%/packages/patches/libcamera-ipa_manager-disable-signature-verification.patch	\
   %D%/packages/patches/libcss-check-format.patch		\
diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index fcc2e2ad63..d026d04485 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -18514,11 +18514,11 @@ (define-public cl-kons-9
 ;;   (sbcl-package->ecl-package sbcl-kons-9))
 
 (define-public sbcl-lack
-  (let ((commit "abff8efeb0c3a848e6bb0022f2b8b7fa3a1bc88b")
+  (let ((commit "35d3a8e03cab9204eec88c7dfe4d5366fc2ea922")
         (revision "1"))
     (package
       (name "sbcl-lack")
-      (version (git-version "0.1.0" revision commit))
+      (version (git-version "0.3.0" revision commit))
       (source
        (origin
          (method git-fetch)
@@ -18527,28 +18527,50 @@ (define-public sbcl-lack
                (commit commit)))
          (file-name (git-file-name "lack" version))
          (sha256
-          (base32 "1avh4ygcj9xcx4m17nj0wnxxaisk26w4ljs2bibzxaln24x7pi85"))))
+          (base32 "1yrhhzn8ywdjxwpaxzlnsm2lslhy45r89brn8gh5n08mdyjlp4l2"))
+         (patches (search-patches "lack.patch"))))
       (build-system asdf-build-system/sbcl)
       (native-inputs
-       (list sbcl-prove))
+       (list sbcl-prove
+             sbcl-cl-cookie
+             sbcl-dexador
+             sbcl-hunchentoot))
       (inputs
-       `(("circular-streams" ,sbcl-circular-streams)
-         ("http-body" ,sbcl-http-body)
-         ("ironclad" ,sbcl-ironclad)
-         ("local-time" ,sbcl-local-time)
-         ("quri" ,sbcl-quri)
-         ("trivial-mimes" ,sbcl-trivial-mimes)))
+       (list sbcl-alexandria
+             sbcl-anypool
+             sbcl-bordeaux-threads
+             sbcl-circular-streams
+             sbcl-cl-base64
+             sbcl-cl-isaac
+             sbcl-cl-redis
+             sbcl-dbi
+             sbcl-http-body
+             sbcl-ironclad
+             sbcl-local-time
+             sbcl-quri
+             sbcl-trivial-mimes
+             sbcl-trivial-rfc-1123))
       (arguments
        '(#:asd-systems '("lack"
+                         "lack-app-directory"
+                         "lack-app-file"
+                         "lack-component"
+                         "lack-middleware-accesslog"
+                         "lack-middleware-auth-basic"
+                         "lack-middleware-backtrace"
+                         "lack-middleware-csrf"
+                         "lack-middleware-dbpool"
+                         "lack-middleware-mount"
+                         "lack-middleware-session"
+                         "lack-middleware-static"
                          "lack-request"
                          "lack-response"
-                         "lack-component"
+                         "lack-session-store-dbi"
+                         "lack-session-store-redis"
                          "lack-util"
                          "lack-util-writer-stream"
                          "lack-middleware-backtrace"
-                         "lack-middleware-static")
-         ;; XXX: Component :CLACK not found
-         #:tests? #f))
+                         "lack-middleware-static")))
       (home-page "https://github.com/fukamachi/lack")
       (synopsis "Lack, the core of Clack")
       (description
diff --git a/gnu/packages/patches/lack.patch b/gnu/packages/patches/lack.patch
new file mode 100644
index 0000000000..c9abfb3d6f
--- /dev/null
+++ b/gnu/packages/patches/lack.patch
@@ -0,0 +1,243 @@
+Remove tests that cannot be run. Some depend on clack, which in turn
+depends on lack. Others refer to systems that don't exist
+(names starting with "t-").
+
+--- a/lack-component.asd
++++ b/lack-component.asd
+@@ -2,7 +2,6 @@
+   :version "0.2.0"
+   :author "Eitaro Fukamachi"
+   :license "MIT"
+-  :components ((:file "src/component"))
+-  :in-order-to ((test-op (test-op "t-lack-component"))))
++  :components ((:file "src/component")))
+ 
+ (register-system-packages "lack-component" '(:lack.component))
+diff --git a/lack-middleware-accesslog.asd b/lack-middleware-accesslog.asd
+index c593988..21a4e70 100644
+--- a/lack-middleware-accesslog.asd
++++ b/lack-middleware-accesslog.asd
+@@ -6,7 +6,6 @@
+                "local-time")
+   :components ((:module "src"
+                 :components
+-                ((:file "middleware/accesslog"))))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-accesslog"))))
++                ((:file "middleware/accesslog")))))
+ 
+ (register-system-packages "lack-middleware-accesslog" '(:lack.middleware.accesslog))
+diff --git a/lack-middleware-auth-basic.asd b/lack-middleware-auth-basic.asd
+index 9206d22..6862f33 100644
+--- a/lack-middleware-auth-basic.asd
++++ b/lack-middleware-auth-basic.asd
+@@ -6,7 +6,6 @@
+                "split-sequence")
+   :components ((:module "src"
+                 :components
+-                ((:file "middleware/auth/basic"))))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-auth-basic"))))
++                ((:file "middleware/auth/basic")))))
+ 
+ (register-system-packages "lack-middleware-auth-basic" '(:lack.middleware.auth.basic))
+diff --git a/lack-middleware-backtrace.asd b/lack-middleware-backtrace.asd
+index 8df7f9f..cf73f81 100644
+--- a/lack-middleware-backtrace.asd
++++ b/lack-middleware-backtrace.asd
+@@ -3,7 +3,6 @@
+   :author "Eitaro Fukamachi"
+   :license "MIT"
+   :depends-on ("uiop")
+-  :components ((:file "src/middleware/backtrace"))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-backtrace"))))
++  :components ((:file "src/middleware/backtrace")))
+ 
+ (register-system-packages "lack-middleware-backtrace" '(:lack.middleware.backtrace))
+diff --git a/lack-middleware-csrf.asd b/lack-middleware-csrf.asd
+index 105d3bb..fcf46f7 100644
+--- a/lack-middleware-csrf.asd
++++ b/lack-middleware-csrf.asd
+@@ -6,7 +6,6 @@
+                "lack-util")
+   :components ((:module "src"
+                 :components
+-                ((:file "middleware/csrf"))))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-csrf"))))
++                ((:file "middleware/csrf")))))
+ 
+ (register-system-packages "lack-middleware-csrf" '(:lack.middleware.csrf))
+diff --git a/lack-middleware-session.asd b/lack-middleware-session.asd
+index 92b1568..bed4c89 100644
+--- a/lack-middleware-session.asd
++++ b/lack-middleware-session.asd
+@@ -19,7 +19,6 @@
+                   :pathname "session"
+                   :components
+                   ((:file "state")
+-                   (:file "state/cookie"))))))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-session"))))
++                   (:file "state/cookie")))))))
+ 
+ (register-system-packages "lack-middleware-session" '(:lack.middleware.session))
+diff --git a/lack-middleware-static.asd b/lack-middleware-static.asd
+index a0ce627..107a386 100644
+--- a/lack-middleware-static.asd
++++ b/lack-middleware-static.asd
+@@ -7,7 +7,6 @@
+                "alexandria")
+   :components ((:module "src"
+                 :components
+-                ((:file "middleware/static"))))
+-  :in-order-to ((test-op (test-op "t-lack-middleware-static"))))
++                ((:file "middleware/static")))))
+ 
+ (register-system-packages "lack-middleware-static" '(:lack.middleware.static))
+diff --git a/lack-request.asd b/lack-request.asd
+index 5efa05c..240b421 100644
+--- a/lack-request.asd
++++ b/lack-request.asd
+@@ -9,7 +9,6 @@
+   :components ((:module "src"
+                 :components
+                 ((:file "request" :depends-on ("media-type"))
+-                 (:file "media-type"))))
+-  :in-order-to ((test-op (test-op "t-lack-request"))))
++                 (:file "media-type")))))
+ 
+ (register-system-packages "lack-request" '(:lack.request))
+diff --git a/lack-session-store-dbi.asd b/lack-session-store-dbi.asd
+index 00e7d1e..825a96c 100644
+--- a/lack-session-store-dbi.asd
++++ b/lack-session-store-dbi.asd
+@@ -7,7 +7,6 @@
+                "marshal"
+                "trivial-utf-8"
+                "cl-base64")
+-  :components ((:file "src/middleware/session/store/dbi"))
+-  :in-order-to ((test-op (test-op "t-lack-session-store-dbi"))))
++  :components ((:file "src/middleware/session/store/dbi")))
+ 
+ (register-system-packages "lack-session-store-dbi" '(:lack.session.store.dbi))
+diff --git a/lack-session-store-redis.asd b/lack-session-store-redis.asd
+index 96b0504..57e4046 100644
+--- a/lack-session-store-redis.asd
++++ b/lack-session-store-redis.asd
+@@ -7,7 +7,6 @@
+                "marshal"
+                "cl-base64"
+                "trivial-utf-8")
+-  :components ((:file "src/middleware/session/store/redis"))
+-  :in-order-to ((test-op (test-op "t-lack-session-store-redis"))))
++  :components ((:file "src/middleware/session/store/redis")))
+ 
+ (register-system-packages "lack-session-store-redis" '(:lack.session.store.redis))
+diff --git a/lack-util.asd b/lack-util.asd
+index 0391a1b..1318c04 100644
+--- a/lack-util.asd
++++ b/lack-util.asd
+@@ -5,7 +5,6 @@
+   :depends-on ((:feature (:or :windows :mswindows :win32 :cormanlisp) "ironclad")
+                (:feature (:not (:or :windows :mswindows :win32 :cormanlisp)) "cl-isaac")
+ 	       "bordeaux-threads")
+-  :components ((:file "src/util"))
+-  :in-order-to ((test-op (test-op "t-lack-util"))))
++  :components ((:file "src/util")))
+ 
+ (register-system-packages "lack-util" '(:lack.util))
+diff --git a/lack.asd b/lack.asd
+index e213c10..dde71cf 100644
+--- a/lack.asd
++++ b/lack.asd
+@@ -43,8 +43,6 @@
+                "lack/middleware/auth/basic"
+                "lack/session/store/redis"
+                "lack/session/store/dbi"
+-               "clack"
+-               "clack-test"
+                "hunchentoot"
+                "dexador"
+                "cl-cookie"
+@@ -60,7 +58,6 @@
+   :serial t
+   :components ((:file "builder")
+                (:file "util")
+-               (:file "request")
+                (:file "component")
+                (:file "media-type")
+                (:module "middleware"
+diff --git a/tests/request.lisp b/tests/request.lisp
+deleted file mode 100644
+index 3fd26e0..0000000
+--- a/tests/request.lisp
++++ /dev/null
+@@ -1,71 +0,0 @@
+-(defpackage #:lack/tests/request
+-  (:use #:cl
+-        #:rove
+-        #:lack/request
+-        #:clack.test
+-        #:flexi-streams)
+-  (:import-from #:dexador)
+-  (:import-from #:alexandria
+-                #:alist-hash-table))
+-(in-package #:lack/tests/request)
+-
+-(defparameter *request*
+-  (make-request `(:content-type "application/x-www-form-urlencoded; charset=utf-8"
+-                  :content-length 20
+-                  :uri-scheme :http
+-                  :query-string "ediweitz=weitzedi&name=eitaro&q=C%2B%2B"
+-                  :raw-body
+-                  ,(flex:make-flexi-stream
+-                    (flex:make-in-memory-input-stream
+-                     #(110 97 109 101 61 230 183 177 231 148 186 232 139 177 229 164 170 233 131 142))
+-                    :external-format :utf-8)
+-                  :headers ,(alexandria:alist-hash-table
+-                             '(("referer" . "http://github.com/fukamachi/clack")
+-                               ("user-agent" . "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US)")
+-                               ("accept" . "text/html")
+-                               ("cookie" . "hoge=1;fuga=semi;colon"))
+-                             :test 'equal))))
+-
+-(deftest lack-request
+-  (ok (typep *request* 'request))
+-
+-  (ok (request-env *request*) "request-env")
+-
+-  (ok (equal (request-content-type *request*) "application/x-www-form-urlencoded; charset=utf-8")
+-      "request-content-type")
+-
+-  (ok (equalp (request-query-parameters *request*)
+-              '(("ediweitz" . "weitzedi") ("name" . "eitaro") ("q" . "C++")))
+-      "request-query-parameters")
+-
+-  (ok (equalp (request-body-parameters *request*)
+-              `(("name" . ,(flex:octets-to-string
+-                            #(230 183 177 231 148 186 232 139 177 229 164 170 233 131 142)
+-                            :external-format :utf-8))))
+-      "request-body-parameters")
+-
+-  (ok (equalp (request-cookies *request*)
+-              '(("hoge" . "1") ("fuga" . "semi") ("colon")))
+-      "request-cookies")
+-
+-  (ok (request-accepts-p *request* "text/html"))
+-
+-  (ng (request-accepts-p *request* "application/json"))
+-
+-  (testing-app "make-request"
+-      (lambda (env)
+-        (make-request env)
+-        `(200 nil (,(third (assoc "file" (request-body-parameters (make-request env)) :test #'string=)))))
+-    (multiple-value-bind (body status)
+-        (dex:post (localhost)
+-                  :content
+-                  `(("file" . ,(asdf:system-relative-pathname :lack #P"data/jellyfish.jpg"))))
+-      (ok (eql status 200))
+-      (ok (equal body "jellyfish.jpg")))
+-
+-    (multiple-value-bind (body status)
+-        (dex:post (localhost)
+-                  :content
+-                  `(("file" . ,(asdf:system-relative-pathname :lack #P"data/jellyfish.jpg"))))
+-      (ok (eql status 200))
+-      (ok (equal body "jellyfish.jpg")))))
-- 
2.45.2