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
This commit is contained in:
Bruno Cornec 2016-04-05 04:13:00 +02:00
parent 9a7e7a3905
commit b9771c00a5
3 changed files with 91 additions and 29 deletions

View File

@ -1,29 +1,37 @@
#!/bin/bash #!/bin/bash
# Syntax: install.sh <Root Dir> <Python SiteLib> <Prefix> <Logging Dir> # Syntax: install.sh <Python> <Root Dir> <Python SiteLib> <Prefix> <PkgName>
set -x set -x
export rootdir=$1 export python=$1
export sitelib=$2 export rootdir=$2
export prefix=$3 export sitelib=$3
#export varlog=$4 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 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 # Hardcoded for now to solve the delivery of the conf file still not correct with setup.py
mkdir -p $rootdir/etc mkdir -p $rootdir/etc
mv $rootdir/$prefix/etc/redfish-client.conf $rootdir/etc/redfish-client.conf mv $rootdir/$prefix/etc/redfish-client.conf $rootdir/etc/redfish-client.conf
# Log files management # Man pages installation
#mkdir -p $rootdir/$varlog/PBPKG 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

View File

@ -14,8 +14,11 @@ filter PBLIC = ASL 2.0
#filter PBDEP = #filter PBDEP =
# PBBDEP is replaced by the list of build dependencies # 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 PBPYTHON2BDEP = 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 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) # PBSUF is replaced by the package suffix ($pb->{'suf'} in code)
filter PBSUF = $pb->{'suf'} filter PBSUF = $pb->{'suf'}

View File

@ -11,21 +11,47 @@ License: PBLIC
Group: PBGRP Group: PBGRP
Url: PBURL Url: PBURL
Source: PBREPO/PBSRC Source: PBREPO/PBSRC
Requires: PBDEP Requires: PBPYTHON2DEP
BuildArch: noarch BuildArch: noarch
BuildRequires: PBBDEP BuildRequires: PBPYTHON2BDEP
%description %description
PBDESC 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 %prep
%setup -q %setup -q
%build
# Fix for now as long as setuptools isn't more recent in distributions # Fix for now as long as setuptools isn't more recent in distributions
PBPYTHON3FILTER 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 # Build minimal documentation
cd doc cd doc
make man make man
@ -33,11 +59,21 @@ make singlehtml
make latexpdf make latexpdf
%install %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 %files
%doc README.rst examples/[a-z]*.py LICENSE %doc README.rst examples/[a-z]*.py LICENSE
%doc doc/build/latex/*.pdf
%{_bindir}/redfish-client %{_bindir}/redfish-client
%dir %{_datadir}/redfish-client %dir %{_datadir}/redfish-client
%{_datadir}/redfish-client/templates/* %{_datadir}/redfish-client/templates/*
@ -46,9 +82,24 @@ make latexpdf
%{python_sitelib}/redfish/*.py* %{python_sitelib}/redfish/*.py*
%{python_sitelib}/redfish/tests/*.py* %{python_sitelib}/redfish/tests/*.py*
%{python_sitelib}/python_redfish* %{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/_static/*
%{_docdir}/PBREALPKG/html/index.html %{_docdir}/PBREALPKG/html/index.html
#%{_logdir}/PBREALPKG %{_docdir}/PBREALPKG/*.pdf
%changelog %changelog
PBLOG PBLOG