sqlite: upgraded package to upstream

Upgraded dev-db/sqlite to version 3.39.2 on amd64, arm64

BUG=b/242291338
TEST=presubmit
RELEASE_NOTE=Upgraded dev-db/sqlite to 3.39.2 to fix CVE-2022-35737.

cos-patch: security-high
Change-Id: Iba29c741db09b9b3b752f8516ff0c8731fd9b8b8
Reviewed-on: https://cos-review.googlesource.com/c/third_party/overlays/portage-stable/+/36008
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Varsha Teratipally <teratipally@google.com>
(cherry picked from commit 07583e6835a76df33bab32870c3ed4fb9f0ae171)
Reviewed-on: https://cos-review.googlesource.com/c/third_party/overlays/portage-stable/+/36028
Main-Branch-Verified: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
diff --git a/dev-db/sqlite/Manifest b/dev-db/sqlite/Manifest
index 1f04fd8..26d5369 100644
--- a/dev-db/sqlite/Manifest
+++ b/dev-db/sqlite/Manifest
@@ -1,2 +1,2 @@
-DIST sqlite-doc-3370200.zip 10542395 BLAKE2B 129ae0bac8099eb2571cc31ded186ed6c166c1b31af493047608ffb63ac7a90ccbaa5df733661c92660d2436bab6e3796f92e42ac8bb4154ff15212afc74b9b0 SHA512 02c68a3906aee3fd05a4340549144032a239e5ab885d9b3b09236ed2b74a90c770de373e4ca9f99e72f92df090d0fb6789213fb361e954d9dd6709af20336857
-DIST sqlite-src-3370200.zip 13145234 BLAKE2B 296eb8ac0e83552c348847ea1d0b06ce1b610ca1f53d8b56fa872196ccdc29c343a3b5cc671716854950c97425f8a5b78968e1b22c137ea1ff3bf386e94d8acc SHA512 2db103965934bb34c8336cf82ff7d77e75dc1ca00fa6324ac5697f3bf4b41bffff355dec7593515a68816449e5c9827a9503f6d7841c4c13981c231d3414ff76
+DIST sqlite-doc-3390200.zip 10683207 BLAKE2B 745aedf0c71da6c0d802aed2b64b6e10ef57f4a72210b12276a3019ccc5408bef537ad93c64eb972a7f24117df5780e35f75246d2ba9cd74c4537588eb6cba3c SHA512 54b9e632244b95ebf35fcaa5ce9c02381601eb442eec2ec2a809a7fe24d2cfed751581bb82fd243aaede2c935864da39fd1f1685e762826dd76fc754c7f79c0b
+DIST sqlite-src-3390200.zip 13403722 BLAKE2B 24ab8cfe5fda267c7a90939875e87bc9f9914f2690f195c21ff2b774ba83a7d6914f57648cf618fd79b37e54ad85121f86310a733a87e6c76bf729716a937d02 SHA512 a838386a48654391590ea0e1cb355d29f6f93033c3e582df7c63139adaf5119dd5a1550e913dbad0d3eafb0bfa03c4fc6dc48a334d9c45ffb8a7205a528b38f1
diff --git a/dev-db/sqlite/metadata.xml b/dev-db/sqlite/metadata.xml
index 1446d7c..60dcd6c 100644
--- a/dev-db/sqlite/metadata.xml
+++ b/dev-db/sqlite/metadata.xml
@@ -13,5 +13,6 @@
 	</use>
 	<upstream>
 		<remote-id type="cpe">cpe:/a:sqlite:sqlite</remote-id>
+		<remote-id type="github">sqlite/sqlite</remote-id>
 	</upstream>
 </pkgmetadata>
diff --git a/dev-db/sqlite/sqlite-3.37.2.ebuild b/dev-db/sqlite/sqlite-3.39.2.ebuild
similarity index 96%
rename from dev-db/sqlite/sqlite-3.37.2.ebuild
rename to dev-db/sqlite/sqlite-3.39.2.ebuild
index 1a27171..3e85700 100644
--- a/dev-db/sqlite/sqlite-3.37.2.ebuild
+++ b/dev-db/sqlite/sqlite-3.39.2.ebuild
@@ -13,6 +13,9 @@
 
 DESCRIPTION="SQL database engine"
 HOMEPAGE="https://sqlite.org/"
+
+# On version updates, make sure to read the forum (https://sqlite.org/forum/forum)
+# for hints regarding test failures, backports, etc.
 if [[ "${PV}" == "9999" ]]; then
 	SRC_URI=""
 else
@@ -199,11 +202,6 @@
 	# Support hidden columns.
 	append-cppflags -DSQLITE_ENABLE_HIDDEN_COLUMNS
 
-	# Support JSON1 extension.
-	# https://sqlite.org/compile.html#enable_json1
-	# https://sqlite.org/json1.html
-	append-cppflags -DSQLITE_ENABLE_JSON1
-
 	# Support memsys5 memory allocator.
 	# https://sqlite.org/compile.html#enable_memsys5
 	# https://sqlite.org/malloc.html#memsys5
@@ -324,6 +322,13 @@
 		else
 			append-cflags -ffloat-store
 		fi
+
+		# Skip known-broken test for now
+		# https://sqlite.org/forum/forumpost/d97caf168f
+		# https://sqlite.org/forum/forumpost/50f136d91d
+		if use test ; then
+			rm test/atof1.test || die
+		fi
 	fi
 
 	econf "${options[@]}"
@@ -360,6 +365,11 @@
 
 	local -x SQLITE_HISTORY="${T}/sqlite_history_${ABI}"
 
+	# e_uri.test tries to open files in /.
+	# https://bugs.gentoo.org/839798
+	local SANDBOX_PREDICT=${SANDBOX_PREDICT}
+	addpredict "/test.db:/ÿ.db"
+
 	emake HAVE_TCL="$(usex tcl 1 "")" $(use debug && echo fulltest || echo test)
 }