From 9d6ec64daf15df8f81d0a74a0366ef52b67108fa Mon Sep 17 00:00:00 2001 From: Bruno Cornec Date: Wed, 15 Feb 2017 18:44:59 +0100 Subject: [PATCH] Improve package build - Packages can now be built with Docker containers and project-builder.org for Mageia 5, Fedora 25, OpenSUSE 42.2 & CentOS 7 - Fix a bug in conf file path management in setup.py - A script pbconf/mkctn is also availble to ease package building - Status is documented in pbconf/README.rst - Update install script to have a variable for doc installation path which is different between Mageia/Fedora and OpenSUSE Change-Id: Id34e885c5cba7b650adf1638147ffb089ad3c7c3 --- doc/source/conf.py | 5 +- install.sh | 11 ++-- pbconf/README.rst | 60 +++++++++++++++++++ pbconf/mkctn | 21 +++++++ pbconf/pbfilter/centos.pbf | 8 ++- pbconf/pbfilter/fedora.pbf | 5 +- pbconf/pbfilter/md.pbf | 7 ++- pbconf/pbfilter/opensuse.pbf | 10 ++++ pbconf/pbfilter/rpm.pbf | 5 +- pbconf/python-redfish.pb | 14 +++-- pbconf/python-redfish/rpm/python-redfish.spec | 5 +- 11 files changed, 128 insertions(+), 23 deletions(-) create mode 100644 pbconf/README.rst create mode 100755 pbconf/mkctn create mode 100644 pbconf/pbfilter/opensuse.pbf diff --git a/doc/source/conf.py b/doc/source/conf.py index 30e45db..32a6a42 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -48,7 +48,7 @@ master_doc = 'index' # General information about the project. project = u'python-redfish' -copyright = u'2015-2016, Bruno Cornec, Vincent Misson, René Ribaud' +copyright = u'2015-now, Bruno Cornec, Vincent Misson, René Ribaud' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -186,6 +186,9 @@ htmlhelp_basename = 'python-redfishdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { + 'classoptions': ',openany,oneside', + 'babel': '\\usepackage[english]{babel}' + # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', diff --git a/install.sh b/install.sh index 2a1ec2c..bfbba85 100755 --- a/install.sh +++ b/install.sh @@ -10,11 +10,12 @@ export prefix=$4 export pkg=$5 # Documentation installation only -if [ $python = "doc" ]; then - install -m 755 -d $rootdir/$prefix/share/doc/$5/manual/html/_static - install -m 644 doc/build/singlehtml/*.html $rootdir/$prefix/share/doc/$5/manual/html - install -m 644 doc/build/singlehtml/_static/* $rootdir/$prefix/share/doc/$5/manual/html/_static - install -m 644 doc/build/latex/*.pdf $rootdir/$prefix/share/doc/$5/manual/ +echo $python | grep -q "/doc" +if [ $? -eq 0 ]; then + install -m 755 -d $rootdir/$python/$5/manual/html/_static + install -m 644 doc/build/singlehtml/*.html $rootdir/$python/$5/manual/html + install -m 644 doc/build/singlehtml/_static/* $rootdir/$python/$5/manual/html/_static + install -m 644 doc/build/latex/*.pdf $rootdir/$python/$5/manual/ exit 0 fi diff --git a/pbconf/README.rst b/pbconf/README.rst new file mode 100644 index 0000000..6dfd8db --- /dev/null +++ b/pbconf/README.rst @@ -0,0 +1,60 @@ +Packaging the python-redfish project +==================================== + +Overview +-------- + +This docuemnt provides information with regards to the packagin of +python-redfish for Linux distributions. Currently the Linux distributions we +are supporting and packaging for are: + +- Mageia 5 +- Fedora 25 +- CentOS 7 +- OpenSUSE 42.2 +- Debian 8 +- Ubuntu 16.04 + +Requirements +------------ + +python-redfish uses a lot of python modules, not all of them having been +packaged for Linux distributions. The one missing the most being +python-tortilla, so we are providing versions for this pending distributions +doing it themselves. + +Status for supported distributions +---------------------------------- + +- Mageia + + There are many python modules missing for Mageia 5 that have been built and + made avaible alongside our packages through at + ftp://ftp.project-builder.org/mageia/5/x86_64 + All packages needed are part of the distribution starting with version 6. + +- Fedora + + Only two packages are missing on Fedora 25 python-simplejson 3.8.1 and + python-tortilla that are avaible alongside our packages through dnf at + ftp://ftp.project-builder.org/fedora/25/x86_64 + +- CentOS + + There are many python modules missing for CentOS 7 that have been built and + made avaible alongside our packages through at + ftp://ftp.project-builder.org/centos/7/x86_64 + +- OpenSUSE + + There are some python modules missing for OpenSUSE 42.2 that have been built + and made avaible alongside our packages through at + ftp://ftp.project-builder.org/opensuse/42.2/x86_64 + +- Debian + + TBD + +- Ubuntu + + TBD diff --git a/pbconf/mkctn b/pbconf/mkctn new file mode 100755 index 0000000..a0aaf0c --- /dev/null +++ b/pbconf/mkctn @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Script to rebuild all packages for supported distros in containers using +# project-builder.org +# +PRJ=python-redfish +PKG=`pbgetparam -p $PRJ velist | sed 's/,/ /'` +if [ _"$1" != _"" ]; then + PKG=$* +fi +for i in $PKG; do + DISTRO=`echo $i | cut -d- -f1` + DISTROVER=`echo $i | cut -d- -f2` + + M=$DISTRO-$DISTROVER-x86_64 + + pb -p pb -T docker -m $M --stop-on-error newve -i ${DISTRO}:$DISTROVER + pb -p pb -T docker -m $M --stop-on-error setupve + pb -p $PRJ -T docker -m $M --stop-on-error sbx2prepve + pb -p $PRJ -T docker -m $M --stop-on-error build2ve +done diff --git a/pbconf/pbfilter/centos.pbf b/pbconf/pbfilter/centos.pbf index c5fa952..ddb7d8c 100644 --- a/pbconf/pbfilter/centos.pbf +++ b/pbconf/pbfilter/centos.pbf @@ -24,6 +24,10 @@ filter PBSUF = %{dist} # PBOBS is replaced by the Obsolete line #filter PBOBS = -filter PB2PYTHON2BDEP = texlive-framed -filter PB2PYTHON3BDEP = +filter PB2PYTHON2BDEP = python-sphinx >= 1.2.3 +filter PB2PYTHON3BDEP = python3-sphinx >= 1.2.3 +# Needed as pb doesn't interpret spec macros +filter PBPYTHON3BDEP = +filter PBPYTHON3DEP = +filter PBPYTHONDOCBDEP = python2-sphinx-theme-alabaster,python-snowballstemmer,texlive-multirow,texlive-upquote,texlive-wrapfig,texlive-threeparttable,texlive-titlesec,texlive-framed,,texlive-latex-bin,texlive-hyphen-base,texlive-cm,texlive-cmap,texlive-ec,texlive-fancyhdr,texlive-fancybox,texlive-mdwtools,texlive-parskip filter PBWITHPY3 = 0 diff --git a/pbconf/pbfilter/fedora.pbf b/pbconf/pbfilter/fedora.pbf index 884d26a..a46e5ef 100644 --- a/pbconf/pbfilter/fedora.pbf +++ b/pbconf/pbfilter/fedora.pbf @@ -24,5 +24,6 @@ filter PBSUF = %{dist} # PBOBS is replaced by the Obsolete line #filter PBOBS = -filter PB2PYTHON2BDEP = texlive-multirow,texlive-upquote,texlive-wrapfig,texlive-threeparttable,texlive-titlesec -filter PB2PYTHON3BDEP = texlive-multirow,texlive-upquote,texlive-wrapfig,texlive-threeparttable,texlive-titlesec +filter PB2PYTHON2BDEP = python-sphinx >= 1.2.3 +filter PB2PYTHON3BDEP = python3-sphinx >= 1.2.3 +filter PBPYTHONDOCBDEP = texlive-multirow,texlive-upquote,texlive-wrapfig,texlive-threeparttable,texlive-titlesec,texlive-framed,texlive-capt-of,texlive-latex-bin,texlive-hyphen-base,texlive-cm,texlive-cmap,texlive-ec,texlive-langcode,texlive-babel-english,texlive-fancyhdr,texlive-fancybox,texlive-mdwtools,texlive-parskip,texlive-eqparbox,texlive-times,texlive-helvetic,texlive-courier,texlive-gsftopk-bin,texlive-dvips,texlive-mfware-bin diff --git a/pbconf/pbfilter/md.pbf b/pbconf/pbfilter/md.pbf index bb66d29..e5e6a6d 100644 --- a/pbconf/pbfilter/md.pbf +++ b/pbconf/pbfilter/md.pbf @@ -1,10 +1,11 @@ # Specific group for Mandriva for python-redfish # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups -filter PBGRP = Development/Python +filter PBGRP = Development/Python # PBLIC is replaced by the license of the application # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses #filter PBLIC = GPL -filter PB2PYTHON2BDEP = python-pkg-resources >= 18, texlive-dist -filter PB2PYTHON3BDEP = python3-pkg-resources >= 18, texlive-dist +filter PB2PYTHON2BDEP = python-pkg-resources >= 18,python-sphinx >= 1.2.3 +filter PB2PYTHON3BDEP = python3-pkg-resources >= 18,python3-sphinx >= 1.2.3 +filter PBPYTHONDOCBDEP = texlive-dist diff --git a/pbconf/pbfilter/opensuse.pbf b/pbconf/pbfilter/opensuse.pbf new file mode 100644 index 0000000..0cedfc8 --- /dev/null +++ b/pbconf/pbfilter/opensuse.pbf @@ -0,0 +1,10 @@ +# Specific group for OpenSUSE for python-redfish +filter PBGRP = Development/Python + +# PBLIC is replaced by the license of the application +#filter PBLIC = GPL + +filter PB2PYTHON2BDEP = python-Sphinx >= 1.2.3,python-colorclass,python-formats +filter PB2PYTHON3BDEP = python3-Sphinx >= 1.2.3,python3-colorclass,python3-formats +filter PBPYTHONDOCBDEP = texlive-latex-bin,texlive-cmap,texlive-fancyhdr,texlive-fancybox,texlive-mdwtools,texlive-parskip,texlive-babel-english,texlive-psnfss,texlive-fncychap,texlive-titlesec,texlive-tabulary,texlive-framed,texlive-fancyvrb,texlive-threeparttable,texlive-float,texlive-wrapfig,texlive-upquote,texlive-capt-of,texlive-multirow,texlive-eqparbox,texlive-metafont-bin,texlive-helvetic,texlive-courier,texlive-dvips,texlive-times +filter PBPYTHON3FILTER = perl -pi -e "s|configparser>=3.3.0; python_version < '3'|configparser>=3.3.0|" requirements.txt$/%define py3dir %{_builddir}/python3-%{name}-%{version}-%{release}$/%define __python3 /usr/bin/python3$/%define python3_version %{py3_ver} diff --git a/pbconf/pbfilter/rpm.pbf b/pbconf/pbfilter/rpm.pbf index 8b3ab66..c05badc 100644 --- a/pbconf/pbfilter/rpm.pbf +++ b/pbconf/pbfilter/rpm.pbf @@ -14,9 +14,10 @@ filter PBLIC = ASL 2.0 #filter PBDEP = # PBBDEP is replaced by the list of build dependencies -filter PBPYTHON2BDEP = make,python-devel,python-setuptools >= 18,python-sphinx >= 1.2.3,python-future >= 0.15.2,python-docopt >= 0.6.2,python-requests >= 2.9.1,python-simplejson >= 3.8.1,python-configparser >= 3.3.0,texlive,python-sphinx_rtd_theme,python-pbr >= 0.8,python-tortilla >= 0.4.1 +filter PBPYTHON2BDEP = make,python-devel,python-setuptools >= 18,python-future >= 0.15.2,python-docopt >= 0.6.2,python-requests >= 2.9.1,python-simplejson >= 3.8.1,python-configparser >= 3.3.0,python-sphinx_rtd_theme,python-pbr >= 0.8,python-tortilla >= 0.4.1 +filter PBPYTHONDOCBDEP = texlive filter PBPYTHON2DEP = python-docopt >= 0.6.2,python-tortilla >= 0.4.1,python-jinja2 >= 2.7.3,python-simplejson >= 3.8.1,python-requests >= 2.9.1,python-configparser >= 3.3.0,python-future >= 0.15.2 -filter PBPYTHON3BDEP = python3-devel,python3-setuptools >= 18,python3-sphinx >= 1.2.3,python3-future >= 0.15.2,python3-docopt >= 0.6.2,python3-requests >= 2.9.1,python3-simplejson >= 3.8.1,texlive,python3-sphinx_rtd_theme,python3-pbr >= 0.8,python3-tortilla >= 0.4.1 +filter PBPYTHON3BDEP = python3-devel,python3-setuptools >= 18,python3-future >= 0.15.2,python3-docopt >= 0.6.2,python3-requests >= 2.9.1,python3-simplejson >= 3.8.1,python3-sphinx_rtd_theme,python3-pbr >= 0.8,python3-tortilla >= 0.4.1 filter PBPYTHON3DEP = python3-docopt >= 0.6.2,python3-tortilla >= 0.4.1,python3-jinja2 >= 2.7.3,python3-simplejson >= 3.8.1,python3-requests >= 2.9.1 filter PBPYTHON3PKG = python3-redfish diff --git a/pbconf/python-redfish.pb b/pbconf/python-redfish.pb index 573ed15..d6b5b3d 100644 --- a/pbconf/python-redfish.pb +++ b/pbconf/python-redfish.pb @@ -86,7 +86,9 @@ vmlist python-redfish = opensuse-12.3-i386,debian-8-i386,ubuntu-16.04-i386,magei # a .vetype extension will be added to the resulting string # a chroot rhel-3-i286 here means that the VE will be named rhel-3-i386.chroot # -#velist python-redfish = fedora-7-i386 +# +# Supported distribution for python-redfish +velist python-redfish = opensuse-42.2-x86_64,centos-7-x86_64,fedora-25-x86_64,debian-8-x86_64,mageia-5-x86_64,ubuntu-16.04-x86_64 # VE params vetype python-redfish = docker @@ -104,9 +106,6 @@ projtag python-redfish = 1 # Hash of valid version names -# Additional repository to add at build time -# addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/5/pb.repo -# addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/5/pb.repo #version python-redfish = devel,stable # Is it a test version or a production version @@ -117,6 +116,11 @@ delivery python-redfish = test # Additional repository to add at build time # addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/5/pb.repo # addrepo centos-4-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm,ftp://ftp.project-builder.org/centos/4/pb.repo +# This will allow usage of python-simplejson 1.8.1 +addrepo fedora-25-x86_64 = ftp://ftp.project-builder.org/fedora/25/x86_64/pb.repo +addrepo centos-7-x86_64 = https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm,ftp://ftp.project-builder.org/centos/7/x86_64/pb.repo +addrepo mageia-5-x86_64 = ftp://ftp.project-builder.org/mageia/5/x86_64/pb.addmedia +addrepo opensuse-42.2-x86_64 = ftp://ftp.project-builder.org/opensuse/42.2/x86_64/pb.repo,http://download.opensuse.org/repositories/devel:languages:python3/openSUSE_Leap_42.2/devel:languages:python3.repo,http://download.opensuse.org/repositories/Virtualization:containers/openSUSE_Leap_42.2/Virtualization:containers.repo,http://download.opensuse.org/repositories/devel:languages:python/openSUSE_Leap_42.2/devel:languages:python.repo # Adapt to your needs: # Optional if you need to overwrite the global values above @@ -130,7 +134,7 @@ defpkgdir python-redfish = . # List of files per pkg on which to apply filters # Files are mentioned relatively to pbroot/defpkgdir -filteredfiles python-redfish = redfish-client/redfish-client,doc/source/conf.py,redfish-client/etc/redfish-client.conf,install.sh,redfish-client/redfish-check-cartridge +filteredfiles python-redfish = redfish-client/redfish-client,redfish-client/redfish-check-cartridge,doc/source/conf.py,redfish-client/etc/redfish-client.conf,install.sh #supfiles python-redfish = python-redfish.init # We use pbr to generate sources diff --git a/pbconf/python-redfish/rpm/python-redfish.spec b/pbconf/python-redfish/rpm/python-redfish.spec index a25bda2..ca4105c 100644 --- a/pbconf/python-redfish/rpm/python-redfish.spec +++ b/pbconf/python-redfish/rpm/python-redfish.spec @@ -33,8 +33,7 @@ Python3 version. %package -n PBREALPKG-doc Summary: %{summary} / Documentation -BuildRequires: PBPYTHON2BDEP,PB2PYTHON2BDEP -Requires: PBPYTHON2DEP +BuildRequires: PBPYTHONDOCBDEP %description -n PBREALPKG-doc PBDESC @@ -86,7 +85,7 @@ popd ./install.sh %{__python} %{buildroot} %{python_sitelib} %{_prefix} PBPKG -./install.sh doc %{buildroot} %{python_sitelib} %{_prefix} PBPKG +./install.sh %{_docdir} %{buildroot} %{python_sitelib} %{_prefix} PBPKG for i in `ls %{buildroot}/%{_mandir}/man1/*-py2.1*`; do j=`echo $i | perl -p -e 's|-py2||'`