ConvertingToGit

Revision 2 as of 2018-01-08 20:56:31

Clear message

Support for flavor seeds being managed in Git-based repositories rather than Bazaar-based repositories has landed in the Ubuntu cdimage tooling in early January of 2018. These are the steps you can follow to convert your flavor from using the old style Bazaar branches to a completely Git-based workflow.

This guide assumes that you represent an active, recognized Ubuntu flavor and your team agrees that this is the way to go. It also assumes that you have the necessary tools installed to build your respective flavor metapackage from source and work with tools like Git and Bazaar.

Here are the steps you can follow:

  1. Convert each of your Bazaar branches to one single branch in a Git repository. It makes things easier if you use a tool like git-remote-bzr so you can use a script like the following (which uses Lubuntu's seeds as an example, you should change this to fit your own needs):

    for i in <SUPPORTED RELEASES>; do
        git clone bzr::lp:~lubuntu-dev/ubuntu-seeds/lubuntu.$i lubuntu.$i
        (cd $i && git checkout -b $i && git push git+ssh://git.launchpad.net/~lubuntu-dev/ubuntu-seeds/+git/lubuntu $i);
    done

    Please note that if your Bazaar branch was located at lp:~lubuntu-dev/ubuntu-seeds/lubuntu.bionic (for example) you need to keep the same Launchpad team (so that you have the same access rights), the same project (so that people can easily propose merge requests into your seed and it shows up on the central seeds page), and it needs to be just the name of the flavor without a .RELEASE suffix. So the new Git branch for lp:~lubuntu-dev/ubuntu-seeds/lubuntu.bionic would now be located at lp:~lubuntu-dev/ubuntu-seeds/+git/lubuntu with the bionic branch existing there.

  2. In the Launchpad web interface (you can find this in Change repository details), change the default branch on the newly created Git repository to the current development release (for example, refs/heads/bionic).

  3. In your metapackage source, in the update script, where it says exec germinate-update-metapackage --bzr, change it to exec germinate-update-metapackage --vcs ; this is so germinate-update-metapackage can autodetect the VCS being used, so when we make a change to update.cfg in the next step, you can have both Git and Bazaar branches working.

  4. In your update.cfg file, where it has these two lines (Lubuntu's change to the Bionic metapackage is used as an example here, modify to your needs):

    [bionic/bzr]
    seed_base: bzr+ssh://bazaar.launchpad.net/~lubuntu-dev/ubuntu-seeds/ bzr+ssh://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-seeds/

    You then need to convert the first of these lines to say vcs and the second line to have the location for your new seed:

    [bionic/vcs]
    seed_base: git+ssh://git.launchpad.net/~lubuntu-dev/ubuntu-seeds/+git/ bzr+ssh://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu-seeds/

    You don't need to modify anything else in your metapackage, because germinate-update-metapackage should automatically detect the correct branch and VCS to use, and clone appropriately.

  5. Run ./update for good measure, and make sure it completes the update process successfully.

  6. Upload your metapackage to the development release (and in the rare case that your metapackage needs an SRU, make sure to make these changes there as well). Make sure it lands in devel before continuing to minimize disruption.

  7. Clone the lp:ubuntu-cdimage source, either by running bzr branch lp:ubuntu-cdimage or if you use the example above, git clone bzr::lp:ubuntu-cdimage.

  8. There is a seed_sources function in lib/cdimage/germinate.py that lists the Germinate sources for each flavor. Assuming you correctly followed the naming convention that was listed above, finding your flavor and changing bzrpattern to gitpattern should be sufficient.

  9. Propose an MP to lp:ubuntu-cdimage with your changes. Once this merge proposal is approved, your flavor ISO uses the Git branch instead of the Bazaar one, and you can now deprecate the Bazaar one.

  10. (Optional, but helpful to reduce later confusion) For each supported release that you converted over, make one final commit removing all files and adding a file called DEPRECATED. Here is some text you could use as a template, but the goal here is just to make sure that anyone who clones that Bazaar branch knows that you have deprecated it in favor of Git:

    This Bazaar branch has been DEPRECATED in favor of the Git conversion:
    <LINK TO CGIT FOR YOUR GIT REPOSITORY>
    
    Appropriate changes should be made to the branch corresponding to the
    release, because this is what Germinate picks up (instead of different Bazaar
    branches like <FLAVOR>.bionic, <FLAVOR>.xenial, etc.).
    
    This change has been made on the metapackage side in <FLAVOR>-meta <VERSION>.
    
    Please contact <CONTACT DETAILS> for more details on this change.

    One other thing you could do is mark the Bazaar branch as Abandoned in Launchpad so people know that it's no longer in active development.

Congratulations! Your seed is now in Git. The archive tooling should now seamlessly pick up this change, and future development releases will be created automatically in this Git repository.

# Deprecating releases

If you want to avoid clutter in your new Git repository, you could (optionally) move the branch for a specific release to another repository entirely. Here's a script that makes it easy, edit the variables at the top for the release you want to deprecate:

REPOPATH="lubuntu"
RELEASE="zesty"
REMOTE="git+ssh://git.launchpad.net/~lubuntu-dev/ubuntu-seeds/+git/lubuntu"

git -C $REPOPATH checkout $RELEASE
git -C $REPOPATH push "$REMOTE" ":$RELEASE"
git -C $REPOPATH push "${REMOTE}.deprecated"

# Feedback

If you have any comments or suggestions about this page or you run into any issues, contact Simon Quigley.