prepare slapos build for obs
============================

This environment is made to prepare a SlapOS tarball and packaging configurations
to be used with openSUSE Build Service (OBS).

Notes
-----

Build in OBS is a bit complex. The build of the packages itself is in offline mode,
meaning that we don't have internet connection. Of course, doing "bin/buildout" to
install slapos and make the package requires internet connection.

Solution: run bin/buildout outside of the OBS system to fetch all the needed files,
put them in a cache and upload it in the OBS system so that buildout is happy and works in
offline mode.

Requirements
------------
- A computer
- Internet connection
- gcc, g++, make, patch, wget, python3, chrpath, osc, devscripts
- An account on OBS

Documentation
-------------
- http://en.opensuse.org/openSUSE:Build_Service_Tutorial
- http://en.opensuse.org/Portal:Packaging
- http://wiki.debian.org/IntroDebianPackaging

Directory Organisation
----------------------

- Makefile : makefile containing all the commands to prepare the packet.
- release_configuration.sh : script defining the version of slapos-node
  package. Version is automaticallmy detected but you can decide to override
  it.
- ./home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node : This is the directory for OBS.
  It is the one used to generate unreleased package and testing it.
  If you have/want to use another directory, update its path in release_configuration.sh
- templates/ : Contain templates to build the package.
	     - Makefile.in : Makefile to build slapos
	     - slapos.dsc.in : File needed by obs to build .deb package
	     - slapos.spec.in : configuration file for rpm packaging
- debian/ : contain configuration files for .deb packaging
- slapos-node/ : Template to build package
  	       - Makefile : Makefile to build slapos and add files for package
	       - slapos/ : to build slapos. Contain buildout.cfg.in


preparing the package
---------------------

First make sure all files are ready and you have all necessary packages installed.
You need in particular an OBS directory (for example, the vifib test directory)::

  $ cd <directory_to_contain_prepare_script>
  $ osc checkout home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node
  $ cd home:VIFIBnexedi:branches:home:VIFIBnexedi/SlapOS-Node
  $ osc up

SlapOS is built using buildout and need an internet connection to fetch all elements.
On OBS, packages are built on virtual machines without internet access.
Makefile will compile slapos on your computer and build a network-cache thanks to prepare_download_cache.sh script.
At the end it remove slapos installation and only keep cache.
It makes a tarball out of it to be used by OBS.
It then fetch packaging configuration from templates directory. Everything is then commit to OBS thanks to osc.

So to build package just run:
# make all

About cron file
---------------

Main cron file is situated in slapos-node/template/slapos-node.cron.d
Prepare script will copy this one in the debian directory.
