Home | Download/Install | Documentation | Packages | Screenshots | News | Forum/Mailing-lists | Contact | GForge

RPM Creation

Goal of this document

Discuss a way to create Python binary RPMs for Fedora. These RPMs must then be installable on a clean environment.

Alinea.PyCupid (Python + Fortran 77 + C)

Create Python RPM

  • create a MANIFEST.in in the package root directory, with the following content:
  include *.txt *.pdf *.ini *.cfg SConstruct MANIFEST.in *.py
  include doc/*.py doc/*.rst doc/*.tar.gz doc/*.bat doc/Makefile
  recursive-include doc/user *.rst *.txt *.png
  include example/*.py example/input/*.csv
  recursive-include src *.py *.c *.h *.f SConscript
  recursive-include test *.out *.rd *.in *.csv *.py
  • generate the spec file Alinea.PyCupid.spec :
    python setup.py bdist_rpm --spec-only
  • adapt the parts %install and %files in the file ./dist/Alinea.PyCupid.spec:
  %install
  python setup.py install --root=$RPM_BUILD_ROOT --install-lib=%{python_sitearch}
  cd $RPM_BUILD_ROOT
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/doc
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/example
  cd  %{_builddir}/%{name}-%{version}
  cp -p *.txt %{buildroot}%{_defaultdocdir}/%{name}-%{version}/
  cp -rp doc/ %{buildroot}%{_defaultdocdir}/%{name}-%{version}/doc
  cp -rp example/ %{buildroot}%{_defaultdocdir}/%{name}-%{version}/example
  %files
  %defattr(-,root,root)
  %{_defaultdocdir}/%{name}-%{version}/
  %{python_sitearch}/
  • generate and install the source RPM :
    python setup.py bdist_rpm --source-only ; rpm -i dist/Alinea.PyCupid-0.1.0-0.src.rpm

  • The package rpm-build must be installed to build RPM packages.
  • Alinea.PyCupid-0.1.0-0.src.rpm could be Alinea.PyCupid-0.1.0-1.src.rpm

  • create the binary RPM from Alinea.PyCupid.spec :
    rpmbuild -ba dist/Alinea.PyCupid.spec

Install the Python RPM

  • install the RPM:
    sudo yum install ~/rpmbuild/RPMS/x86_64/Alinea.PyCupid-0.1.0-1.x86_64.rpm

Post install on a machine where OpenAlea framework IS already installed

  • set the environment variables:
    alea_config

Test

  • cd test ; python test_cupid.py ; python test_postprocess.py ; cd -

VPlants.PlantGL (Python + C++)

Create Python RPM

  • create a MANIFEST.in in the package root directory, with the following content:
  include *.txt *.py MANIFEST.in *.ini SConstruct *.cfg
  recursive-include debian source/format *.desktop *.install changelog control compat rules copyright
  recursive-include doc *.rst *.txt *.png *.py *.bat Makefile
  exclude doc/user/solutions_python/truncated_isocaedron.py
  include sconsx_ext/*.py
  recursive-include share *.geom *.bgeom *.png *.smb *.app *.ico *.xpm LICENSE
  recursive-include src *.cpp *.filters *.h *.ico *.kpf *.l *.png *.prj *.py *.rc *.sln *.txt *.ui *.vcproj *.vcxproj *.y README SConscript
  recursive-include test *.bgeom *.csv *.geom *.obj *.py
  • generate the spec file VPlants.PlantGL.spec :
    python setup.py bdist_rpm --spec-only
  • adapt the parts %install and %files in the file VPlants.PlantGL.spec:
  %install
  python setup.py install --root=$RPM_BUILD_ROOT --install-lib=%{python_sitearch}
  cd $RPM_BUILD_ROOT
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/doc
  mkdir -p %{buildroot}%{_defaultdocdir}/%{name}-%{version}/share
  cd  %{_builddir}/%{name}-%{version}
  cp -p *.txt %{buildroot}%{_defaultdocdir}/%{name}-%{version}/
  cp -rp doc/ %{buildroot}%{_defaultdocdir}/%{name}-%{version}/doc
  cp -rp share/ %{buildroot}%{_defaultdocdir}/%{name}-%{version}/share
  %files
  %defattr(-,root,root)
  %{_defaultdocdir}/%{name}-%{version}/
  %{python_sitearch}/
  • generate and install the source RPM :
    python setup.py bdist_rpm --source-only ; rpm -i dist/VPlants.PlantGL-2.17.0-1.src.rpm
The package rpm-build must be installed to build RPM packages.
  • create the binary RPM from VPlants.PlantGL.spec :
    rpmbuild -ba dist/VPlants.PlantGL.spec
./doc/user/solutions_python/truncated_isocaedron.py contains a typo. Workaround: exclude truncated_isocaedron.py in MANIFEST.in.

Install the Python RPM

  • sudo rpm -i --nodeps VPlants.PlantGL-2.17.0-1.x86_64.rpm
Install VPlants.PlantGL binary RPM with Yum

sudo yum install ~/rpmbuild/RPMS/x86_64/VPlants.PlantGL-2.17.0-1.x86_64.rpm

failed with 2 errors. The first one is:

Erreur : Paquet : VPlants.PlantGL-2.17.0-1.x86_64 (/VPlants.PlantGL-2.17.0-1.x86_64)
         Requiert : qt < 4

Qt3 is installed on my system. Why do I have such an error? Anyway, does VPlants.PlantGL really require qt < 4? The second one is:

Erreur : Paquet : VPlants.PlantGL-2.17.0-1.x86_64 (/VPlants.PlantGL-2.17.0-1.x86_64)
         Requiert : python>=2.4

Python 2.7 is installed and is set as the default version. Why do I have such an error?

A workaround for these 2 errors is to install the RPM without checking the dependencies.

Post install on a machine where OpenAlea framework IS already installed

  • set the dynamic library path:
    alea_config --install-dyn-lib=/usr/lib64/python2.7/site-packages/lib

Post install on a machine where OpenAlea framework is NOT already installed

  • install VPlants.PlantGL dependencies:
    sudo yum install ipython boost ann PyQt4 freeglut qhull freeglut-devel

Test

  • ipython --gui=qt -i -c "from vplants.plantgl.all import * ; scene = Scene() ; c = Cylinder(1, 10) ; color = Material(Color3(255,0,0),0,Color3(0,0,0),Color3(0,0,0),1,0) ; shape = Shape(c, color) ; scene.add(shape) ; Viewer.display(scene)"

Automation of the RPMs construction

For each meta-package OpenAlea, VPlants and Alinea, a script manifest.py permits to automate the construction of the binary RPMs. We describe here the process to construct all the binary RPMs using the scripts manifest.py, on the clean “Developer” machine.

Getting the sources of the trunk

svn checkout --username usename https://scm.gforge.inria.fr/svn/openalea/trunk openalea_tr
svn checkout --username usename https://scm.gforge.inria.fr/svn/vplants/vplants/trunk vplants_tr
svn checkout --username usename https://scm.gforge.inria.fr/svn/openaleapkg/trunk openaleapkg_tr

Install the compile-time dependencies of OpenAlea, VPlants and Alinea

sudo yum install python-matplotlib CGAL-devel boost-math PyQt4 python-nose freeglut-devel freeglut boost-python scons gnuplot ann-devel python-fpconst bison-devel qscintilla-python SOAPpy subversion gcc-gfortran qhull-devel numpy flex python-setuptools boost-devel PyOpenGL PyQt4-devel flex-static scipy readline-devel gcc-c++ python-imaging python-networkx bison sip-devel R ipython python-matplotlib-qt4 rpy python-pandas pysvn rpm-build

Since the “ann” library is named “ANN” on Fedora, create a symbolic link to ANN:

sudo ln -s /usr/lib64/libANN.so /usr/lib64/libann.so

Construct the binary RPMs

cd openalea_tr
sudo python manifest.py
cd ../vplants_tr
sudo python manifest.py
cd ../openaleapkg_tr
sudo python manifest.py

Install the RPMs and test

We now want to install the constructed RPMs on a clean “user” machine. Let's consider these RPMs are available in the directory my_rpms_dir.

Install the run-time dependencies of OpenAlea, VPlants and Alinea

sudo yum install PyQt4 qscintilla-python boost-python boost ann freeglut qhull ipython rpy gnuplot python-fpconst SOAPpy flex CGAL readline PyOpenGL scipy python-imaging python-networkx bison R python-matplotlib-qt4 python-pandas sip

Install the binary RPMs available in my_rpms_dir

cd my_rpms_dir
sudo rpm -i --nodeps *.rpm

See Install the Python RPM of VPlants.PlantGL for a discussion about the use of the option ”–nodeps”.

To finalize the installation, we now need to set the dynamic library path:

sudo alea_config --install-dyn-lib=/usr/lib64/python2.7/site-packages/lib

Tests

VPlants.PlanGL

In a new shell:

ipython --gui=qt -i -c "from vplants.plantgl.all import * ; scene = Scene() ; c = Cylinder(1, 10) ; color = Material(Color3(255,0,0),0,Color3(0,0,0),Color3(0,0,0),1,0) ; shape = Shape(c, color) ; scene.add(shape) ; Viewer.display(scene)"

Alinea.Adel

Start visualea, open the dataflow “AdelR MonoRun”, and make a “Run” on the node “Plot”. A 3D crop model should be displayed without any error.

 
documentation/core/propositions/217_-_rpm_creation.txt · Last modified: 2014/02/13 11:06 by user   Back to top
INRIA   INRA     CIRAD     AGROPOLIS
INRIA GForge RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki