From 5ac8e73c24537b0a311137438f2cffc4e2696039 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 25 Jun 2022 12:53:26 -0400 Subject: [PATCH] Drop test data with problematic license status --- .gitignore | 1 + get_source | 34 ++++++++++++++++++++++++++++++++++ python-chardet.spec | 44 ++++++++++++++++++++++---------------------- sources | 2 +- 4 files changed, 58 insertions(+), 23 deletions(-) create mode 100755 get_source diff --git a/.gitignore b/.gitignore index bb18b7a..4a4974b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /chardet-*.tar.gz /chardet-*/ +/chardet-4.0.0-filtered.tar.xz diff --git a/get_source b/get_source new file mode 100755 index 0000000..8268d9e --- /dev/null +++ b/get_source @@ -0,0 +1,34 @@ +#!/bin/sh +set -o errexit +set -o nounset + +if [ "$#" != '1' ] +then + cat 1>&2 < Downloading: ${URL}" 1>&2 +curl -L -O "${URL}" + +ARCHIVE="$(find . -mindepth 1 -maxdepth 1 -type f -name '*.tar.gz' -print -quit)" +echo "--> Extracting: $(basename "${ARCHIVE}")" 1>&2 +tar -xzf "${ARCHIVE}" +echo '--> Removing tests due to licensing issues' 1>&2 +rm -rvf */tests/ +FILTERED="$(basename "${ARCHIVE}" .tar.gz)-filtered.tar.xz" +echo "--> Re-archiving: ${FILTERED}" 1>&2 +tar -c "${FILTERED}" */ | xz -9e > "${FILTERED}" +mv -v "${FILTERED}.xz" "${OUTDIR}" +echo 'Done.' 1>&2 diff --git a/python-chardet.spec b/python-chardet.spec index 56dc09d..2e38257 100644 --- a/python-chardet.spec +++ b/python-chardet.spec @@ -1,6 +1,3 @@ -# Circular dependency on pytest -%bcond_without tests - # Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # @@ -12,31 +9,34 @@ Version: 4.0.0 Release: %autorelease Summary: Python character encoding detector -# The entire source is LGPLv2+, except: -# -# - tests/ascii/howto.diveintomark.org.xml is CC-BY-SA (but is not installed) +# The entire source, after tests/ are filtered, is LGPLv2+. See the comment +# above Source0 for more details on tests/. # # See also: -# clarify Trove license classifier -# https://github.com/chardet/chardet/issues/162 -# Clarify LGPL version in License trove classifier -# https://github.com/chardet/chardet/pull/255 +# clarify Trove license classifier +# https://github.com/chardet/chardet/issues/162 +# Clarify LGPL version in License trove classifier +# https://github.com/chardet/chardet/pull/255 License: LGPLv2+ URL: https://github.com/chardet/chardet -Source0: %{pypi_source chardet} +# A filtered source tarball, obtained by (see Source1): +# +# ./get_source %%{version} +# +# is required because the contents of tests/ are under various undocumented +# licenses and are, for the most part, not freely redistributable. See: +# +# problematic licensing of /tests? +# https://github.com/chardet/chardet/issues/231 +Source0: chardet-%{version}-filtered.tar.xz +Source1: get_source # Hand-written for Fedora in groff_man(7) format based on --help output -Source1: chardetect.1 +Source2: chardetect.1 BuildArch: noarch BuildRequires: python3-devel -%if %{with tests} -BuildRequires: python3dist(pytest) -# Optional; enables additional tests (see test.py) -BuildRequires: python3dist(hypothesis) -%endif - %if %{with doc_pdf} BuildRequires: make BuildRequires: python3dist(sphinx) @@ -112,13 +112,13 @@ PYTHONPATH="${PWD}" %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}' %install %pyproject_install %pyproject_save_files chardet -install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE1}' +install -t '%{buildroot}%{_mandir}/man1' -D -p -m 0644 '%{SOURCE2}' -%if %{with tests} %check -%pytest -v -%endif +# We cannot run the upstream tests because they would require data files with +# problematic license status. +%pyproject_check_import %files -n python3-chardet -f %{pyproject_files} diff --git a/sources b/sources index dad62a1..f73c80e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (chardet-4.0.0.tar.gz) = ebd7f420e1094445270db993f6373ffe7370419e002b0bb13299dc6c9b0f7c4e77b0f44f871fba6371e6869e7c86728514367db377e3137487a3acf50cb81e96 +SHA512 (chardet-4.0.0-filtered.tar.xz) = ac510d460dc65233bda8d11964d6d9a130a53ef64035393d05c52ab6c4e0b7a7ca6f34108c21771fb40236d71e7de62dfe6c6f9fa6cd1722a355116930b5e12b