The https://git.gnome.org/browse/gnome-continuous git module contains a build system presently named "ostbuild". It is a build system designed for OSTree, in the same way rpmbuild is designed for rpm. This code is the same software backing http://build.gnome.org/#gnome-continuous.

High level overview

The build system is divided into two layers. First, a base system is built using OpenEmbedded, from the Yocto Project. This base system includes the Linux kernel, gcc, bash, NSS, OpenSSL, and such. These are pinned to specific versions, and we do not perform continuous integration on them. The second layer is the gnome-continuous layer ("ostbuild"), which is designed to do continuous integration directly from git repositories.

It's honestly a bit of a Frankenstein mashup. On the other hand, it works, and the different systems have different strengths.

Doing a local build

You will be building everything from source, and this involves disk space (plan for at least 30GB) and time (plan for at least 24 hours for a full initial build). On the positive side, the build system runs completely as non-root, and does not otherwise impact your system. Once you have a completed build, incremental builds are fast.

Prerequisites

First: The gnome-continuous system is regularly tested building from a Red Hat Enterprise Linux 6.4 host. It's possible to build from other hosts (Ubuntu, OpenSUSE, Fedora, Debian), but your mileage may vary. If you're trying one of these systems, it's recommended to first do a test build of "core-image-minimal" from OpenEmbedded to ensure the toolchain works on your system.

You can do a build inside a virtual machine, but if you want to run tests, it's highly encouraged to use a bare metal system, as nested virtualization is too slow.

To start, see the OpenEmbedded Getting Started page; you'll need a variety of basic tools as listed on that page.

Next, ensure you have the linux-user-chroot tool installed, and setuid root.

Building

The recommended way to use gnome-continuous is inside Jhbuild (although it could be "packaged" for a distribution too). Once you have jhbuild set up, you should run all further commands from inside a jhbuild shell:

$ jhbuild shell

Next, let's build gnome-continuous:

$ jhbuild build gnome-continuous

We need to create a build directory. This should have at least 30GB of disk space free.

mkdir -p ~/build/gnome-continuous

And a symbolic link for the "manifest" to the gnome-continuous git repository; this is a one-time setup.

ln -s ~/src/gnome-continuous/manifest.json ~/build/gnome-continuous

From here, all further commands should be run from the build directory.

Updating and performing a build

This command starts a fetch of the git repos (a "resolve"), and if it's changed, starts a build:

cd ~/build/gnome-continuous
ostbuild make -x builddisks resolve fetchAll=true

The reason for the "-x builddisks" is to skip the disk image (.qcow2) generation and subsequent test runs; this is something the build server does, and you can do locally if you want, but here we're just building.

What we have now is a build of gnome-continuous inside our local repo, built completely from source.

ostree --repo=$HOME/build/gnome-continuous/repo ls -R gnome-continuous/buildmaster/x86_64-runtime

Running just one task

The build process is two stages "resolve" and "build". You can run them individually like this:

Just running a resolve:

ostbuild make -n resolve

Do a build:

ostbuild make -n build

And so on. Other tasks are "builddisks", "smoketest", and "integrationtest".

Setting up a VM

Now we have a build sitting in an OSTree repository, how do we actually use it? The recommended way at the moment is to use a virtual machine.

There is one important step; you will need to add "user_allow_other" to the FUSE configuration, as root. Like this:

# echo user_allow_other >> /etc/fuse.conf

Now, you can generate a local disk image this way:

ostbuild make -n builddisks

This step requires libguestfs. At the end of that, you will have a qcow2 format disk image in ~/build/gnome-continuous/images. You can boot it directly like this:

qemu-kvm -monitor stdio -vnc :0  -vga std -drive file=gnome-ostree-trees_gnomeos-3.8-x86_64-devel-disk.qcow2,if=virtio -m 768M -usb

But it's recommended to use libvirt+qemu. You can import the qcow2 image as an existing disk image in virt-manager.

Using local override git repositories

cd ~/src
# This command needs our workdir so it can find the snapshots/ directory
# and check out the exact git revision specified there.
ostbuild checkout --workdir=$HOME/build/gnome-continuous/ --snapshot=$HOME/build/gnome-continuous/results/tasks/build/snapshot.json gnome-shell

mkdir -p ~/build/gnome-continuous/overrides
ln -s ~/src/gnome-shell ~/build/gnome-continuous/overrides

Pulling builds from host (or build server) to a VM

One very useful workflow is to simply point /ostree/repo/config on a Continuous VM at a locally built repository. You can do this by setting up any static webserver you want which exports $HOME/build/gnome-continuous/repo. If your builder is also the virtualization host, you'd point it at e.g. http://192.168.122.1/repo.

Attic/GnomeContinuous/Building (last edited 2021-03-10 21:51:49 by EmmanueleBassi)