SyncBzrFromGit

The core of Ubuntu Online Accounts consists of a set of upstream project maintained at https://gitlab.com/groups/accounts-sso

The code is stored in git repositories, and because of a bug in Launchpad an automatic import of the repositories into the LP projects is not possible. In this page we'll explain how to manually perform the import (it's usually done at every upstream release, but it can be done more often if needed).

Dependencies

You'll need bzr-git:

sudo apt-get install bzr-git

Structure of the projects

Development happens in https://gitlab.com/groups/accounts-sso and is hosted in git. Code reviews happen there, using the tools provided by gitlab.com. In launchpad, for each upstream repository there are two bzr branches, both owned by the ~online-accounts team:

  • upstream: this is a 1-1 mirror of the git master branch

  • trunk: this is the branch where packages are built from; it's made with the code from the upstream branch, plus the debian packaging. Changes land to this branch automatically, once approved with a code review; directly committing to this branch is forbidden.

Development of the Ubuntu-specific changes (typically packaging) can happen in a branch owned by the developer; we'll call this branch packaging, but it could have any name. This branch is created by branching off the current bzr trunk and merging the latest bzr upstream into it; then, any needed packaging changes can be developed on it, and finally it's pushed for review. Once the review process is completed, the changes will be automatically merged into the trunk branch, and packages will be built and added to the archive.

Setting up the projects

We'll take signond as example. The first thing to do, is to create a directory where to host the bzr branches for signond. For example:

mkdir ~/src/bzr/signond
cd ~/src/bzr/signond

Then, let's create a checkout of the git repository and of the bzr upstream branch which will track it, and set the git branch as parent:

git clone git@gitlab.com:accounts-sso/signond.git git
bzr branch lp:~online-accounts/signon/upstream
cd upstream
bzr pull --remember ../git
cd ..

Once this is done, we need to get the bzr trunk branch:

bzr branch lp:signon trunk

This is all what is needed for the initial setup. Let's see now how to merge changes from upstream.

Getting the latest upstream

We need to move inside the git repository and update it:

cd ~/src/bzr/signond/git
git pull

For this step, it's essential that the currently active branch in the git checkout is master; but unless you have switched to another branch yourself, this should always be the case.

Now let's update the bzr upstream branch:

cd ../upstream
bzr pull
bzr push    # this should push to lp:~online-accounts/signon/upstream

And make the packaging changes needed (at the very least, updating the debian/changelog):

# update the trunk branch
cd ../trunk
bzr pull
cd ..
# The next two lines are not needed if you know that your packaging branch is
# clean, and can be replaced by "bzr pull" from within the packaging branch
rm -rf packaging
bzr branch trunk packaging
cd packaging

# Merge from bzr upstream:
bzr merge ../upstream

# Fix any conflicts, update the debian packaging, and finally the changelog:
...
dch -i

# commit and push
bzr commit
bzr push lp:~<your-lp-id>/signon/packaging

After all of this, your final branch with the latest upstream code and updated packaging will be found at lp:~<your-lp-id>/signon/packaging. It's time to create a merge proposal and get it merged into bzr trunk.

OnlineAccounts/SyncBzrFromGit (last edited 2016-06-08 07:55:15 by localhost)