Package: iw.releaser
Report any bug or feature requests to :http://trac.ingeniweb.comContentsWhat is iw.releaser ?How to install iw.releaser ?How to use iw.releaser ?Setting up your environementCreating the project structureCreating egg-based packageReleasing eggsReleasing the projectUpgrading an existing buildoutWhat is iw.releaser ?iw.releaser provides command line utilities to make it easier to release
and deploy zc.buildout/subversion based projects.It provides:new setuptools commandsrelease: used to release an egg-based packagebuild_mo: used to search and compile .po fileconsole scriptsproject_release: used to release a buildout based projectproject_deploy: used to deploy a buildout based projectproject_copy_eggs: used to collect all eggs used in a projectproject_md5: used to compute the MD5 hash of a buildout projecta hook to be able to launch actions when a package is released,
with a default one that sends an email on each release.a paste template to create a project structureHow to install iw.releaser ?To installiw.releaser, you just need to run easy_install:$ easy_install iw.releaseror you can launch its setup if you have downloaded it:$ python setup.py installHow to use iw.releaser ?To work with iw.releaser, let’s do a small tutorial on how to create
a buildbout-based project. This is done in a few steps:setting up your environementcreating the project structurecreating egg-based packagesreleasing eggsreleasing the buildoutupgrading an existing buildoutSetting up your environementThe first thing to do to work smoothly with zc.buildout is to set up a
few things on your environment to make sure you can run all kind of
buildout-based applications.Put two files in your home directory:HOME/.buildout/.httpauth: this file will contain the authentication
informations when the system tries to reach a http ressource which is
password protected (like a svn or a private web site).
It is a text file where each line is: realm,url,user,passwordFor example:trac,https://svn.ingeniweb.com,user,password
pypi,http://products.ingeniweb.com,user,passwordThis is used bulovely.buildouthttp.HOME/.buildout/default.cfg: this file set some defaults values, so
zc.buildout can cache and spare downloaded eggs.For example:[buildout]

download-cache = /home/tarek/.buildout/downloads
eggs-directory = /home/tarek/.buildout/eggsNext, you need to make sure you can release your eggs to several
targets, because some private eggs are not to be published at the
cheeseshop. At this time, the only software that provides the same
web services than Cheeseshop is Plone Software Center >= 1.5.To make it possible to handle several cheeseshop-like servers,
we need to install a small addon, callediw.dist:$ easy_install iw.distThis will allow you to define several servers in .pypirc. For instance
if you are working with a private cheeseshop-like server you can define
it like this in HOME/.pypirc[distutils]
index-servers =
    pypi
    ingeniweb-public

[pypi]
username:ingeniweb
password:secret

[ingeniweb-public]
repository:http://products.ingeniweb.com/catalog
username:ingeniweb
password:secretLast, you need to define the release strategy configuration, that
will define for each target server the list packages that must be released
there (regular expressions) and the command sequence that is used
with setup.py. Here’s a default example, that can be added in your.pypircas well, by completing the sections withrelease-commandandrelease-packagesvariables:...

[ingeniweb-public]
...
release-command = mregister sdist build_mo bdist_egg mupload
release-packages =
    ^iw\..*

[pypi]
...
release-command = mregister sdist build_mo bdist_egg mupload
release-packages =
    ^plone\..*
    ^collective\..*This will push all eggs that starts withplone.orcollective.to Pypi and all eggs that starts withiw.to ingeniweb-public.
The command used to push the packages are defined bycommand.Creating the project structureEvery project must be structurized the same way:$ paster create -t iw_plone_project my_projectThis will ask you for a few values:project_name: the name of the projectproject_repo: the root of the subversion repositorysome more values that can be left to default.This will generate a set of folders inmy_project:$ ls my_project
./buildout
./bundles
./docs
./packages
./releasesEach folder has a role:buildout: contains the buildoutbundles: contains the bundle used to work in develop modedocs: contains the docspackages: contains the egg-based packagereleases: contains the releases of the buildoutThis structure must be commited in your subversion:$ svn import my_project http://some.svn/my_project -m "initial commit"You will then be able to work in your buildout.Creating egg-based packageFrom there you can add some packages into the project, by putting them
in thepackagesfolder, by using any template available in ZopeSkel.be carefull though, to use a trunk/tags/branches in packages for each
project$ cd my_projet/packages
$ paster create -t plone plone.example
$ mv plone.example trunk
$ mkdir plone.example
$ mv trunk plone.example/
$ mkdir plone.example/tags plone.example/branches
$ svn add plone.example
$ svn ci -m "initial import of  plone.example"Do not use trunk as a package name with paster, as this will generate
bad metadata in the packageA special section can be added intosetup.cfg, in order
to send a mail everytime the package is released:[mail_hook]
hook = iw.releaser:mail
from = support@ingeniweb.com
emails =
     trac@lists.ingeniweb.comIf your system does not have a SMTP servern you will need to add
in that case the name of a SMTP server, and its port in your .pypirc file,
in amail_hooksection:[mail_hook]
host = smtp.neuf.fr
port = 25From there you can bind the package to your buildout, with a develop
variable, in yourmy_project/buildout folder:[buildout]
...
develop=
    .../packages/monprojet.reports/trunkThebundlefolder can also be used to set svn:externals to make it
simpler to work in the buildout.Releasing eggsReleasing eggs is done by callingreleasefrom a package:$ python setup.py release
running release
This package is version 0.1.2
Do you want to run tests before releasing ? [y/N]: N
Do you want to create the release ? If no, you will just be able to deploy again the current release [y/N]: Y
Enter a version [0.1.2]: 0.1.2
Commiting changes...
Creating branches...
...This will take care of:upgrading the setup.py versioncreating a branch and a tag in svnpushing the package to the various cheeseshop-like serverssending a mail with the changes, if the mail_hook section was provided in setup.cfgReleasing the projectReleasing the project consists of callingproject_releasethenproject_deploy.project_releasewill just create a new branch in subversion:$ cd my_project/buildout
$ project_release
What version you are releasing ? 0.1
Added version file.This will copymy_project/buildouttomy_project/releases/0.1in
subversion. You can then work in this release, to pinpoint the versions
in your buildout. A good practice is to create a dedicated cfg file
for deployment.The next step is to generate a tarball withproject_deploy:$ cd /tmp
$ svn co http://somesvn/my_projet/releases/0.1 my_project
$ cd my_project
$ project_deploy prod.cfgThis will build a tarball in/tmpusing virtualenv,
and set everything up so the buildout can be reinstalled
offline anywhere with this archive.So the result can be installed with the two lines:$ python boostrap.py
$ bin/buildoutUpgrading an existing buildoutTo upgrade an existing buildout, you can use theproject_eggscommand.
It will create a tarball with all eggs needed to run the project and the
.cfg file.Run it in your buildout, by pointing the .cfg and by providing a name of
the archive:$ project_eggs buildout.cfg /tmp/upgrade.tgzYou can even give a filter to collect specific packages
with glob-like names, separated by commas:$ project_eggs buildout.cfg /tmp/upgrade.tgz "iw.*,plone.*"This filter will only get the eggs starting withiw.andplone..
This is useful when you have changed only a few eggs, and want to
reduce the size of the tarball for the upgrade.Doing an upgrade will then consist of calling:$ cp upgrade.tgz my_project/
$ cd my_project
$ tar -xzvf upgrade.tgz
$ bin/buildout