Drop test data with problematic license status

This commit is contained in:
Benjamin A. Beasley 2022-06-25 12:53:26 -04:00
parent 47140811aa
commit 5ac8e73c24
4 changed files with 58 additions and 23 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/chardet-*.tar.gz
/chardet-*/
/chardet-4.0.0-filtered.tar.xz

34
get_source Executable file
View File

@ -0,0 +1,34 @@
#!/bin/sh
set -o errexit
set -o nounset
if [ "$#" != '1' ]
then
cat 1>&2 <<EOF
Usage: $0 VERSION
Downloads the requested version and creates a filtered source tarball.
EOF
exit 1
fi
VERSION="${1}"
OUTDIR="${PWD}"
TMPDIR="$(mktemp -d)"
trap "rm -rf '${TMPDIR}'" INT TERM EXIT
cd "${TMPDIR}"
URL="$(rpm -E "%{pypi_source chardet ${VERSION}}")"
echo "--> 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

View File

@ -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}

View File

@ -1 +1 @@
SHA512 (chardet-4.0.0.tar.gz) = ebd7f420e1094445270db993f6373ffe7370419e002b0bb13299dc6c9b0f7c4e77b0f44f871fba6371e6869e7c86728514367db377e3137487a3acf50cb81e96
SHA512 (chardet-4.0.0-filtered.tar.xz) = ac510d460dc65233bda8d11964d6d9a130a53ef64035393d05c52ab6c4e0b7a7ca6f34108c21771fb40236d71e7de62dfe6c6f9fa6cd1722a355116930b5e12b