Note, this page is semi-obsolete. See GnomeOSTree/Building for the simple "give me a build" instructions.

Old content

One of the primary goals of OSTree is to make hacking on Linux-based operating systems both safer and faster for developers than the current set of possible tools (jhbuild, rebuild debs/rpms, virtualization, etc.). Before reading this, you should have read OSTree/Ostbuild and have some understanding of an OSTree repository, the source manifest, and source/binary snapshots.

Rebuilding multiple components from source

Problem statement: We want to make an API/ABI-incompatible change to gnome-menus (a shared library) and update gnome-shell (a consumer of this library) to use it.

Problems with dpkg/rpm and jhbuild

For dpkg/rpm, you might be tempted to make an updated RPM of gnome-menus and install it on your system, so you could then start modifying gnome-shell, but this would immediately break your current gnome-shell. This is so clearly painful that it drives you to a higher level tool, so you can compile them independently of your system install (for .deb, this is pbuilder ). But even if you do that, once you have things compiling, if you install the resulting debs/rpms, you've likely broken your base system, since this is the first time you're testing it. This drives you towards "mock/pbuilder + virtualization", which is an extremely heavyweight workflow.

For Jhbuild, the saving grace here is that you have a regular system install in /, and can do jhbuild builds which don't affect the system. However were you to log in to Jhbuild, you'd be back to a state where your build affects the running system.

OSTree workflow

OSTree is better for two reasons:

  1. It always separates compilation from installing them on a running system (similar to mock/pbuilder)
  2. You can run modified components in an OSTree branch that doesn't affect your system install, nor your other OSTree branches. There is no rpm/dpkg equivalent to this.

One time setup

You've done an OSTree install, and you have an OSTree repository in /ostree/repo. Let's say you keep source code in ~/src, and binaries in ~/build.

Doing a full build from scratch

gnome-ostree used to support importing binaries from a build server, but doesn't anymore (currently). So to do a build right now, you need to build everything from source. After that, you have a local binary build, and can more efficiently rebuild individual items.

First, you'll need a checkout of the gnome-ostree git module. Install it with jhbuild:

jhbuild build gnome-ostree

Now, let's create abuild directory, and a symbolic link for the "manifest" to the gnome-ostree git repository; this is a one-time setup.

mkdir -p ~/build/gnome-ostree
ln -s ~/src/gnome-ostree/manifest.json ~/build/gnome-ostree

Editing the manifest

Now, here's the part I'm least proud of - to point gnome-ostree at local source code, we need to edit the JSON file in ~/build/gnome-ostree/snapshots/2012.1-xxxx.json. You change the manifest to point at your local git repository. You should change the data that looks like this:

            "branch": "master", 
            "name": "gnome-menus", 
            "revision": "3.4.0-7-g068bfbdbcb328c0f7eb29faecaf41c82e5633bb5", 
            "src": "git:git://"


            "branch": "master", 
            "name": "gnome-menus", 
            "src": "local:/home/user/src/gnome-menus"

Now we've pointed ostbuild at our modified source. Do the build process again:

$ ostbuild make build

Projects/OSTree/Ostbuild/DeveloperWorkflow (last edited 2013-11-22 20:27:23 by walters)