From b9771c00a57a9c49cddf772a65e393d08314326a Mon Sep 17 00:00:00 2001 From: Bruno Cornec Date: Tue, 5 Apr 2016 04:13:00 +0200 Subject: [PATCH] Fix #43 by providing python3 pkgs - Adds python3 package build in .spec - Adds a doc package to host html and pdf - Keeps man pages common --- install.sh | 44 +++++++----- pbconf/pbfilter/rpm.pbf | 7 +- pbconf/python-redfish/rpm/python-redfish.spec | 69 ++++++++++++++++--- 3 files changed, 91 insertions(+), 29 deletions(-) diff --git a/install.sh b/install.sh index 82770e1..b0a8ef8 100755 --- a/install.sh +++ b/install.sh @@ -1,29 +1,37 @@ #!/bin/bash -# Syntax: install.sh +# Syntax: install.sh set -x -export rootdir=$1 -export sitelib=$2 -export prefix=$3 -#export varlog=$4 +export python=$1 +export rootdir=$2 +export sitelib=$3 +export prefix=$4 +export pkg=$5 + +# Documentation installation only +if [ $python = "doc" ]; then + install -d 755 $rootdir/$prefix/share/doc/$5/html/_static + install -m 644 doc/build/singlehtml/*.html $rootdir/$prefix/share/doc/$5/html + install -m 644 doc/build/singlehtml/_static/* $rootdir/$prefix/share/doc/$5/html/_static + install -m 644 doc/build/latex/*.pdf $rootdir/$prefix/share/doc/$5/ + exit 0 +fi + +pyver=`$python --version 2>&1 | perl -p -e 's|.* ([2-3])\..*|$1|'` +$python setup.py install --skip-build --root=$rootdir --prefix=$prefix -python setup.py install --skip-build --root=$rootdir --prefix=$prefix rm -rf $rootdir/$sitelib/redfish/old -# Documentation installation -for i in 1; do - mkdir -p $rootdir/$prefix/share/man/man$i - install -m 644 doc/build/man/*.$i $rootdir/$prefix/share/man/man$i -done - -install -d 755 $rootdir/$prefix/share/doc/PBPKG/html/_static -install -m 644 doc/build/singlehtml/*.html $rootdir/$prefix/share/doc/PBPKG/html -install -m 644 doc/build/singlehtml/_static/* $rootdir/$prefix/share/doc/PBPKG/html/_static - # Hardcoded for now to solve the delivery of the conf file still not correct with setup.py mkdir -p $rootdir/etc mv $rootdir/$prefix/etc/redfish-client.conf $rootdir/etc/redfish-client.conf -# Log files management -#mkdir -p $rootdir/$varlog/PBPKG +# Man pages installation +for i in 1; do + mkdir -p $rootdir/$prefix/share/man/man$i + for e in `ls doc/build/man/*.$i`; do + ne=`echo $e | perl -p -e 's|.*/([^/]*)\.'$i'|$1-py'$pyver.$i'|'` + install -m 644 $e $rootdir/$prefix/share/man/man$i/$ne + done +done diff --git a/pbconf/pbfilter/rpm.pbf b/pbconf/pbfilter/rpm.pbf index a7611d1..8f23a90 100644 --- a/pbconf/pbfilter/rpm.pbf +++ b/pbconf/pbfilter/rpm.pbf @@ -14,8 +14,11 @@ filter PBLIC = ASL 2.0 #filter PBDEP = # PBBDEP is replaced by the list of build dependencies -filter PBBDEP = python-devel,python-setuptools,python-pbr >= 0.8,python-sphinx >= 1.2.3,python-future >= 0.15.2 -filter PBDEP = python-docopt >= 0.6.2,python-tortilla >= 0.4.1,python-jinja2 >= 2.7.3,python-pbr >= 0.8,python-simplejson >= 3.8.1,python-requests >= 2.9.1 +filter PBPYTHON2BDEP = python-devel,python-setuptools,python-pbr >= 0.8,python-sphinx >= 1.2.3,python-future >= 0.15.2 +filter PBPYTHON2DEP = python-docopt >= 0.6.2,python-tortilla >= 0.4.1,python-jinja2 >= 2.7.3,python-pbr >= 0.8,python-simplejson >= 3.8.1,python-requests >= 2.9.1,python-configparser >= 3.3.0 +filter PBPYTHON3BDEP = python3-devel,python3-setuptools,python3-pbr >= 0.8,python3-sphinx >= 1.2.3,python-future >= 0.15.2 +filter PBPYTHON3DEP = python3-docopt >= 0.6.2,python3-tortilla >= 0.4.1,python3-jinja2 >= 2.7.3,python3-pbr >= 0.8,python3-simplejson >= 3.8.1,python3-requests >= 2.9.1 +filter PBPYTHON3PKG = python3-redfish # PBSUF is replaced by the package suffix ($pb->{'suf'} in code) filter PBSUF = $pb->{'suf'} diff --git a/pbconf/python-redfish/rpm/python-redfish.spec b/pbconf/python-redfish/rpm/python-redfish.spec index 63aa93a..8c9d963 100644 --- a/pbconf/python-redfish/rpm/python-redfish.spec +++ b/pbconf/python-redfish/rpm/python-redfish.spec @@ -11,21 +11,47 @@ License: PBLIC Group: PBGRP Url: PBURL Source: PBREPO/PBSRC -Requires: PBDEP +Requires: PBPYTHON2DEP BuildArch: noarch -BuildRequires: PBBDEP +BuildRequires: PBPYTHON2BDEP %description PBDESC +Python2 version. + +%package -n PBPYTHON3PKG +Summary: %{summary} / Python 3 library +BuildRequires: PBPYTHON3BDEP +Requires: PBPYTHON3DEP + +%package -n PBREALPKG-doc +Summary: %{summary} / Documentation +BuildRequires: PBPYTHON3BDEP +Requires: PBPYTHON3DEP + +%description -n PBPYTHON3PKG +PBDESC +Python3 version. + +%description -n PBREALPKG-doc +PBDESC +Documentation %prep %setup -q - -%build # Fix for now as long as setuptools isn't more recent in distributions PBPYTHON3FILTER -%{__python} setup.py build +cp -a . %{py3dir} +%build +pushd %{py3dir} +%{__python3} setup.py build +# Build minimal documentation +cd doc +make man +popd + +%{__python} setup.py build # Build minimal documentation cd doc make man @@ -33,11 +59,21 @@ make singlehtml make latexpdf %install -./install.sh %{buildroot} %{python_sitelib} %{_prefix} #%{_logdir} +./install.sh %{__python} %{buildroot} %{python_sitelib} %{_prefix} PBPKG + +./install.sh doc %{buildroot} %{python_sitelib} %{_prefix} PBPKG + +for i in `ls %{buildroot}/%{_mandir}/man1/*-py2.1*`; do + j=`echo $i | perl -p -e 's|-py2||'` + cp -a $i $j +done + +pushd %{py3dir} +./install.sh %{__python3} %{buildroot} %{python3_sitelib} %{_prefix} PBPYTHON3PKG +popd %files %doc README.rst examples/[a-z]*.py LICENSE -%doc doc/build/latex/*.pdf %{_bindir}/redfish-client %dir %{_datadir}/redfish-client %{_datadir}/redfish-client/templates/* @@ -46,9 +82,24 @@ make latexpdf %{python_sitelib}/redfish/*.py* %{python_sitelib}/redfish/tests/*.py* %{python_sitelib}/python_redfish* -%{_mandir}/man1/* +# Needs improvement to host all .1 man pages but not the py3 ones +%{_mandir}/man1/PBREALPKG.1* +%{_mandir}/man1/*-py2.1* + +%files -n PBPYTHON3PKG +%doc README.rst examples/[a-z]*.py LICENSE +%dir %{python3_sitelib}/redfish +%{python3_sitelib}/redfish/*.py* +%{python3_sitelib}/redfish/__pycache__/*.py* +%{python3_sitelib}/redfish/tests/*.py* +%{python3_sitelib}/redfish/tests/__pycache__/*.py* +%{python3_sitelib}/python_redfish* +%{_mandir}/man1/*-py3.1* + +%files -n PBREALPKG-doc %{_docdir}/PBREALPKG/html/_static/* %{_docdir}/PBREALPKG/html/index.html -#%{_logdir}/PBREALPKG +%{_docdir}/PBREALPKG/*.pdf + %changelog PBLOG