ConvertingToGit

Differences between revisions 1 and 19 (spanning 18 versions)
Revision 1 as of 2018-01-08 20:55:15
Size: 6140
Editor: tsimonq2
Comment:
Revision 19 as of 2018-05-31 20:04:15
Size: 6474
Editor: tsimonq2
Comment: Ubuntu flavors now have their own up-to-date wiki page
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
# Initial conversion = Initial conversion =
Line 5: Line 5:
This guide assumes that you represent an active, recognized [[ https://www.ubuntu.com/about/about-ubuntu/flavours | 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. This guide assumes that you represent an active, recognized [[ https://wiki.ubuntu.com/UbuntuFlavors | 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.

NOTE - Ensure that both `bzr` and `git-remote-bzr` have been installed.
Line 10: Line 12:
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);
flavor=lubuntu; for i in <SUPPORTED RELEASES>; do
    git clone bzr::lp:~$flavor-dev/ubuntu-seeds/$flavor.$i $flavor.$i
    (cd $flavor.$i && git checkout -b $i && git push git+ssh://launchpad-id@git.launchpad.net/~$flavor-dev/ubuntu-seeds/+git/$flavor $i);
Line 14: Line 16:
}}} 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 [[ https://code.launchpad.net/ubuntu-seeds/+git | 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.
 1. 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`).
 1. 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.
}}} 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 to merge requests into your seed and it shows up on [[ https://code.launchpad.net/ubuntu-seeds/+git | 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.
 1. In the Launchpad web interface (i.e. https://code.launchpad.net/~lubuntu-dev/ubuntu-seeds/+git/lubuntu/ - 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`).
 1. 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.
Line 26: Line 28:
 1. Clone lp:ubuntu-archive-scripts, and propose an MP that changes `update-seeds` to reflect your new URL and pass the git="yes" argument (like in Lubuntu's lines).
 1. After landing the changes to lp:ubuntu-archive-scripts, ask the ubuntu-archive team to remove the existing bzr checkouts on snakefruit and re-run update-seeds.
Line 27: Line 31:
 1. 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.
 1. 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.
 1. (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.
 1. 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. Also, be sure to fix the tests, as described [[ https://code.launchpad.net/~xubuntu-dev/ubuntu-cdimage/git_seed/+merge/346912 | here]].
 1. Propose an MP to `lp:ubuntu-cdimage` with your changes, and once this is approved, ask someone with access to nusakan to make the appropriate change there. Once this merge proposal is approved and nusakan changes are made, your flavor ISO uses the Git branch instead of the Bazaar one, and you can now delete the Bazaar one.
 1. For each supported release that you converted over, you should delete the Bazaar one, assuming that there are identical commits in the Git repository. This is so that nobody is mistaken and uses your Bazaar branch by accident, and only uses the Git repository (and there should be no use for the Bazaar branch anyway if you did everything correctly). Note that deleting the bzr branches also deletes MP history; if you wish to preserve this history you may wish to set your branch status to 'Abandoned' in Launchpad but keep the branches.
Line 44: Line 37:
# Deprecating releases = Deprecating releases =
Line 48: Line 41:
Line 58: Line 50:
# Feedback = Feedback =

Initial conversion

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.

NOTE - Ensure that both bzr and git-remote-bzr have been installed.

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):

    flavor=lubuntu; for i in <SUPPORTED RELEASES>; do
        git clone bzr::lp:~$flavor-dev/ubuntu-seeds/$flavor.$i $flavor.$i
        (cd $flavor.$i && git checkout -b $i && git push git+ssh://launchpad-id@git.launchpad.net/~$flavor-dev/ubuntu-seeds/+git/$flavor $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 to 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 (i.e. https://code.launchpad.net/~lubuntu-dev/ubuntu-seeds/+git/lubuntu/ - 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 lp:ubuntu-archive-scripts, and propose an MP that changes update-seeds to reflect your new URL and pass the git="yes" argument (like in Lubuntu's lines).

  8. After landing the changes to lp:ubuntu-archive-scripts, ask the ubuntu-archive team to remove the existing bzr checkouts on snakefruit and re-run update-seeds.
  9. 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.

  10. 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. Also, be sure to fix the tests, as described here.

  11. Propose an MP to lp:ubuntu-cdimage with your changes, and once this is approved, ask someone with access to nusakan to make the appropriate change there. Once this merge proposal is approved and nusakan changes are made, your flavor ISO uses the Git branch instead of the Bazaar one, and you can now delete the Bazaar one.

  12. For each supported release that you converted over, you should delete the Bazaar one, assuming that there are identical commits in the Git repository. This is so that nobody is mistaken and uses your Bazaar branch by accident, and only uses the Git repository (and there should be no use for the Bazaar branch anyway if you did everything correctly). Note that deleting the bzr branches also deletes MP history; if you wish to preserve this history you may wish to set your branch status to 'Abandoned' in Launchpad but keep the branches.

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.

Germinate/ConvertingToGit (last edited 2018-05-31 20:04:15 by tsimonq2)