Testing developer versions using Git¶
If you want to work on the code, or test a fix that has just been made, you'll want to get the latest developer version. We use Git for version control, so make sure you have that. You'll also need 'gettext-tools' to build the translations.
To install these on Ubuntu, open a terminal emulator and run this command:
$ sudo apt-get install git gitk gettext
(gitk is a largish visualisation tool and is not strictly necessary, but highly recommended)
Click on the SCM link on any program's page to see its Git page (for example, 0install.git for 0install itself). The link for cloning is displayed there; use it like this:
$ git clone https://github.com/0install/0install.git $ cd 0install
The directory contains the latest version, plus a single (hidden) .git directory with all the git-related bits.
To see the log:
$ git log
This doesn't require network access; your clone has the whole history.
To view a visualisation of the history:
$ gitk --all
--all shows the history of all branches and tags, not just the main trunk)
To download the latest updates into your copy:
$ git pull --rebase
--rebase option says that if you've committed some changes locally, they should be reapplied on top of the latest version. Otherwise, it would create a merge commit, which is usually not what you want.)
You can also pull from other places. If someone posts to the mailing list, they will tell you where to pull from to try the feature out. If they send a patch, you can apply it with:
$ git am the.patch
Understanding the OCaml code¶
Most modules have two files - a
.ml file containing the implementation and a
.mli file describing the module's public interface. You should always start by reading the
.mli file. sigs.mli describes several abstract interfaces used in the code.
Thomas Leonard's blog has many blog posts describing various aspects of 0install. For example, Simplifying the Solver With Functors explains how 0install chooses a compatible set of libraries to run a program, while Asynchronous Python vs OCaml describes the code for downloading things.
If you've changed the code in some way then you can commit the changes like this (this just stores them on your own computer, in the
$ git commit -a
Enter a log message. The first line should be a short summary (like the subject of an email). Then leave a blank line, then write a longer description.
To view your patch after committing:
$ git show
If you realised you made a mistake, correct it and then do:
$ git commit -a --amend
Finally, to make a patch file ready to send to the mailing list:
$ git format-patch origin/master
Making a new translation¶
Translations are not currently working - see Gettext support in OCaml.
If you prefer, you can also use the Transifex web interface to work on translations.
The steps are:
- Create the
- Create a new directory
share/locale/_$locale_/LC_MESSAGESinside the Git checkout.
- Copy the
.potfile inside it with a
e.g. to make a French translation:
$ make share/locale/zero-install.pot $ mkdir -p share/locale/fr/LC_MESSAGES $ cp share/locale/zero-install.pot share/locale/fr/LC_MESSAGES/zero-install.po
Then edit the
.po file to give a translation for each string. When you're done, create the
.mo file from the
.po file and test:
$ make translations $ ./0launch
Finally, send us the new