From f31a81f598c0a3a9dd4da48647a55c039957d3f39e71a8bd64ed1c8703fcab8c Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Jul 2024 17:57:15 +0000 Subject: [PATCH] - Add no-store-btime-gzip.patch to fix bsc#1227999 by not storing build time in gzip headers so as to make building documentation reproducible - Add rpmlintrc OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-sphinxcontrib-devhelp?expand=0&rev=14 --- no-store-btime-gzip.patch | 25 +++++++++++++++++++++++++ python-sphinxcontrib-devhelp.changes | 8 ++++++++ python-sphinxcontrib-devhelp.rpmlintrc | 2 ++ python-sphinxcontrib-devhelp.spec | 18 ++++++++++++------ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 no-store-btime-gzip.patch create mode 100644 python-sphinxcontrib-devhelp.rpmlintrc diff --git a/no-store-btime-gzip.patch b/no-store-btime-gzip.patch new file mode 100644 index 0000000..47aefe1 --- /dev/null +++ b/no-store-btime-gzip.patch @@ -0,0 +1,25 @@ +From 2e0fc9b9da0227b146258aa3831a416c7b023234 Mon Sep 17 00:00:00 2001 +From: "Bernhard M. Wiedemann" +Date: Wed, 17 Jul 2024 07:50:46 +0200 +Subject: [PATCH] Avoid storing build time in gzip headers + +This allows to create bit-reproducible Python3.12/Python.devhelp.gz output. + +See https://reproducible-builds.org/ for why this is good. +--- + sphinxcontrib/devhelp/__init__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sphinxcontrib/devhelp/__init__.py b/sphinxcontrib/devhelp/__init__.py +index bc99016..fc441d0 100644 +--- a/sphinxcontrib/devhelp/__init__.py ++++ b/sphinxcontrib/devhelp/__init__.py +@@ -124,7 +124,7 @@ def write_index(title: str, refs: list[Any], subitems: Any) -> None: + + # Dump the XML file + xmlfile = path.join(outdir, outname + '.devhelp.gz') +- with gzip.open(xmlfile, 'w') as f: ++ with gzip.GzipFile(filename=xmlfile, mode='w', mtime=0) as f: + tree.write(f, 'utf-8') # type: ignore + + diff --git a/python-sphinxcontrib-devhelp.changes b/python-sphinxcontrib-devhelp.changes index 7069ed6..3dbaab1 100644 --- a/python-sphinxcontrib-devhelp.changes +++ b/python-sphinxcontrib-devhelp.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Jul 19 17:56:18 UTC 2024 - Matej Cepl + +- Add no-store-btime-gzip.patch to fix bsc#1227999 by not storing + build time in gzip headers so as to make building documentation + reproducible +- Add rpmlintrc + ------------------------------------------------------------------- Sun Jan 14 10:42:57 UTC 2024 - Dirk Müller diff --git a/python-sphinxcontrib-devhelp.rpmlintrc b/python-sphinxcontrib-devhelp.rpmlintrc new file mode 100644 index 0000000..cf2462c --- /dev/null +++ b/python-sphinxcontrib-devhelp.rpmlintrc @@ -0,0 +1,2 @@ +addFilter("hidden-file-or-dir /usr/lib/python.*/sphinxcontrib/devhelp/locales/.tx") +addFilter("file-not-in-%lang /usr/lib/python.*/site-packages/sphinxcontrib/devhelp/locales/.*\.mo") diff --git a/python-sphinxcontrib-devhelp.spec b/python-sphinxcontrib-devhelp.spec index 14bbfa3..ff35d8b 100644 --- a/python-sphinxcontrib-devhelp.spec +++ b/python-sphinxcontrib-devhelp.spec @@ -1,5 +1,5 @@ # -# spec file +# spec file for package python-sphinxcontrib-devhelp # # Copyright (c) 2024 SUSE LLC # @@ -32,7 +32,11 @@ Summary: Sphinx extension which outputs Devhelp documents License: BSD-2-Clause Group: Development/Languages/Python URL: https://github.com/sphinx-doc/sphinxcontrib-devhelp -Source: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-devhelp/sphinxcontrib_devhelp-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/s/sphinxcontrib-devhelp/sphinxcontrib_devhelp-%{version}.tar.gz +Source99: python-sphinxcontrib-devhelp.rpmlintrc +# PATCH-FIX-UPSTREAM no-store-btime-gzip.patch bsc#1227999 mcepl@suse.com +# don't store build time in gzip headers to make building documentation reproducible +Patch0: no-store-btime-gzip.patch %if %{with test} BuildRequires: %{python_module Sphinx >= 5.0} BuildRequires: %{python_module pytest} @@ -50,13 +54,13 @@ BuildArch: noarch sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document. %prep -%setup -q -n sphinxcontrib_devhelp-%{version} +%autosetup -p1 -n sphinxcontrib_devhelp-%{version} %build %pyproject_wheel %install -%if !%{with test} +%if %{without test} %pyproject_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %endif @@ -66,11 +70,13 @@ sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document. %pytest %endif -%if !%{with test} +%if %{without test} %files %{python_files} %doc README.rst CHANGES %license LICENSE -%{python_sitelib}/* +%dir %{python_sitelib}/sphinxcontrib +%{python_sitelib}/sphinxcontrib/devhelp +%{python_sitelib}/sphinxcontrib_devhelp-%{version}*-info %endif %changelog