Subject: [PATCH v2] gnu: fossil: Update to 2.24.

From: [email-masked]
Date: Thu, 1 Aug 2024 21:44:19 +0000

From: Ashish SHUKLA <[email-masked]>

* gnu/packages/version-control.scm (fossil): Update to 2.24.
[sources]: switch to a simpler tarball URL. (patches): Add patches
from upstream to fix test failures. [inputs]: Switch to sqlite-next
as fossil needs bleeding edge sqlite.

* gnu/packages/patches/fossil-comment-utf-tests.patch: New file.
* gnu/packages/patches/fossil-disable-tests.patch: New file.
* gnu/packages/patches/fossil-fix-json-test.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register them.

Change-Id: I0e4ffa6b5017cce345b28de953564e534282f6b4
---
Hi,

It seems fossil upstream has introduced a captcha on their web interface which
is where the patches in the previous revision were fetched from. This revision
bundles those patches.

Thanks!
Ashish

 gnu/local.mk                                  |   3 +
 .../patches/fossil-comment-utf-tests.patch    | 119 +++++++++++
 .../patches/fossil-disable-tests.patch        | 187 ++++++++++++++++++
 .../patches/fossil-fix-json-test.patch        |  18 ++
 gnu/packages/version-control.scm              |  16 +-
 5 files changed, 336 insertions(+), 7 deletions(-)
 create mode 100644 gnu/packages/patches/fossil-comment-utf-tests.patch
 create mode 100644 gnu/packages/patches/fossil-disable-tests.patch
 create mode 100644 gnu/packages/patches/fossil-fix-json-test.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 6d2b14e72d..d328533eee 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1240,6 +1240,9 @@ dist_patch_DATA =						\
   %D%/packages/patches/foobillard++-pkg-config.patch		\
   %D%/packages/patches/foomatic-filters-CVE-2015-8327.patch	\
   %D%/packages/patches/foomatic-filters-CVE-2015-8560.patch	\
+  %D%/packages/patches/fossil-comment-utf-tests.patch		\
+  %D%/packages/patches/fossil-disable-tests.patch		\
+  %D%/packages/patches/fossil-fix-json-test.patch		\
   %D%/packages/patches/foxi-fix-build.patch			\
   %D%/packages/patches/fp16-implicit-double.patch		\
   %D%/packages/patches/fp16-system-libraries.patch		\
diff --git a/gnu/packages/patches/fossil-comment-utf-tests.patch b/gnu/packages/patches/fossil-comment-utf-tests.patch
new file mode 100644
index 0000000000..7f03362be2
--- /dev/null
+++ b/gnu/packages/patches/fossil-comment-utf-tests.patch
@@ -0,0 +1,119 @@
+Index: test/utf.test
+==================================================================
+--- test/utf.test
++++ test/utf.test
+@@ -17609,25 +17609,25 @@
+ Has flag LOOK_LONG: no
+ Has flag LOOK_INVALID: no
+ Has flag LOOK_ODD: no
+ Has flag LOOK_SHORT: no}
+ 
+-utf-check 1179 utf-check-1179-2-129-1.jnk \
+-{File "%TEMP%/utf-check-1179-2-129-1.jnk" has 7 bytes.
+-Starts with UTF-8 BOM: no
+-Starts with UTF-16 BOM: yes
+-Looks like UTF-8: yes
+-Has flag LOOK_NUL: no
+-Has flag LOOK_CR: no
+-Has flag LOOK_LONE_CR: no
+-Has flag LOOK_LF: no
+-Has flag LOOK_LONE_LF: no
+-Has flag LOOK_CRLF: no
+-Has flag LOOK_LONG: no
+-Has flag LOOK_INVALID: yes
+-Has flag LOOK_ODD: no
+-Has flag LOOK_SHORT: no}
++#utf-check 1179 utf-check-1179-2-129-1.jnk \
++#{File "%TEMP%/utf-check-1179-2-129-1.jnk" has 7 bytes.
++#Starts with UTF-8 BOM: no
++#Starts with UTF-16 BOM: yes
++#Looks like UTF-8: yes
++#Has flag LOOK_NUL: no
++#Has flag LOOK_CR: no
++#Has flag LOOK_LONE_CR: no
++#Has flag LOOK_LF: no
++#Has flag LOOK_LONE_LF: no
++#Has flag LOOK_CRLF: no
++#Has flag LOOK_LONG: no
++#Has flag LOOK_INVALID: yes
++#Has flag LOOK_ODD: no
++#Has flag LOOK_SHORT: no}
+ 
+ utf-check 1180 utf-check-1180-2-130-0.jnk \
+ {File "%TEMP%/utf-check-1180-2-130-0.jnk" has 4 bytes.
+ Starts with UTF-8 BOM: no
+ Starts with UTF-16 BOM: yes
+@@ -24121,41 +24121,41 @@
+ Has flag LOOK_LONG: no
+ Has flag LOOK_INVALID: yes
+ Has flag LOOK_ODD: no
+ Has flag LOOK_SHORT: no}
+ 
+-utf-check 1586 utf-check-1586-3-128-0.jnk \
+-{File "%TEMP%/utf-check-1586-3-128-0.jnk" has 6 bytes.
+-Starts with UTF-8 BOM: no
+-Starts with UTF-16 BOM: reversed
+-Looks like UTF-16: no
+-Has flag LOOK_NUL: yes
+-Has flag LOOK_CR: no
+-Has flag LOOK_LONE_CR: no
+-Has flag LOOK_LF: no
+-Has flag LOOK_LONE_LF: no
+-Has flag LOOK_CRLF: no
+-Has flag LOOK_LONG: no
+-Has flag LOOK_INVALID: no
+-Has flag LOOK_ODD: no
+-Has flag LOOK_SHORT: no}
+-
+-utf-check 1587 utf-check-1587-3-128-1.jnk \
+-{File "%TEMP%/utf-check-1587-3-128-1.jnk" has 7 bytes.
+-Starts with UTF-8 BOM: no
+-Starts with UTF-16 BOM: reversed
+-Looks like UTF-8: no
+-Has flag LOOK_NUL: yes
+-Has flag LOOK_CR: no
+-Has flag LOOK_LONE_CR: no
+-Has flag LOOK_LF: no
+-Has flag LOOK_LONE_LF: no
+-Has flag LOOK_CRLF: no
+-Has flag LOOK_LONG: no
+-Has flag LOOK_INVALID: yes
+-Has flag LOOK_ODD: no
+-Has flag LOOK_SHORT: no}
++#utf-check 1586 utf-check-1586-3-128-0.jnk \
++#{File "%TEMP%/utf-check-1586-3-128-0.jnk" has 6 bytes.
++#Starts with UTF-8 BOM: no
++#Starts with UTF-16 BOM: reversed
++#Looks like UTF-16: no
++#Has flag LOOK_NUL: yes
++#Has flag LOOK_CR: no
++#Has flag LOOK_LONE_CR: no
++#Has flag LOOK_LF: no
++#Has flag LOOK_LONE_LF: no
++#Has flag LOOK_CRLF: no
++#Has flag LOOK_LONG: no
++#Has flag LOOK_INVALID: no
++#Has flag LOOK_ODD: no
++#Has flag LOOK_SHORT: no}
++
++#utf-check 1587 utf-check-1587-3-128-1.jnk \
++#{File "%TEMP%/utf-check-1587-3-128-1.jnk" has 7 bytes.
++#Starts with UTF-8 BOM: no
++#Starts with UTF-16 BOM: reversed
++#Looks like UTF-8: no
++#Has flag LOOK_NUL: yes
++#Has flag LOOK_CR: no
++#Has flag LOOK_LONE_CR: no
++#Has flag LOOK_LF: no
++#Has flag LOOK_LONE_LF: no
++#Has flag LOOK_CRLF: no
++#Has flag LOOK_LONG: no
++#Has flag LOOK_INVALID: yes
++#Has flag LOOK_ODD: no
++#Has flag LOOK_SHORT: no}
+ 
+ utf-check 1588 utf-check-1588-3-129-0.jnk \
+ {File "%TEMP%/utf-check-1588-3-129-0.jnk" has 6 bytes.
+ Starts with UTF-8 BOM: no
+ Starts with UTF-16 BOM: no
+
diff --git a/gnu/packages/patches/fossil-disable-tests.patch b/gnu/packages/patches/fossil-disable-tests.patch
new file mode 100644
index 0000000000..2aaf04e6d4
--- /dev/null
+++ b/gnu/packages/patches/fossil-disable-tests.patch
@@ -0,0 +1,187 @@
+Index: test/amend.test
+==================================================================
+--- test/amend.test
++++ test/amend.test
+@@ -313,10 +313,11 @@
+   }
+   foreach res [lsort -nocase $result] {
+     append t2exp "sym-$res*"
+   }
+   eval fossil amend $HASH $tags
++  set t1exp [string trimleft $t1exp ,]
+   test amend-tag-$tc.1 {[string match "*hash:*$HASH*tags:*$t1exp*" $RESULT]}
+   fossil tag ls --raw $HASH
+   test amend-tag-$tc.2 {[string match $t2exp $RESULT]}
+   fossil timeline -n 1
+   test amend-tag-$tc.3 {[string match $t3exp $RESULT]}
+
+Index: test/merge5.test
+==================================================================
+--- test/merge5.test
++++ test/merge5.test
+@@ -23,11 +23,11 @@
+ }
+ protOut {
+ fossil sqlite3 --no-repository reacts badly to SQL dumped from
+ repositories created from fossil older than version 2.0.
+ }
+-test merge5-sqlite3-issue false knownBug
++#test merge5-sqlite3-issue false knownBug
+ test_cleanup_then_return
+ 
+ # Verify the results of a check-out
+ #
+ proc checkout-test {testid expected_content} {
+
+Index: test/stash.test
+==================================================================
+--- test/stash.test
++++ test/stash.test
+@@ -168,14 +168,14 @@
+ 
+ ########
+ # fossil stash show|cat ?STASHID? ?DIFF-OPTIONS?
+ # fossil stash [g]diff ?STASHID? ?DIFF-OPTIONS?
+ 
+-fossil stash show
+-test stash-1-show {[normalize_result] eq $diff_stash_1}
+-fossil stash diff
+-test stash-1-diff {[normalize_result] eq $diff_stash_1} knownBug
++#fossil stash show
++#test stash-1-show {[normalize_result] eq $diff_stash_1}
++#fossil stash diff
++#test stash-1-diff {[normalize_result] eq $diff_stash_1} knownBug
+ 
+ ########
+ # fossil stash pop
+ 
+ stash-test 2 pop {
+@@ -206,16 +206,16 @@
+ # fossil: ./src/delta.c:231: checksum: Assertion '...' failed.
+ # Should be triggered by this stash-WY-1 test.
+ fossil checkout --force c1
+ fossil clean
+ fossil mv --soft f1 f1new
+-stash-test WY-1 {-expectError save -m "Reported 2016-02-09"} {
+-  REVERT   f1
+-  DELETE   f1new
+-} -changes {
+-} -addremove {
+-} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result}
++#stash-test WY-1 {-expectError save -m "Reported 2016-02-09"} {
++#  REVERT   f1
++#  DELETE   f1new
++#} -changes {
++#} -addremove {
++#} -exists {f1 f2 f3} -notexists {f1new} -knownbugs {-code -result}
+ # TODO: add tests that verify the saved stash is sensible. Possibly
+ # by applying it and checking results. But until the SQLITE_CONSTRAINT
+ # error is fixed, there is nothing stashed to test.
+ 
+ 
+@@ -296,16 +296,17 @@
+ }] -changes {
+   RENAMED f2  ->  f2n
+ } -addremove {
+ } -exists {f1 f2n} -notexists {f2}
+ 
+-stash-test 3-2 {save -m f2n} {
+-  REVERT f2
+-  DELETE f2n
+-} -exists {f1 f2} -notexists {f2n} -knownbugs {-result}
++fossil stash save -m f2n
++#stash-test 3-2 {save -m f2n} {
++#  REVERT f2
++#  DELETE f2n
++#} -exists {f1 f2} -notexists {f2n} -knownbugs {-result}
+ fossil stash show
+-test stash-3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug
++#test stash-3-2-show-1 {![regexp {\sf1} $RESULT]} knownBug
+ test stash-3-2-show-2 {[regexp {\sf2n} $RESULT]}
+ stash-test 3-2-pop {pop} {
+   UPDATE f1
+   UPDATE f2n
+ } -changes {
+
+Index: test/tester.tcl
+==================================================================
+--- test/tester.tcl
++++ test/tester.tcl
+@@ -308,10 +308,11 @@
+       comment-format \
+       crlf-glob \
+       crnl-glob \
+       default-csp \
+       default-perms \
++      default-skin \
+       diff-binary \
+       diff-command \
+       dont-commit \
+       dont-push \
+       dotfiles \
+
+Index: test/utf.test
+==================================================================
+--- test/utf.test
++++ test/utf.test
+@@ -35,11 +35,11 @@
+   set i 1
+   foreach {fileName result} $args {
+     set fileName [file join $tempPath $fileName]
+     fossil test-looks-like-utf $fileName
+     set result [string map [list %TEMP% $tempPath \r\n \n] $result]
+-    # if {$::RESULT ne $result} {puts stdout $::RESULT}
++    # if {$::RESULT ne $result} {puts stdout $::RESULT; exit}
+     test utf-check-$testname.$i {$::RESULT eq $result}
+     incr i
+   }
+ }
+ 
+@@ -17613,12 +17613,12 @@
+ 
+ utf-check 1179 utf-check-1179-2-129-1.jnk \
+ {File "%TEMP%/utf-check-1179-2-129-1.jnk" has 7 bytes.
+ Starts with UTF-8 BOM: no
+ Starts with UTF-16 BOM: yes
+-Looks like UTF-8: no
+-Has flag LOOK_NUL: yes
++Looks like UTF-8: yes
++Has flag LOOK_NUL: no
+ Has flag LOOK_CR: no
+ Has flag LOOK_LONE_CR: no
+ Has flag LOOK_LF: no
+ Has flag LOOK_LONE_LF: no
+ Has flag LOOK_CRLF: no
+@@ -24124,27 +24124,27 @@
+ Has flag LOOK_SHORT: no}
+ 
+ utf-check 1586 utf-check-1586-3-128-0.jnk \
+ {File "%TEMP%/utf-check-1586-3-128-0.jnk" has 6 bytes.
+ Starts with UTF-8 BOM: no
+-Starts with UTF-16 BOM: no
+-Looks like UTF-8: no
++Starts with UTF-16 BOM: reversed
++Looks like UTF-16: no
+ Has flag LOOK_NUL: yes
+ Has flag LOOK_CR: no
+ Has flag LOOK_LONE_CR: no
+ Has flag LOOK_LF: no
+ Has flag LOOK_LONE_LF: no
+ Has flag LOOK_CRLF: no
+ Has flag LOOK_LONG: no
+-Has flag LOOK_INVALID: yes
++Has flag LOOK_INVALID: no
+ Has flag LOOK_ODD: no
+ Has flag LOOK_SHORT: no}
+ 
+ utf-check 1587 utf-check-1587-3-128-1.jnk \
+ {File "%TEMP%/utf-check-1587-3-128-1.jnk" has 7 bytes.
+ Starts with UTF-8 BOM: no
+-Starts with UTF-16 BOM: no
++Starts with UTF-16 BOM: reversed
+ Looks like UTF-8: no
+ Has flag LOOK_NUL: yes
+ Has flag LOOK_CR: no
+ Has flag LOOK_LONE_CR: no
+ Has flag LOOK_LF: no
+
diff --git a/gnu/packages/patches/fossil-fix-json-test.patch b/gnu/packages/patches/fossil-fix-json-test.patch
new file mode 100644
index 0000000000..adafce2e9e
--- /dev/null
+++ b/gnu/packages/patches/fossil-fix-json-test.patch
@@ -0,0 +1,18 @@
+Index: test/json.test
+==================================================================
+--- test/json.test
++++ test/json.test
+@@ -107,11 +107,11 @@
+     set request [subst {POST $url HTTP/1.0\r
+ Host: localhost\r
+ User-Agent: Fossil-Test\r
+ Cookie: $cookie\r
+ Content-Type: application/json
+-Content-Length $len
++Content-Length: $len
+ \r
+ $data}]
+   } else {
+     set request [subst {GET $url HTTP/1.0\r
+ Host: localhost\r
+
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 9f67237d5d..0951eb6f23 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -53,6 +53,7 @@
 ;;; Copyright © 2023 Josselin Poiret <[email-masked]>
 ;;; Copyright © 2024 Hilton Chain <[email-masked]>
 ;;; Copyright © 2024 Suhail Singh <[email-masked]>
+;;; Copyright © 2024 Ashish SHUKLA <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3132,17 +3133,18 @@ (define-public git-annex-remote-rclone
 (define-public fossil
   (package
     (name "fossil")
-    (version "2.20")
+    (version "2.24")
     (source
      (origin
        (method url-fetch)
        (uri (string-append
-             "https://www.fossil-scm.org/home/tarball/"
-             "210e89a0597f225f49722b096cf5563bf193e920e02a9bd38503a906deacd416"
-             "/fossil-src-" version ".tar.gz"))
-       ;; XXX: Currently the above hash must be manually updated.
+	     "https://fossil-scm.org/home/tarball/version-" version "/fossil-" version ".tar.gz"))
        (sha256
-        (base32 "08g7img88n2nwcdkpzmg4aqbp2iy40nllgas53502dspm97ym4h8"))
+        (base32 "0k1gjvxbvvs98yspnf7nj6rb0c7yf60savq7jywbkgimd0bkrkcm"))
+       (patch-flags '("-p0"))
+       (patches (search-patches "fossil-comment-utf-tests.patch"
+                                "fossil-disable-tests.patch"
+                                "fossil-fix-json-test.patch"))
        (modules '((guix build utils)))
        (snippet
         '(delete-file-recursively "compat"))))
@@ -3152,7 +3154,7 @@ (define-public fossil
            which                        ;for tests only
            ed))                         ;ditto
     (inputs
-     (list openssl zlib sqlite))
+     (list openssl zlib sqlite-next))
     (arguments
      `(#:configure-flags (list "--with-openssl=auto"
                                "--disable-internal-sqlite")

base-commit: 2b4e3c9847dce02e371ff4dce615789fdfd101fa
-- 
2.45.2