synergy-service/packaging/README.md
Vincent Llorens c2588f9972 import project from launchpad git repo
In addition to importing the project, this commit also includes fixes
to pass PEP8 and unit tests on OpenStack CI.

Commit history that was imported from the launchpad project:

. The first commit's message is:
first Synergy implementation

. This is the 2nd commit message:

added README file

. This is the 3rd commit message:

added new logging configuration support

. This is the 4th commit message:

added new logging configuration support

. This is the 5th commit message:

Synergy repository restructured

. This is the 6th commit message:

Synergy repository restructured

. This is the 7th commit message:

TimeManager

. This is the 8th commit message:

first service implementation

. This is the 9th commit message:

package synergy.managers.scheduler removed

. This is the 10th commit message:

Keystone and MYSQL configuration removed

. This is the 11th commit message:

Clean up setup.py

- remove all directory creation, chmoding, etc. This will be handled by
  the system package.

- rename `scripts` as `bin` to follow best practices.

. This is the 12th commit message:

Fix systemd unit file

- remove all the directory creation since it will be done by the system
  package.

. This is the 13th commit message:

Move synergy source to parent directory

Follow the standard of having the source package directory at the root.

This also make it easier to work with setuptools.

. This is the 14th commit message:

Add dependencies in setup.py

. This is the 15th commit message:

Add RPM spec file for packaging

. This is the 16th commit message:

debian/ubuntu package

. This is the 17th commit message:

add oslo.log as a requirement

. This is the 18th commit message:

deb pkg: explicit naming for oslo.*

. This is the 19th commit message:

rename deb package to python-synergy-service

. This is the 20th commit message:

fix debian package configure step

. This is the 21st commit message:

remove unecessary init & upstart scripts

We will target Ubuntu >= 15.04 and EL >= 7. Both use systemd by default,
so we do not need initv and upstart scripts.

. This is the 22nd commit message:

changed license field: GPL->Apache 2

. This is the 23rd commit message:

change license to Apache 2 for rpm & deb

. This is the 24th commit message:

rename python package to "synergy-service"

This is the name that will be used on PyPI.

. This is the 25th commit message:

oslo_log dependence removed

. This is the 26th commit message:

remove oslo.log dependency from packaging

. This is the 27th commit message:

remove oslo package renaming

Both python-oslo-* and python-oslo.* are supported on Ubuntu >= 15.04,
but only python-oslo.* are supported on Ubuntu 14.04.

. This is the 28th commit message:

fix oslo imports for Ubuntu14.04

This concerns 2 python packages:
- oslo config
- oslo messaging

Both packages cannot be imported using their "oslo_PKG" name in Ubuntu
14.04.

These packages can be imported on both Ubuntu 14.04 and 15.04 using
"oslo.PKG".

. This is the 29th commit message:

fix manager config setup

We check for manager in the conf file using the oslo config package.

Previously, we relied on a private variable to list the managers.
However, this private variable is not present on the oslo.config
packaged shipped with ubuntu 14.04.

In this commit we change the way we list managers to be compatible with
both Ubuntu 14.04 and 15.04.

. This is the 30th commit message:

Revert "fix oslo imports for Ubuntu14.04"

This reverts commit 6ee3b4d54765993d165169a56d54efdfb2653c89.
We are going to use try/except imports to deal with oslo{.,_}PKG

. This is the 31st commit message:

use try/except imports for oslo{.,_} packages

The oslo packages are imported using "oslo.PKG" for versions < 2.0.0,
but are imported using "oslo_PKG" for versions >= 2.0.0.

We use try/except statements to try to import "oslo_PKG" first, and fail
over to "oslo.PKG".

. This is the 32nd commit message:

add packaging README

. This is the 33rd commit message:

add cleaning functions in packaging scripts

This way when a container as finished building, when can easily do a
rebuild with: docker start -a -i container_id

. This is the 34th commit message:

various fixes on packaging

- deb: postinst depends on "adduser" package
- deb: add upstart & systemv init scripts in deb package
- deb: postrm purge now removes init script
- deb: override lintian error about systemd/init script
- rpm: fix the cleaning stage
- rpm: fix /var/lib/synergy not being created and preventing systemd
  from starting the synergy service

. This is the 35th commit message:

use entry points to discover managers

Also add the TimerManager to the manager entry point.

fix centos docker builder

The .git repo would not get cleaned up after a failed build, resulting
in incapacity of starting the container again.

add base files for OpenStack CI

Most of the files were created with cookiecutter.
http://docs.openstack.org/infra/manual/creators.html#preparing-a-new-git-repository-using-cookiecutter

fix centos docker builder

The .git repo would not get cleaned up after a failed build, resulting
in incapacity of starting the container again.

fix setup.py failing to build due to pbr

rename service to "synergy"

Previously it was either "python-synergy-service" or "synergy"
depending on the platform.

Change-Id: Iebded1d0712a710d9f71913144bf82be31e6765b
2016-04-27 16:29:13 +02:00

3.1 KiB

Packaging

Packaging for Ubuntu and CentOS using Docker

We provide Dockerfiles for CentOS 7 and Ubuntu 14.04. A Dockerfile for Ubuntu > 14.04 should work by just changing the "FROM" statement of the Ubuntu 14.04 Dockerfile. Using these, you can easily build rpm and deb packages for synergy-service without having to setup the build system on your own system.

The build process using Docker is made of 3 steps:

  1. Build the docker image

  2. Setup the build variables

  3. Run the build with docker

If the build is successful, the package will be put in the build directory inside the synergy-service directory.

Example for CentOS 7

  • go into the directory that contains the Dockerfile for CentOS 7

    cd synergy-service/packaging/docker/centos7
    
  • build the docker image and tag it

    docker build -t synergy-centos7-builder .
    
  • edit the file synergy-service/packaging/docker/build_env.sh to define environment variables.

  • launch the container

    docker run -i -v /path/to/synergy-service:/tmp/synergy-service \
               --env-file=/path/to/synergy-service/packaging/docker/build_env.sh \
               synergy-centos7-builder
    

    This actually mount the synergy-service directory to /tmp/synergy-service on the guest. It also loads environment variables from the build_env.sh file.

  • the resulting rpm should be in the build directory if successful

Example for Ubuntu 14.04

  • go into the directory that contains the Dockerfile for Ubuntu 14.04

    cd synergy-service/packaging/docker/ubuntu-14.04
    
  • build the docker image and tag it

    docker build -t synergy-ubuntu14.04-builder .
    
  • edit the file synergy-service/packaging/docker/build_env.sh to define environment variables.

  • launch the container

    docker run -i -v /path/to/synergy-service:/tmp/synergy-service \
               --env-file=/path/to/synergy-service/packaging/docker/build_env.sh \
               synergy-ubuntu14.04-builder
    
  • the resulting deb should be in the build directory if successful

Packaging for Ubuntu

  1. Install the necessary build packages:
  • debhelper
  • dh-systemd
  • build-essential
  • devscripts
  • python-all
  • python-setuptools
  1. Make a gzip archive of synergy-service named python-synergy-service_VERSION.orig.tar.gz.

  2. Copy synergy-service/packaging/debian to synergy-service/debian.

  3. Go in the synergy-service directory and build with debuild -us -uc.

Packaging for CentOS

  1. Install the necessary build packages:
  • rpm-build
  • python-devel
  • python-setuptools
  1. Setup your rpmbuild environment if not already done.

    mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    
  2. Move synergy-service/packaging/rpm/python-synergy.spec to ~/rpmbuild/SPECS.

  3. Create a source archive:

    cp -r /path/to/synergy-service ~/rpmbuild/SOURCES/python-synergy-service
    tar cjf python-synergy-service python-synergy-service.tar.bz2
    
  4. Go in ~/rpmbuild/SPECS and buils with rpmbuild -ba python-synergy.spec.