300.2. qbittorrent-5.2.3
BitTorrent client (Qt 6) with a web UI, plus qbittorrent-nox for a machine with no display
| Version | 5.2.3, release 2 |
| Shelf | transfer — File transfer, synchronisation, backup and BitTorrent |
| Phase | 44_apps (Applications), 389 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.qbittorrent.org/ |
| Build time | 36.0 SBU |
| Installed size | 27.9 MiB in 35 files |
| Recipe | ports/core/transfer/qbittorrent/kpkgbuild |
About
qBittorrent is a BitTorrent client on Qt 6 and libtorrent-rasterbar, with a built-in web interface for remote control. The port builds the source twice: once as the desktop client, qbittorrent, and once with no GUI as qbittorrent-nox, which runs on a machine with no display and is driven through its web interface.
Sources
qbittorrent-5.2.3.tar.gz(10.3 MiB)
sha256a5f540cdfb0053f0ce1a1c62ccd92d08214f16bcb2c512569ec54d81531e541f
upstream: https://github.com/qbittorrent/qBittorrent/archive/refs/tags/release-5.2.3.tar.gz
archive copy: sources-4/transfer--qbittorrent-5.2.3.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, boost, openssl, zlib, libtorrent-rasterbar, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtwayland, hicolor-icon-theme.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
geoip-off-by-default.patch— Insrc/base/preferences.cpp, changes the default ofPreferences/Connection/ResolvePeerCountriesfromtruetofalse. With it on, qBittorrent downloads DB-IP’s free country database fromdownload.db-ip.comand fetches it again each month to show each peer’s country. With the patch a fresh profile makes no such request; the setting can still be turned on in the preferences.libtorrent-2.1.patch— Support build against latest version of libtorrentPR #23953.
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 qbittorrent'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/transfer/qbittorrent.
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/qbittorrent
echo 'a5f540cdfb0053f0ce1a1c62ccd92d08214f16bcb2c512569ec54d81531e541f qbittorrent-5.2.3.tar.gz' | 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/qbittorrent
SRC=$SRC_ROOT/qbittorrent-5.2.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf qbittorrent-5.2.3.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/libtorrent-2.1.patch"
patch -p1 -i "$PORT_SRC/geoip-off-by-default.patch"
for _gui in ON OFF; do
cmake -S . -B build-gui-$_gui -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D GUI=$_gui \
-D WEBUI=ON \
-D STACKTRACE=OFF \
-D TESTING=OFF \
-D SYSTEMD=OFF \
-Wno-dev
cmake --build build-gui-$_gui
done
DESTDIR=$PKG cmake --install build-gui-ON
install -Dm755 build-gui-OFF/qbittorrent-nox "$PKG/usr/bin/qbittorrent-nox"
install -Dm644 doc/en/qbittorrent-nox.1 "$PKG/usr/share/man/man1/qbittorrent-nox.1"
find "$PKG/usr/share/man" -mindepth 1 -maxdepth 1 ! -name 'man[0-9]*' -exec rm -rf {} +
cat > "$PKG/usr/share/applications/org.qbittorrent.qBittorrent.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=qBittorrent
GenericName=BitTorrent Client
Comment=Download and share files over BitTorrent
Exec=qbittorrent %U
Icon=qbittorrent
Terminal=false
StartupWMClass=org.qbittorrent.qBittorrent
SingleMainWindow=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;Qt;
Keywords=bittorrent;torrent;magnet;download;p2p;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.qbittorrent.qBittorrent.desktop"
The switches, and why each is set:
-D GUI=$_gui—build.shloops overONandOFF, configuring intobuild-gui-ONandbuild-gui-OFF. WithGUI=ONthe build is the desktop client; withGUI=OFFit isqbittorrent-nox. The whole install is taken from the GUI build, and only theqbittorrent-noxbinary and its manual page are added from the other.-D WEBUI=ON— the built-in HTTP server for remote control, in both builds. This is upstream’s default, and it isqbittorrent-nox’s only interface.-D STACKTRACE=OFF— no crash handler that prints a backtrace to the terminal and into a dialog. On by default upstream.-D TESTING=OFF— no internal test suite, upstream’s default.-D SYSTEMD=OFF— do not install the systemd service file forqbittorrent-nox; KDOS has no systemd (see No systemd).
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/qbittorrent, 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 qbittorrent-5.2.3-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/qbittorrent, and runs the triggers its paths call for.
Contents
Installed programs: qbittorrent, qbittorrent-nox.
Installed directories: /usr/share/licenses/qbittorrent.
Short descriptions
qbittorrent |
a Bittorrent client written in C++ / Qt |
qbittorrent-nox |
a command line Bittorrent client written in C++ / Qt |
Notes
build.sh deletes every directory under /usr/share/man that is not a man<N> section, which removes upstream’s translated manual pages; kpkg’s size and language policy removes the same directories from every package. The recipe writes its own desktop entry: qBittorrent sets its desktop file name to org.qbittorrent.qBittorrent, which is the Wayland app id the entry’s StartupWMClass names, where upstream’s entry carries qbittorrent. The entry claims application/x-bittorrent and magnet: links; Transmission’s entry claims neither.