Actions

Difference between revisions of "Developer Area/Language Packs/Launchpad Branching"

From Mahara Wiki

< Developer Area‎ | Language Packs
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
= A word about Bazaar =
 +
 +
Because the translation is managed through Launchpad, it's handled by the Bazaar version control system instead of Git. Bazaar has similar functionality to git, but its organizational system is '''very''' different. Unlike Git and CVS, in which branches and tags are a kind of "parallel dimension" to the repository's directory structure, Bazaar is more like Subversion, where branches and tags are addressed as directories.
 +
 +
Bazaar (at least the distribution on Ubuntu) also incorporates several Launchpad-specific shortcuts. For instance, prefacing a location with "lp:" is shorthand for the Launchpad Bazaar repository: bzr+ssh://bazaar.launchpad.net/+branch/mahara-lang/mahara. When we create new branches, they're referred to starting with "lp:~mahara-lang/mahara-lang", which means they're owned by the "mahara-lang" group, and placed under their "mahara-lang" directory (named after the "mahara-lang" project). Once we associate a particular branch with the mahara-lang project officially through Launchpad, the address shortens to "lp:mahara-lang/...".
 +
 +
As long as you're not trying to do anything too new and different, the code here should be enough to get you through.
 +
 +
= 0. Initial setup =
 +
 +
If you haven't used the Mahara Bazaar repo before, you'll need to do some setup. (These instructions are taken from the [http://doc.bazaar.canonical.com/bzr.2.6/en/mini-tutorial/index.html#introducing-yourself Bazaar manual]). First, install the Bazaar command-line tools, and the Debian package maintainer utilities.
 +
 +
sudo apt-get install bzr devscripts
 +
 +
Then, upload your public SSH key into Launchpad, using the Launchpad website: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
 +
 +
Once you've done that, you can set up your bzr credentials on your computer. These are stored at the user level.
 +
 +
bzr whoami "FIRSTNAME LASTNAME <[email protected]>"
 +
bzr launchpad-login YOUR_LAUNCHPAD_USERNAME
 +
 
= Create a new code branch =
 
= Create a new code branch =
  
Create a new code branch in the mahara-lang launchpad project for importing pot templates.  This should contain a copy of the latest mahara/mahara.pot from master.  Roughly, do something like this, from an existing up-to-date local copy of the mahara-lang bzr repo (If you don't have a copy of the mahara-lang bzr repo, do "bzr branch lp:mahara-lang" to do an initial checkout of it):
+
Create a new code branch in the mahara-lang launchpad project for importing pot templates.  This should contain a copy of the latest mahara/mahara.pot from master.
 +
 
 +
First, get the latest code from master...
 +
 
 +
  cd ~/bazaar # Or wherever you want to store your bazaar branches
 +
# There's probably a better way to keep your master checkout in sync,
 +
# But I find it's just easiest to delete it and do a new checkout
 +
rm -Rf trunk
 +
bzr checkout lp:mahara-lang ./trunk # get a copy of the mahara-lang trunk
 +
 +
Then, create the new code branch, copy the master code into it, and publish it to Launchpad.
  
  mkdir 1.5_STABLE
+
cd ~/bazaar
  cd 1.5_STABLE
+
  mkdir 16.10_STABLE
 +
  cd 16.10_STABLE
 
  bzr init
 
  bzr init
 
  mkdir mahara
 
  mkdir mahara
 
  # Copy the mahara.pot from the trunk
 
  # Copy the mahara.pot from the trunk
  cp ../mahara/mahara.pot mahara/
+
  cp ~/bazaar/trunk/mahara/mahara.pot mahara/
 
  bzr add mahara/mahara.pot
 
  bzr add mahara/mahara.pot
 
  bzr commit
 
  bzr commit
  bzr push lp:~mahara-lang/mahara-lang/1.5_STABLE
+
  bzr push lp:~mahara-lang/mahara-lang/16.10_STABLE
 +
 
 +
= Create the new export branch =
  
Check that the branch has appeared (with the mahara.pot file) under https://code.launchpad.net/mahara-lang
+
You'll also need to manually create a new export branch, which can be mostly empty. (Launchpad will fill it with content.)
 +
 
 +
cd ~/bazaar
 +
mkdir 16.10_STABLE-export
 +
cd 16.10_STABLE-export
 +
bzr init
 +
mkdir mahara
 +
bzr add mahara
 +
bzr commit
 +
bzr push lp:~mahara-lang/mahara-lang/16.10_STABLE-export
  
 
= Create a new series =
 
= Create a new series =
 +
 +
Check that the two branches have appeared under https://code.launchpad.net/mahara-lang. The code branch should contain the mahara.pot file.
  
 
Create the new series under the mahara-lang project on launchpad at https://launchpad.net/mahara-lang/+addseries
 
Create the new series under the mahara-lang project on launchpad at https://launchpad.net/mahara-lang/+addseries
Line 24: Line 69:
 
= Set up translation import and export for the new series =
 
= Set up translation import and export for the new series =
  
In the translation synchronisation settings for the 1.5 series (https://translations.launchpad.net/mahara-lang/1.5/+translations-settings), set the translation to "Import template files" from the official branch (on the trunk series, we "Import template and translation files", but it can potentially overwrite translations, so we don't do that for a stable branch).
+
Access the translation settings for the new series, like so:
  
In the export synchronisation settings, first, create a new branch called lp:~mahara-lang/mahara-lang/1.5_STABLE-export, then export translations for the series to this new branch.  This should be automatically created in a day or so, once there are translations to export. This is the branch where the langpacks.mahara.org tarballs
+
# Go to https://translations.launchpad.net/mahara-lang
come from.
+
# You'll see a list, "All translatable series". Click on your new series there.
 +
# On the page that opens up, under the "Automatic synchronization" subheading, click the link '''Set up branch synchronization '''
 +
# This should take you to a page titled "Translations synchronization settings". Or you can try to get there by munging the URL: https://translations.launchpad.net/mahara-lang/16.04/+translations-settings
 +
 
 +
In the "Import translations from branch" column of the synchronization settings page, set the translation to '''Import template files''' (on the trunk series, we "Import template and translation files", but it can potentially overwrite translations, so we don't do that for a stable branch).
 +
 
 +
In the "Export translations to branch" column of the synchronization settings page, click the link at the bottom that reads '''Choose a target branch'''. Then paste in the name of the next export branch (e.g. lp:~mahara-lang/mahara-lang/1.5_STABLE-export), and click "Update". If you get an error message about how that branch doesn't exist, then you didn't create and publish the next export branch properly. Go back to [[Developer_Area/Language_Packs/Launchpad_Branching#Create_the_new_export_branch|this step]] and try again.
 +
 
 +
Once these are setup, the langpacks for the new series should be should be automatically populated in a day or so, once there are translations to export. The export branch is where the langpacks.mahara.org tarballs come from.
  
 
= Update the scripts =
 
= Update the scripts =
Line 33: Line 86:
 
Update the langpack scripts.  In the mahara-scripts repo, there are two files that need to be updated with the new branch name:
 
Update the langpack scripts.  In the mahara-scripts repo, there are two files that need to be updated with the new branch name:
  
mahara-langpacks/langpacks.pl (which generates langpack tarballs from lp:~mahara-lang/mahara-lang/1.5_STABLE-export)
+
mahara-langpacks/langpacks.pl (which generates langpack tarballs from lp:~mahara-lang/mahara-lang/1.5_STABLE-export)
 +
mahara-langpacks/update-pot.sh (which pushes new changes to English strings to lp:mahara-lang/1.5 to be translated)
  
mahara-langpacks/update-pot.sh (which pushes new changes to English strings to lp:mahara-lang/1.5 to be translated)
+
Just edit these files, look for the other branch names, and add 1.5_STABLE. You should also remove the old no-longer-supported branches at the same time. (See [[Developer Area/Language Pack Generation]] if you want to know more about how these scripts work.)
  
Just edit these files, look for the other branch names, and add 1.5_STABLE.  You may also want to remove the old no-longer-supported branch at the same time, in this case, 1.2_STABLE.  Once the scripts are committed, deploy the scripts by generating a new custom-site-mahara-langpacks debian package. Run
+
Once the scripts are committed, deploy the scripts by generating a new custom-site-mahara-langpacks debian package.
  
 +
cd path/to/mahara-scripts
 +
dch -i --no-auto-nmu # And then update the changelog to indicate what you're doing, e.g. "16.04 release"
 
  fakeroot debian/rules binary
 
  fakeroot debian/rules binary
 +
git add debian/changelog
 +
git commit -m "16.04 release"
 +
git push
 +
 +
If done correctly, this will generate a file called "custom-site-mahara-langpacks_X.YY_all.deb". If you get a strange version number with something like "-ubuntu" or "-nmu1" on the end, then remove your local changes and try manually specifying the incremented version with "dch -v 1.29", or just edit the debian/changelog file by hand.
 +
 +
The resulting .deb will need to need to be installed on the Catalyst servers where langpacks.mahara.org are installed. You may ask the Catalyst Sysadmins to deploy it by creating a WR and attaching the .deb file. They will upload it to the correct internal repository and deploy it.
  
within your mahara-scripts checkout. The resulting .deb can be installed over the existing one (currently on chatter.catalyst.net.nz).
+
= Send reminder to owners of language string repos =
 +
The language string translations for most languages are managed by launchpad. But some of them have their own repo. We can see which ones in this file [https://gitlab.wgtn.cat-it.co.nz/mahara/mahara-langpacks/blob/master/scripts/language-repos.txt language-repos.txt].
 +
As we can't create the release branch in that repo, we have to send a reminder to the owner to create it. The language pack for the latest release won't be available until they do.

Revision as of 15:54, 17 July 2019

A word about Bazaar

Because the translation is managed through Launchpad, it's handled by the Bazaar version control system instead of Git. Bazaar has similar functionality to git, but its organizational system is very different. Unlike Git and CVS, in which branches and tags are a kind of "parallel dimension" to the repository's directory structure, Bazaar is more like Subversion, where branches and tags are addressed as directories.

Bazaar (at least the distribution on Ubuntu) also incorporates several Launchpad-specific shortcuts. For instance, prefacing a location with "lp:" is shorthand for the Launchpad Bazaar repository: bzr+ssh://bazaar.launchpad.net/+branch/mahara-lang/mahara. When we create new branches, they're referred to starting with "lp:~mahara-lang/mahara-lang", which means they're owned by the "mahara-lang" group, and placed under their "mahara-lang" directory (named after the "mahara-lang" project). Once we associate a particular branch with the mahara-lang project officially through Launchpad, the address shortens to "lp:mahara-lang/...".

As long as you're not trying to do anything too new and different, the code here should be enough to get you through.

0. Initial setup

If you haven't used the Mahara Bazaar repo before, you'll need to do some setup. (These instructions are taken from the Bazaar manual). First, install the Bazaar command-line tools, and the Debian package maintainer utilities.

sudo apt-get install bzr devscripts

Then, upload your public SSH key into Launchpad, using the Launchpad website: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair

Once you've done that, you can set up your bzr credentials on your computer. These are stored at the user level.

bzr whoami "FIRSTNAME LASTNAME <[email protected]>"
bzr launchpad-login YOUR_LAUNCHPAD_USERNAME

Create a new code branch

Create a new code branch in the mahara-lang launchpad project for importing pot templates. This should contain a copy of the latest mahara/mahara.pot from master.

First, get the latest code from master...

cd ~/bazaar # Or wherever you want to store your bazaar branches
# There's probably a better way to keep your master checkout in sync,
# But I find it's just easiest to delete it and do a new checkout
rm -Rf trunk
bzr checkout lp:mahara-lang ./trunk # get a copy of the mahara-lang trunk

Then, create the new code branch, copy the master code into it, and publish it to Launchpad.

cd ~/bazaar
mkdir 16.10_STABLE
cd 16.10_STABLE
bzr init
mkdir mahara
# Copy the mahara.pot from the trunk
cp ~/bazaar/trunk/mahara/mahara.pot mahara/
bzr add mahara/mahara.pot
bzr commit
bzr push lp:~mahara-lang/mahara-lang/16.10_STABLE

Create the new export branch

You'll also need to manually create a new export branch, which can be mostly empty. (Launchpad will fill it with content.)

cd ~/bazaar
mkdir 16.10_STABLE-export
cd 16.10_STABLE-export
bzr init
mkdir mahara
bzr add mahara
bzr commit
bzr push lp:~mahara-lang/mahara-lang/16.10_STABLE-export

Create a new series

Check that the two branches have appeared under https://code.launchpad.net/mahara-lang. The code branch should contain the mahara.pot file.

Create the new series under the mahara-lang project on launchpad at https://launchpad.net/mahara-lang/+addseries

You should set the official series branch to the one you just created (~mahara-lang/mahara-lang/1.5_STABLE). Once that's done, launchpad calls the branch by the abbreviated name lp:mahara-lang/1.5

Set up translation import and export for the new series

Access the translation settings for the new series, like so:

  1. Go to https://translations.launchpad.net/mahara-lang
  2. You'll see a list, "All translatable series". Click on your new series there.
  3. On the page that opens up, under the "Automatic synchronization" subheading, click the link Set up branch synchronization
  4. This should take you to a page titled "Translations synchronization settings". Or you can try to get there by munging the URL: https://translations.launchpad.net/mahara-lang/16.04/+translations-settings

In the "Import translations from branch" column of the synchronization settings page, set the translation to Import template files (on the trunk series, we "Import template and translation files", but it can potentially overwrite translations, so we don't do that for a stable branch).

In the "Export translations to branch" column of the synchronization settings page, click the link at the bottom that reads Choose a target branch. Then paste in the name of the next export branch (e.g. lp:~mahara-lang/mahara-lang/1.5_STABLE-export), and click "Update". If you get an error message about how that branch doesn't exist, then you didn't create and publish the next export branch properly. Go back to this step and try again.

Once these are setup, the langpacks for the new series should be should be automatically populated in a day or so, once there are translations to export. The export branch is where the langpacks.mahara.org tarballs come from.

Update the scripts

Update the langpack scripts. In the mahara-scripts repo, there are two files that need to be updated with the new branch name:

mahara-langpacks/langpacks.pl (which generates langpack tarballs from lp:~mahara-lang/mahara-lang/1.5_STABLE-export)
mahara-langpacks/update-pot.sh (which pushes new changes to English strings to lp:mahara-lang/1.5 to be translated)

Just edit these files, look for the other branch names, and add 1.5_STABLE. You should also remove the old no-longer-supported branches at the same time. (See Developer Area/Language Pack Generation if you want to know more about how these scripts work.)

Once the scripts are committed, deploy the scripts by generating a new custom-site-mahara-langpacks debian package.

cd path/to/mahara-scripts
dch -i --no-auto-nmu # And then update the changelog to indicate what you're doing, e.g. "16.04 release"
fakeroot debian/rules binary
git add debian/changelog
git commit -m "16.04 release"
git push

If done correctly, this will generate a file called "custom-site-mahara-langpacks_X.YY_all.deb". If you get a strange version number with something like "-ubuntu" or "-nmu1" on the end, then remove your local changes and try manually specifying the incremented version with "dch -v 1.29", or just edit the debian/changelog file by hand.

The resulting .deb will need to need to be installed on the Catalyst servers where langpacks.mahara.org are installed. You may ask the Catalyst Sysadmins to deploy it by creating a WR and attaching the .deb file. They will upload it to the correct internal repository and deploy it.

Send reminder to owners of language string repos

The language string translations for most languages are managed by launchpad. But some of them have their own repo. We can see which ones in this file language-repos.txt. As we can't create the release branch in that repo, we have to send a reminder to the owner to create it. The language pack for the latest release won't be available until they do.