Neon/Locally build packages: Difference between revisions

From KDE Community Wiki
Line 52: Line 52:


<code>sudo pbuilder create --distribution focal --othermirror "deb http://archive.neon.kde.org/user focal main|deb-src http://archive.neon.kde.org/user focal main" --keyring /usr/share/keyrings/neon-archive-keyring.gpg</code>
<code>sudo pbuilder create --distribution focal --othermirror "deb http://archive.neon.kde.org/user focal main|deb-src http://archive.neon.kde.org/user focal main" --keyring /usr/share/keyrings/neon-archive-keyring.gpg</code>
== Using ccache ==
<code>echo 'CCACHEDIR=/var/cache/pbuilder/ccache' | sudo tee -a /etc/pbuilderrc</code>
You will probably want to use bindfs to map a ccache from (assuming you are uuid 1000) to your personal home directory so you can share the ccache adequately.
<code>echo "bindfs#/var/cache/pbuilder/ccache /home/$HOME/ccache fuse force-user=1000,force-group=1000 0 0" | sudo tee -a /etc/fstab && sudo mount /var/cache/pbuilder/ccache</code>
Set your local user cache to point to this mount:
<code>ccache -o cache_dir=/home/$HOME/ccache</code>

Revision as of 02:07, 21 December 2020

This page describes some basics in taking a package from https://invent.kde.org/neon/ and building it locally. This can be useful for doing local testing before committing changes.

Prerequisites

Setting up local files for building package

  1. Clone the package repository repository, i.e. https://invent.kde.org/neon/kde/libkdegames
  2. Copy the source tree from your kde sources to where the debian/ path resides.
  3. Create a usr/share/locale to simulate CI locale injection, mkdir -p usr/share/locale && touch usr/share/locale/stub
  4. Remove symbols to simulate CI removing the symbol files, rm debian/*.symbols
  5. Change debian/source/format to use native instead of quilt, sed -i 's/quilt/native/' debian/source/format
  6. Apply patches, QUILT_PATCHES=debian/patches quilt push -a

Or, in one command:

mkdir -p usr/share/locale && touch usr/share/locale/stub && rm -f debian/*.symbols && sed -i 's/quilt/native/' debian/source/format && QUILT_PATCHES=debian/patches quilt push -a

Building the package

Use your favorite tool:

  • dpkg-buildpackage
  • debuild

Known false negatives

  • Complaints about dsc and missing key.
  • Lintian returns malformed-debian-changelog-version.

Speeding up compilation

A compiler cache can help speed things up immensely, particularly when it comes to packages that take a while to compile.

Install ccache. It might be worth also setting these options:

  • ccache -o max_size="20G" - Increases the cache size to 20G, roughly kdesrc-build uses about 12G currently and the default is 10G.
  • ccache -o compression="true" - Enable compression, reduces cache size by compressing objects.
  • ccache -o compression_level="9" - Highest level of compression, helps utilize your space significantly better at a relatively minimal performance cost.

Configure ~/.devscripts to use ccache when using debuild:

echo 'DEBUILD_PREPEND_PATH="/usr/lib/ccache"' | tee -a ~/.devscripts

Now you should be able to use debuild with ccache. You may want to validate this by checking its' usage statistics while building, use ccache -s.

Using pbuilder

pbuilder is a useful tool when you want to build in a clean environment, and to validate that required development packages are correctly configured in the debian/control file.

pbuilder requires the definition of the Neon repositories when creating the base image:

sudo pbuilder create --distribution focal --othermirror "deb http://archive.neon.kde.org/user focal main|deb-src http://archive.neon.kde.org/user focal main" --keyring /usr/share/keyrings/neon-archive-keyring.gpg

Using ccache

echo 'CCACHEDIR=/var/cache/pbuilder/ccache' | sudo tee -a /etc/pbuilderrc

You will probably want to use bindfs to map a ccache from (assuming you are uuid 1000) to your personal home directory so you can share the ccache adequately.

echo "bindfs#/var/cache/pbuilder/ccache /home/$HOME/ccache fuse force-user=1000,force-group=1000 0 0" | sudo tee -a /etc/fstab && sudo mount /var/cache/pbuilder/ccache

Set your local user cache to point to this mount:

ccache -o cache_dir=/home/$HOME/ccache