Skip to content

Commit

Permalink
Merge branch 'master' of github.com:baallan/distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
baallan committed Jun 21, 2019
2 parents 39abf61 + dc6a837 commit f394e44
Show file tree
Hide file tree
Showing 9 changed files with 289 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ When working with test packages, pay particular attention to the variables at th

Scalable configuration management of clusters is most easily done using the libgenders
options to control the ldmsd systemd service. An example of this is given in [gendersTutorial.md](gendersTutorial.md).

## Packaging for versions 4 of OVIS
The optional object store sosdb uses python/numpy/cython for easy access to data arrays in python.
The default RHEL 7 Numpy (1.7) and Cython (0.19) are incompatible with sosdb usage.
While personal builds can be performed with any modern batteries-include python distribution instead of Redhat's,
rpm builds require known rpms for cython and numpy, so these are provided in the toss3.numpy and toss3.cython directories.
The numpy and cython rpm spec files and generated rpms for python 2.7 will also work in plain RHEL 7 environments.
19 changes: 19 additions & 0 deletions toss3.cython/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
This is an rpm recipe for use with TOSS Linux version 3.

It provides a module to add cython 0.28.5
support via /opt/cython to the stock python 2.7 in /usr.

To install, create the typical rpmbuild environment and (after installing the TOSS 3 cython in /opt):
```
wget https://github.com/cython/cython/archive/0.28.5/cython-0.28.5.tar.gz
cp toss-python2-Cython.spec ~/rpmbuild/SPECS
cp cython-0.28.5.tar.gz ~/rpmbuild/SOURCES
cp module.toss-cython ~/rpmbuild/SOURCES
cd ~/rpmbuild/SPECS
rpmbuild -ba toss-python2-numpy.spec
```
When successful, you can yum install the resulting rpm.
In the TOSS 3 modules environment,
```
module load cython
```
20 changes: 20 additions & 0 deletions toss3.cython/module.toss-cython
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#%Module1.0
# vi:set filetype=tcl:
#

# global control file
if { [file exists $env(MODULESHOME)/etc/control] } {
source $env(MODULESHOME)/etc/control
}

# local variables
set name cython
set version 0.28.5
set prefix /opt/$name/$version
set bindir $prefix/bin
set libdir $prefix/lib64

prepend-path PATH $bindir
prepend-path LD_LIBRARY_PATH $libdir
prepend-path PYTHONPATH $libdir/python2.7/site-packages

83 changes: 83 additions & 0 deletions toss3.cython/toss-python2-Cython.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
%global srcname cython
%global upname Cython

%define pkgname python2-%{srcname}

Name: %{pkgname}
Version: 0.28.5
Release: 1%{?dist}
Summary: Language for writing Python extension modules

License: ASL 2.0
URL: http://www.cython.org
Source0: https://github.com/cython/cython/archive/%{version}/%{srcname}-%{version}.tar.gz
Source1: module.toss-cython

BuildRequires: gcc

# override /usr in installation, but Prefix isn't working for this.
%define cy_root /opt/cython/%{version}
%define cy_bin %{cy_root}/bin
%define cy_sitepackages %{cy_root}/%{_lib}/python%{python2_version}/site-packages
%define cy_sitelib %{cy_root}/%{_lib}/python%{python2_version}/site-packages
%define moddir /opt/modules/modulefiles/cython/%{version}


%global _description \
This is a development version of Pyrex, a language\
for writing Python extension modules.

%description %{_description}

# % package
Summary: %{summary}
Obsoletes: python2-Cython < 0.28.5
BuildRequires: python-devel
BuildRequires: python-setuptools
Prefix: /

%description -n %{pkgname} %{_description}
Python 2 cython 0.28 for TOSS 3.

%prep
mkdir -p %{buildroot}%{cy_root}
%autosetup -n %{srcname}-%{version} -p1

%build
%py2_build

%install
mkdir -p %{buildroot}/%{moddir}
%{__install} -m 755 %{_sourcedir}/module.toss-cython %{buildroot}/%{moddir}

# % py2_install ; redefining the macro didn't work, so inline it here
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install --prefix=%{cy_root} -O1 --skip-build --root %{buildroot}

# support forward compatibility with rhel 8
for bin in cython cythonize cygdb; do
(cd %{buildroot}%{cy_bin}; ln -s ${bin} ${bin}-%{python2_version})
(cd %{buildroot}%{cy_bin}; ln -s ${bin}-%{python2_version} ${bin}-2)
done
rm -rf %{buildroot}%{cy_root}%{cy_sitelib}/setuptools/tests

%files -n %{pkgname}
%license LICENSE.txt
%doc *.txt Demos Doc Tools
%{moddir}/*
%{cy_bin}/cython
%{cy_bin}/cython-2
%{cy_bin}/cython-%{python2_version}
%{cy_bin}/cygdb
%{cy_bin}/cygdb-2
%{cy_bin}/cygdb-%{python2_version}
%{cy_bin}/cythonize
%{cy_bin}/cythonize-2
%{cy_bin}/cythonize-%{python2_version}
%{cy_sitepackages}/%{upname}-*.egg-info/
%{cy_sitepackages}/%{upname}/
%{cy_sitepackages}/pyximport/
%{cy_sitepackages}/%{srcname}.py*

%changelog
* Thu Jun 20 2019 Ben Allan <[email protected]>
Cython 0.28.5 for TOSS3 system python
23 changes: 23 additions & 0 deletions toss3.numpy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
This is an rpm recipe for use with TOSS linux version 3.

It provides a module to add numpy 1.14 (less f2py)
support via /opt/numpy to the stock python 2.7 in /usr.

It requires Cython 0.28.5 for TOSS also be installed.

To install, create the typical rpmbuild environment and (after installing the toss3 cython in /opt):
```
wget https://github.com/numpy/numpy/releases/download/v1.14.6/numpy-1.14.6.tar.gz
cp toss-python2-numpy.spec ~/rpmbuild/SPECS
cp numpy-1.14.6.tar.gz ~/rpmbuild/SOURCES
cp module.toss-numpy ~/rpmbuild/SOURCES
cd ~/rpmbuild/SPECS
rpmbuild -ba toss-python2-numpy.spec
```
When successful, you can yum install the resulting rpm.

In the TOSS 3 modules environment,
```
module load cython
module load numpy
```
18 changes: 18 additions & 0 deletions toss3.numpy/module.toss-numpy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#%Module1.0
# vi:set filetype=tcl:
#

# global control file
if { [file exists $env(MODULESHOME)/etc/control] } {
source $env(MODULESHOME)/etc/control
}

# local variables
set name numpy
set version 1.14.6
set prefix /opt/$name/$version
set libdir $prefix/lib64

prepend-path PYTHONPATH $libdir/python2.7/site-packages
prereq cython

115 changes: 115 additions & 0 deletions toss3.numpy/toss-python2-numpy.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Name: numpy
Version: 1.14.6
Release: 1%{?dist}
Epoch: 1
Summary: A fast multidimensional array facility for Python

# override /usr in installation, but Prefix isn't working for this with python macros
# we need the path to include cython from the required package, or numpy may use the system cython
# incorrectly.
%define cy_root /opt/cython/%{version}
%define cy_bin %{cy_root}/bin
%define cy_sitepackages %{cy_root}/%{_lib}/python%{python2_version}/site-packages

%define moddir /opt/modules/modulefiles/numpy/%{version}/
%define numpy_root /opt/numpy/%{version}
%define numpy_sitepackages %{numpy_root}/%{_lib}/python%{python2_version}/site-packages
%define moddir /opt/modules/modulefiles/numpy/%{version}/

# Everything is BSD except for class SafeEval in numpy/lib/utils.py which is Python
License: BSD and Python
URL: http://www.numpy.org/
Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1: module.toss-numpy

BuildRequires: python-devel python-setuptools python2-cython gcc
BuildRequires: lapack-devel
BuildRequires: atlas-devel

%description
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
arrays. NumPy is built on the Numeric code base and adds features
introduced by numarray as well as an extended C-API and the ability to
create arrays of arbitrary type.

There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation.

%package -n python2-numpy
Summary: A fast multidimensional array facility for Python

%description -n python2-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
arrays. NumPy is built on the Numeric code base and adds features
introduced by numarray as well as an extended C-API and the ability to
create arrays of arbitrary type.

There are also basic facilities for discrete fourier transform,
basic linear algebra and random number generation.

%prep
%setup -q -n %{name}-%{version}%{?relc}

# workaround for rhbz#849713
# http://mail.scipy.org/pipermail/numpy-discussion/2012-July/063530.html
rm numpy/distutils/command/__init__.py && touch numpy/distutils/command/__init__.py


%build
env ATLAS=%{_libdir} \
PATH=%{cy_bin}:$PATH \
PYTHONPATH=%{cy_sitepackages}:$PYTHONPATH \
FFTW=%{_libdir} BLAS=%{_libdir} \
BLAS=%{_libdir} \
LAPACK=%{_libdir} CFLAGS="%{optflags}" \
%{__python2} setup.py build

%install
mkdir -p %{buildroot}/%{moddir}
%{__install} -m 755 %{_sourcedir}/module.toss-numpy %{buildroot}/%{moddir}/py%{python2_version}

env ATLAS=%{_libdir} \
PATH=%{cy_bin}:$PATH \
PYTHONPATH=%{cy_sitepackages}:$PYTHONPATH \
FFTW=%{_libdir} BLAS=%{_libdir} \
LAPACK=%{_libdir} CFLAGS="%{optflags}" \
%{__python2} setup.py install --prefix=%{numpy_root} --root %{buildroot}

rm -rf %{buildroot}/%{numpy_sitepackages}/numpy/f2py
rm -rf %{buildroot}/%{numpy_root}/bin

%check
pushd doc &> /dev/null
PATH="%{buildroot}%{_bindir}:${PATH}" PYTHONPATH="%{buildroot}%{numpy_sitepackages}:%{cy_sitepackages}" %{__python2} -c "import pkg_resources, numpy ; numpy.test(verbose=2)" \
# don't remove this comment
popd &> /dev/null

%files -n python2-numpy
%license LICENSE.txt
%doc THANKS.txt site.cfg.example
%dir %{numpy_sitepackages}/%{name}
%{moddir}/*
%{numpy_sitepackages}/%{name}/*.py*
%{numpy_sitepackages}/%{name}/core
%{numpy_sitepackages}/%{name}/distutils
%{numpy_sitepackages}/%{name}/doc
%{numpy_sitepackages}/%{name}/fft
%{numpy_sitepackages}/%{name}/lib
%{numpy_sitepackages}/%{name}/linalg
%{numpy_sitepackages}/%{name}/ma
%{numpy_sitepackages}/%{name}/random
%{numpy_sitepackages}/%{name}/testing
%{numpy_sitepackages}/%{name}/tests
%{numpy_sitepackages}/%{name}/compat
%{numpy_sitepackages}/%{name}/matrixlib
%{numpy_sitepackages}/%{name}/polynomial
%{numpy_sitepackages}/%{name}-*.egg-info
%exclude %{numpy_sitepackages}/%{name}/LICENSE.txt

%changelog
* Fri Jun 21 2019 Ben Allan <[email protected]> - 1.14.6-1
- package modern numpy for toss3 system python as module
5 changes: 3 additions & 2 deletions toss3/firerpms
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
#
packing=toss3
ovis_branch=v3.4.12
ovis_branch=v3.4.13
sos_branch=master
NetworkRequires=github.com
#[email protected]:tom/SOS.git
Expand Down Expand Up @@ -141,7 +141,8 @@ else
git submodule init sos && git submodule update sos && tar cf ../$SOSTAR sos
fi

patches="ovis_self.patch"
#patches="ovis_self.patch"
patches=
for i in $patches; do
patch -p1 < ../patches/$i
git commit -a -m "add $packing distribution patches"
Expand Down
2 changes: 1 addition & 1 deletion toss3/ovis.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
Summary: OVIS Commands and Libraries
Name: ovis
Version: @VERSION@
Release: 2.1%{?dist}
Release: 1.0%{?dist}
License: GPLv2 or BSD
Group: %{ldms_all}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Expand Down

0 comments on commit f394e44

Please sign in to comment.