Releasing Bazaar
################

This document describes the processes for making and announcing a Bazaar
release, and managing the release process.  This is just one phase of
the `overall development cycle
<http://doc.bazaar.canonical.com/developers/cycle.html>`_, (go re-read
this document to ensure it hasn't been updated) but it's the most
complex part.  This document gives a checklist you can follow from start
to end in one go.

If you're helping the Release Manager (RM) for one reason or another, you
may notice that he didn't follow that document scrupulously. He may have
good reasons to do that but he may also have missed some parts.

Follow the document yourself and don't hesitate to create the missing
milestones for example (we tend to forget these ones a lot).

.. contents::


Preconditions
=============

#. Download the pqm plugin and install it into your ``~/.bazaar/plugins``::

     bzr branch lp:bzr-pqm ~/.bazaar/plugins/pqm


When do we relase ?
===================

As of October 2010, we mantain four series.  Concurrently releasing them
all at the same time makes it harder to shorten the delay between the
source availability and the package building longer than necessary (we
delay the official announcement until most of our users can install the new
release).

In order to continue to do time-based releases, we need to plan the
releases by series to minimize the collisions. In the end, it's the Release
Manager call to decide whether he prefers to do all releases at once
though, so the rules presented here are a conservative approach.

We want to respect the following rules::

 #. as much as possible releases should not disturb development, and
    ongoing development should not disturb releases,

 #. the most recent development series should release once a month during
    the beta period (see `Development cycles <cycle.html>`_ for more
    details),

 #. the most recent stable series should release every other month (based
    on the amount of bug fixes, this can be shorter or longer depending on
    the bugs importance),

 #. previous series should relesase on a regular basis without interfering
    with the most recent series with a decreasing order of priority (again
    this should be based on bugs importance and user feedback),

 #. the death of a series should be planned ahead of time. 6 months should
    give enough time to our users to migrate to a more recent series. This
    doesn't mean we will make a release at the end of the series, just that
    before the end date we _could_ possibly put out another release if
    there was a sufficiently important fix.  Beyond that date, we won't
    even land changes on that branch (unless something causes a miraculous
    resurrection.)

 #. there should not be more than 2 releases in the same week (but the
    Release Manager is free to ignore this (get in touch with packagers
    though),

 #. the series are aligned with Ubuntu releases for convenience since we
    create a new series every 6 months. This means that we support the
    stable series for 18 months. Note that we also propose the most recent
    stable series via the ppa, so whether we keep supporting LTS directly
    or via the ppa is still an open question.


At the start of a release cycle
===============================

To start a new release cycle:

#. If this is the first release for a given *x.y* then create a new
   series at <https://launchpad.net/bzr/+addseries>. There is one series
   for every *x.y* release.

#. If you made a new series, create a new pqm-controlled branch for this
   release series, by asking a Canonical sysadmin.  This branch means that
   from the first release beta or candidate onwards, general development
   continues on the trunk, and only specifically-targeted fixes go into
   the release branch.

#. If you made a new series, add milestones at
   <https://launchpad.net/bzr/x.y/+addmilestone> to that series for
   the beta release, release candidate and the final release, and their
   expected dates.

#. Create a new milestone <https://launchpad.net/bzr/x.y/+addmilestone>
   and add information about this release.  We will not use it yet, but it
   will be available for targeting or nominating bugs.

#. Send mail to the list with the key dates, who will be the release
   manager, and the main themes or targeted bugs.  Ask people to nominate
   objectives, or point out any high-risk things that are best done early,
   or that interact with other changes. This is called the metronome mail
   and is described in `Development cycles <cycle.html>`_.

#. Make a local branch for preparing this release.  (Only for the first
   release in a series, otherwise you should already have a branch.) ::

     bzr branch trunk prepare-1.14

#. Configure pqm-submit for this branch, with a section like this (where
   x.y is the version to release). **Or use hydrazine for easy use**
   ``~/.bazaar/locations.conf``::

	[/home/mbp/bzr/prepare-x.y]
	pqm_email = Canonical PQM <pqm@bazaar-vcs.org>
	submit_branch = http://bazaar.launchpad.net/~bzr-pqm/bzr/x.y
	parent_branch = http://bazaar.launchpad.net/~bzr-pqm/bzr/x.y
	public_branch = http://bazaar.example.com/prepare-x.y
	submit_to = bazaar@lists.canonical.com
	smtp_server = mail.example.com:25

    Please see <http://doc.bazaar.canonical.com/developers/HACKING.html#an-overview-of-pqm>
    for more details on PQM

#. Update the version number in the ``bzr`` script, and the
   ``bzrlib/__init__.py`` file::
   
       version_info = (x, y, z, 'dev', 0)
   
#. If you made a new series, then start a new release-notes file::

       cd doc/en/release-notes
       cp series-template.txt bzr-x.y.txt  # e.g. bzr-2.3.txt
       bzr add bzr-x.y.txt

#. Add a new section at the top of the current release notes (in
   ``doc/en/release-notes``) about the new release, including its version
   number and the headings from ``release-template.txt``.

#. Update the "What's New" documents in ``doc/en/whats-new``.

#. Commit this and send it to PQM.


Doing a particular release
==========================

Update the source code
----------------------

#. Check that there is a milestone for the release you're doing. If there
   is no milestone it indicates a process problem - make the milestone but
   also mail the list to raise this issue in our process. Milestones are
   found at <https://launchpad.net/bzr/+milestone/x.y.z>.

#. In the release branch, update  ``version_info`` in ``./bzrlib/__init__.py``.
   Make sure the corresponding milestone exists.
   Double check that ./bzr ``_script_version`` matches ``version_info``. Check
   the output of ``bzr --version``.

   For beta releases use::

       version_info = (2, 1, 0, 'beta', SERIAL)

   For instance 2.1b1::

       version_info = (2, 1, 0, 'beta', 1)

   For release candidates use::

       version_info = (2, 0, 1, 'candidate', SERIAL)

   For stable releases use::

       version_info = (2, 1, 2, 'final', 0)

#. Update the ``./doc/en/release-notes/`` section for this release.

   Fill out the date and a description of the release under the existing
   header. If there isn't one, follow the instructions above for using the
   ``release-template.txt`` file.

   See *2.1.1* or similar for an example of what this looks like.

#. Add a summary of the release into the "What's New" document.

#. To check that all bugs mentioned in the release notes are actually
   marked as closed in Launchpad, you can run
   ``tools/check-newsbugs.py``::

     ./tools/check-newsbugs.py doc/en/release-notes/bzr-x.y.txt

   (As of 2011-12-03, only a few false positives remain. Don't let this slow
   you down too much.)

#. Commit these changes to the release branch, using a command like::

     bzr commit -m "Release 1.14."

   The diff before you commit will be something like::

     === modified file 'NEWS'
     --- NEWS        2008-09-17 23:09:18 +0000
     +++ NEWS        2008-09-23 16:14:54 +0000
     @@ -4,6 +4,23 @@

      .. contents::

     +bzr 1.7 2008-09-23
     +------------------
     +
     +This release includes many bug fixes and a few performance and feature
     +improvements.  ``bzr rm`` will now scan for missing files and remove them,
     +like how ``bzr add`` scans for unknown files and adds them. A bit more
     +polish has been applied to the stacking code. The b-tree indexing code has
     +been brought in, with an eye on using it in a future repository format.
     +There are only minor installer changes since bzr-1.7rc2.
     +
      bzr 1.7rc2 2008-09-17
      ---------------------


     === modified file 'bzrlib/__init__.py'
     --- bzrlib/__init__.py  2008-09-16 21:39:28 +0000
     +++ bzrlib/__init__.py  2008-09-23 16:14:54 +0000
     @@ -41,7 +41,7 @@
      # Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
      # releaselevel of 'dev' for unreleased under-development code.

     -version_info = (1, 7, 0, 'candidate', 2)
     +version_info = (1, 7, 0, 'final', 0)


      # API compatibility version: bzrlib is currently API compatible with 1.7.

   Note that the NEWS file formatting has evolved, this example needs to
   be updated.

#. Tag the new release::

     bzr tag bzr-1.14

#. Push those changes to a bzr repository that is public and accessible on
   the Internet. PQM will pull from this repository when it attempts to merge
   your changes. Then submit those changes to PQM for merge into the
   appropriate release branch::

     bzr push
     bzr pqm-submit -m "(mbp) Release 1.14 (Martin Pool)"

   Or with hydrazine::

     bzr lp-propose -m "Release 1.14" --approve lp:bzr/1.14
     feed-pqm bzr

#. When PQM succeeds, pull down the master release branch.


Making the source tarball
-------------------------

#. Change into the source directory and run ::

     make dist

#. Now we'll try expanding this tarball and running the test suite
   to check for packaging problems::

     make check-dist-tarball | subunit2pyunit

   You may encounter failures while running the test suite caused by your
   locally installed plugins. Use your own judgment to decide if you can
   release with these failures. When in doubt, disable the faulty plugins
   one by one until you get no more failures. Alternatively, you can use
   ``BZR_DISABLE_PLUGINS`` or ``BZR_PLUGIN_PATH=-site`` to disable one or
   all plugins.

   Remember that PQM has just tested everything too, this step is
   particularly testing that the pyrex extensions, which are updated
   by your local pyrex version when you run make dist, are in good
   shape.


Publishing the source tarball
-----------------------------

#. Go to the relevant milestone page in Launchpad.

#. Create a release of the milestone, and upload the source tarball and
   the GPG signature.  Or, if you prefer, use the
   ``tools/packaging/lp-upload-release`` script to do this. Note that
   this changes what the download widget on the Launchpad bzr home
   page shows, so don't stop the release process yet, or platform binary
   installers won't be made and the download list will stay very small!
   <https://bugs.launchpad.net/launchpad/+bug/586445>


Announcing the source freeze
----------------------------

#. Post to the ``bazaar`` list, saying that the source has been frozen
   (gone gold). Be extra clear that this is only a *source* release
   targeted at packagers and installer builders (see
   <https://bugs.launchpad.net/launchpad/+bug/645084>).  This is the cue
   for platform maintainers and plugin authors to update their code.  This
   is done before the general public announcement of the release.


Kick off the next cycle
-----------------------

#. To let developers work on the next release, do
   `At the start of a release cycle` now.

#. Pause for a few days.


Publishing the release
----------------------

There is normally a delay of a few days after the source freeze to allow
for binaries to be built on various platforms.  Once they have been built,
we have a releasable product.  The next step is to make it generally
available to the world.

#. Go to the release web page at <https://launchpad.net/bzr/x.y/x.y.z>

#. Announce on the `Bazaar website <http://bazaar.canonical.com/>`_.
   This page is edited via the lp:bzr-website branch. (Changes
   pushed to this branch are refreshed by a cron job on escudero.)

#. Check that the documentation for this release is available in
   <http://doc.bazaar.canonical.com>.  It should be automatically build when the
   branch is created, by a cron script ``update-bzr-docs`` on
   ``escudero``. As of today (2009-08-27) ``igc`` manually updates the
   pretty version of it.


Announcing the release
----------------------

Now that the release is publicly available, tell people about it.

#. Make an announcement mail.

   For release candidates or beta releases, this is sent to the ``bazaar``
   list only to inform plugin authors and package or installer managers.

   Once the installers are available, the mail can be sent to the
   ``bazaar-announce`` list too.

   For final releases, it should also be cc'd to ``info-gnu@gnu.org``,
   ``python-announce-list@python.org``, ``bug-directory@gnu.org``.

   In all cases, it is good to set ``Reply-To: bazaar@lists.canonical.com``,
   so that people who reply to the announcement don't spam other lists.

   The announce mail will look something like this::

      Subject: bzr x.y.z released!

      The Bazaar team is happy to announce availability of a new
      release of the bzr adaptive version control system.
      Bazaar is part of the GNU system <http://gnu.org/>.

      <<Summary paragraph from news>>

      Thanks to everyone who contributed patches, suggestions, and
      feedback.

      Bazaar is now available for download from
      https://launchpad.net/bzr/x.y/x.y.z/ as a source tarball; packages
      for various systems will be available soon.

      <<release notes from this release back to the last major release>>

   Feel free to tweak this to your taste.

#. Make an announcement through <https://launchpad.net/bzr/+announce>

#. Update the IRC channel topic. Use the ``/topic`` command to do this,
   ensuring the new topic text keeps the project name, web site link, etc.

#. Announce on http://freshmeat.net/projects/bzr/

   This should be done for beta releases, release candidates and final
   releases. If you do not have a Freshmeat account yet, ask one of the
   existing admins.

   The purpose here is to point users to the latest stable release while still
   publishing announcements for development releases.

   There are several kinds of modifications that could be done there via the
   ``Administration`` box in the lower right area of the page:

   * Edit the project: This is where most of the URLs proposed in the
     ``Links`` box are edited. This should rarely change except for the URLs
     related to the latest stable release.

   * New announcement: When doing a release (beta, candidates, final), put the
     summary of the release (you can't embed URLs there, the moderation staff
     remove them). Users can still access the releases notes via the ``Release
     Notes`` URL in the ``Links`` box in the upper right area of the page.

   * Set direct download: When releasing a new stable release, this should
     point to the corresponding launchpad page:
     <https://launchpad.net/bzr/x.y/x.y.z/>

#. Update `<http://en.wikipedia.org/wiki/Bazaar_(software)>`_ -- this should
   be done for final releases but not for beta releases or Release Candidates.

#. Update the python package index: <http://pypi.python.org/pypi/bzr> - best
   done by running ::

       python setup.py register

   Remember to check the results afterwards -- this should be done for
   final releases but not for beta releases or Release Candidates.

   To be able to register the release you must create an account on
   <http://pypi.python.org/pypi> and have one of the existing owners of
   the project add you to the group.


Merging the released code back to trunk
---------------------------------------

Merge the release branch back into the trunk.  The
``doc/en/release-notes`` changes should be merged into the right place
because each release series has its own release-notes file, but
double-check.

If it's not already done, advance the version number in ``bzr`` and
``bzrlib/__init__.py``.  Submit this back into pqm for bzr.dev.

As soon as you change the version number in trunk, make sure you have
created the corresponding milestone to ensure the continuity in bug
targeting or nominating. Depending on the change, you may even have to
create a new series (if your change the major or minor release number), in
that case go to `At the start of a release cycle` and follow the instructions from there.

You should also merge (not pull) the release branch into
``lp:~bzr/bzr/current``, so that branch contains the current released code
at any time.

Releases until the final one
----------------------------

Congratulations - you have made your first release.  Have a beer
or fruit juice - it's on the house! If it was a beta, or
candidate, you're not finished yet. Another beta or candidate or
hopefully a final release is still to come.

The process is the same as for the first release. Goto `Doing a
particular release`_ and follow the instructions again. Some details change
between beta, candidate and final releases, but they should be
documented. If the instructions aren't clear enough, please fix them.


Getting the release into Ubuntu
-------------------------------

(Feel free to propose or add new sections here about what we should do to
get bzr into other places.)

For the currently-under-development release of Ubuntu, no special action
is needed: the release should be picked by Debian and synced from there into
Ubuntu.

Releases off stable bzr branches should go in to the ``-updates`` of the
Ubuntu release that originally contained that branch.  (Ubuntu Lucid had
bzr 2.2.0, so should get every 2.2.x update.)  This means going through
the `SRU (Stable Release Updates)
<https://wiki.ubuntu.com/StableReleaseUpdates>`__ process.   

As of September 2010, bzr has applied to the technical board to be added
to the `MicroReleaseExceptions
<https://wiki.ubuntu.com/StableReleaseUpdates/MicroReleaseExceptions>`__
category so that whole bugfix releases can more easily be approved.

**After making a bzr stable-release release, nominate the most serious bug
for the appropriate Ubuntu release and subscribe the `ubuntu-sru` team.**

This requires a couple of tricks (please reconsider and tweak as things
evolves from one release to the other):

 * create a distro task with the ``Also affects distribution`` button and
   select ``bzr (Ubuntu)``.

 * change the *URL* to point to ``ubuntu/+source/bzr`` instead of ``bzr``
   (this is needed if you create the distro task but not if it exists
   already). You should now be able to click the ``Nominate for release``
   button and select the right Ubuntu release. As of September 2010, this
   means:

  * ``maverick`` for the 2.2 series,
  * ``lucid`` for the 2.1 series,
  * ``karmic`` for the 2.0 series.

 * Subscribe the ``~ubuntu-sru`` team to the bug.

 * Add a comment targeted to ``~ubuntu-sru`` explaining the expectations
   (we are targeting running the test suite during the build which, as of
   September 2010, fails for known reasons that are currently addressed).
   Search for bugs tagged with ``sru`` for examples and don't forget to tag
   the bug you selected.


See also
--------

* `Packaging into the bzr PPA <ppa.html>`_ to make and publish Ubuntu
  packages.
* `Bazaar Developer Document Catalog <index.html>`_
* `Development cycles <cycle.html>`_: things that happen during the cycle
  before the actual release.

..
   vim: filetype=rst textwidth=74 ai shiftwidth=4
