app-text/cmark: add 0.31.2

Closes: https://bugs.gentoo.org/964554
Closes: https://bugs.gentoo.org/973781
Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/44299
Closes: https://github.com/gentoo/gentoo/pull/44299
Signed-off-by: Pacho Ramos <pacho@gentoo.org>
This commit is contained in:
Azamat H. Hackimov
2026-03-01 22:18:49 +03:00
committed by Pacho Ramos
parent dfed714c87
commit cad446af24
3 changed files with 136 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST cmark-0.31.1.tar.gz 264170 BLAKE2B c1de1cf035ff5c706455889413c8cfdaa4b5da39a333d21ed77e2091d1a2f5ef9c90c34100c18be62426aea68c2d5ce157719964a761312f7e4b11e05dae0024 SHA512 3b4f8b47d8ea270078ab986aa22fc32b227786459bd33c7225aac578d8dd014e3d8788a6add60ea10571fdb4c7dc6a1ece960815a02f04f153b1775c73ccff8f
DIST cmark-0.31.2.tar.gz 267259 BLAKE2B 6d7a21b3b5f5af0b190ad566978821d5447921026846517ec076dc23900cb1241f03d55cb61a51e4d37147d3827d77ce6e95a76f706d210d8622ba0aa64de631 SHA512 8dcf4f25b53e84a16afa506214f17c3d2d7b0cc78d9d289b469ad8d1e481c4b355263eca3fb1e2b595c30734bc2d617fd38e00d17a14dcfa9de8c71580916265

View File

@@ -0,0 +1,37 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..14} )
inherit cmake python-any-r1
DESCRIPTION="CommonMark parsing and rendering library and program in C"
HOMEPAGE="https://github.com/commonmark/cmark"
SRC_URI="https://github.com/commonmark/cmark/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="BSD-2"
SLOT="0/0.31.2"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
BDEPEND="test? ( ${PYTHON_DEPS} )"
PATCHES=(
"${FILESDIR}/cmark-0.31.2_python-3.14.patch"
)
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_configure() {
local mycmakeargs=(
-DCMARK_LIB_FUZZER=OFF
-DBUILD_SHARED_LIBS=ON
-DBUILD_TESTING="$(usex test)"
)
cmake_src_configure
}

View File

@@ -0,0 +1,98 @@
From: https://github.com/commonmark/cmark/pull/602
From: "Azamat H. Hackimov" <azamat.hackimov@gmail.com>
Date: Sun, 1 Mar 2026 22:11:33 +0300
Subject: [PATCH] Fix running tests on Python 3.14
In Python 3.14 multiprocessing module changed start method from fork to forkserver. Now child processes don't have access to parent's memory objects, and pathological_tests.py fails. This change move required objects (mostly object initialization) into child's area.
--- a/test/pathological_tests.py
+++ b/test/pathological_tests.py
@@ -1,29 +1,14 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
-import re
import argparse
-import sys
-import platform
import itertools
import multiprocessing
+import re
+import sys
import queue
-import time
from cmark import CMark
-TIMEOUT = 5
-
-parser = argparse.ArgumentParser(description='Run cmark tests.')
-parser.add_argument('--program', dest='program', nargs='?', default=None,
- help='program to test')
-parser.add_argument('--library-dir', dest='library_dir', nargs='?',
- default=None, help='directory containing dynamic library')
-args = parser.parse_args(sys.argv[1:])
-
-allowed_failures = {"many references": True}
-
-cmark = CMark(prog=args.program, library_dir=args.library_dir)
-
def hash_collisions():
REFMAP_SIZE = 16
COUNT = 25000
@@ -133,13 +118,18 @@ pathological_cmark = {
whitespace_re = re.compile('/s+/')
-def run_pathological(q, inp):
+def run_pathological(q, inp, prog, lib_dir):
+ cmark = CMark(prog=prog, library_dir=lib_dir)
q.put(cmark.to_html(inp))
-def run_pathological_cmark(q, inp):
+def run_pathological_cmark(q, inp, prog, lib_dir):
+ cmark = CMark(prog=prog, library_dir=lib_dir)
q.put(cmark.to_commonmark(inp))
-def run_tests():
+def run_tests(args):
+ allowed_failures = {"many references": True}
+ TIMEOUT = 5
+
q = multiprocessing.Queue()
passed = []
errored = []
@@ -150,12 +140,16 @@ def run_tests():
for description in (*pathological, *pathological_cmark):
if description in pathological:
(inp, regex) = pathological[description]
- p = multiprocessing.Process(target=run_pathological,
- args=(q, inp))
+ p = multiprocessing.Process(
+ target=run_pathological,
+ args=(q, inp, args.program, args.library_dir)
+ )
else:
(inp, regex) = pathological_cmark[description]
- p = multiprocessing.Process(target=run_pathological_cmark,
- args=(q, inp))
+ p = multiprocessing.Process(
+ target=run_pathological_cmark,
+ args=(q, inp, args.program, args.library_dir)
+ )
p.start()
try:
# wait TIMEOUT seconds or until it finishes
@@ -199,4 +193,10 @@ def run_tests():
exit(0)
if __name__ == "__main__":
- run_tests()
+ parser = argparse.ArgumentParser(description='Run cmark tests.')
+ parser.add_argument('--program', dest='program', nargs='?', default=None,
+ help='program to test')
+ parser.add_argument('--library-dir', dest='library_dir', nargs='?',
+ default=None, help='directory containing dynamic library')
+ args = parser.parse_args(sys.argv[1:])
+ run_tests(args)
--
2.52.0