Developer Area/Language Packs/Launchpad Branching
From Mahara Wiki
< Developer Area | Language PacksRevision as of 17:43, 23 September 2020 by Cecilia (talk | contribs) (→Update the scripts)
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:
- Go to https://translations.launchpad.net/mahara-lang
- 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 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
Since the scripts to generate the language packs were added to gitlab, there's only one file that needs to be updated.
The new branch needs to be added to the list of branches to be translated here.
Find the mahara-langpacks.conf file and add the new branch inside BRANCHES variable. It should look like this:
BRANCHES="20.10_STABLE 20.04_STABLE 19.10_STABLE 19.04_STABLE 18.10_STABLE 18.04_STABLE master"
Old instructions (before 2020)
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.
Update the pipeline in Gitlab
To be done by Catalyst
- In the Catalyst-internal Gitlab /mahara/mahara-langpacks add the new branch to mahara-langpacks.conf.
- You may also want to remove old branches that should not be built anymore.
- Commit and push.
- Run the pipeline “update pot” to push to Launchpad and run it manually.
Note: It is set to run at 8 p.m. NZ, which is after the EOB for that day.
If you change anything in the “templates” folder, you need to run the template pipeline manually to push the changes to the server. That job does not run on a cron though as updates are minimal.
The scripts themselves have not been updated. They are still in need of some love. Right now it can happen that jobs are marked as succeeding when they are failing under certain circumstances.
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.