Debian Codegraph @

docs/en/reference/platforms/linux/system.md

raw
1 # Native System Packages
2
3 <table class="host-platform-support-table">
4 <colgroup>
5 <col style="width: 11%" />
6 <col style="width: 10%" />
7 <col style="width: 7%" />
8 <col style="width: 5%" />
9 <col style="width: 6%" />
10 <col style="width: 5%" />
11 <col style="width: 5%" />
12 <col style="width: 7%" />
13 <col style="width: 11%" />
14 <col style="width: 7%" />
15 <col style="width: 10%" />
16 </colgroup>
17 <thead>
18 <tr>
19 <th colspan="11"><a href="../../../../reference/platforms">Host Platform Support</a></th>
20 </tr>
21 <tr>
22 <th colspan="2">macOS</th>
23 <th colspan="5">Windows</th>
24 <th colspan="4">Linux</th>
25 </tr>
26 <tr>
27 <th>x86‑64</th>
28 <th>arm64</th>
29 <th>x86</th>
30 <th colspan="2">x86‑64</th>
31 <th colspan="2">arm64</th>
32 <th>x86</th>
33 <th>x86‑64</th>
34 <th>arm</th>
35 <th>arm64</th>
36 </tr>
37 </thead>
38 <tbody>
39 <tr>
40 <td>{{ maintainer_tested }}</td>
41 <td>{{ maintainer_tested }}</td>
42 <td></td>
43 <td colspan="2"></td>
44 <td colspan="2"></td>
45 <td>{{ not_tested }}</td>
46 <td>{{ ci_tested }}</td>
47 <td>{{ not_tested }}</td>
48 <td>{{ ci_tested }}</td>
49 </tr>
50 </tbody>
51 </table>
52
53 All modern Linux distributions have a native format for distributing packages that are integrated into their overall operating system:
54
55 - `.deb`, used by Debian, Ubuntu, Mint (and others)
56 - `.rpm`, used by Red Hat, Fedora, CentOS, AlmaLinux, openSUSE (and others)
57 - `.pkg.tar.zst`, used by Arch Linux and Manjaro Linux
58
59 The Briefcase `system` backend provides a way to build your app in these system package formats.
60
61 /// admonition | Not all Linux distributions are supported!
62
63 Briefcase cannot reliably identify *every* Linux vendor. If your Linux distribution isn't being identified (or isn't being identified correctly), please [open a ticket](https://github.com/beeware/briefcase/issues) with the contents of your `/etc/os-release` file.
64
65 ///
66
67 The packaged app includes a stub binary, so that the app will appear in process lists using your app's name. It also includes a FreeDesktop registration so the app will appear in system menus.
68
69 When installed from a Briefcase-produced system package, the app will use the system Python install, and the standard library provided by the system. However, the app will be isolated from any packages that have been installed at a system level.
70
71 As the app uses the system Python, system packages are highly dependent on the distribution version. It is therefore necessary to build a different system package for every distribution you want to target. To help simplify this process, Briefcase uses Docker to provide build environments. Using these Docker environments, it is possible to build a system package for any target distribution and version, regardless of the host distribution and version - that is, you can build a Debian Buster package on an Ubuntu 20.04 machine, or an Ubuntu 22.04 package on a RHEL8 machine.
72
73 The usage of the system Python also means that system packages are different from most other Briefcase-packaged apps. On other target platforms (macOS and Windows apps, Linux AppImage, etc), the version of Python used to run Briefcase will be the version of Python used by the bundled app. However, when building a system package, Briefcase will use the operating system's Python3 installation for system packages, regardless of the host Python version. This means you will need to perform additional platform testing to ensure that your app is compatible with that version of Python.
74
75 ## Icon format
76
77 Deb packages uses `.png` format icons. An application must provide icons in the following sizes:
78
79 - 16px
80 - 32px
81 - 64px
82 - 128px
83 - 256px
84 - 512px
85
86 Linux System packages do not support splash screens or installer images.
87
88 ## Additional files
89
90 The Linux system app template includes a `LICENSE` and `CHANGELOG` file, with stub content. When the application is generated from template, Briefcase will look in the project root folder (i.e., the folder that contains your `pyproject.toml`) for files with the same name. If these files are found, they will be copied into your project. You should ensure these files are complete and correct before publishing your app.
91
92 The Linux system app template also includes an initial draft manfile for your app. This manfile will be populated with the [`description`][] and [`long_description`][] of your app. You may wish to add more details on app usage.
93
94 ## Additional options
95
96 The following options can be provided at the command line when producing Deb packages:
97
98 ### `--target`
99
100 A Docker base image identifier for the Linux distribution you want to target. The identifier will be in the pattern `<vendor>:<codename>` (e.g., `debian:buster` or `ubuntu:jammy`). You can also use the version number in place of the code name (e.g., `debian:10`, `ubuntu:22.04`, or `fedora:37`). Whichever form you choose, you should be consistent; no normalization of code name and version is performed, so `ubuntu:jammy` and `ubuntu:22.04` will be identified as different versions (even though they the same version).
101
102 You can specify any identifier you want, provided the distribution is still supported by the vendor, and system Python is Python 3.10 or later.
103
104 The following Linux vendors are known to work as Docker targets:
105
106 - Debian (e.g., `debian:bookworm` or `debian:12`)
107 - Ubuntu (e.g., `ubuntu:noble` or `ubuntu:24.04`)
108 - Fedora (e.g, `fedora:41`)
109 - AlmaLinux (e.g., `almalinux:9`)
110 - Red Hat Enterprise Linux (e.g., `redhat/ubi9:9`)
111 - openSUSE Tumbleweed (e.g., `"opensuse/tumbleweed:latest"`)
112 - Arch Linux (e.g., `archlinux:latest`)
113 - Manjaro Linux (e.g., `manjarolinux/base:latest`)
114
115 ### `--Xdocker-build=<value>`
116
117 A configuration argument to be passed to the Docker build command for the app image. For example, to provide an additional build argument to the Dockerfile, specify `--Xdocker-build=--build-arg=ARG=value`. See [the Docker build documentation](https://docs.docker.com/reference/cli/docker/buildx/build/#options) for details on the full list of options that can be provided.
118
119 You may specify multiple `--Xdocker-build` arguments; each one specifies a single argument to pass to Docker, in the order they are specified.
120
121 ## Application configuration
122
123 The following options can be added to the `tool.briefcase.app.<appname>.linux.system` section of your `pyproject.toml` file; if defined in this section, the values will apply for *all* Linux distributions for which you build packages.
124
125 If you need to override these settings for a specific target vendor, or for a specific distribution version, you can provide increasingly specific sections for vendor and version information. Each distribution is identified by:
126
127 - Vendor base (e.g., `debian`, `rhel`, `arch`, `suse`)
128 - Vendor (e.g, `debian`, `ubuntu`, `rhel`, `fedora`, `opensuse-tumbleweed`, `arch`, `manjaro`). The vendor identifier *may* be the same as the vendor base (e.g, in the case of Debian, Red Hat, or Arch)
129 - Code name (e.g., a version number, or `jammy`).
130
131 For example, a full configuration for `myapp` running on Ubuntu 22.04 (jammy) would consist of the following sections:
132
133 - `tool.briefcase.app.myapp` providing global configuration options
134 - `tool.briefcase.app.myapp.linux` providing definitions common to *all* Linux packaging backends
135 - `tool.briefcase.app.myapp.linux.system` providing definitions for all Linux system package targets
136 - `tool.briefcase.app.myapp.linux.system.debian` providing definitions common to all Debian-based packaging targets
137 - `tool.briefcase.app.myapp.linux.system.ubuntu` providing definitions common to all Ubuntu-based packaging targets
138 - `tool.briefcase.app.myapp.linux.system.ubuntu.jammy` providing definitions specific to for Ubuntu 22.04 (Jammy).
139
140 These configurations will be merged at runtime; any version-specific definitions will override the generic vendor definitions; any vendor definitions will override the vendor-base definitions; and any vendor-base definitions will override generic system package definitions.
141
142 ### `system_requires`
143
144 A list of operating system packages that must be installed for the system package build to succeed. If a Docker build is requested, this list will be passed to the Docker context when building the container for the app build. These entries should be the format the target Linux distribution will accept. For example, if you're using a Debian-derived distribution, you might use:
145
146 ```python
147 system_requires = ["libgirepository1.0-dev", "libcairo2-dev"]
148 ```
149
150 to make the GTK GI and Cairo operating system development packages available to your app. However, if you're on a RedHat-derived distribution, you would use:
151
152 ```python
153 system_requires = ["gobject-introspection-devel", "python3-cairo-devel"]
154 ```
155
156 If you see errors during `briefcase build` of the form:
157
158 ```python
159 Could not find dependency: libSomething.so.1
160 ```
161
162 but the app works under `briefcase dev`, the problem may be an incomplete [`system_requires`][] definition. The `briefcase build` process generates a new environment that is completely isolated from your development environment, so if your app has any operating system dependencies, they *must* be listed in your [`system_requires`][] definition.
163
164 [`system_requires`][] are the packages required at *build* time. To specify *runtime* system requirements, use the [`system_runtime_requires`][] setting.
165
166 ### `system_runtime_requires`
167
168 A list of system packages that your app requires at *runtime*. These will be closely related to the [`system_requires`][] setting, but will likely be different; most notably, you will probably need `-dev` packages at build time, but non `-dev` packages at runtime.
169
170 [`system_runtime_requires`][] should be specified as system package requirements; they can optionally include version pins. Briefcase will automatically include the dependencies needed for Python. For example:
171
172 ```python
173 system_runtime_requires = ["libgtk-3-0 (>=3.14)", "libwebkit2gtk-4.1-0"]
174 ```
175
176 will specify that your app needs Python 3, a version of `libgtk >= 3.14`, and any version of `libwebkit2gtk`.
177
178 Any problems with installing or running your system package likely indicate an issue with your [`system_runtime_requires`][] definition.
179
180 ### `system_section`
181
182 When an application is published as a `.deb` file, Debian requires that you specify a "section", describing a classification of the application area. The template will provide a default section of `utils`; if you want to override that default, you can specify a value for [`system_section`][]. For details on the allowed values for [`system_section`][], refer to the [Debian Policy Manual](https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-section).
183
184 ### `dockerfile_extra_content`
185
186 Any additional Docker instructions that are required to configure the container used to build your Python app. For example, any dependencies that cannot be configured with `apt-get` could be installed. [`dockerfile_extra_content`][] is string literal that will be added verbatim to the end of the project Dockerfile.
187
188 Any Dockerfile instructions added by [`dockerfile_extra_content`][] will be executed as the `brutus` user, rather than the `root` user. If you need to perform container setup operations as `root`, switch the container's user to `root`, perform whatever operations are required, then switch back to the `brutus` user - e.g.:
189
190 ```python
191 dockerfile_extra_content = """
192 RUN <first command run as brutus>
193
194 USER root
195 RUN <second command run as root>
196
197 USER brutus
198 """
199
200 ```
201
202 ## Platform quirks
203
204 ### Local path references and Docker builds
205
206 Docker builds are not able to reference local paths in the [`requires`][] and [`requirement_installer_args`][] configurations. This is because the Docker container only has access to specific file paths on the host system. See [issue \#2018](https://github.com/beeware/briefcase/issues/2081) for more discussion of the problem, and some possible workarounds.