How to best build and test an individual Qubes OS package for dom0?

I’m currently hacking on qubes-gui-daemon attempting to implement this (input device pattern cloaking). I have a rather crude prototype implemented, and would like to give it a spin on my Qubes OS machine to see if it mostly works as intended or if it breaks everything.

Slight problem - I don’t know how to build packages for dom0. I know how to build packages for Fedora (I actually maintain a few Fedora packages, though they get almost no updates so I’m not an expert by any means), and I found qubes-builder-v2 which is suitable for building the entire OS. But… building the whole OS is a bit overkill for my use case (or at least so I think), and to build my modified package like a normal Fedora package I’d have to get a Fedora machine set up so that it had Qubes’ repos enabled. That could work I guess, but I expect that I’ll run into surprises trying that. I could try running Fedora packaging tools in dom0 itself, but… :grimacing: I don’t think you’re supposed to use dom0 like that. There doesn’t seem to exist any “fedora-with-dom0-repos-but-in-a-qube” official templates for Qubes that I could use.

Is there any official documentation on how to do one-off builds of packages intended for Qubes dom0? Is qubes-builder intended to help with this? Should I just go ahead and build the whole OS?

Actually, I think I should build the whole OS. I need to be using a testing build anyway to develop for Qubes efficiently.

You can also build specific packages with qubes-builderv2.

Here’s a base configuration you can use with the docker executor:

builder.yml

git:
  baseurl: https://github.com
  prefix: QubesOS/qubes-
  branch: release4.2
  maintainers:
    # marmarek
    - '0064428F455451B3EBE78A7F063938BA42CFA724'
    # simon
    - '274E12AB03F2FE293765FC06DA0434BC706E1FCF'

backend-vmm: xen
debug: true
verbose: true
qubes-release: r4.2

use-qubes-repo:
  version: 4.2
  testing: true

distributions:
  - host-fc37
  - vm-bookworm
  - vm-fc39
  - vm-fc40

components:
  - gui-daemon

executor:
  type: docker
  options:
    image: "qubes-builder-fedora:latest"

stages:
  - fetch
  - prep
  - build

It builds for dom0 but also for some qube distributions. If you only care about dom0, you can remove them.

You can add skip-git-fetch: true if you want to edit the source and not have the code removed while fetching, and increment-devel-versions: true if you want an incremental way of installing the package, which is easier if you need to test a lot of different versions.

You can follow the documentation on the repo to get everything up and running on a Fedora-based qube:

Once you are done, all you need to do is run ./qb package fetch to get the gui-daemon source code (available in artifacts/sources) and then run ./qb package prep build and wait for the packages to be built. The packages will be available in artifacts/repository.

To speed up the process a little bit, you can init a cache with ./qb package init-cache.

1 Like

Nice, thank you! I managed to find docs for most of that but didn’t do the init-cache, which means I’m probably hammering people’s servers with downloads every time I fix a compiler error in my patch :sweat_smile: I’ll enable the cache feature and then I should be fully up and running.