Commit graph

832 commits

Author SHA1 Message Date
Eberhard Beilharz
2c8f878f1d
chore(linux): add verification for source tarball and source package
This change adds a new GitHub action that verifies that Keyman can build
from the source package. Also check that source package used for Launchpad
and Debian/Ubuntu packaging doesn't produce lintian errors. Previously
lintian errors did go unnoticed because they didn't stop the build.

Also refactor `launchpad.sh` script to be a proper builder script, and add
some new parameters to allow skipping some steps in the script.

Build-bot: skip
Test-bot: skip
2026-05-06 19:03:12 +02:00
Eberhard Beilharz
76866b275b
feat(linux): address code review comments
- add date to header and filename
- add state of ibus
- add privacy statement and link to privacy policy
2026-02-26 17:04:49 +01:00
Eberhard Beilharz
cb1de97ae7
feat(linux): implement diagnostic report
This change allows to collect data for a diagnostic report. This can be
done either from the command line through the new `km-diag-report` tool,
or in `km-config` from the new `Support` tab that allows to generate the
report and then copy it to the clipboard or save as a file.

The diagnostic report contains installed browsers and their versions and
installation methods as well as the default browser. It checks for
browsers installed through apt (Ubuntu/Debian), snap, and flatpak.

The change also has an implementation for pacman (Arch Linux) and
dnf/yum (Fedora), although these have not been tested.

Fixes: #7784
2026-02-13 17:29:22 +01:00
Eberhard Beilharz
c6e7337475
refactor(linux): make get_ibus_version() public 2026-02-12 16:49:32 +01:00
Eberhard Beilharz
7941b3d4a1
fix(linux): check for existing file before trying to install
Under some circumstances it's possible that the user manages to select
a directory instead of a kmp file, or manually enters a non-existing file.
Is used to throw an error that we caught on Sentry; the user was able to
continue to use the app. This change now checks for a valid file before
trying to install the kmp file.

Fixes: #15572
Fixes: KEYMAN-LINUX-99
2026-02-09 16:04:24 +01:00
Darcy Wong
356ef54c86 chore(common): Update Crowdin strings for de 2026-01-29 16:38:12 +07:00
Darcy Wong
665e82a104 chore(common): Update Crowdin strings for Italian 2026-01-13 09:37:15 +07:00
Darcy Wong
e6b8f46ae1 chore(linux): Update keyman-config.pot strings
Output of
```
cd linux/keyman-config
make update-template
```
2025-12-18 09:47:37 +07:00
Eberhard Beilharz
9d2b17613c
chore(linux): add manual test for localization
This change adds a manual test that allows to see if all strings are
localizable. It also fixes the `update-template` target in the
`Makefile`.

Build-bot: skip
Test-bot: skip
2025-12-15 19:05:58 +01:00
Eberhard Beilharz
e77d2432ef
Merge pull request #14973 from keymanapp/chore/linux/14957_parseversion
chore(linux): replace deprecated `parse_version`

`pkg_resources` which contains `parse_version` is deprecated. Latest versions output a warning. This change uses the suggested replacement, `package.version.parse` which is available in all supported Ubuntu versions.

Fixes: #14957
2025-10-17 09:15:18 +02:00
Eberhard Beilharz
917c6c20a1
Merge pull request #14971 from keymanapp/fix/linux/10178_exitibus
fix(linux): use `ibus` command to restart ibus

When using Kubuntu exiting ibus sometimes used to hang (#10178). This was because ibus' `bus.exit()` doesn't shutdown properly (see https://github.com/ibus/ibus/issues/2816#issuecomment-3410473708). The recommended way is to use the `ibus exit` command. Since we no longer use the API we can directly use the `ibus restart` command, which this PR implements.

Fixes: #10178
2025-10-17 09:14:46 +02:00
Eberhard Beilharz
ddb9522337
chore(linux): replace deprecated parse_version
`pkg_resources` which contains `parse_version` is deprecated. Latest
versions output a warning. This change uses the suggested replacement,
`package.version.parse` which is available in all supported Ubuntu
versions.

Fixes: #14957
2025-10-16 18:27:57 +02:00
Eberhard Beilharz
be2118aaf2
Merge pull request #14962 from keymanapp/fix/linux/14943_installschema
fix(linux): install schema during `keyman-config/build.sh install`

- improve documentation for installing km-config
- install schema during `keyman-config/build.sh install`
- remove schema during `keyman-config/build.sh uninstall`
- improve two scenarios when running `keyman-config/build.sh install`:
    - on newer Ubuntu versions it's no longer possible to directly install Python packages, so we have to use a virtual environment. This change detects a virtual environment and installs into that.
    - detect if we're running directly as `root` user instead of `sudo` and explicitly install into `/usr/local`.
- remove obsolete targets from Makefile. `make deb` no longer worked, so this change removes it. The other removed targets in the Makefile were just calling `./build.sh` and so are not really necessary and not used.
- update packaging documentation

Fixes: #14943
2025-10-16 17:12:09 +02:00
Eberhard Beilharz
1958cd52bf
fix(linux): use ibus command to restart ibus
When using Kubuntu exiting ibus sometimes used to hang (#10178). This
was because ibus' `bus.exit()` doesn't shutdown properly
(see https://github.com/ibus/ibus/issues/2816#issuecomment-3410473708).
The recommended way is to use the `ibus exit` command. Since we no longer
use the API we can directly use the `ibus restart` command, which this
PR implements.

Fixes: #10178
2025-10-16 16:58:18 +02:00
Eberhard Beilharz
da1371ff4c
fix(linux): remove schema during keyman-config/build.sh uninstall
Part-of: #14943
Test-bot: skip
2025-10-16 16:47:57 +02:00
Eberhard Beilharz
7574d2eb68
Merge pull request #14953 from keymanapp/fix/linux/14911_instshared
fix(linux): fix installing keyboard in shared area 🍲

Installing into the shared area (`/usr/local/share`) requires `root` permissions, so in order to install into the shared area the user has to call `km-package-install` with `sudo`. But we also want to add the keyboard to the user's list of available keyboards so that he can switch to it. That needs to be done in the user context. However, when `sudo` ran the command in the user context, the environment variables to connect to the user's session dbus were not set.

This change fixes this by passing `DBUS_SESSION_BUS_ADDRESS` along with the `sudo -u <user>` call. Since `root` doesn't have this variable set (or at least not pointing to the user's dbus), we construct the dbus address based on the user's uid.

On newer Ubuntu versions (>=25.04) we also have to set `XDG_RUNTIME_DIR`, at least when running the autopkgtests.

Fixes: #14911
2025-10-16 15:33:34 +02:00
Eberhard Beilharz
7da6a4e98c
Apply suggestions from code review
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-10-16 15:17:35 +02:00
Eberhard Beilharz
58875a5680
fix(linux): refactor common strings
Also some other minor changes to address code review comments.
2025-10-16 12:33:56 +02:00
Eberhard Beilharz
be62a31a25
Merge pull request #14938 from keymanapp/chore/linux/sentryautopkgtests
chore(linux): don't report errors to Sentry when running autopkgtests 🍲
2025-10-16 12:11:09 +02:00
Eberhard Beilharz
b5535ff4c0
Merge pull request #14956 from keymanapp/refactor/linux/removeoldcode
refactor(linux): remove no-longer-needed Python 3.7 code

Our oldest supported Ubuntu version is 22.04 which comes with Python 3.10, so we can remove the code for Python 3.7.
2025-10-16 11:36:50 +02:00
Eberhard Beilharz
f9a41473c0
chore(linux): remove obsolete targets from Makefile
`make deb` no longer worked, so this change removes it. The other targets
were just calling `./build.sh` and so are not really necessary and not
used.
2025-10-15 11:57:02 +02:00
Eberhard Beilharz
211f05afe3
fix(linux): improve local installation
This improves two scenarios when running `keyman-config/build.sh install`:
- on newer Ubuntu versions it's no longer possible to directly install
  Python packages, so we have to use a virtual environment. This change
  detects a virtual environment and installs into that.
- detect if we're running directly as `root` user instead of `sudo`
  and explicitly install into `/usr/local`.

Test-bot: skip
2025-10-15 11:57:02 +02:00
Eberhard Beilharz
d3abb26bca
fix(linux): install schema during keyman-config/build.sh install
Also improve detection when running with root permissions.

Fixes: #14943
Test-bot: skip
2025-10-15 11:57:01 +02:00
Eberhard Beilharz
d1fa884266
refactor(linux): remove no-longer-needed code
Our oldest supported Ubuntu version is 22.04 which comes with Python 3.10,
so we can remove the code for Python 3.7.

Test-bot: skip
2025-10-14 18:03:57 +02:00
Eberhard Beilharz
b7d5e89577
fix(linux): fix installing keyboard in shared area
Installing into the shared area (`/usr/local/share`) requires `root`
permissions, so in order to install into the shared area the user has
to call `km-package-install` with `sudo`. But we also want to add the
keyboard to the user's list of available keyboards so that he can
switch to it. That needs to be done in the user context. However,
when `sudo` ran the command in the user context, the environment
variables to connect to the user's session dbus were not set.

This change fixes this by passing `DBUS_SESSION_BUS_ADDRESS` along
with the `sudo -u <user>` call. Since `root` doesn't have this variable
set (or at least not pointing to the user's dbus), we construct the
dbus address based on the user's uid.

On newer Ubuntu versions (>=25.04) we also have to set `XDG_RUNTIME_DIR`,
at least when running the autopkgtests.

Fixes: #14911
2025-10-14 17:54:36 +02:00
Eberhard Beilharz
3690fec1f2
fix(linux): don't cache files when running with sudo
When running `km-package-install` with `sudo`, cache files owned by
root get created in the users directory. This makes it harder to
replace, and if the user tries to install the keyboard again under his
user account, installation will fail. This change prevents the use
of the cache when running with `sudo`.

Test-bot: skip
2025-10-14 09:55:47 +02:00
Eberhard Beilharz
eaf0183460
chore(linux): don't report errors to Sentry when running autopkgtests
Test-bot: skip
2025-10-13 18:29:24 +02:00
Eberhard Beilharz
584e9d87aa
refactor(linux): extract functions
Test-bot: skip
2025-10-10 15:50:25 +02:00
Eberhard Beilharz
6ef624e7e6
fix(linux): replace dbus-x11 dependency
When using a different DBus implementation `dbus-launch` might not exist,
but instantiating a `SessionBus` object might start a session dbus if
it's not already running. This change also replaces the `dbus-x11`
dependency with `default-dbus-session-bus | dbus-session-bus` and changes
the way we detect if dbus is already running.

Also remove `DBUS_SESSION_BUS_ADDRESS` from `sudo gsettings` call. It
turns out we don't need this since we execute the `gsettings` command
in the context of the user anyway which connects to the user's session
dbus.

Fixes: #14888
2025-10-07 16:23:49 +02:00
Eberhard Beilharz
596371dde2
feat(linux): improve Sentry error reports
- add breadcrumbs with keyboard details
- add some more information about system
- mark files in `km_config` as to the app belonging
- some refactorings

Test-bot: skip
2025-09-16 18:23:47 +02:00
Eberhard Beilharz
f3643827d1
Merge pull request #14760 from keymanapp/fix/linux/14748_TypeError
Fixes: #14748
Fixes: KEYMAN-LINUX-8Q
2025-09-16 14:33:23 +02:00
Eberhard Beilharz
466fd06665
refactor(linux): remove warning
Using `if var := func():` syntax outputs a warning
`FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.`
in Python 3.12. This change works around this warning.

Test-bot: skip
2025-09-15 16:52:07 +02:00
Eberhard Beilharz
8d9c3ee09b
fix(linux): don't crash on invalid languages in keyboard
Fixes: #14748
Fixes: KEYMAN-LINUX-8Q
2025-09-15 16:37:22 +02:00
Eberhard Beilharz
189ee50e24
fix(linux): don't crash if kmp.json is missing keyboards section
Some keyboards seem to be missing the `keyboards` section in the
`kmp.json` file. This change prevents a crash and instead returns `None`
and thus we don't create a .ldml file and so onboard will show the
default keyboard instead. The alternative would be to create an empty
.ldml file, but that causes onboard to show a keyboard with all key caps
being empty.

Fixes: #14707
Fixes: KEYMAN-LINUX-8P
Test-bot: skip
2025-09-08 18:06:36 +02:00
Eberhard Beilharz
72ea66832d
Merge pull request #14542 from keymanapp/fix/linux/14465_normalizeLanguage
This fixes a bug where a keyboard didn't show up in the language dropdown if the first language it specified wasn't a normalized language tag. Previously in that case we added a custom keyboard with whatever language tag the keyboard specified. With this change we now continue to use the first language of the first keyboard but normalize it. Since the selection of the language now happens a little earlier it is slightly possible that there will be unexpected side effects that didn't show up in my testing.

Fixes: #14465
2025-08-20 14:09:11 +02:00
Eberhard Beilharz
57970724fa
refactor(linux): some code cleanup in bash completion script
Build-bot: skip
Test-bot: skip
2025-08-18 19:54:33 +02:00
Eberhard Beilharz
951793ea84
fix(linux): normalize language tags from keyboard
This fixes a bug where a keyboard didn't show up in the language dropdown
if the first language it specified wasn't a normalized language tag.
Previously in that case we added a custom keyboard with whatever language
tag the keyboard specified. With this change we now continue to use
the first language of the first keyboard but normalize it. Since the
selection of the language now happens a little earlier it is slightly
possible that there will be unexpected side effects that didn't show up
in my testing.

Fixes: #14465
2025-08-18 19:49:38 +02:00
Marc Durdin
f394245636 maint(common): consolidate builder scripts
Clarifies the confusing builder.inc.sh / build-utils.sh distinction by
giving the scripts more appropriate names. Most build scripts should use
builder-full.inc.sh; some helper scripts can use builder-basic.inc.sh.
Documented in resources/build/README.md.

Renames:
* resources/build/builder.inc.sh to resources/build/builder-full.inc.sh
* resources/build/build-utils.sh to resources/build/builder-basic.inc.sh

Other changes:
* Moves Android-specific functions out of builder-basic.inc.sh and into
  android/build.sh.
* Renames functions in builder-basic.inc.sh

More functions may be moved from builder-basic.inc.sh into utils.inc.sh
or other scripts in the future.

Fixes: #14065
Build-bot: build all
Test-bot: skip
2025-08-02 08:11:24 +10:00
Eberhard Beilharz
3d006659f9 chore(linux): clarify that it's a Python test runner
Rename the directory to make it clearer that it's test runner for Python
tests. Addresses code review comments.
2025-06-02 15:20:42 +02:00
Eberhard Beilharz
581e4e03ef chore(linux): add TC test runner
This adds a modified version of JetBrains' TeamCity test runner that
makes use of the `parent` property in the service messages and thus
allows to properly indent and fold the block that contains the test
output.

Test-bot: skip
2025-06-02 15:20:42 +02:00
Eberhard Beilharz
3cb9fe2a65
fix(linux): fix variable replacements
This fixes the version numbers in `km-config` which broke with #13854.
This also fixes opening the download page in `km-config` because that
uses a version number in the URL.

Fixes: #14031
Follow-up-of: #13854
2025-05-22 16:20:18 +02:00
Eberhard Beilharz
fc79e38cc4
maint(linux): fix lintian warnings
This addresses comments from Debian review of the package.
2025-05-13 20:07:32 +02:00
Eberhard Beilharz
4d81589f48
maint(common): use unique names for Keyman version variables
Previously the builder scripts defined a readonly `VERSION` environment
variable for the Keyman version. That caused problems when another
(external) script tried to define a `VERSION` variable. We encountered
this problem when trying to move the TC build steps of a configuration
into a single script (#13399) when we tried to source `~/.nvm/nvm.sh`.

This change uses a Keyman specific prefix for the version variables and
renames `VERSION` → `KEYMAN_VERSION` etc. Unfortunately these variables
are used in a lot of places, so this turned out to be a bit of a yak
shave.

Test-bot: skip
2025-05-07 18:46:51 +02:00
Eberhard Beilharz
d661905c60
Merge pull request #13779 from keymanapp/maint/linux/tcnoble
This change overrides a check added in Ubuntu 24.04+ that prevents mixing Python packages installed through apt and through pip. This allows to install the necessary Python package for TC which isn't available as Debian package. This change allows builds on Ubuntu 24.04 based TC agents.
2025-05-06 14:56:12 +02:00
Eberhard Beilharz
397b5bdf93
maint(linux): streamline use of env variables to detect running on TC
This changes the variable we use to detect if we're running on TC to
be the same as the one used on #13810.
2025-05-06 11:49:59 +02:00
Eberhard Beilharz
cf93da452f
maint(linux): add clarifying comment on why different TEAMCITY variables 2025-05-06 11:46:48 +02:00
Eberhard Beilharz
2ff9e309fa
chore(common): allow to run tests in virtual environment
This changes the shebang at the top of the file to allow use Python
from a virtual environment instead of hard-coding the path. This might
not be strictly necessary, but reduces confusion and doesn't hurt.
2025-04-29 19:20:49 +02:00
Eberhard Beilharz
b7649defd0
chore(common): override check when running on TC
This change overrides a check added in Ubuntu 24.04+ that prevents
mixing Python packages installed through apt and through pip. This
allows to install the necessary Python package for TC which isn't
available as Debian package. This change allows builds on Ubuntu 24.04
based TC agents.
2025-04-29 11:54:33 +02:00
Marc Durdin
4f829f5c8f chore: Merge remote-tracking branch 'origin/master' into chore/merge-beta-to-master-b18s5 2025-04-21 07:13:35 +07:00
Eberhard Beilharz
d1b74d0175
chore(linux): fall back to package id
This change addresses a code review comment. In the case where the kmp
doesn't contain a name, we now use the `packageID` instead.
2025-04-03 15:56:07 +02:00