Compare commits

...

No commits in common. 'c9' and 'c8-stream-3.9_bootstrap' have entirely different histories.

2
.gitignore vendored

@ -1,2 +1,2 @@
SOURCES/numpy-1.20.1.tar.gz
SOURCES/numpy-1.19.4.tar.gz
SOURCES/numpy-html.zip

@ -1,2 +1,2 @@
4e928ed206e84d8c26182fbe52a9dd5485136546 SOURCES/numpy-1.20.1.tar.gz
501cb32818de06b79a852322da95fc8b27a32742 SOURCES/numpy-1.19.4.tar.gz
035c72d0bb7430cebc242f229f5cc05a07caa5d9 SOURCES/numpy-html.zip

@ -0,0 +1,135 @@
From f73d993bcb03701f4e9146005a65eb482689140a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
Date: Mon, 26 Oct 2020 18:54:22 +0100
Subject: [PATCH] TST: Make test suite work in FIPS (140-2) Mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Tests using MD5 algorithms fail in FIPS Mode because MD5 is not FIPS
compliant.
Mark usages of MD5 in test suite as not being used for security
purposes to overcome that.
Signed-off-by: Nikola Forró <nforro@redhat.com>
---
numpy/core/tests/test_regression.py | 2 +-
numpy/random/tests/test_generator_mt19937.py | 10 +++++-----
numpy/random/tests/test_random.py | 4 ++--
numpy/random/tests/test_randomstate.py | 6 +++---
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index 2e731d4fa..4633174d9 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1509,7 +1509,7 @@ class TestRegression:
from hashlib import md5
x = np.array([1, 2, 3], dtype=np.dtype('<i4'))
- assert_equal(md5(x).hexdigest(), '2a1dd1e1e59d0a384c26951e316cd7e6')
+ assert_equal(md5(x, usedforsecurity=False).hexdigest(), '2a1dd1e1e59d0a384c26951e316cd7e6')
def test_0d_string_scalar(self):
# Bug #1436; the following should succeed
diff --git a/numpy/random/tests/test_generator_mt19937.py b/numpy/random/tests/test_generator_mt19937.py
index 6be7d852b..9b166e3a2 100644
--- a/numpy/random/tests/test_generator_mt19937.py
+++ b/numpy/random/tests/test_generator_mt19937.py
@@ -507,14 +507,14 @@ class TestIntegers:
val = random.integers(0, 6 - endpoint, size=1000, endpoint=endpoint,
dtype=dt).byteswap()
- res = hashlib.md5(val).hexdigest()
+ res = hashlib.md5(val, usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(dt).name] == res)
# bools do not depend on endianness
random = Generator(MT19937(1234))
val = random.integers(0, 2 - endpoint, size=1000, endpoint=endpoint,
dtype=bool).view(np.int8)
- res = hashlib.md5(val).hexdigest()
+ res = hashlib.md5(val, usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(bool).name] == res)
def test_repeatability_broadcasting(self, endpoint):
@@ -910,7 +910,7 @@ class TestRandomDist:
actual = random.choice(10000, 5000, replace=False)
if sys.byteorder != 'little':
actual = actual.byteswap()
- res = hashlib.md5(actual.view(np.int8)).hexdigest()
+ res = hashlib.md5(actual.view(np.int8), usedforsecurity=False).hexdigest()
assert_(choice_hash == res)
def test_bytes(self):
@@ -2436,7 +2436,7 @@ def test_jumped(config):
key = mt19937.state["state"]["key"]
if sys.byteorder == 'big':
key = key.byteswap()
- md5 = hashlib.md5(key)
+ md5 = hashlib.md5(key, usedforsecurity=False)
assert mt19937.state["state"]["pos"] == config["initial"]["pos"]
assert md5.hexdigest() == config["initial"]["key_md5"]
@@ -2444,7 +2444,7 @@ def test_jumped(config):
key = jumped.state["state"]["key"]
if sys.byteorder == 'big':
key = key.byteswap()
- md5 = hashlib.md5(key)
+ md5 = hashlib.md5(key, usedforsecurity=False)
assert jumped.state["state"]["pos"] == config["jumped"]["pos"]
assert md5.hexdigest() == config["jumped"]["key_md5"]
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py
index 276b5bc81..e49251af3 100644
--- a/numpy/random/tests/test_random.py
+++ b/numpy/random/tests/test_random.py
@@ -233,13 +233,13 @@ class TestRandint:
else:
val = self.rfunc(0, 6, size=1000, dtype=dt).byteswap()
- res = hashlib.md5(val.view(np.int8)).hexdigest()
+ res = hashlib.md5(val.view(np.int8), usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(dt).name] == res)
# bools do not depend on endianness
np.random.seed(1234)
val = self.rfunc(0, 2, size=1000, dtype=bool).view(np.int8)
- res = hashlib.md5(val).hexdigest()
+ res = hashlib.md5(val, usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(bool).name] == res)
def test_int64_uint64_corner_case(self):
diff --git a/numpy/random/tests/test_randomstate.py b/numpy/random/tests/test_randomstate.py
index 23dbbed6a..aa53d9322 100644
--- a/numpy/random/tests/test_randomstate.py
+++ b/numpy/random/tests/test_randomstate.py
@@ -341,13 +341,13 @@ class TestRandint:
else:
val = self.rfunc(0, 6, size=1000, dtype=dt).byteswap()
- res = hashlib.md5(val.view(np.int8)).hexdigest()
+ res = hashlib.md5(val.view(np.int8), usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(dt).name] == res)
# bools do not depend on endianness
random.seed(1234)
val = self.rfunc(0, 2, size=1000, dtype=bool).view(np.int8)
- res = hashlib.md5(val).hexdigest()
+ res = hashlib.md5(val, usedforsecurity=False).hexdigest()
assert_(tgt[np.dtype(bool).name] == res)
@pytest.mark.skipif(np.iinfo('l').max < 2**32,
@@ -1987,7 +1987,7 @@ def test_integer_repeat(int_func):
val = f(*args, size=1000000)
if sys.byteorder != 'little':
val = val.byteswap()
- res = hashlib.md5(val.view(np.int8)).hexdigest()
+ res = hashlib.md5(val.view(np.int8), usedforsecurity=False).hexdigest()
assert_(res == md5)
--
2.26.2

@ -1,22 +1,14 @@
#uncomment next line for a release candidate or a beta
#%%global relc rc1
# RHEL8: Tests disabled due to missing dependencies
%bcond_with tests
%if 0%{?fedora} >= 33 || 0%{?rhel} >= 9
%global blaslib flexiblas
%global blasvar %{nil}
%else
%global blaslib openblas
%global blasvar p
%endif
%global modname numpy
Name: numpy
Version: 1.20.1
Release: 5%{?dist}
Epoch: 1
Version: 1.19.4
Release: 3%{?dist}
Summary: A fast multidimensional array facility for Python
# Everything is BSD except for class SafeEval in numpy/lib/utils.py which is Python
@ -25,6 +17,13 @@ URL: http://www.numpy.org/
Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: https://numpy.org/doc/1.19/numpy-html.zip
Patch0: numpy-1.19.2-FIPS.patch
# Exclude i686 arch. Due to a modularity issue it's being added to the
# x86_64 compose of CRB, but we don't want to ship it at all.
# See: https://projects.engineering.redhat.com/browse/RCM-72605
ExcludeArch: i686
%description
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
@ -38,30 +37,28 @@ basic linear algebra and random number generation. Also included in
this package is a version of f2py that works properly with NumPy.
%package -n python3-numpy
%package -n python%{python3_pkgversion}-numpy
Summary: A fast multidimensional array facility for Python
License: BSD
%{?python_provide:%python_provide python3-numpy}
Provides: libnpymath-static = %{epoch}:%{version}-%{release}
Provides: libnpymath-static%{?_isa} = %{epoch}:%{version}-%{release}
Provides: numpy = %{epoch}:%{version}-%{release}
Provides: numpy%{?_isa} = %{epoch}:%{version}-%{release}
Obsoletes: numpy < 1:1.10.1-3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
%{?python_provide:%python_provide python%{python3_pkgversion}-numpy}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-Cython
BuildRequires: gcc-gfortran gcc
BuildRequires: lapack-devel
%if %{with tests}
BuildRequires: python3-hypothesis
BuildRequires: python3-pytest
BuildRequires: python3-test
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-test
BuildRequires: python%{python3_pkgversion}-hypothesis
%endif
BuildRequires: %{blaslib}-devel
BuildRequires: %{blaslib}-devel
Requires: python%{python3_pkgversion}-setuptools
%description -n python3-numpy
%description -n python%{python3_pkgversion}-numpy
NumPy is a general-purpose array-processing package designed to
efficiently manipulate large multi-dimensional arrays of arbitrary
records without sacrificing too much speed for small multi-dimensional
@ -73,26 +70,29 @@ There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation. Also included in
this package is a version of f2py that works properly with NumPy.
%package -n python3-numpy-f2py
%package -n python%{python3_pkgversion}-numpy-f2py
Summary: f2py for numpy
Requires: python3-numpy%{?_isa} = %{epoch}:%{version}-%{release}
Requires: python3-devel
Provides: python3-f2py = %{version}-%{release}
Obsoletes: python3-f2py <= 2.45.241_1927
%{?python_provide:%python_provide python3-numpy-f2py}
Provides: f2py = %{epoch}:%{version}-%{release}
Provides: numpy-f2py = %{epoch}:%{version}-%{release}
Obsoletes: numpy-f2py < 1:1.10.1-3
%description -n python3-numpy-f2py
Requires: python%{python3_pkgversion}-numpy%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}-devel
Provides: python%{python3_pkgversion}-f2py = %{version}-%{release}
%{?python_provide:%python_provide python%{python3_pkgversion}-numpy-f2py}
# Require alternatives version that implements the --keep-foreign flag
Requires(postun): alternatives >= 1.19.1-1
# python39 installs the alternatives master symlink to which we attach a slave
Requires: python%{python3_pkgversion}
Requires(post): python%{python3_pkgversion}
Requires(postun): python%{python3_pkgversion}
%description -n python%{python3_pkgversion}-numpy-f2py
This package includes a version of f2py that works properly with NumPy.
%package -n python3-numpy-doc
Summary: Documentation for numpy
Requires: python3-numpy = %{epoch}:%{version}-%{release}
BuildArch: noarch
%package -n python%{python3_pkgversion}-numpy-doc
Summary: Documentation for numpy
Requires: python%{python3_pkgversion}-numpy = %{version}-%{release}
BuildArch: noarch
%description -n python3-numpy-doc
%description -n python%{python3_pkgversion}-numpy-doc
This package provides the complete documentation for NumPy.
@ -131,29 +131,45 @@ env OPENBLAS=%{_libdir} \
LAPACK=%{_libdir} CFLAGS="%{optflags}" \
%{__python3} setup.py install --root %{buildroot}
pushd %{buildroot}%{_bindir} &> /dev/null
ln -s f2py3 f2py.numpy
# Remove unversioned binaries
rm f2py
rm f2py3
popd &> /dev/null
#symlink for includes, BZ 185079
mkdir -p %{buildroot}%{_includedir}
ln -s %{python3_sitearch}/%{name}/core/include/numpy/ %{buildroot}%{_includedir}/numpy
# All ghost files controlled by alternatives need to exist for the files
# section check to succeed
touch %{buildroot}%{_bindir}/f2py3
%check
%if %{with tests}
%ifarch ppc64le
# https://github.com/numpy/numpy/issues/14357
python3 runtests.py -- -k 'not test_einsum_sums_cfloat64'
%{__python3} runtests.py -v -- -k 'not test_einsum_sums_cfloat64'
%else
python3 runtests.py
%{__python3} runtests.py -v
%endif
%endif
%files -n python3-numpy
%post -n python%{python3_pkgversion}-numpy-f2py
alternatives --add-slave python3 %{_bindir}/python%{python3_version} \
%{_bindir}/f2py3 \
f2py3 \
%{_bindir}/f2py%{python3_version}
%postun -n python%{python3_pkgversion}-numpy-f2py
# Do this only during uninstall process (not during update)
if [ $1 -eq 0 ]; then
alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \
f2py3
fi
%files -n python%{python3_pkgversion}-numpy
%license LICENSE.txt
%doc THANKS.txt site.cfg.example
%{python3_sitearch}/%{name}/__pycache__
%{python3_sitearch}/%{name}/__pycache__/
%dir %{python3_sitearch}/%{name}
%{python3_sitearch}/%{name}/*.py*
%{python3_sitearch}/%{name}/core
@ -171,53 +187,26 @@ python3 runtests.py
%{python3_sitearch}/%{name}/polynomial
%{python3_sitearch}/%{name}-*.egg-info
%exclude %{python3_sitearch}/%{name}/LICENSE.txt
%{_includedir}/numpy
%{python3_sitearch}/%{name}/__init__.pxd
%{python3_sitearch}/%{name}/__init__.cython-30.pxd
%{python3_sitearch}/%{name}/py.typed
%{python3_sitearch}/%{name}/typing/
%files -n python3-numpy-f2py
%{_bindir}/f2py
%{_bindir}/f2py3
%{_bindir}/f2py.numpy
%files -n python%{python3_pkgversion}-numpy-f2py
%{_bindir}/f2py%{python3_version}
%ghost %{_bindir}/f2py3
%{python3_sitearch}/%{name}/f2py
%files -n python3-numpy-doc
%files -n python%{python3_pkgversion}-numpy-doc
%doc docs/*
%changelog
* Tue Feb 08 2022 Tomas Orsava <torsava@redhat.com> - 1.20.1-5
- Add automatically generated Obsoletes tag with the python39- prefix
for smoother upgrade from RHEL8
- Related: rhbz#1990421
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.20.1-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Nikola Forró <nforro@redhat.com> - 1:1.20.1-3
- Disable tests by default (#1928123)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:1.20.1-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Mon Feb 08 2021 Gwyn Ciesla <gwync@protonmail.com> 1:1.20.1-1
- 1.21.1
* Mon Feb 01 2021 Gwyn Ciesla <gwync@protonmail.com> - 1:1.20.0-1
- 1.20.0 final.
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:1.20.0-0.2.rc2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jan 04 2021 Nikola Forró <nforro@redhat.com> - 1:1.20.0-0.1.rc2
- Generate the main dispatcher config header into the build dir
* Thu Aug 05 2021 Tomas Orsava <torsava@redhat.com> - 1.19.4-3
- Adjusted the postun scriptlets to enable upgrading to RHEL 9
- Resolves: rhbz#1933055
* Mon Dec 28 2020 Gwyn Ciesla <gwync@protonmail.com> - 1:1.20.0-0.rc2
- 1.20.0 rc2
* Mon Jan 18 2021 Tomas Orsava <torsava@redhat.com> - 1.19.4-2
- Convert from Fedora to the python39 module in RHEL8
- Resolves: rhbz#1877430
* Tue Nov 03 2020 Gwyn Ciesla <gwync@protonmail.com> - 1:1.19.4-1
- 1.19.4

Loading…
Cancel
Save