Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

300.4. deluge-2.2.0

BitTorrent client with a daemon, a GTK 3 interface, a web UI and a console UI

The build-state snapshot was taken from 2.2.0-1; this recipe is 2.2.0-2, so the size, time and contents below describe the earlier build.

Version 2.2.0, release 2
Shelf transfer — File transfer, synchronisation, backup and BitTorrent
Phase 44_apps (Applications), 391 of 422 in build order
Licence GPL-3.0-or-later
Homepage https://deluge-torrent.org/
Build time 1.0 SBU
Installed size 13.0 MiB in 1855 files
Recipe ports/core/transfer/deluge/kpkgbuild

About

Deluge is a BitTorrent client split into a daemon, deluged, and the interfaces that drive it: the GTK 3 window deluge-gtk, the web interface deluge-web and the console deluge-console. It is written in Python on Twisted, and does its torrent work through the Python binding of libtorrent-rasterbar, which must be of the 2.0 series: the 2.1 binding lacks settings and names the daemon uses, and deluged stops at start. The port installs the daemon, the three interfaces, the deluge command that starts whichever interface is set as the default, and the menu entry for the GTK window.

Sources

Dependencies

Depends on: python3, python3-pip, python3-setuptools, python3-wheel, python3-hatchling, python3-hatch-vcs, python3-setuptools-scm, python3-versioneer, python3-cython, python3-packaging, python3-attrs, python3-typing-extensions, python3-idna, python3-twisted, python3-zope-interface, python3-cryptography, python3-mako, python3-pyxdg, python3-distro, python3-pillow, python3-gobject, python3-cairo, libtorrent-rasterbar, gtk3, librsvg, xdg-utils, hicolor-icon-theme.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install deluge'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/transfer/deluge.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/transfer/deluge
echo 'f0fc64e052334ef294ca3951975dd926f129d62813f6c909bb523d914abe6537  deluge-2.2.0.tar.gz' | sha256sum -c -
echo 'e126657d75080ce560236bb690b4f5d4459dab5bb984c6b11adc23998edbcc33  deluge-vendor-2.2.0.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/deluge
SRC=$SRC_ROOT/deluge-2.2.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf deluge-2.2.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers pyrequirements, pyruntime and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/no-pkg_resources.patch"
patch -p1 -i "$PORT_SRC/pyopenssl-26.patch"
patch -p1 -i "$PORT_SRC/release-check-off-by-default.patch"

mkdir -p vendor
tar -xf $PORT_SRC/$name-vendor-$version.tar.xz --strip-components=1 -C vendor

_back="$SRC_ROOT/backends"
pip3 install --no-deps --no-index --find-links=vendor --no-build-isolation \
	--target "$_back" hatch-fancy-pypi-readme rjsmin
export PYTHONPATH="$_back${PYTHONPATH:+:$PYTHONPATH}"

pip3 install --no-deps --no-index --find-links=vendor --no-build-isolation \
	--ignore-installed --root=$PKG --prefix=/usr \
	pyopenssl service-identity pyasn1 pyasn1-modules rencode \
	setproctitle .

_site=$(python3 -c 'import sys, sysconfig; print(sysconfig.get_path("platlib", vars={"platbase": sys.argv[1], "base": sys.argv[1]}))' "$PKG/usr")
find "$_site/deluge/i18n" -mindepth 1 -maxdepth 1 -type d ! -name 'en*' -exec rm -rf {} +

for _egg in "$_site"/deluge/plugins/*.egg; do
	mv "$_egg" "$_egg.zip"
	python3 -m zipfile -e "$_egg.zip" "$_egg"
	rm "$_egg.zip"
done

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/deluge.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Deluge
GenericName=BitTorrent Client
Comment=Download and share files over BitTorrent
Exec=deluge-gtk %U
Icon=deluge
Terminal=false
StartupWMClass=deluge
Categories=Network;FileTransfer;P2P;GTK;
Keywords=bittorrent;torrent;magnet;download;p2p;deluge;
DESKTOP
chmod 644 "$PKG/usr/share/applications/deluge.desktop"

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/deluge, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf deluge-2.2.0-2.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/deluge, and runs the triggers its paths call for.

Contents

Installed programs: deluge, deluge-console, deluge-gtk, deluge-web, deluged.

Installed directories: /usr/lib/python3.14/site-packages/OpenSSL, /usr/lib/python3.14/site-packages/deluge, /usr/lib/python3.14/site-packages/deluge-2.2.0.dist-info, /usr/lib/python3.14/site-packages/pyasn1, /usr/lib/python3.14/site-packages/pyasn1-0.6.4.dist-info, /usr/lib/python3.14/site-packages/pyasn1_modules, /usr/lib/python3.14/site-packages/pyasn1_modules-0.4.2.dist-info, /usr/lib/python3.14/site-packages/pyopenssl-26.4.0.dist-info, /usr/lib/python3.14/site-packages/rencode, /usr/lib/python3.14/site-packages/rencode-1.0.9.dist-info, /usr/lib/python3.14/site-packages/service_identity, /usr/lib/python3.14/site-packages/service_identity-26.1.0.dist-info, /usr/lib/python3.14/site-packages/setproctitle, /usr/lib/python3.14/site-packages/setproctitle-1.3.7.dist-info, /usr/share/licenses/deluge.

Short descriptions

deluge A BitTorrent client
deluge-console A BitTorrent client console interface
deluge-gtk A BitTorrent client Gtk interface
deluge-web A BitTorrent client web interface
deluged A BitTorrent client daemon

Notes