From 561e82e7096de5d98ac320d2a8ad4caf6dd313f6dce7027765ff3bb0af52c125 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Tue, 8 Jul 2025 08:14:17 +0000 Subject: [PATCH 1/2] - Add reproducible-doc-build.patch to make the build reproducible. gh#RDFLib/rdflib#2645 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rdflib?expand=0&rev=79 --- python-rdflib.changes | 6 ++++++ python-rdflib.spec | 2 ++ reproducible-doc-build.patch | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 reproducible-doc-build.patch diff --git a/python-rdflib.changes b/python-rdflib.changes index 68f1d5e..4716b62 100644 --- a/python-rdflib.changes +++ b/python-rdflib.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 8 08:07:39 UTC 2025 - Daniel Garcia + +- Add reproducible-doc-build.patch to make the build reproducible. + gh#RDFLib/rdflib#2645 + ------------------------------------------------------------------- Thu Apr 3 06:45:45 UTC 2025 - John Paul Adrian Glaubitz diff --git a/python-rdflib.spec b/python-rdflib.spec index 9d91182..2f50b1a 100644 --- a/python-rdflib.spec +++ b/python-rdflib.spec @@ -37,6 +37,8 @@ URL: http://rdflib.net/ Source: https://files.pythonhosted.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz # PATCH-FIX-UPSTREAM sphinx8.patch gh#RDFLib/rdflib#2956 -- daniel.garcia@suse.com Patch0: sphinx8.patch +# PATCH-FIX-OPENSUSE reproducible-doc-build.patch gh#RDFLib/rdflib#2645 -- daniel.garcia@suse.com +Patch1: reproducible-doc-build.patch BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives diff --git a/reproducible-doc-build.patch b/reproducible-doc-build.patch new file mode 100644 index 0000000..e32e53f --- /dev/null +++ b/reproducible-doc-build.patch @@ -0,0 +1,26 @@ +diff --git a/rdflib/term.py b/rdflib/term.py +index 3e397674..4e0cfcf1 100644 +--- a/rdflib/term.py ++++ b/rdflib/term.py +@@ -23,6 +23,7 @@ underlying Graph: + + from __future__ import annotations + ++import sys + import abc + import re + from fractions import Fraction +@@ -483,7 +484,12 @@ class BNode(IdentifiedNode): + else: + node_id = sn_result + else: +- node_id = uuid4().hex ++ # Do not generate random id for doc, this will help with reproducible ++ # builds https://github.com/RDFLib/rdflib/issues/2645 ++ if "sphinx-build" in sys.argv[0]: ++ node_id = "NODEID" ++ else: ++ node_id = uuid4().hex + # note, for two (and only two) string variables, + # concat with + is faster than f"{x}{y}" + value = _prefix + f"{node_id}" From e6de289b7ecc06ab5f055e53994b7aa2bb92939ef2b590eaaf3bb65c446572af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Tue, 8 Jul 2025 08:19:58 +0000 Subject: [PATCH 2/2] - Convert to libalternatives OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rdflib?expand=0&rev=80 --- python-rdflib.changes | 5 +++++ python-rdflib.spec | 35 +++++++++++++---------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/python-rdflib.changes b/python-rdflib.changes index 4716b62..d6ed945 100644 --- a/python-rdflib.changes +++ b/python-rdflib.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jul 8 08:17:28 UTC 2025 - Markéta Machová + +- Convert to libalternatives + ------------------------------------------------------------------- Tue Jul 8 08:07:39 UTC 2025 - Daniel Garcia diff --git a/python-rdflib.spec b/python-rdflib.spec index 2f50b1a..6d8b7ba 100644 --- a/python-rdflib.spec +++ b/python-rdflib.spec @@ -18,39 +18,37 @@ %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "doc" -%bcond_without doc %define psuffix -doc +%bcond_without doc %else -%bcond_with doc %define psuffix %{nil} +%bcond_with doc %endif - # Tests don't work and cause a dependency loop with python-SPARQLWrapper %bcond_with tests +%bcond_without libalternatives %{?sle15_python_module_pythons} Name: python-rdflib%{psuffix} Version: 7.1.4 Release: 0 Summary: A Python library for working with RDF License: BSD-3-Clause -URL: http://rdflib.net/ +URL: https://rdflib.net/ Source: https://files.pythonhosted.org/packages/source/r/rdflib/rdflib-%{version}.tar.gz # PATCH-FIX-UPSTREAM sphinx8.patch gh#RDFLib/rdflib#2956 -- daniel.garcia@suse.com Patch0: sphinx8.patch # PATCH-FIX-OPENSUSE reproducible-doc-build.patch gh#RDFLib/rdflib#2645 -- daniel.garcia@suse.com Patch1: reproducible-doc-build.patch +BuildRequires: alts BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires: alts BuildArch: noarch - %if %{with tests} BuildRequires: %{python_module SPARQLWrapper} BuildRequires: %{python_module flake8} BuildRequires: %{python_module pytest} %endif - %if %{with doc} BuildRequires: %{python_module rdflib = %{version}} BuildRequires: python3-Sphinx @@ -67,8 +65,8 @@ BuildRequires: %{python_module pyparsing} BuildRequires: %{python_module wheel} BuildRequires: %{python_module xml} Requires: python-pyparsing -%python_subpackages %endif +%python_subpackages %description RDFLib is a Python library for working with RDF, a simple yet powerful @@ -119,19 +117,12 @@ popd %else -%post -%python_install_alternative rdfs2dot -%python_install_alternative rdfpipe -%python_install_alternative rdfgraphisomorphism -%python_install_alternative rdf2dot -%python_install_alternative csv2rdf - -%postun -%python_uninstall_alternative rdfs2dot -%python_uninstall_alternative rdfpipe -%python_uninstall_alternative rdfgraphisomorphism -%python_uninstall_alternative rdf2dot -%python_uninstall_alternative csv2rdf +%pre +%python_libalternatives_reset_alternative rdfs2dot +%python_libalternatives_reset_alternative rdfpipe +%python_libalternatives_reset_alternative rdfgraphisomorphism +%python_libalternatives_reset_alternative rdf2dot +%python_libalternatives_reset_alternative csv2rdf %files %{python_files} %license LICENSE