Developer Area/Language Packs/Launchpad Branching: Difference between revisions
From Mahara Wiki
< Developer Area | Language Packs
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=A word about Bazaar= | ==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. | 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. | ||
Line 7: | Line 7: | ||
As long as you're not trying to do anything too new and different, the code here should be enough to get you through. | 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= | ==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]) | 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]). | ||
#Install the Bazaar command-line tools, and the Debian package maintainer utilities. <code>sudo apt-get install bzr devscripts</code> | |||
#Upload your public SSH key into Launchpad, using the Launchpad website: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair | |||
#Set up your bzr credentials on your computer. These are stored at the user level. | |||
<code>bzr whoami "FIRSTNAME LASTNAME <YOUREMAILADDRESS@whatever.com>"</code> | |||
<code>bzr launchpad-login YOUR_LAUNCHPAD_USERNAME</code> | |||
'''Errors''' | |||
File "/usr/bin/bzr", line 49 | File "/usr/bin/bzr", line 49 | ||
except locale.Error, e: | except locale.Error, e: | ||
^ SyntaxError: invalid syntax | ^ SyntaxError: invalid syntax | ||
It might mean your version of Python is not compatible with Bzr | It might mean your version of Python is not compatible with Bzr. You may need to have Python2.x installed first, then edit the bzr file, e.g. if you have installed Python 2.7 | ||
then edit the bzr file, | |||
<code>sudo jed /usr/bin/bzr</code> | |||
to | and change the first line from <code>#! /usr/bin/python</code> to <code>#! /usr/bin/python2.7</code> | ||
==Create a new code branch== | |||
Note: Use _DEV instead of _STABLE from 22.04 | |||
Create a new code branch in the mahara-lang launchpad project for importing pot templates to contain a copy of the latest mahara/mahara.pot from main. | |||
# There's probably a better way to keep your master checkout in sync, | # 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 | # But I find it's just easiest to delete it and do a new checkout | ||
> rm -Rf trunk | > rm -Rf trunk # trunk is the name of the branch | ||
> bzr checkout lp:mahara-lang ./trunk # get a copy of the mahara-lang trunk | > bzr checkout lp:mahara-lang ./trunk # get a copy of the mahara-lang trunk | ||
Create the new code branch, copy the main code into it, and publish it to Launchpad. | |||
mkdir 16.10_DEV | |||
mkdir 16. | cd 16.10_DEV | ||
cd 16. | |||
bzr init | bzr init | ||
mkdir mahara | mkdir mahara | ||
Line 61: | Line 49: | ||
cp ~/bazaar/trunk/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 -m 'Add 16.10 mahara.pot' | ||
bzr push lp:~mahara-lang/mahara-lang/16. | bzr push lp:~mahara-lang/mahara-lang/16.10_DEV | ||
=Create the new export branch= | ==Create the new export branch== | ||
Manually create a new export branch, which can be mostly empty. (Launchpad will fill it with content.) | |||
cd ~/bazaar | cd ~/bazaar | ||
mkdir 16. | mkdir 16.10_DEV-export | ||
cd 16. | cd 16.10_DEV-export | ||
bzr init | bzr init | ||
mkdir mahara | mkdir mahara | ||
bzr add mahara | bzr add mahara | ||
bzr commit | bzr commit | ||
bzr push lp:~mahara-lang/mahara-lang/16. | bzr push lp:~mahara-lang/mahara-lang/16.10_DEV-export | ||
=Create a new series= | ==Create a new series== | ||
Check that the two branches | #Check that the two branches appear at https://code.launchpad.net/mahara-lang. The code branch should contain the <code>mahara.pot</code> file. | ||
#Create the new series under the mahara-lang project on launchpad at https://launchpad.net/mahara-lang/+addseries | |||
#Set the official series branch to the one you just created (<code>~mahara-lang/mahara-lang/1.5_STABLE</code>). | |||
Note: Launchpad calls the branch by the abbreviated name <code>lp:mahara-lang/1.5</code> | |||
==Set up translation import and export for the new series== | |||
Access the translation settings for the new series: | |||
Access the translation settings for the new series | |||
#Go to https://translations.launchpad.net/mahara-lang | #Go to https://translations.launchpad.net/mahara-lang | ||
Line 101: | Line 88: | ||
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. | 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 | ==Update the config== | ||
#Add the new branch to the BRANCHES list to be translated in the [https://gitlab.wgtn.cat-it.co.nz/mahara/mahara-langpacks/-/blob/main/mahara-langpacks.conf#L7 mahara-langpacks.conf] file. <code>BRANCHES="20.10_STABLE 20.04_STABLE 19.10_STABLE 19.04_STABLE 18.10_STABLE 18.04_STABLE main"</code> | |||
#Create a merge request and get Kristina's approval to merge. | |||
==Old instructions (before 2020)== | ==Old instructions (before 2020)== | ||
Line 132: | Line 114: | ||
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. | 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= | ==Update the pipeline in Gitlab== | ||
'''To be done by Catalyst''' | '''To be done by Catalyst''' | ||
#In the Catalyst-internal Gitlab /mahara/mahara-langpacks add the new branch to mahara-langpacks.conf. | #In the Catalyst-internal Gitlab /mahara/mahara-langpacks add the new branch to <code>mahara-langpacks.conf</code>. | ||
#You may also want to remove old branches that should not be built anymore. | #You may also want to remove old branches that should not be built anymore. | ||
#Commit and push. | #Commit and push. | ||
Line 147: | Line 129: | ||
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. | 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= | ==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]. | 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. | 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. |
Latest revision as of 13:54, 1 November 2022
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).
- Install the Bazaar command-line tools, and the Debian package maintainer utilities.
sudo apt-get install bzr devscripts
- Upload your public SSH key into Launchpad, using the Launchpad website: https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair
- 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
Errors
File "/usr/bin/bzr", line 49 except locale.Error, e: ^ SyntaxError: invalid syntax
It might mean your version of Python is not compatible with Bzr. You may need to have Python2.x installed first, then edit the bzr file, e.g. if you have installed Python 2.7
sudo jed /usr/bin/bzr
and change the first line from #! /usr/bin/python
to #! /usr/bin/python2.7
Create a new code branch
Note: Use _DEV instead of _STABLE from 22.04
Create a new code branch in the mahara-lang launchpad project for importing pot templates to contain a copy of the latest mahara/mahara.pot from main.
# 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 # trunk is the name of the branch > bzr checkout lp:mahara-lang ./trunk # get a copy of the mahara-lang trunk
Create the new code branch, copy the main code into it, and publish it to Launchpad.
mkdir 16.10_DEV cd 16.10_DEV 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 -m 'Add 16.10 mahara.pot' bzr push lp:~mahara-lang/mahara-lang/16.10_DEV
Create the new export branch
Manually create a new export branch, which can be mostly empty. (Launchpad will fill it with content.)
cd ~/bazaar mkdir 16.10_DEV-export cd 16.10_DEV-export bzr init mkdir mahara bzr add mahara bzr commit bzr push lp:~mahara-lang/mahara-lang/16.10_DEV-export
Create a new series
- Check that the two branches appear at 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
- Set the official series branch to the one you just created (
~mahara-lang/mahara-lang/1.5_STABLE
).
Note: 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:
- 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 config
- Add the new branch to the BRANCHES list to be translated in the mahara-langpacks.conf file.
BRANCHES="20.10_STABLE 20.04_STABLE 19.10_STABLE 19.04_STABLE 18.10_STABLE 18.04_STABLE main"
- Create a merge request and get Kristina's approval to merge.
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.