guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

15/15: gnu: SQLite: Absorb grafted replacement.


From: guix-commits
Subject: 15/15: gnu: SQLite: Absorb grafted replacement.
Date: Fri, 21 May 2021 12:50:00 -0400 (EDT)

lfam pushed a commit to branch wip-ungrafting
in repository guix.

commit 3219012715c93b9efdcde6d3d411a636cef7cb38
Author: Leo Famulari <leo@famulari.name>
AuthorDate: Mon May 17 11:57:07 2021 -0400

    gnu: SQLite: Absorb grafted replacement.
    
    * gnu/packages/sqlite.scm (sqlite): Update to 3.32.3.
    [replacement]: Remove field.
    (sqlite/fixed): Remove variable.
    * gnu/packages/patches/python-3-fix-sqlite-tests.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Add it.
    * gnu/packages/python.scm (python-3.8)[source]: Use it.
---
 gnu/local.mk                                       |  1 +
 .../patches/python-3-fix-sqlite-tests.patch        | 87 ++++++++++++++++++++++
 gnu/packages/python.scm                            |  1 +
 gnu/packages/sqlite.scm                            | 26 +------
 4 files changed, 91 insertions(+), 24 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 311d14e..24da747 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1585,6 +1585,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/python-3-deterministic-build-info.patch \
   %D%/packages/patches/python-3-search-paths.patch             \
   %D%/packages/patches/python-3-fix-tests.patch                        \
+  %D%/packages/patches/python-3-fix-sqlite-tests.patch         \
   %D%/packages/patches/python-3.8-fix-tests.patch              \
   %D%/packages/patches/python-3.8-CVE-2021-3177.patch          \
   %D%/packages/patches/python-3.9-fix-tests.patch              \
diff --git a/gnu/packages/patches/python-3-fix-sqlite-tests.patch 
b/gnu/packages/patches/python-3-fix-sqlite-tests.patch
new file mode 100644
index 0000000..14fb4d9
--- /dev/null
+++ b/gnu/packages/patches/python-3-fix-sqlite-tests.patch
@@ -0,0 +1,87 @@
+Fix test failures with SQLite 3.32:
+
+https://bugs.python.org/issue40784
+
+Patch copied from upstream source repository:
+
+https://github.com/python/cpython/commit/00a240bf7f95bbd220f1cfbf9eb58484a5f9681a
+
+From 00a240bf7f95bbd220f1cfbf9eb58484a5f9681a Mon Sep 17 00:00:00 2001
+From: "Miss Islington (bot)"
+ <31488909+miss-islington@users.noreply.github.com>
+Date: Fri, 29 May 2020 05:46:34 -0700
+Subject: [PATCH] bpo-40784: Fix sqlite3 deterministic test (GH-20448)
+
+(cherry picked from commit c610d970f5373b143bf5f5900d4645e6a90fb460)
+
+Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
+---
+ Lib/sqlite3/test/userfunctions.py | 36 +++++++++++++++++++++++--------
+ 1 file changed, 27 insertions(+), 9 deletions(-)
+
+diff --git a/Lib/sqlite3/test/userfunctions.py 
b/Lib/sqlite3/test/userfunctions.py
+index 9501f535c4999..c11c82e127577 100644
+--- a/Lib/sqlite3/test/userfunctions.py
++++ b/Lib/sqlite3/test/userfunctions.py
+@@ -1,8 +1,7 @@
+-#-*- coding: iso-8859-1 -*-
+ # pysqlite2/test/userfunctions.py: tests for user-defined functions and
+ #                                  aggregates.
+ #
+-# Copyright (C) 2005-2007 Gerhard H�ring <gh@ghaering.de>
++# Copyright (C) 2005-2007 Gerhard Häring <gh@ghaering.de>
+ #
+ # This file is part of pysqlite.
+ #
+@@ -158,6 +157,7 @@ def setUp(self):
+         self.con.create_function("isblob", 1, func_isblob)
+         self.con.create_function("islonglong", 1, func_islonglong)
+         self.con.create_function("spam", -1, func)
++        self.con.execute("create table test(t text)")
+ 
+     def tearDown(self):
+         self.con.close()
+@@ -276,18 +276,36 @@ def CheckAnyArguments(self):
+         val = cur.fetchone()[0]
+         self.assertEqual(val, 2)
+ 
++    # Regarding deterministic functions:
++    #
++    # Between 3.8.3 and 3.15.0, deterministic functions were only used to
++    # optimize inner loops, so for those versions we can only test if the
++    # sqlite machinery has factored out a call or not. From 3.15.0 and onward,
++    # deterministic functions were permitted in WHERE clauses of partial
++    # indices, which allows testing based on syntax, iso. the query optimizer.
++    @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 
3.8.3 or higher")
+     def CheckFuncNonDeterministic(self):
+         mock = unittest.mock.Mock(return_value=None)
+-        self.con.create_function("deterministic", 0, mock, 
deterministic=False)
+-        self.con.execute("select deterministic() = deterministic()")
+-        self.assertEqual(mock.call_count, 2)
+-
+-    @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "deterministic 
parameter not supported")
++        self.con.create_function("nondeterministic", 0, mock, 
deterministic=False)
++        if sqlite.sqlite_version_info < (3, 15, 0):
++            self.con.execute("select nondeterministic() = nondeterministic()")
++            self.assertEqual(mock.call_count, 2)
++        else:
++            with self.assertRaises(sqlite.OperationalError):
++                self.con.execute("create index t on test(t) where 
nondeterministic() is not null")
++
++    @unittest.skipIf(sqlite.sqlite_version_info < (3, 8, 3), "Requires SQLite 
3.8.3 or higher")
+     def CheckFuncDeterministic(self):
+         mock = unittest.mock.Mock(return_value=None)
+         self.con.create_function("deterministic", 0, mock, deterministic=True)
+-        self.con.execute("select deterministic() = deterministic()")
+-        self.assertEqual(mock.call_count, 1)
++        if sqlite.sqlite_version_info < (3, 15, 0):
++            self.con.execute("select deterministic() = deterministic()")
++            self.assertEqual(mock.call_count, 1)
++        else:
++            try:
++                self.con.execute("create index t on test(t) where 
deterministic() is not null")
++            except sqlite.OperationalError:
++                self.fail("Unexpected failure while creating partial index")
+ 
+     @unittest.skipIf(sqlite.sqlite_version_info >= (3, 8, 3), "SQLite < 3.8.3 
needed")
+     def CheckFuncDeterministicNotSupported(self):
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index ce424bd..6ae353a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -374,6 +374,7 @@ data types.")
                         "python-CVE-2020-26116.patch"
                         "python-3.8-CVE-2021-3177.patch"
                         "python-3-fix-tests.patch"
+                        "python-3-fix-sqlite-tests.patch"
                         "python-3.8-fix-tests.patch"
                         "python-3-deterministic-build-info.patch"
                         "python-3-search-paths.patch"))
diff --git a/gnu/packages/sqlite.scm b/gnu/packages/sqlite.scm
index a48d724..8b68ec6 100644
--- a/gnu/packages/sqlite.scm
+++ b/gnu/packages/sqlite.scm
@@ -48,7 +48,7 @@
 (define-public sqlite
   (package
    (name "sqlite")
-   (version "3.31.1")
+   (version "3.32.3")
    (source (origin
             (method url-fetch)
             (uri (let ((numeric-version
@@ -64,8 +64,7 @@
                                   numeric-version ".tar.gz")))
             (sha256
              (base32
-              "1bj936svd8i5g25xd1bj52hj4zca01fgl3sqkj86z9q5pkz4wa32"))))
-   (replacement sqlite/fixed)
+              "0rlbaq177gcgk5dswd3akbhv2nvvzljrbhgy18hklbhw7h90f5d3"))))
    (build-system gnu-build-system)
    (inputs `(("readline" ,readline)))
    (native-inputs (if (hurd-target?)
@@ -123,27 +122,6 @@ widely deployed SQL database engine in the world.  The 
source code for SQLite
 is in the public domain.")
    (license license:public-domain)))
 
-(define-public sqlite/fixed
-  (package
-    (inherit sqlite)
-    (version "3.32.3")
-    (source (origin
-              (method url-fetch)
-              (uri (let ((numeric-version
-                          (match (string-split version #\.)
-                            ((first-digit other-digits ...)
-                             (string-append first-digit
-                                            (string-pad-right
-                                             (string-concatenate
-                                              (map (cut string-pad <> 2 #\0)
-                                                   other-digits))
-                                             6 #\0))))))
-                     (string-append "https://sqlite.org/2020/sqlite-autoconf-";
-                                    numeric-version ".tar.gz")))
-              (sha256
-               (base32
-                "0rlbaq177gcgk5dswd3akbhv2nvvzljrbhgy18hklbhw7h90f5d3"))))))
-
 ;; Column metadata support was added to the regular 'sqlite' package with
 ;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7.
 (define-public sqlite-with-column-metadata



reply via email to

[Prev in Thread] Current Thread [Next in Thread]