Haiku Git Repositories

Haiku uses Git for source control, combined with Gerrit for review of code changes.

Most of the operating system sources are stored in a single repository at

http://cgit.haiku-os.org/haiku

.

Another repository at

http://cgit.haiku-os.org/buildtools

contains the build tools, that is, gcc, binutils, and Jam, which are maintained by Haiku developers.

Additional repositories

are hosed on GitHub.

Finally, some pre-compiled packages are downloaded during the build, these are built using Haikuporter from

recipes available here

.

Getting the sourcecode

https://www.haiku-os.org/guides/building/get-source-git

Sending change reviews

https://dev.haiku-os.org/wiki/CodingGuidelines/SubmittingPatches

https://review.haiku-os.org/Documentation/user-upload.html

Source tree organization

The source tree is organized so you can easily find what you look for. If you’re already familiar with Haiku, you will notice that the source directory generally mirrors the way the filesystem in Haiku is organized.

At the top level, things that need to be “built” in some way are put in the "src" directory. For example, the “data” folder at the root contains files that are used as-is in the disk image, while “src/data” contain files that need to be compild or converted to different formats, such as the MIME database.

Managing 3rd-party code

GCC and binutils updates using vendor branches

The buidtools repository uses vendor branches. This concept originates from

the SVN Book

but applies just as well to Git. This organization allows to clearly separate the imported code from upstream, and the changes we have made to it.

The idea is to import all upstream changes in a dedicated branch (there are currently two, called vendor-gcc and vendor-binutils). These branches contains the sources of gcc and binutils as distributed by the GNU project, without any Haiku changes.

The master branch can then merge new versions from the vendor branches. This allows to use Git conflict resolution to make sure our patches are correctly ported from one version to the next.

It also makes it easy to compare the current state of our sourcecode with the upstream code, for example to extract patches that could be upstreamed.

# How to import upstream binutils changes

Here is an example of the process used to update to a new version of binutils:

Now this can easily be merged into the master branch:

Review and fix the conflicts, if any, then push the changes for review on Gerrit.

# How to import upstream gcc changes

Here is an example of the process used to update to a new version of binutils:

Now this can easily be merged into the master branch:

Review and fix the conflicts, if any, then push the changes for review on Gerrit.

# Comparing our code with upstream

Comparing the two versions is easy because you can refer to them by branch names:

Third party code in Haiku without vendor branches

The Haiku main repository contains third party code that does not use vendor branches. This can be for various reasons, such as:

Some examples of this are:

In this case, since there is no branch to track where the upstream code came from and what changes were made, a few specific steps should be taken to avoid confusion and possibly losing some of our changes and fixes:

When importing new version of the files from upstream, make sure to review all the places where there are __HAIKU__ guards, and consider wether they still apply in the new version, or if the upstream code has been changed so they can be removed.