From 419be4df25bc6fcc1958cb6e44afc1b9e64fce71 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 11:01:30 +0200 Subject: [PATCH 001/160] 3.3: start a new changelog --- CHANGES | 1535 +------------------------------------------------- CHANGES-3.2 | 1544 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1549 insertions(+), 1530 deletions(-) create mode 100644 CHANGES-3.2 diff --git a/CHANGES b/CHANGES index 415424592..d9e8bffc4 100644 --- a/CHANGES +++ b/CHANGES @@ -4,1541 +4,16 @@ This is the changelog for Calamares. For each release, the major changes and contributors are listed. Note that Calamares does not have a historical -changelog -- this log starts with version 3.2.0. The release notes on the -website will have to do for older versions. +changelog -- this log starts with version 3.3.0. See CHANGES-3.2 for +the history of the 3.2 series (2018-05 - 2021-12). -# 3.2.43 (unreleased) # +# 3.3.0 (unreleased) # This release contains contributions from (alphabetically by first name): - - Joe Kamprad + - No external contributors yet ## Core ## - - Translations have been made more consistent. In particular, some *OK*, - *Yes*, *No* and *Cancel* buttons that were previously untranslated - or "stuck" in the language that Calamares started in, are now - changed to the current language as selected in the welcome page. + - No core changes yet ## Modules ## - No module changes yet - - -# 3.2.42 (2021-09-06) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Artem Grinev - - Nico 'dr460nf1r3' (new contributor, welcome!) - - Waneon Kim (new contributor, welcome!) - -## Core ## - - No core changes yet - -## Modules ## - - BTRFS partitions are no longer listed as "check in phase 2" in - the *fstab* module. (Thanks Nico) - - The *keyboard* module (and *keyboardq*) now pick an English layout - (with Rupee) for keyboards when the language is English and locale is India, - rather than Hindi layout. - - The *localeq* module had the i18n.qml rewritten to make it easier - to customize. A bug in the layout has been fixed, and the overall - look has been updated. - - *networkcfg* now translates the "live user" on an ISO to the regular - user on the installed system, so that network configuration changes - made in the live system are automatically used after installation. #1755 - - *partition* no longer allows you to delete an extended partition with - children (which led to crashes). #1749 (Thanks Artem) - - *partition* complains in more detail about the state of the UEFI - boot partition (under manual partitioning schemes). #1761 - - *welcome* can now check multiple URLs to determine if internet connectivity - is available. It is still recommended to check the distro home-page or - some special "ping" page of the distro, although that has some privacy - implications; using example.com or google.com may work as well. Listing - multiple URLs will ping each of them in turn until one succeeds. #1669 - - The work to make a QML version available for all view modules is almost - completed. Two new QML modules have been added *packagechooserq* and *summaryq*. - Summaryq brings the option to present the summary page in a customizable - way, with a bit more of a contemporary look. Packagechooserq adds the option - to preselect an item and displays all options in one overview. - (Thanks Anke) - - -# 3.2.41.1 (2021-08-05) # - -This is a hotfix release for a crash in the *partition* module, reported on -KDE neon. #1746 - - -# 3.2.41 (2021-07-31) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Camilo Higuita - -## Core ## - - The (re)translation framework has been internally re-vamped to be - less resource-intensive and to work with all QObjects, not just - widgets. Consumers of the translations framework are expected to - set up the event filter on the top-level widget(s) manually. Since - Calamares and the Calamares-test-applications have been adjusted already, - no further action is needed. - -## Modules ## - - When the *keyboard* module is activated, it no longer replaces - an explicit user choice (e.g. for a Belgian layout) by a guessed-for- - this-language layout (e.g. Danish if you're installing in Danish). - - Logic for handling installation lists has been moved around in the - *packages* module so that package managers can, in principle, - adjust how to handle critical and non-critical package lists. - - In the *partition* module, translation code has been simplified. - - The *usersq* module has had a fair bit of QML rewritten to make it easier - to customize the colors used by the module in a consistent way. - (Thanks Anke) - - *Welcome* now uses a translated message from the Config object, - increasing the sharing between widgets- and QML-modules. - - -# 3.2.40 (2021-07-14) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Anubhav Choudhary (SoK success!) - - Emmanuel Arias (new contributor! welcome!) - - Erik Dubois - - Jerrod Frost (new contributor! welcome!) - - Jia Chao (new contributor! welcome!) - - Joe Kamprad - - Lisa Vitolo (blast from the past!) - - Omer I.S. (new contributor! welcome!) - -In project news, chat (instant-messaging) communications has largely -moved to Matrix and Libera.Chat. CI notifications -- issues and build -results -- are sent to Matrix only. - -## Core ## - - The CMake modules for consumption by external modules (e.g. the - calamares-extensions repository, but also any other modules built - by distro's for internal use) now support consistent skip-module - behavior and reporting. #1641 (one tiny part of this change) - - In global storage, the *filesystem_use* key now has an API in - libcalamares to systematically mark filesystem (types) as "in use" - or not. This, in turn, means that modules can depend on that information - for other work (e.g. removing drivers for unused filesystems). #1635 - - The "upload log file" now has a configurable log-file-size. (Thanks Anubhav) - -## Modules ## - - *bootloader* can now install an aarch64 (ARM) compatible EFI GRUB. (Thanks Jia) - - *displaymanager* example configuration has been shuffled around a bit, - for better results when the live image is running XFCE. Also lists - more potential display managers. #1205 (Thanks Erik) - - *keyboard* now switches on an alternate `en_US` keyboard layout when - Arabic or Hebrew is selected as primary layout. (Thanks Omer) - - *localeq* now has a fully functional offline option (alongside the default - interactive map option, which requires internet). - - The *netinstall* module can now fall back to alternative URLs when - loading groups data. The first URL to yield a non-empty groups - collection is accepted. No changes are needed in the configuration. #1673 - - *packagechooser* can now integrate with the *packages* module; that - means you can specify package names to install for a given selection, - and the regular package-installation mechanism will take care of it. - Legacy configurations that use *contextualprocess* are still supported. - See the `packagechooser.conf` file for details. #1550 - - A long-neglected pull request from Lisa Vitolo for the *partition* - module -- allowing to set filesystem labels during manual partitioning -- - has been revived and merged. - - The *partition* manager has had a long-standing bug with partition-flags - and manual partitioning resolved. This may help resolve some installation - issues on UEFI systems. #1724 - - *usersq* is further implemented and can now be used for a successful install. - Not all warning messages available in the regular users module are implemented. - - -# 3.2.39.3 (2021-04-14) # - -A minor bugfix tweak release. Since this contains yet **another** -autologin-related fix, and there is nothing large enough to justify -a 3.2.40 release yet, add it to the growing tail of 3.2.39. (Reported -by Joe Kamprad, #1672). Also fixes a regression from 3.2.28 in -localized packages (e.g. *package-LOCALE* did not work). - - -# 3.2.39.2 (2021-04-02) # - -This is **another** hotfix release for issues around autologin .. -autoLogin, really, since the whole problem is that internal capitalization -changed. An unrelated bug in writing /etc/default/keyboard was -also fixed. (Reported by pcrepix, #1668) - - -# 3.2.39.1 (2021-03-30) # - -This hotfix release corrects a regression in the *displaymanager* -module caused by changes in the *users* module; autologin was -internally renamed and no longer recognized by the *displaymanager* -module. (Reported by Erik Dubois, #1665) - - -# 3.2.39 (2021-03-19) # - -This release contains contributions from (alphabetically by first name): - - Matti Hyttinen - -## Core ## - - A *packages* service has been added to the core, for use by - *netinstall* module and any others that need to set up - package information for the *packages* module. - -## Modules ## - - The *mount* module has gained a configurable setup for btrfs volumes. - If your distro has a default-to-btrfs setup, it can skip the hard- - coded setup (which Calamares has had for a long time with @home - and similar) and introduce a custom btrfs configuration through the - `mount.conf` file. See issues #1659 and #1661 for warnings about - using this in production. - - *netinstall* now supports fallbacks for the groups data. - Instead of a single URL, multiple URLs may be specified in - a list and Calamares goes through them until one is successfully - retrieved. Older configurations with a single string are - treated like a one-item list. #1579 - - The *usersq* module now connects to the internal configuration - object and may be usable for regular installations. - - -# 3.2.38.1 (2021-03-15) # - -This hotfix release is for this item in the release notes of 3.2.38: - - The .desktop file for Calamares now makes a longer trip, calling - `sh -c "pkexec calamares"`; distributions may still need to adjust. -The change had been lost while updating other files. It has been restored -in `calamares.desktop` and `calamares.desktop.in`. (Reported by Erik) -Other minor changes and fixes: - - presets in the *users* module show the hostname, too, - - translations update for Korean, Ukranian and Chinese (zh_TW). - - -# 3.2.38 (2021-03-14) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Anubhav Choudhary - - Neal Gompa - -## Core ## - - Uploading your log files (in case of installation failure) has been - expanded and is now more configurable. Users should still take care - when uploading logs, and distro's should configure a URL with - no public viewing of those logs. (Thanks Anubhav) - - The .desktop file for Calamares now makes a longer trip, calling - `sh -c "pkexec calamares"`; distributions may still need to adjust. - -## Modules ## - - A new QML-based *finishedq* module has been added. (Thanks Anke) - - The *packages* module no longer supports *urpmi*; no Calamares- - consumers with that package manager seem to exist. (Thanks Neal) - - The *users* module now can set a fixed username and prevent editing. - The *presets* configuration entry in `users.conf` can set a *loginName* - and a *fullName* and (independently) enable or disable editing of - that value. You can, for instance, set *loginName* to "manjaro" if - you like; the user can change it afterwards. You could set the - *loginName* to "oem" and prevent editing it as well. #942 - - -# 3.2.37 (2021-02-23) # - -This release contains contributions from (alphabetically by first name): - - benne-dee - -## Core ## - - Calamares has a table of 'best guess' languages for each country - and when GeoIP is enabled, it will automatically select that - country's language as default -- the user can of course pick - a different one. The 'best guess' is based on Unicode / ISO - data, which is sometimes dubious. Based on some personal notes, - the 'best guess' language for Belarus has been changed to Russian. - - Calamares has a table of 'best guess' keyboard mappings, - allowing native language input. However, usernames and - passwords should be in US-ASCII (this is a limitation of - the login system -- **some** parts of the system will support - non-ASCII input, but it's better safe than sorry). - Add Greek to the list of languages that needs US-ASCII - in addition to native input. - - The CI infrastructure now builds Calamares and Calamares-extensions - on a nightly basis. - -## Modules ## - - The *netinstall* module has a YAML schema, allowing packagers - to validate and verify their netinstall configurations before - shipping an ISO (or writing bug reports). Thanks benne-dee. - - The *finished* module has been heavily refactored, opening - the way to a QML-based version of the same module. This is - also preparatory work for allowing packagers (e.g. PostmarketOS) - to customize the messages on the finished page. - - -# 3.2.36 (2021-02-03) # - -This release contains contributions from (alphabetically by first name): - - Anubhav Choudhary - - benne-dee - - Gaël PORTAY - - Jonas Strassel - - Kevin Kofler - - Matti Hyttinen - - Neal Gompa - -## Core ## - - It is now possible to hide the *next* and *back* buttons during - the "exec" phase of installation. Thanks Anubhav. - - The Calamares CI has migrated to GitHub actions. Thanks Jonas. - -## Modules ## - - *bootloader* now uses the current file names for the UEFI Secure Boot - shim instead of obsolete ones. - - The *mount* module creates swap in its own subvolume, if btrfs is used. - Thanks Matti. - - *partition* includes more information about what it will do, including - GPT partition types (in human-readable format, if possible). Thanks Gaël. - - Some edge-cases with overlay filesystems have been resolved in the - *partition* module. Thanks Gaël. - - During the creation of filesystems and partitions, automounting is - turned off (if DBus is available, and the host system supports - KDE Solid automount control). This should reduce the number of - failed installations if automount grabs partitions while they are - being created. The code is prepared to handle other ways to control - automount-behavior as well. - - -# 3.2.35.1 (2020-12-07) # - -This release contains contributions from (alphabetically by first name): - - Anubhav Choudhary - - Matti Hyttinen - -Some strange string artifacts appeared, leading to `{1?}` being -displayed in various user-facing messages. These have been removed -and the translations updated. - -## Modules ## - - The *initcpiocfg* module would sometimes configure the system to ask - for a passphrase, when none is needed. - - -# 3.2.35 (2020-11-30) # - -This release contains contributions from (alphabetically by first name): - - Clarissa Borges - - Matti Hyttinen - -A new kind of issue template has been added for Calamares, -for reporting (and adding tests for) usability issues. Thanks -to Clarissa for leading that effort. - -## Core ## - - No core changes yet - -## Modules ## - - The *partition* module now supports a not-full-disk-encryption setup, - where `/boot` is not encrypted, but the rest of the system is. - - The *plasmalnf* module has been substantially rewritten, so that it - can support a QML version of the module in future. The UI has changed - a little, and now displays more themes than before. - - -# 3.2.34 (2020-11-16) # - -This release contains contributions from (alphabetically by first name): - - Artem Grinev - - Gaël PORTAY - -## Core ## - - No core changes yet - -## Modules ## - - The *keyboard* module had a regression in which it no-longer painted - the keycaps in the keyboard preview. (reported by Vinnie) - - The *plasmalnf* module did not set all of the look-and-feel values - in the target system. (reported by Bluestar Linux) - - In the *users* module, warnings about the strength of the password - are now correctly pluralized when possible. - - In the *users* module, if ICU is installed, the user's full name is - automatically transliterated to US-ASCII (for some locales; this will - need tweaking) so that the login name is acceptable. (Thanks Artem) - - -# 3.2.33 (2020-11-09) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Andrius Štikonas - - Artem Grinev - - Gaël PORTAY - - Matti Hyttinen - - TTran Me - -## Core ## - - Calamares now sets the C++ standard for compilation to C++17; this - is for better compatibility and fewer warnings when building with - modern KDE Frameworks and KPMcore 4.2.0. - - Vietnamese translations have been added. Welcome! (Thanks TTran) - -## Modules ## - - The *initcpiocfg* module should support plymouth with encryption - now. (Thanks Matti) - - The *keyboard* and *keyboardq* modules now share backend code - and handle non-ASCII layouts better (for setting passwords - and usernames). (Thanks Artem) - - Various cleanups and documentation improvements in the *partition* - module, and configurable GPT name for swap. (Thanks Gaël) - - A long-standing bug related to GPT partition flags in the - *partition* module has been resolved. #1327 #1267 - - The *users* module now has a more detailed way to specify - user groups -- which may be system groups rather than user-GIDs. - A new option in each group can require that the group already - exists in the target system, allowing for better consistency checks - with the squashfs. #1523 - - -# 3.2.32.1 (2020-10-17) # - -This is a release to address source-incompatible changes in KPMcore 4.2.0, -which was released just before Calamares 3.2.32 and had not yet been -compile-tested. There is also one changed message in the translations, -reported by Yuri Chornoivan. - - -# 3.2.32 (2020-10-16) # - -This release contains contributions from (alphabetically by first name): - - Fabian Tomat - - Gaël PORTAY - -## Core ## - - When doing GeoIP lookups, Calamares pretends to be Firefox. - This resolves an issue where the GeoIP provider was refusing - QNAM connections with the default User-Agent. - - New translation available, Friulian. Welcome! - -## Modules ## - - The *netinstall* module has some tricky configuration files; - it now complains about more cases of bad syntax or poor structure. - - The *partition* module can now be constrained to work only with - a particular kind of partition table. (thanks Gaël) - - The *partition* module is a little more resilient to variations - in btrfs notation from os-prober. - - The *shellprocess* module now supports having a different progress - message (other than "Shell Processes Job") through the config file. - - - # 3.2.31 (2020-10-06) # - -This release contains contributions from (alphabetically by first name): - - Corentin Noël - - kadler15 (new contributor! hi!) - -## Core ## - - At the start of the *exec* phase, an overview is given of the - various job weights, which allows you to tweak the overall - progress reporting during the installation. - - Problems with running Calamares on a 1-core single CPU have been resolved. - -## Modules ## - - The *keyboard* module now recognizes Turkish "F" layout and - will set the vconsole keyboard layout correctly even if xkb - keymaps are not found. - - The *machineid* module, which generates UUIDs for systemd and dbus - and can generate entropy files (filled from `/dev/urandom` in the host - system) now supports more than one entropy file; generate them as needed - (or copy a fixed value to all, depending on *entropy-copy*). Deprecate - *entropy* (which generates a specific output file) as too inflexible. - - In the *partition* module, swap can now be chosen as *file*, which is - **not** create a swap partition, but write a `/swapfile` in the root - directory, 512MiB large, and set that as swap. There is as yet no - "smarts" about the size of the swap file. - - Multiple problems in the *partition* module around partition - sizing have been resolved by Corentin Noël. - - The *preservefiles* module documentation did not match the functionality, - and when used, didn't work right. #1521 (thanks kadler15) - - Progress reporting from the *unpackfs* module has been revamped: - it reports more often now, so that it is more obvious that files - are being transferred even when the percentage progress does not - change. - - The *unpackfs* module now supports a *weight* setting for each - of the unpack entries. For a single entry this does not matter, - but if there are multiple entries it allows tweaking the relative - progress between each entry. - - -# 3.2.30 (2020-09-03) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Asif Mahmud Shimon - - Manzoor Ahmed Munawar - - Sai Kamal - - Victor Ibragimov - -This release has two giant source-code changes that have no effect -on functionality, but do touch each and every source file: - - SPDX headers for licensing information, following the standard - set by REUSE.software ; all source files and resources have - SPDX-License-Identifier information and copyright notices. All - of the boilerplate texts have been removed. - - Calamares coding style has been mechanically applied to the entire - codebase. This was already done to most of it, but there were - some hold-outs. - -## Core ## - - Network access status is deprecated in Qt 5.15's QNetworkAccessManager, - and was not useful already in some previous versions. Replace its - use in the Calamares network service by testing-it-ourself directly - via a synchronous ping. (Thanks to Asif) - - New Telugu translation. (Thanks to Sai) - - Urdu translation started. (Thanks to Manzoor) - - Timezones translated in Tajik and Russian. (Thanks to Victor) - -## Modules ## - - *keyboardq* and *localeq* improvements. (Thanks to Anke) - - *users* module did not set up autologin properly. This is yet another - regression left over from 3.2.28. (Reported by Phil and pcrepix, #1498) - - *welcome* module now sets the *LANG* key in the locale configuration - (which is shared with the *locale* module and consumed by the - *localecfg* module). This makes it feasible to drop the *locale* - module and still set the installed system's language to the language - selected in Calamares. (Reported by FerenOS) - - -# 3.2.29 (2020-08-20) # - -This release contains contributions from (alphabetically by first name): - - Asif Mahmud Shimon (new contributor! hi!) - -## Core ## - - Edge case in extracting string-lists from YAML, reported and fixed - by Asif (#1491). - - Progress reporting is now more flexible. Modules can have a weight - assigned to them in the descriptor; module instances can have a weight - assigned which overrides the module descriptor. When jobs are run - for a module instance, the jobs report progress pro-rated by the - module's weight. Or in other words, it is now possible to tweak - the amount of the overall progress bar that different modules fill. - The default settings give unpackfs a weight of 12. (#1176) - -## Modules ## - - The *users* module did not read the *defaultGroups* correctly. - Fixed by the string-lists change mentioned above. - - - # 3.2.28.3 (2020-08-18) # - -Another hotfix, for more issues reported by Marco Obaid. Users -were not having a password set (#1489) - - -# 3.2.28.2 (2020-08-12) # - -A second hotfix, for autologin support -- the autologin group was not -created in the target system before assigning the user to it. Reported -by Marco Obaid. - - -# 3.2.28.1 (2020-08-10) # - -This is a hotfix release for #1482 and #1483, where no user was -created during installation and a chmod was failing (resulting in -a failed installation). Reported by Jonathan Riddell. - -With incidental improvements in SPDX tagging (code licensing) -and some new icon options for the welcomeq and localeq modules. - - -# 3.2.28 (2020-08-09) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - apt-ghetto - - Victor Ibragimov - -## Core ## - - A new object *Network* is available to QML modules in `io.calamares.core`. - It exposes network status through the *hasInternet* property. - - Welcome to Tajik translations. The Tajik language has quickly reached - 100% completion. Thanks Victor! - - Welcome to [Interlingue](https://en.wikipedia.org/wiki/Interlingue). - The translation is at an early stage. Qt does not support language - code *ie* though, so it may take some time to be integrated (much - like Esperanto wasn't supported until Qt 5.12). - -## Modules ## - - The *locale* module has been completely redone on the inside. - Users should see no changes. #1391 - - The *localeq* module uses the redone internals of the locale module. - It can now be used to set timezone, language and locale information - and is a suitable alternative module. Thanks to Anke Boersma who did - the work of figuring out maps. Note that the map uses several GeoIP - and GeoData providers and you may need to configure the URLs - with suitable usernames for those services. #1426 - - Both *locale* and *localeq* can now be configured to use the system's - timezone setting -- this can be useful to avoid both hard-coding an - initial zone and doing extra GeoIP lookups, in the case where the - live system already does so. #1391 - - The *locale* and *localeq* modules have additional machinery for - timezone lookups; please report cases where clicking on the map - returns an obviously bogus timezone (up until this release, for - instance, Cape Town). - - The *users* module no longer accepts `root` as a username. #1462 - - The *keyboardq* module is now more inline with the look of the rest - of the Calamares modules, use of a background image is removed. - - The *grubcfg* module now understands `/etc/default/grub.d`. #1457 - - -# 3.2.27 (2020-07-11) # - -This release contains contributions from (alphabetically by first name): - - Gaël PORTAY - - Vitor Lopes (new! welcome!) - -## Core ## - - QML modules with no surrounding navigation -- this is basically a - special case for full-screen Calamares -- now have margins suitable - for full-screen use. - - PythonQt modules are increasingly on the way out. - -## Modules ## - - The Manjaro package manager *pamac* has been added to those supported by - the *packages* module. - - The *netinstall* module has had some minor UI tweaks. - - Partitioning now tries harder to avoid floppy drives. - - -# 3.2.26.1 (2020-06-23) # - -This is a hotfix release for undefined behavior caused by an -uninitialized integer variable. It includes new translations -and features as well since those arrived independently. - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Gaël PORTAY - -## Core ## - - Welcome to Azerbaijani translations. These are available - in two variations, *Azerbaijani* and *Azerbaijani (Azerbaijan)*. - [Wikipedia Azerbaijani](https://en.wikipedia.org/wiki/Azerbaijani_language#North_vs._South_Azerbaijani) - has a nice overview. - - Warnings while building with Qt 5.15 have been much reduced. - -## Modules ## - - *partitioning* has one case of undefined behavior (UB) due - to a missing integer-initialization. (Thanks Gaël) - - *keyboardq* QML module now works correctly. (Thanks Anke) - - -# 3.2.26 (2020-06-18) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Gaël PORTAY - - Pablo Ovelleiro Corral - - Philip Müller - -## Core ## - - The default branch for Calamares source repositories (calamares - and calamares-extensions) is now *calamares*. - - External modules can now be built again, outside of the Calamares - source and build-tree. - - The repository *calamares-tools* has been removed. The idea behind - the tooling was to provide schema validation for Calamares configuration - files. This has been merged into the primary repository, where it - is now part of the test suite. - -## Modules ## - - *locale* put some more places into the correct timezone **visually**; - for instance Norfolk Island gave up UTC+11.5 in 2015 and is now - UTC+11, but Calamares still showed it in a zone separate from UTC+11. - - *localeq* can now properly switch between on & offline mode, - it detects internet status through js. - - *packages* gained support for the Void Linux package manager, - *xbps*. (thanks Pablo) - - *tracking* now supports kuserfeedback configuration. - - *welcomeq* added the GEOIP configuration option, so locale can be - initially set according to IP address. - - -# 3.2.25 (2020-06-06) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Callum Farmer - - FLVAL - - Gaël PORTAY - -## Core ## - - The slideshow in `branding.desc` can be configured with QML (recommended, - as it has been for the past umpteen releases) or with a list of - images (new). - - It is possible to turn off all the new QML code -- navigation, slideshow, - QML-based modules -- with a single `-DWITH_QML=OFF` at CMake time. - This removes QML from Calamares' dependency footprint (but only saves - 200kB in Calamares itself). - - Tests have been extended and now support a tests/CMakeTests.txt file - for fine-tuning tests for Python modules. - - SPDX identifiers are used much more widely and consistently in Calamares. - (thanks Callum) - -## Modules ## - - The QML based *welcomeq* module is now a viable alternative to the - *welcome*(widgets based) module. Using QML files means it no longer - is needed to have pop-up windows for additional information or warnings, - all loads in the Calamares window itself. Additional features include the - option to customize the *About* info and load files like Release Notes - direct into Calamares, QML files added to the branding directory can be used. - - The *welcome* and *locale* modules that do GeoIP lookup can now also - use "fixed" style; this just negates the GeoIP lookup and substitutes a - constant (fixed) value; useful for testing specific locales. - - The *keyboard* module no longer uses *ca_eng* keyboards in Canada by - default, but sticks to the *us* keyboard. #1419 - - -# 3.2.24 (2020-05-11) # - -This release contains contributions from (alphabetically by first name): - - Bill Auger - - Gaël PORTAY - - Luna Jernberg - - Philip Müller - -## Core ## - - There is now a bash-completions script for Calamares; turn on - the (CMake-time) option INSTALL_COMPLETION to get it. (Thanks Gaël) - - The *productWallpaper* setting is documented and works. (Thanks Bill) - - GlobalStorage is available to QML modules as `Global`. - - The height of the navigation bar in QML can be set within the - QML code for the navigation; if not set, try something sensible. - - A regression in the requirements-checker which could block the - installer from proceeding without telling the user **why** it - was blocked, has been resolved. - -## Modules ## - - The *bootloader* module can force a UEFI-based machine to boot into - the newly-installed system. #1394 (Thanks Gaël) - - *partition* Pop-ups about boot flags use the right flag names. #1192 - - -# 3.2.23 (2020-04-17) # - -This release contains contributions from (alphabetically by first name): - - FLVAL - -## Core ## - - Some strange annotations were added to the *About* dialog text in - all the translations, like `{1?}`. These have been removed again. - -## Modules ## - - *locale* module had some errors in timezone data, where clicking - on a city would select a different timezone. Some of these are - now fixed (thanks FLVAL). #1374 - - *netinstall* supports a wider variety of package naming schemes, - and is more flexible in loading a `netinstall.yaml` that is copied from - the example configuration file, *groups* key and all. #1369 - - *users* module logs a full error message from libpwquality if something - is wrong internally. - - -# 3.2.22 (2020-04-08) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Camilo Higuita - -## Core ## - - Both the sidebar (on the left) and the navigation buttons (along the - bottom of the window) can now be configured to use the traditional - *widgets*, to use *qml*, or *hidden* from view (hiding the navigation - is not recommended unless you have a pure-QML UI to run inside - Calamares). The example QML that is compiled into Calamares has - been improved. To use your own QML, put files `calamares-sidebar.qml` - or `calamares-navigation.qml` into the branding directory. - - The sidebar and navigation can now be placed on any side of the - main window. This is probably only useful for QML-based UIs. - See `branding.desc` for details. - -## Modules ## - - The *welcomeq* module has been improved with better layout and - nicer buttons in the example QML form. (Thanks to Anke Boersma) - - The *keyboardq* and *localeq* modules now provide some QML for - configuring these parts, although they are still very primitive. - - *netinstall* has had some minor layout fixes. - - *unpackfs* has much more detailed progress reporting and no - longer jumps around strangely in overall progress. - - *partition* now correctly marks a partition as bootable in BIOS + MBR - installs. #1175 - - -# 3.2.21 (2020-03-27) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Camilo Higuita - - Gabriel Craciunescu - - Gaël PORTAY - -## Core ## - - Python job modules (such as *unpackfs* or *packages*) can now provide - a `pretty_status_message()` function, like the existing `pretty_name()` - function, that is used to update the status during install. #1330 - - QML support-modules and objects are now registered into the io.calamares - namespace. This affects modules using Calamares models inside their - QML UI (at this point, very few). With this release, the necessary - `import` for Calamares parts looks like - > ```import io.calamares.ui 1.0``` - A complete list of objects available from Calamares van be found in the - documentation in `Qml.h`. - - The sidebar (which shows overall progress in the installation) is now - more configurable: the branding key *sidebar* controls it. The sidebar - can be shown as a widget (default, as it has been), hidden, or use a - new QML view which is more easily customised. - - A new `settings.conf` key *quit-at-end* will automatically close - Calamares (by clicking on the *Done* button) when the end of the - sequence is reached. If *finished* is the last module in the sequence, - this will run whatever it is configured for; you can also leave out - the finished page and Calamares will close after the exec parts. - -## Modules ## - - *packages* now reports more details in the installation progress-bar. - - *netinstall* module supports an `expanded` key, which will pre-expand - a group (as if the user had pressed the arrow-button in the tree-view). - This only affects the UI, and only the **outermost** level of groups. - - *netinstall* module now supports a special value for *groupsUrl*. - Setting this to *local* will read the groups directly from the - configuration file. - - *netinstall* groups now support a new key `immutable` which prevents - their check-state from being changed (they are shown, or hidden, - as usual and can be expanded). - - Modules that use QML need a new import line. The QML file for the - module is configured through new keys *qmlSearch* and *qmlFilename* - (previously those were without the `qml` prefix, which invites name - collisions). The full module identifier is also used as a filename, - so that multiple instances of a module can use different QML files. - - *partition* module has a number of new features and settings for - type, UUID, and filesystem characteristics. Thanks to Gaël. - - -# 3.2.20 (2020-02-27) # - -This release contains contributions from (alphabetically by first name): - - Bart Ribbers - -## Core ## - - When logging level is set to 8 (eight), for instance via the `-D8` - logging flag, or the `-d` debug flag, the *Show debug information* - button will appear in the progress view. This helps with debugging - issues where the `-d` flag would be inappropriate. - - Calamares now starts at logging level 1 (warnings and errors to - the console) by default. Previously it (wrongly) started at level 8. - -## Modules ## - - The *partition* module now stores which filesystems are in use in - global storage. - - The *contextualprocess* module now understands "compound variable - names", where a dot (.) is used to index into structured data - stored in global storage. This allows it to use the map stored - by the partition module (but also other things, like looking into - the branding information). - - The *packages* module now understands "apk", the Alpine Linux - package manager. - - -# 3.2.19.1 (2020-02-24) # - -This is a hotfix release for bugs in the *users* module. -Reported by Philip Mueller and Walter Lapchynski. - -## Modules ## - - The *users* module no longer wrote `/etc/hostname` at all. - - The *users* module erroneously shows the root password input fields. - - The *initramfs* module sets a resume-hook even when there is no swap. - - The partitioning service expects *udevadm* in `/sbin`, but some - distro's place it elsewhere. - - The mount service didn't unmount directories properly, leading to - blocked installations. - - -# 3.2.19 (2020-02-21) # - -This release contains contributions from (alphabetically by first name): - - Anke Boersma - - Camilo Higuita - - Gabriel Craciunescu - -## Core ## - - *Assamese* translation has been completed. - - Translations are now loaded from more places: instead of **only** - being compiled in to the Calamares executable, they can now be - read from the current directory (when Calamares is run in developer - mode) and from the application data directory.This allows updating the - translations without requiring a recompile: helpful for translators - and possibly for distributions with their own translation style. - See the translators and deployers wiki for details. - - A new `ViewStep` base class, `QmlViewStep`, has been added that loads - a configurable QML file and plays it. This is used by the new *notesqml* - module -- which is in itself a minimal wrapper around the same that - adds only a translatable module name. - -## Modules ## - - The *machineid* and *users* modules now prefer high-quality random - data from `/dev/urandom` rather than pseudo-random data. #1254 - - A new *notesqml* module supports loading QML. This can be used for - "fancy" release notes as a QML application, rather than a webview - or text widget. Note that this does not replace the slideshow-during- - installation module. - - The *users* module now has knobs for setting the hostname and writing - the `/etc/hosts` file. The new configuration options are documented - in `users.conf`. #1140 - - Multiple *netinstall* modules can exist side-by-side, and they each - control the package installation for their part of the package list. - Previously, a netinstall module would overwrite all of the package - configuration done by other netinstall modules. Translations can be - provided in the configuration file, `netinstall.conf`. #1303 - - The *fstab* module no longer "claims" all the swap partitions it finds - on disk. It only uses swap specified for the current installation. - This means that "replace" and "alongside" installations will have - no swap configured in the target system. - - -# 3.2.18 (2020-01-28) # - -This release contains contributions from (alphabetically by first name): - - Bill Auger - -## Core ## - - *Assamese* translation has been added (still in preliminary state). - - Timezone support code has migrated into the core of Calamares. This - means that modules now have easier access to timezone information. - Translations for timezones have also been enabled, so it is **possible** - at least to translate the displayed zones in the *locale* module. - - Branding can now specify whether to (try to) display the Calamares window - in the middle of the desktop or not. The *windowPlacement* key in - `branding.desc` specifies *center* or *free* placement. - -## Modules ## - - All modules can now set a new key in `module.desc` called *noconfig*. - If this key is set to `true` (the default is `false), no configuration - file is searched-for or loaded, and no warning is printed if the - configuration is missing. This should tidy up some unnecessary warnings - on startup. #1302 #1301 - - The *license* module has seen a significant change to its looks. - Actions are now labeled more clearly, and the URL (or filename) - for each license is displayed. - - The *locale* module now supports translations for timezone and - location names (e.g. "Berlin" is "Berlijn" in Dutch). - - *Packagechooser* is a little more careful with displaying - default and empty package names. (thanks to Bill Auger) - - The *unpackfs* module now carries a larger weight in the overall - progress of the installation, which should resolve downstream reports - like "progress stops at 24% for a long time". This is currently - hard-coded, but will become configurable in a future release. #1176 - - -# 3.2.17.1 (2019-12-02) # - -This is a hotfix release for a bug in the grubcfg module. -Reported by Philip Mueller and Erik Dubois. - -## Modules ## - - The *grubcfg* module had a typo in it that made installations fail. - - -# 3.2.17 (2019-11-28) # - -This release contains contributions from (alphabetically by first name): - - Bill Auger - -## Core ## - - A translation "string freeze" is now enforced by the release scripts. - -## Modules ## - - A new module, *hostinfo*, places information about the host into - Global Storage. This can support contextualprocess modules that - need that information. - - The password-checks in the *users* module are now ordered consistently. - A new check *nonempty* can be used to explicitly check for a non-empty - password. This was previously hard-coded. If you have no other - password-requirements set (e.g. minimum-length) and rely on - Calamares to filter out empty passwords, add this check. - - The *grubcfg* module has a new configuration setting *keepDistributor* - which prevents replacing the `GRUB_DISTRIBUTION` line when writing - the new configuration. #1201 - - *packagechooser* documentation has been updated. - - *welcome* module now works better with dark themes. - - The *license* module could get into a confused state, now fixed. #1271 - - -# 3.2.16 (2019-11-01) # - -This release contains contributions from (alphabetically by first name): - - Bill Auger - -## Core ## - - Some obscure build scenarios which would lead to bogus module-is- - misconfigured messages on startup have been resolved. - -## Modules ## - - The explanatory messages on the *users* page have moved to tooltips, - and placeholder text has been added to the fields. #1202 - - The bad-password messages in the *users* page have been improved. #1261 - - Password-checking in the *users* module has been substantially - changed. A new key *allowWeakPasswords* can be used to introduce - an additional checkbox to the page, which can then be used to - switch off strict password checking. (Thanks to Bill Auger) - - The icons used in password warnings on the *users* page have been - changed to the colorful status icons (rather than the thin red X). - - -# 3.2.15 (2019-10-11) # - -This release contains contributions from (alphabetically by first name): - - No other contributors this time around. - -## Core ## - - No changes to core functionality - -## Modules ## - - - *displaymanager* module now treats *sysconfig* as a regular entry in the - *displaymanagers* list, and the *sysconfigSetup* key is used as a - shorthand to force **only** that entry in the list. #1253 - - *machineid* module has been re-written in C++ and extended with - a new configuration key to generate urandom pool data. #1252 - - *unpackfs* now supports a special *sourcefs* value of `file` - for copying single files (optionally with renaming) or directory - trees to the target system. - - *unpackfs* now support an *exclude* and *excludeFile* setting for - excluding particular files or patters from unpacking. #1229 - - -# 3.2.14 (2019-09-30) # - -This release contains contributions from (alphabetically by first name): - - Andrius Štikonas - - Harald Sitter - -## Core ## - - No changes to core functionality - -## Modules ## - - - *locale* module no longer recognizes the legacy GeoIP configuration. - This has been deprecated since Calamares 3.2.8 and is now removed. - - *packagechooser* module can now be custom-labeled in the overall - progress (left-hand column). #1228 - - *displaymanager* module now recognizes KDE Plasma 5.17. - - *displaymanager* module now can handle Wayland sessions and can detect - sessions from their .desktop files. #1247 #1248 - - *unpackfs* now has special handling for *sourcefs* setting "file" - (so you can copy single files or directories that are on the source - system, directly to the target). #1188 #1181 - - -# 3.2.13 (2019-08-30) # - -This release contains contributions from (alphabetically by first name): - - Arnaud Ferraris - - Arnaud Rebillout - - Bill Auger - - Kevin Kofler - -## Core ## - -- The Calamares standard coding style -- embodied in `ci/calamaresstyle` - has had a few updates and has now been consistently applied across - the core codebase (e.g. libcalamares, libcalamaresui, calamares, but - not the modules). -- *KCoreAddons* is now a required dependency. This lets us drop a chunk - of code that was copied from KCoreAddons years ago, and use the - (maintained!) upstream version instead. It also gives us KMacroExpander - everywhere, which will simplify code for handling substitutions - in configuration files. -- *Slideshows* now have a new property *activatedInCalamares* which - controls the keyboard shortcuts (and can control timers and other - properties of the slideshow, too). - -## Modules ## - -- The *packagechooser* module can load data from the config-file, - from AppData XML files referred by the config-file, and (new) also - from AppStream caches by referring to an application's AppStream id. #1212 -- The *partition* module now understands the units *KB*, *MB*, *GB* which - are powers-of-ten sizes, alongside the powers-of-two sizes that it already - used. (thanks to Arnaud) -- The *welcome* module now supports a *Donate* button if *showDonateUrl* - is set to a non-empty URL. #1197 -- The *welcome* module can have URLs for the various buttons configured - directly in the module configuration (rather than in `branding.desc`). - - -# 3.2.12 (2019-08-07) # - -This release contains contributions from (alphabetically by first name): - - apt-ghetto - - Bill Auger - - embar - -## Core ## - - - Preliminary work to allow jobs to have a *weight* assigned to them - has been added. This will allow the progress bar to better reflect - progress by the amount of work done rather than purely by the - number of jobs. (Thanks to Bill Auger) - - Preliminary work has been added to post the installation log to a - pastebin for bug reporting. (Thanks to Bill Auger) - - Support for translated human-readable strings in Calamares - config files has been added. This is used only in the *packagechooser* - module (see below) but will expand to those modules that need - user-visible strings from the configuration file (existing - solutions need either gettext or Qt support). - - Esperanto is now available when Qt version 5.12.2 or later is used. - -## Modules ## - - - *fstab* A new configuration key *efiMountOptions* has been added, to - allow setting filesystem options specifically for the EFI partition. - (Thanks to apt-ghetto) - - *packagechooser* is a new module for low-density package choices, - e.g. for selecting a default desktop environment, or adding some - proprietary drivers, or chosing browsers of office suites. It presents - **one** collection of items -- at most ten or so, because of the UI -- - and the user can select zero or more of them. The behavior is - configurable, and package information can be set through the Calamares - configuration file or by reading AppData files for the packages. #426 - - -# 3.2.11 (2019-07-06) # - -This release contains contributions from (alphabetically by first name): - - No other contributors this time around. - -This is a security release with no functional changes (except for -improved security) relative to 3.2.10. The Calamares team would like -to acknowledge the help of the following people in reporting and -understanding the issues (alphabetically by first name): - - Kevin Kofler - - Seth Arnold - - Simon Quigley - - Thomas Ward -Both CVE's have been resolved. - -## Core ## - -No core changes. - -## Modules ## - - - *initramfs* could create an initramfs with insecure permissions. - Since the keyfile is included in the initramfs, an attacker could - read the file from the initramfs. #1190 CVE-2019-13178 - - *luksbootkeyfile* created a key file where a window of opportunity - existed where the key file could have too-lax file permissions. - #1191 CVE-2019-13179 - - -# 3.2.10 (2019-06-28) # - -This release contains contributions from (alphabetically by first name): - - No other contributors this time around. - -Distributions are **advised** to check the slideshow they use for the -installation step; changes in loading and translation mechanisms may -require changes in the slideshow. - -## Core ## - - - With this release, option *WITH_PYTHONQT* changes default to **off**. - There does not seem to be any serious use of the PythonQt API and - the UI opportunities it offers, so begin the process of deprecating - and removing that. Sometime in the future, QML pages will fill the - gap for easily-prototyped-yet-slick UI elements. - - A crash when no *finished* page (or rather, no page at all) is - configured after the last *exec* section of the sequence has been - solved. The *finished* page can be left out (but then you don't get - the restart-now functionality). #1168 - - The *slideshow* which is run during installation now has API versions. - API version 1 (the default) runs as before, where the slideshow is loaded - when the installation starts. API version 2 loads the slideshow on - Calamares startup, thus improving responsiveness. Documentation - in `src/branding/README.md`. #1152 - - The example slideshow now uses API version 2. - -## Modules ## - - - *initramfs* has been changed from a Python module to a C++ module. - Packaging will need to adjust now it installs a .so instead of a .py. - The module itself functions as before. It does have a new configuration - option, to change the version passed as to the `-k` option of - update-initramfs. #1180 - - *partition* Now has its own setting for *requiredStorage*, duplicating - the same setting in the *welcome* module. This is useful for - configurations where no *welcome* module is used, but a minimum - size must be checked anyway. #1169 - - -# 3.2.9 (2019-06-03) # - -This release contains contributions from (alphabetically by first name): - - Kevin Kofler - -## Core ## - -No user- or deployer-visible changes. Bugfixing as usual, see the -milestone for details. - -## Modules ## - - - *branding* now supports os-release variables in the *strings* section, - which allows re-using (at runtime) information set in /etc/os-release . - This requires KDE Frameworks 5.58. #1150 - - *branding* allows the use of FreeDesktop.org icon names for the - *productLogo* and *productIcon* keys. If a file is named there, then - the file is used, and otherwise the icon is looked up in the current - theme. #1160 - - *packages* On Arch, with the `pacman` package manager, avoid a hang - during system update. #1154 - - *welcome* allows a custom image path or icon name to be set for the - language-selection drop-down (instead of the international standard one). - - -# 3.2.8 (2019-05-10) # - -This is a **source-incompatible** release of Calamares. Include files -have been shuffled around, so third-party C++ modules will need -adjustment to the changed names. - -This release contains contributions from (alphabetically by first name): - - Arnaud Ferraris - - Kevin Kofler - -## Core ## - - - All user-visible texts referring to "MB" and "GB" now use the standard - "MiB" and "GiB" wording, which matches what we were actually calculating - with (i.e. 2^20 and 2^30 respectively). #1129 - - The side-pane, which shows the list of steps that will be executed, - now tries to fit the text (name of each module) into the available space - by shrinking the font as needed. #1137 - - *libcalamares* (accidentally) linked with Qt's GUI libraries when - PythonQt was found. This led to the odd situation where the non-GUI - Calamares library depends on a bunch of GUI libraries. - - *libcalamares* The `utils/` subdirectory has been hugely refactored, - with functionality split out into separate files. C++ modules will - need to have their `#include` names updated. Basically, users of - `utils/CalamaresUtils.h` will need to include the header file for - the functionality that is actually used. - -## Modules ## - - - *finished* has a new mechanism for configuring the behavior of the - *restart now* button. The old-style boolean configuration is still - supported but generates a warning. #1138 - - *locale* module GeoIP configuration has a new preferred format. - See `locale.conf` for details. The old configuration is still - supported but will be phased out before 3.3.0 -- in particular, - support for "legacy" format will be removed, since that was a - crutch for the disappearance of one GeoIP provider in 2018. - - *oemid* is a new module for configuring OEM phase-0 (image pre-mastering, - or pre-deployment) things. It has limited functionality at the moment, - writing only a single batch-identifier file. #943 - - *welcome* can now do GeoIP lookups as well (but be careful with the - configuration, since you need a GeoIP that provides country information, - not just timezones). This will let Calamares select a starting language - that matches where it is -- which might not be useful at all. #934 - - All Python modules now bail out gracefully on (at least some) bad - configurations, rather than raising an exception. The pre-release - scripts now test for exceptions to avoid shipping modules with - ImportError or SyntaxError results. - - -# 3.2.7 (2019-04-27) # - -This is a **hotfix** release for regressions introduced in the -Python modules. The *localecfg* module was unusable because of -a missing `import`. - - -# 3.2.6 (2019-04-25) # - -This release contains contributions from (alphabetically by first name): - - Arnaud Ferraris - - Dominic Hayes (feren) - - Raul Rodrigo Segura (raurodse) - -## Core ## - - * Under-the-hood code cleanups in lots of parts of the core. Calamares now - builds without warnings when Clang 8 is used. - * A new *disable-cancel-during-exec* setting provides more fine-grained - control than *disable-cancel*, which hides the button entirely. - #1122 (Thanks to Dominic, FerenOS) - * A branding module can now also cause a stylesheet to be loaded, which - will be applied to the widgets inside Calamares. #961 (Thanks to Raul) - -## Modules ## - - * All of the Python-based modules now have translations enabled. #991 - * *Displaymanager* module has improved support for LightDM configuration. - #1123 (Thanks to Dominic, FerenOS) - * *License* module can now display local files inline, and scrolls to - allow longer lists of licenses and to support long license texts - displayed inline. #1124 #1125 #1052 - * *Partition* module has additional checks for validity partition layouts. - #1127 (Thanks to Arnaud) - * *Welcome* module has improved usability: a standard icon - alongside the *Language* label, for improved recognition, - and improved language-list display and sorting. #1107 - - -# 3.2.5 (2019-04-15) # - -This release contains contributions from (alphabetically by first name): - - Arnaud Ferraris - - Dan Simmons - - Gabriel Craciunescu - -## Core ## - - * View modules (in C++) can now perform their own requirements-checking - to see if installation makes sense. This expands upon the existing - requirements checks in the welcome module (RAM, disk space, ..). - The checks have been made asynchronous, so that responsiveness during - requirements-checking is improved and the user has better feedback. - * Support for building an AppImage of Calamares has been added to the - `ci/` directory. There are use-cases where a containerized build and - configuration make sense rather than having Calamares installed in the - host system. (Thanks to the AppImage team, Alexis) - * OEM mode (phase-1) now correctly refers to Calamares as a "Setup Program" - rather than an installer. #1100 (Thanks to Arnaud) - -## Modules ## - - * *Bootloader* module: a serious bug introduced in 3.2.4 which prevents - succesful boot after installation on EFI machines, has been repaired. - (Thanks to Gabriel) #1104 - * *Displaymanager* module: it is no longer a fatal error to not have any - display-managers. #1095 - * *Partition* module: it is now possible to build without libparted. Since - KPMCore may not need this library anymore, it is a dependency that will - be dropped as soon as it is feasible. Add this to the CMake flags: - `-DCMAKE_DISABLE_FIND_PACKAGE_LIBPARTED=ON` - * *Partition* module: the location that is selected for the bootloader, - no longer changes when a new partition is created. #1098 - * Python modules: several modules have had translations added. This is - usually only visible when the module runs as part of the *exec* step, - when the module's *pretty name* is displayed. In addition, some error - messages are now translated. - * *UnpackFS* module: improved progress reporting and tests. #565 - - -# 3.2.4 (2019-02-12) # - -This release contains contributions from (alphabetically by first name): - - Alf Gaida - - aliveafter1000 - - Arnaud Ferraris - - Caio Jordão Carvalho - - Collabora LTD - - Gabriel Craciunescu - - Kevin Kofler - - Philip Mueller - - Scott Harvey - -## Core ## - - * The Calamares application now recognizes the `-X` or `--xdg-config` - option, which adds XDG_DATA_DIRS to the places used to find QML - and branding directories, and XDG_CONFIG_DIRS to the places used - to find the global settings and module configurations. This allows - a more fine-grained, and more layered, approach to setting up - Calamares configurations (in particular, distro's can **add** - configuration files and give them priority, instead of **forking** - configuration files). - * The *branding* file now contains settings that control the size - and resize behavior of Calamares. See the branding file for - more documentation. In particular, the setting *windowExpanding* - can be set to *normal*, *fullscreen* or *noexpand*. - * The `settings.conf` file can now configure whether the *Cancel* button - is shown (this isn't a branding thing, because it's quite fundamental - to the workflow of the installer). - -## Modules ## - - * The *partition* module supports RAID devices, but only when Calamares - is compiled with the newest KPMCore release (3.3.0). - * The calculation of required space -- including swap -- has been simplified, - and Calamares no longer reserves 2GiB of space in calculations for internal - use (this means that it no longer mysteriously drops swap when the disk - size is close to the required installation size). - * The name of the type of default filesystem (e.g. ext4 or btrfs) is now handled - case- and localization-insensitively. This means that *btrfs* is now always - an acceptable spelling. - * The currently-selected disk device is remembered between manual partitioning - and the partitioning-overview pages. (Thanks to Arnaud) - * *partition* There is new support for partitioning layout presets. - See `partition.conf` for documentation and details. - * The *keyboard* module now handles the (bogus) Austrian keymap for - the system console properly. (Thanks to Kevin) - * The *preservefiles* module now has a mechanism for setting the permissions - (and ownership) of preserved files. (Thanks to Scott) - * New module *fsresizer* can be used to resize filesystems. It is intended - for use in OEM installs where an image of fixed size is created, - and then sized to the actual SD card the user has used. - * The *mount* module now handles missing *extraMounts* and *extraMountsEfi* - keys gracefully (this is probably a misconfiguration, though, and gives a - warning). - * The *packages* module now supports pre- and post-script options - for all operations, not just during install (keep in mind that - these run as three separate shells, though). - * A new *rawfs* module supports straightforward copying of filesystems from - the installation media to the target stystem. This can be used, for instance, - for block-level-identical installations. - - -# 3.2.3 (2019-01-09) # - -This release contains contributions from (alphabetically by first name): - - aliveafter1000 - -## Core ## - -There are no core changes in this release. - -## Modules ## - - * *partition* Fixed bug where, during detection of existing systems, the - existing system partitions may be mounted and then files deleted. - This is a **limited** version of the patch from aliveafter1000 - that will be in 3.2.4, which tries harder to mount filesystems - read-only and unmodifiable. - * *locale* It was possible to set the installer and system language - (e.g. to German) while the global storage value for *locale* - remained set to English. Then no localization packages are installed - (see feature `${LOCALE}` in `packages.conf`). Reported downstream - in Netrunner. - - -# 3.2.2 (2018-09-04) # - -This release contains contributions from (alphabetically by first name): - - Andrius Štikonas - - artoo@cromnix.org - - Caio Jordão Carvalho - - Harald Sitter - - Philip Müller - - Simon Quigley - - Walter Lapchynski - -## Core ## - - * Example configurations are **no longer installed** by default. - The default setting for *INSTALL_CONFIG* has changed. Distributions - are strongly encouraged to write their own configuration files and - not rely on the example configuration files. Example configurations - may change unpredictably. - * It is now possible to express module dependencies through the - *requiredModules* key in `module.desc`. All of the required modules - for a given module must occur in the sequence **before** the module - requiring them. None of the core modules use this facility. - * The search paths for QML files, branding descriptors and module - descriptors have been revamped and now self-document in the log. - * A new `ci/RELEASE.sh` script has been added to streamline releases; - it is not guaranteed to work anywhere in particular though. - -## Modules ## - - * When multiple modules are mutually exclusive, or don't make sense - to enable concurrectly, a new `USE_` framework has been added - to CMake to simplify the selection of modules. This is in addition - to the existing `SKIP_MODULES` mechanism. - * Various off-by-one-sector errors in the automatic partitioning - mode have been corrected. In addition, swap space is calculated - a little more conservatively. - * A new module has been added to the core which can configure openrc - services. To make services configuration consistent: - - The *services* module has been **renamed** *services-systemd*, - - The openrc module is named *services-openrc*, - - At CMake time, it is possible to select all of the services modules, - or one specific one, by setting the *USE_services* CMake variable. - By default, all of the modules are built and installed. - * The systemd-services module can now disable targets and mask both - targets and services (which will allow you to break the system with - a bad configuration). The configuration is a little more flexible - because a service (or target) name can be used on its own with - sensible defaults. - * The displaymanager module has been entirely revamped. A long-standing - bug which ignored the settings for default desktop has been fixed - (thanks to Walter Lapchynski). Translations have been added to the - error messages. Each DM now has an implementation class for doing - all the configuration steps it needs. This groups the code needed for - a specific DM (and presumably, per-distro) in one place. - Distro's are **strongly advised** to re-test their DM configuration - and installation with the revamped code. - -# 3.2.1 (2018-06-25) # - -This release contains contributions from (alphabetically by first name): - - Bill Auguer - - Gabriel Craciunescu - - Phil Mueller - - Raul Rodrigo Segura - -## Core ## - - * Qt 5.7 is now the minimum required Qt version. Because KPMCore - (a fairly fundamental dependency) requires Qt 5.7, Calamares - has followed suit. - * New testing application `loadmodule` for loading and running a - single Calamares module. - * New translations Belarussian and Korean. - * Jobs can now be *emergency jobs* which run even after a failure. - * Improved debugging when modules fail to load. - * Bad configuration files will now cause the user-interface of - Calamares to display an error message, rather than silently - ignoring some configuration errors. This will certainly cause - problems for distributions with sloppy configurations. - -## Modules ## - - * New module preservefiles, keeps (log) files around after install; - this duplicates functionality with the unmount module, but unmount - is very late, rather limited, and fragile. - * Interactiveterminal module now disables itself if build requirements - are not met, rather than blocking the build. - * Fixes in the timezone map data make the southern hemisphere more - usable and put Reykjavik in its place. - * The packages module can now update the target system if explicitly - told to do so. - * More paths and executables are configurable in the bootloader module. - * Distributions are advised to review the `users.conf` setup **again**, - as some changes in version 3.2.0 caused regressions downstream. - * Distributions are advised to review their `locale.gen` files - **again**. Previous changes were too restrictive, matching only - the specific format Chakra Linux uses. Calamares now preserves - all the comment-lines in the file and writes enabled locales - at the end, with a descriptive comment. - -# 3.2.0 (2018-05-17) # - -This release contains contributions from (alphabetically by first name): - - Alf Gaida - - AlmAck - - Caio Jordão Carvalho - - Frede H - -## Modules ## - - * UI annoyances in the partitioning module were fixed; the - mount-point selector is now more obvious when no mount-point - has been chosen, and the mount-point and flags are preserved - when (re)editing partitions. - * The handling of `@@ROOT@@` substitution in shellprocesses was - backwards; this has been fixed (the substitution is made when - running in the **host**). - * The user shell is no longer hard-coded to `/bin/bash`, - but follows the default setting for useradd(8), e.g. - those set in `/etc/default/useradd`. diff --git a/CHANGES-3.2 b/CHANGES-3.2 new file mode 100644 index 000000000..415424592 --- /dev/null +++ b/CHANGES-3.2 @@ -0,0 +1,1544 @@ + + +This is the changelog for Calamares. For each release, the major changes and +contributors are listed. Note that Calamares does not have a historical +changelog -- this log starts with version 3.2.0. The release notes on the +website will have to do for older versions. + +# 3.2.43 (unreleased) # + +This release contains contributions from (alphabetically by first name): + - Joe Kamprad + +## Core ## + - Translations have been made more consistent. In particular, some *OK*, + *Yes*, *No* and *Cancel* buttons that were previously untranslated + or "stuck" in the language that Calamares started in, are now + changed to the current language as selected in the welcome page. + +## Modules ## + - No module changes yet + + +# 3.2.42 (2021-09-06) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Artem Grinev + - Nico 'dr460nf1r3' (new contributor, welcome!) + - Waneon Kim (new contributor, welcome!) + +## Core ## + - No core changes yet + +## Modules ## + - BTRFS partitions are no longer listed as "check in phase 2" in + the *fstab* module. (Thanks Nico) + - The *keyboard* module (and *keyboardq*) now pick an English layout + (with Rupee) for keyboards when the language is English and locale is India, + rather than Hindi layout. + - The *localeq* module had the i18n.qml rewritten to make it easier + to customize. A bug in the layout has been fixed, and the overall + look has been updated. + - *networkcfg* now translates the "live user" on an ISO to the regular + user on the installed system, so that network configuration changes + made in the live system are automatically used after installation. #1755 + - *partition* no longer allows you to delete an extended partition with + children (which led to crashes). #1749 (Thanks Artem) + - *partition* complains in more detail about the state of the UEFI + boot partition (under manual partitioning schemes). #1761 + - *welcome* can now check multiple URLs to determine if internet connectivity + is available. It is still recommended to check the distro home-page or + some special "ping" page of the distro, although that has some privacy + implications; using example.com or google.com may work as well. Listing + multiple URLs will ping each of them in turn until one succeeds. #1669 + - The work to make a QML version available for all view modules is almost + completed. Two new QML modules have been added *packagechooserq* and *summaryq*. + Summaryq brings the option to present the summary page in a customizable + way, with a bit more of a contemporary look. Packagechooserq adds the option + to preselect an item and displays all options in one overview. + (Thanks Anke) + + +# 3.2.41.1 (2021-08-05) # + +This is a hotfix release for a crash in the *partition* module, reported on +KDE neon. #1746 + + +# 3.2.41 (2021-07-31) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Camilo Higuita + +## Core ## + - The (re)translation framework has been internally re-vamped to be + less resource-intensive and to work with all QObjects, not just + widgets. Consumers of the translations framework are expected to + set up the event filter on the top-level widget(s) manually. Since + Calamares and the Calamares-test-applications have been adjusted already, + no further action is needed. + +## Modules ## + - When the *keyboard* module is activated, it no longer replaces + an explicit user choice (e.g. for a Belgian layout) by a guessed-for- + this-language layout (e.g. Danish if you're installing in Danish). + - Logic for handling installation lists has been moved around in the + *packages* module so that package managers can, in principle, + adjust how to handle critical and non-critical package lists. + - In the *partition* module, translation code has been simplified. + - The *usersq* module has had a fair bit of QML rewritten to make it easier + to customize the colors used by the module in a consistent way. + (Thanks Anke) + - *Welcome* now uses a translated message from the Config object, + increasing the sharing between widgets- and QML-modules. + + +# 3.2.40 (2021-07-14) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Anubhav Choudhary (SoK success!) + - Emmanuel Arias (new contributor! welcome!) + - Erik Dubois + - Jerrod Frost (new contributor! welcome!) + - Jia Chao (new contributor! welcome!) + - Joe Kamprad + - Lisa Vitolo (blast from the past!) + - Omer I.S. (new contributor! welcome!) + +In project news, chat (instant-messaging) communications has largely +moved to Matrix and Libera.Chat. CI notifications -- issues and build +results -- are sent to Matrix only. + +## Core ## + - The CMake modules for consumption by external modules (e.g. the + calamares-extensions repository, but also any other modules built + by distro's for internal use) now support consistent skip-module + behavior and reporting. #1641 (one tiny part of this change) + - In global storage, the *filesystem_use* key now has an API in + libcalamares to systematically mark filesystem (types) as "in use" + or not. This, in turn, means that modules can depend on that information + for other work (e.g. removing drivers for unused filesystems). #1635 + - The "upload log file" now has a configurable log-file-size. (Thanks Anubhav) + +## Modules ## + - *bootloader* can now install an aarch64 (ARM) compatible EFI GRUB. (Thanks Jia) + - *displaymanager* example configuration has been shuffled around a bit, + for better results when the live image is running XFCE. Also lists + more potential display managers. #1205 (Thanks Erik) + - *keyboard* now switches on an alternate `en_US` keyboard layout when + Arabic or Hebrew is selected as primary layout. (Thanks Omer) + - *localeq* now has a fully functional offline option (alongside the default + interactive map option, which requires internet). + - The *netinstall* module can now fall back to alternative URLs when + loading groups data. The first URL to yield a non-empty groups + collection is accepted. No changes are needed in the configuration. #1673 + - *packagechooser* can now integrate with the *packages* module; that + means you can specify package names to install for a given selection, + and the regular package-installation mechanism will take care of it. + Legacy configurations that use *contextualprocess* are still supported. + See the `packagechooser.conf` file for details. #1550 + - A long-neglected pull request from Lisa Vitolo for the *partition* + module -- allowing to set filesystem labels during manual partitioning -- + has been revived and merged. + - The *partition* manager has had a long-standing bug with partition-flags + and manual partitioning resolved. This may help resolve some installation + issues on UEFI systems. #1724 + - *usersq* is further implemented and can now be used for a successful install. + Not all warning messages available in the regular users module are implemented. + + +# 3.2.39.3 (2021-04-14) # + +A minor bugfix tweak release. Since this contains yet **another** +autologin-related fix, and there is nothing large enough to justify +a 3.2.40 release yet, add it to the growing tail of 3.2.39. (Reported +by Joe Kamprad, #1672). Also fixes a regression from 3.2.28 in +localized packages (e.g. *package-LOCALE* did not work). + + +# 3.2.39.2 (2021-04-02) # + +This is **another** hotfix release for issues around autologin .. +autoLogin, really, since the whole problem is that internal capitalization +changed. An unrelated bug in writing /etc/default/keyboard was +also fixed. (Reported by pcrepix, #1668) + + +# 3.2.39.1 (2021-03-30) # + +This hotfix release corrects a regression in the *displaymanager* +module caused by changes in the *users* module; autologin was +internally renamed and no longer recognized by the *displaymanager* +module. (Reported by Erik Dubois, #1665) + + +# 3.2.39 (2021-03-19) # + +This release contains contributions from (alphabetically by first name): + - Matti Hyttinen + +## Core ## + - A *packages* service has been added to the core, for use by + *netinstall* module and any others that need to set up + package information for the *packages* module. + +## Modules ## + - The *mount* module has gained a configurable setup for btrfs volumes. + If your distro has a default-to-btrfs setup, it can skip the hard- + coded setup (which Calamares has had for a long time with @home + and similar) and introduce a custom btrfs configuration through the + `mount.conf` file. See issues #1659 and #1661 for warnings about + using this in production. + - *netinstall* now supports fallbacks for the groups data. + Instead of a single URL, multiple URLs may be specified in + a list and Calamares goes through them until one is successfully + retrieved. Older configurations with a single string are + treated like a one-item list. #1579 + - The *usersq* module now connects to the internal configuration + object and may be usable for regular installations. + + +# 3.2.38.1 (2021-03-15) # + +This hotfix release is for this item in the release notes of 3.2.38: + - The .desktop file for Calamares now makes a longer trip, calling + `sh -c "pkexec calamares"`; distributions may still need to adjust. +The change had been lost while updating other files. It has been restored +in `calamares.desktop` and `calamares.desktop.in`. (Reported by Erik) +Other minor changes and fixes: + - presets in the *users* module show the hostname, too, + - translations update for Korean, Ukranian and Chinese (zh_TW). + + +# 3.2.38 (2021-03-14) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Anubhav Choudhary + - Neal Gompa + +## Core ## + - Uploading your log files (in case of installation failure) has been + expanded and is now more configurable. Users should still take care + when uploading logs, and distro's should configure a URL with + no public viewing of those logs. (Thanks Anubhav) + - The .desktop file for Calamares now makes a longer trip, calling + `sh -c "pkexec calamares"`; distributions may still need to adjust. + +## Modules ## + - A new QML-based *finishedq* module has been added. (Thanks Anke) + - The *packages* module no longer supports *urpmi*; no Calamares- + consumers with that package manager seem to exist. (Thanks Neal) + - The *users* module now can set a fixed username and prevent editing. + The *presets* configuration entry in `users.conf` can set a *loginName* + and a *fullName* and (independently) enable or disable editing of + that value. You can, for instance, set *loginName* to "manjaro" if + you like; the user can change it afterwards. You could set the + *loginName* to "oem" and prevent editing it as well. #942 + + +# 3.2.37 (2021-02-23) # + +This release contains contributions from (alphabetically by first name): + - benne-dee + +## Core ## + - Calamares has a table of 'best guess' languages for each country + and when GeoIP is enabled, it will automatically select that + country's language as default -- the user can of course pick + a different one. The 'best guess' is based on Unicode / ISO + data, which is sometimes dubious. Based on some personal notes, + the 'best guess' language for Belarus has been changed to Russian. + - Calamares has a table of 'best guess' keyboard mappings, + allowing native language input. However, usernames and + passwords should be in US-ASCII (this is a limitation of + the login system -- **some** parts of the system will support + non-ASCII input, but it's better safe than sorry). + Add Greek to the list of languages that needs US-ASCII + in addition to native input. + - The CI infrastructure now builds Calamares and Calamares-extensions + on a nightly basis. + +## Modules ## + - The *netinstall* module has a YAML schema, allowing packagers + to validate and verify their netinstall configurations before + shipping an ISO (or writing bug reports). Thanks benne-dee. + - The *finished* module has been heavily refactored, opening + the way to a QML-based version of the same module. This is + also preparatory work for allowing packagers (e.g. PostmarketOS) + to customize the messages on the finished page. + + +# 3.2.36 (2021-02-03) # + +This release contains contributions from (alphabetically by first name): + - Anubhav Choudhary + - benne-dee + - Gaël PORTAY + - Jonas Strassel + - Kevin Kofler + - Matti Hyttinen + - Neal Gompa + +## Core ## + - It is now possible to hide the *next* and *back* buttons during + the "exec" phase of installation. Thanks Anubhav. + - The Calamares CI has migrated to GitHub actions. Thanks Jonas. + +## Modules ## + - *bootloader* now uses the current file names for the UEFI Secure Boot + shim instead of obsolete ones. + - The *mount* module creates swap in its own subvolume, if btrfs is used. + Thanks Matti. + - *partition* includes more information about what it will do, including + GPT partition types (in human-readable format, if possible). Thanks Gaël. + - Some edge-cases with overlay filesystems have been resolved in the + *partition* module. Thanks Gaël. + - During the creation of filesystems and partitions, automounting is + turned off (if DBus is available, and the host system supports + KDE Solid automount control). This should reduce the number of + failed installations if automount grabs partitions while they are + being created. The code is prepared to handle other ways to control + automount-behavior as well. + + +# 3.2.35.1 (2020-12-07) # + +This release contains contributions from (alphabetically by first name): + - Anubhav Choudhary + - Matti Hyttinen + +Some strange string artifacts appeared, leading to `{1?}` being +displayed in various user-facing messages. These have been removed +and the translations updated. + +## Modules ## + - The *initcpiocfg* module would sometimes configure the system to ask + for a passphrase, when none is needed. + + +# 3.2.35 (2020-11-30) # + +This release contains contributions from (alphabetically by first name): + - Clarissa Borges + - Matti Hyttinen + +A new kind of issue template has been added for Calamares, +for reporting (and adding tests for) usability issues. Thanks +to Clarissa for leading that effort. + +## Core ## + - No core changes yet + +## Modules ## + - The *partition* module now supports a not-full-disk-encryption setup, + where `/boot` is not encrypted, but the rest of the system is. + - The *plasmalnf* module has been substantially rewritten, so that it + can support a QML version of the module in future. The UI has changed + a little, and now displays more themes than before. + + +# 3.2.34 (2020-11-16) # + +This release contains contributions from (alphabetically by first name): + - Artem Grinev + - Gaël PORTAY + +## Core ## + - No core changes yet + +## Modules ## + - The *keyboard* module had a regression in which it no-longer painted + the keycaps in the keyboard preview. (reported by Vinnie) + - The *plasmalnf* module did not set all of the look-and-feel values + in the target system. (reported by Bluestar Linux) + - In the *users* module, warnings about the strength of the password + are now correctly pluralized when possible. + - In the *users* module, if ICU is installed, the user's full name is + automatically transliterated to US-ASCII (for some locales; this will + need tweaking) so that the login name is acceptable. (Thanks Artem) + + +# 3.2.33 (2020-11-09) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Andrius Štikonas + - Artem Grinev + - Gaël PORTAY + - Matti Hyttinen + - TTran Me + +## Core ## + - Calamares now sets the C++ standard for compilation to C++17; this + is for better compatibility and fewer warnings when building with + modern KDE Frameworks and KPMcore 4.2.0. + - Vietnamese translations have been added. Welcome! (Thanks TTran) + +## Modules ## + - The *initcpiocfg* module should support plymouth with encryption + now. (Thanks Matti) + - The *keyboard* and *keyboardq* modules now share backend code + and handle non-ASCII layouts better (for setting passwords + and usernames). (Thanks Artem) + - Various cleanups and documentation improvements in the *partition* + module, and configurable GPT name for swap. (Thanks Gaël) + - A long-standing bug related to GPT partition flags in the + *partition* module has been resolved. #1327 #1267 + - The *users* module now has a more detailed way to specify + user groups -- which may be system groups rather than user-GIDs. + A new option in each group can require that the group already + exists in the target system, allowing for better consistency checks + with the squashfs. #1523 + + +# 3.2.32.1 (2020-10-17) # + +This is a release to address source-incompatible changes in KPMcore 4.2.0, +which was released just before Calamares 3.2.32 and had not yet been +compile-tested. There is also one changed message in the translations, +reported by Yuri Chornoivan. + + +# 3.2.32 (2020-10-16) # + +This release contains contributions from (alphabetically by first name): + - Fabian Tomat + - Gaël PORTAY + +## Core ## + - When doing GeoIP lookups, Calamares pretends to be Firefox. + This resolves an issue where the GeoIP provider was refusing + QNAM connections with the default User-Agent. + - New translation available, Friulian. Welcome! + +## Modules ## + - The *netinstall* module has some tricky configuration files; + it now complains about more cases of bad syntax or poor structure. + - The *partition* module can now be constrained to work only with + a particular kind of partition table. (thanks Gaël) + - The *partition* module is a little more resilient to variations + in btrfs notation from os-prober. + - The *shellprocess* module now supports having a different progress + message (other than "Shell Processes Job") through the config file. + + + # 3.2.31 (2020-10-06) # + +This release contains contributions from (alphabetically by first name): + - Corentin Noël + - kadler15 (new contributor! hi!) + +## Core ## + - At the start of the *exec* phase, an overview is given of the + various job weights, which allows you to tweak the overall + progress reporting during the installation. + - Problems with running Calamares on a 1-core single CPU have been resolved. + +## Modules ## + - The *keyboard* module now recognizes Turkish "F" layout and + will set the vconsole keyboard layout correctly even if xkb + keymaps are not found. + - The *machineid* module, which generates UUIDs for systemd and dbus + and can generate entropy files (filled from `/dev/urandom` in the host + system) now supports more than one entropy file; generate them as needed + (or copy a fixed value to all, depending on *entropy-copy*). Deprecate + *entropy* (which generates a specific output file) as too inflexible. + - In the *partition* module, swap can now be chosen as *file*, which is + **not** create a swap partition, but write a `/swapfile` in the root + directory, 512MiB large, and set that as swap. There is as yet no + "smarts" about the size of the swap file. + - Multiple problems in the *partition* module around partition + sizing have been resolved by Corentin Noël. + - The *preservefiles* module documentation did not match the functionality, + and when used, didn't work right. #1521 (thanks kadler15) + - Progress reporting from the *unpackfs* module has been revamped: + it reports more often now, so that it is more obvious that files + are being transferred even when the percentage progress does not + change. + - The *unpackfs* module now supports a *weight* setting for each + of the unpack entries. For a single entry this does not matter, + but if there are multiple entries it allows tweaking the relative + progress between each entry. + + +# 3.2.30 (2020-09-03) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Asif Mahmud Shimon + - Manzoor Ahmed Munawar + - Sai Kamal + - Victor Ibragimov + +This release has two giant source-code changes that have no effect +on functionality, but do touch each and every source file: + - SPDX headers for licensing information, following the standard + set by REUSE.software ; all source files and resources have + SPDX-License-Identifier information and copyright notices. All + of the boilerplate texts have been removed. + - Calamares coding style has been mechanically applied to the entire + codebase. This was already done to most of it, but there were + some hold-outs. + +## Core ## + - Network access status is deprecated in Qt 5.15's QNetworkAccessManager, + and was not useful already in some previous versions. Replace its + use in the Calamares network service by testing-it-ourself directly + via a synchronous ping. (Thanks to Asif) + - New Telugu translation. (Thanks to Sai) + - Urdu translation started. (Thanks to Manzoor) + - Timezones translated in Tajik and Russian. (Thanks to Victor) + +## Modules ## + - *keyboardq* and *localeq* improvements. (Thanks to Anke) + - *users* module did not set up autologin properly. This is yet another + regression left over from 3.2.28. (Reported by Phil and pcrepix, #1498) + - *welcome* module now sets the *LANG* key in the locale configuration + (which is shared with the *locale* module and consumed by the + *localecfg* module). This makes it feasible to drop the *locale* + module and still set the installed system's language to the language + selected in Calamares. (Reported by FerenOS) + + +# 3.2.29 (2020-08-20) # + +This release contains contributions from (alphabetically by first name): + - Asif Mahmud Shimon (new contributor! hi!) + +## Core ## + - Edge case in extracting string-lists from YAML, reported and fixed + by Asif (#1491). + - Progress reporting is now more flexible. Modules can have a weight + assigned to them in the descriptor; module instances can have a weight + assigned which overrides the module descriptor. When jobs are run + for a module instance, the jobs report progress pro-rated by the + module's weight. Or in other words, it is now possible to tweak + the amount of the overall progress bar that different modules fill. + The default settings give unpackfs a weight of 12. (#1176) + +## Modules ## + - The *users* module did not read the *defaultGroups* correctly. + Fixed by the string-lists change mentioned above. + + + # 3.2.28.3 (2020-08-18) # + +Another hotfix, for more issues reported by Marco Obaid. Users +were not having a password set (#1489) + + +# 3.2.28.2 (2020-08-12) # + +A second hotfix, for autologin support -- the autologin group was not +created in the target system before assigning the user to it. Reported +by Marco Obaid. + + +# 3.2.28.1 (2020-08-10) # + +This is a hotfix release for #1482 and #1483, where no user was +created during installation and a chmod was failing (resulting in +a failed installation). Reported by Jonathan Riddell. + +With incidental improvements in SPDX tagging (code licensing) +and some new icon options for the welcomeq and localeq modules. + + +# 3.2.28 (2020-08-09) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - apt-ghetto + - Victor Ibragimov + +## Core ## + - A new object *Network* is available to QML modules in `io.calamares.core`. + It exposes network status through the *hasInternet* property. + - Welcome to Tajik translations. The Tajik language has quickly reached + 100% completion. Thanks Victor! + - Welcome to [Interlingue](https://en.wikipedia.org/wiki/Interlingue). + The translation is at an early stage. Qt does not support language + code *ie* though, so it may take some time to be integrated (much + like Esperanto wasn't supported until Qt 5.12). + +## Modules ## + - The *locale* module has been completely redone on the inside. + Users should see no changes. #1391 + - The *localeq* module uses the redone internals of the locale module. + It can now be used to set timezone, language and locale information + and is a suitable alternative module. Thanks to Anke Boersma who did + the work of figuring out maps. Note that the map uses several GeoIP + and GeoData providers and you may need to configure the URLs + with suitable usernames for those services. #1426 + - Both *locale* and *localeq* can now be configured to use the system's + timezone setting -- this can be useful to avoid both hard-coding an + initial zone and doing extra GeoIP lookups, in the case where the + live system already does so. #1391 + - The *locale* and *localeq* modules have additional machinery for + timezone lookups; please report cases where clicking on the map + returns an obviously bogus timezone (up until this release, for + instance, Cape Town). + - The *users* module no longer accepts `root` as a username. #1462 + - The *keyboardq* module is now more inline with the look of the rest + of the Calamares modules, use of a background image is removed. + - The *grubcfg* module now understands `/etc/default/grub.d`. #1457 + + +# 3.2.27 (2020-07-11) # + +This release contains contributions from (alphabetically by first name): + - Gaël PORTAY + - Vitor Lopes (new! welcome!) + +## Core ## + - QML modules with no surrounding navigation -- this is basically a + special case for full-screen Calamares -- now have margins suitable + for full-screen use. + - PythonQt modules are increasingly on the way out. + +## Modules ## + - The Manjaro package manager *pamac* has been added to those supported by + the *packages* module. + - The *netinstall* module has had some minor UI tweaks. + - Partitioning now tries harder to avoid floppy drives. + + +# 3.2.26.1 (2020-06-23) # + +This is a hotfix release for undefined behavior caused by an +uninitialized integer variable. It includes new translations +and features as well since those arrived independently. + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Gaël PORTAY + +## Core ## + - Welcome to Azerbaijani translations. These are available + in two variations, *Azerbaijani* and *Azerbaijani (Azerbaijan)*. + [Wikipedia Azerbaijani](https://en.wikipedia.org/wiki/Azerbaijani_language#North_vs._South_Azerbaijani) + has a nice overview. + - Warnings while building with Qt 5.15 have been much reduced. + +## Modules ## + - *partitioning* has one case of undefined behavior (UB) due + to a missing integer-initialization. (Thanks Gaël) + - *keyboardq* QML module now works correctly. (Thanks Anke) + + +# 3.2.26 (2020-06-18) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Gaël PORTAY + - Pablo Ovelleiro Corral + - Philip Müller + +## Core ## + - The default branch for Calamares source repositories (calamares + and calamares-extensions) is now *calamares*. + - External modules can now be built again, outside of the Calamares + source and build-tree. + - The repository *calamares-tools* has been removed. The idea behind + the tooling was to provide schema validation for Calamares configuration + files. This has been merged into the primary repository, where it + is now part of the test suite. + +## Modules ## + - *locale* put some more places into the correct timezone **visually**; + for instance Norfolk Island gave up UTC+11.5 in 2015 and is now + UTC+11, but Calamares still showed it in a zone separate from UTC+11. + - *localeq* can now properly switch between on & offline mode, + it detects internet status through js. + - *packages* gained support for the Void Linux package manager, + *xbps*. (thanks Pablo) + - *tracking* now supports kuserfeedback configuration. + - *welcomeq* added the GEOIP configuration option, so locale can be + initially set according to IP address. + + +# 3.2.25 (2020-06-06) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Callum Farmer + - FLVAL + - Gaël PORTAY + +## Core ## + - The slideshow in `branding.desc` can be configured with QML (recommended, + as it has been for the past umpteen releases) or with a list of + images (new). + - It is possible to turn off all the new QML code -- navigation, slideshow, + QML-based modules -- with a single `-DWITH_QML=OFF` at CMake time. + This removes QML from Calamares' dependency footprint (but only saves + 200kB in Calamares itself). + - Tests have been extended and now support a tests/CMakeTests.txt file + for fine-tuning tests for Python modules. + - SPDX identifiers are used much more widely and consistently in Calamares. + (thanks Callum) + +## Modules ## + - The QML based *welcomeq* module is now a viable alternative to the + *welcome*(widgets based) module. Using QML files means it no longer + is needed to have pop-up windows for additional information or warnings, + all loads in the Calamares window itself. Additional features include the + option to customize the *About* info and load files like Release Notes + direct into Calamares, QML files added to the branding directory can be used. + - The *welcome* and *locale* modules that do GeoIP lookup can now also + use "fixed" style; this just negates the GeoIP lookup and substitutes a + constant (fixed) value; useful for testing specific locales. + - The *keyboard* module no longer uses *ca_eng* keyboards in Canada by + default, but sticks to the *us* keyboard. #1419 + + +# 3.2.24 (2020-05-11) # + +This release contains contributions from (alphabetically by first name): + - Bill Auger + - Gaël PORTAY + - Luna Jernberg + - Philip Müller + +## Core ## + - There is now a bash-completions script for Calamares; turn on + the (CMake-time) option INSTALL_COMPLETION to get it. (Thanks Gaël) + - The *productWallpaper* setting is documented and works. (Thanks Bill) + - GlobalStorage is available to QML modules as `Global`. + - The height of the navigation bar in QML can be set within the + QML code for the navigation; if not set, try something sensible. + - A regression in the requirements-checker which could block the + installer from proceeding without telling the user **why** it + was blocked, has been resolved. + +## Modules ## + - The *bootloader* module can force a UEFI-based machine to boot into + the newly-installed system. #1394 (Thanks Gaël) + - *partition* Pop-ups about boot flags use the right flag names. #1192 + + +# 3.2.23 (2020-04-17) # + +This release contains contributions from (alphabetically by first name): + - FLVAL + +## Core ## + - Some strange annotations were added to the *About* dialog text in + all the translations, like `{1?}`. These have been removed again. + +## Modules ## + - *locale* module had some errors in timezone data, where clicking + on a city would select a different timezone. Some of these are + now fixed (thanks FLVAL). #1374 + - *netinstall* supports a wider variety of package naming schemes, + and is more flexible in loading a `netinstall.yaml` that is copied from + the example configuration file, *groups* key and all. #1369 + - *users* module logs a full error message from libpwquality if something + is wrong internally. + + +# 3.2.22 (2020-04-08) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Camilo Higuita + +## Core ## + - Both the sidebar (on the left) and the navigation buttons (along the + bottom of the window) can now be configured to use the traditional + *widgets*, to use *qml*, or *hidden* from view (hiding the navigation + is not recommended unless you have a pure-QML UI to run inside + Calamares). The example QML that is compiled into Calamares has + been improved. To use your own QML, put files `calamares-sidebar.qml` + or `calamares-navigation.qml` into the branding directory. + - The sidebar and navigation can now be placed on any side of the + main window. This is probably only useful for QML-based UIs. + See `branding.desc` for details. + +## Modules ## + - The *welcomeq* module has been improved with better layout and + nicer buttons in the example QML form. (Thanks to Anke Boersma) + - The *keyboardq* and *localeq* modules now provide some QML for + configuring these parts, although they are still very primitive. + - *netinstall* has had some minor layout fixes. + - *unpackfs* has much more detailed progress reporting and no + longer jumps around strangely in overall progress. + - *partition* now correctly marks a partition as bootable in BIOS + MBR + installs. #1175 + + +# 3.2.21 (2020-03-27) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Camilo Higuita + - Gabriel Craciunescu + - Gaël PORTAY + +## Core ## + - Python job modules (such as *unpackfs* or *packages*) can now provide + a `pretty_status_message()` function, like the existing `pretty_name()` + function, that is used to update the status during install. #1330 + - QML support-modules and objects are now registered into the io.calamares + namespace. This affects modules using Calamares models inside their + QML UI (at this point, very few). With this release, the necessary + `import` for Calamares parts looks like + > ```import io.calamares.ui 1.0``` + A complete list of objects available from Calamares van be found in the + documentation in `Qml.h`. + - The sidebar (which shows overall progress in the installation) is now + more configurable: the branding key *sidebar* controls it. The sidebar + can be shown as a widget (default, as it has been), hidden, or use a + new QML view which is more easily customised. + - A new `settings.conf` key *quit-at-end* will automatically close + Calamares (by clicking on the *Done* button) when the end of the + sequence is reached. If *finished* is the last module in the sequence, + this will run whatever it is configured for; you can also leave out + the finished page and Calamares will close after the exec parts. + +## Modules ## + - *packages* now reports more details in the installation progress-bar. + - *netinstall* module supports an `expanded` key, which will pre-expand + a group (as if the user had pressed the arrow-button in the tree-view). + This only affects the UI, and only the **outermost** level of groups. + - *netinstall* module now supports a special value for *groupsUrl*. + Setting this to *local* will read the groups directly from the + configuration file. + - *netinstall* groups now support a new key `immutable` which prevents + their check-state from being changed (they are shown, or hidden, + as usual and can be expanded). + - Modules that use QML need a new import line. The QML file for the + module is configured through new keys *qmlSearch* and *qmlFilename* + (previously those were without the `qml` prefix, which invites name + collisions). The full module identifier is also used as a filename, + so that multiple instances of a module can use different QML files. + - *partition* module has a number of new features and settings for + type, UUID, and filesystem characteristics. Thanks to Gaël. + + +# 3.2.20 (2020-02-27) # + +This release contains contributions from (alphabetically by first name): + - Bart Ribbers + +## Core ## + - When logging level is set to 8 (eight), for instance via the `-D8` + logging flag, or the `-d` debug flag, the *Show debug information* + button will appear in the progress view. This helps with debugging + issues where the `-d` flag would be inappropriate. + - Calamares now starts at logging level 1 (warnings and errors to + the console) by default. Previously it (wrongly) started at level 8. + +## Modules ## + - The *partition* module now stores which filesystems are in use in + global storage. + - The *contextualprocess* module now understands "compound variable + names", where a dot (.) is used to index into structured data + stored in global storage. This allows it to use the map stored + by the partition module (but also other things, like looking into + the branding information). + - The *packages* module now understands "apk", the Alpine Linux + package manager. + + +# 3.2.19.1 (2020-02-24) # + +This is a hotfix release for bugs in the *users* module. +Reported by Philip Mueller and Walter Lapchynski. + +## Modules ## + - The *users* module no longer wrote `/etc/hostname` at all. + - The *users* module erroneously shows the root password input fields. + - The *initramfs* module sets a resume-hook even when there is no swap. + - The partitioning service expects *udevadm* in `/sbin`, but some + distro's place it elsewhere. + - The mount service didn't unmount directories properly, leading to + blocked installations. + + +# 3.2.19 (2020-02-21) # + +This release contains contributions from (alphabetically by first name): + - Anke Boersma + - Camilo Higuita + - Gabriel Craciunescu + +## Core ## + - *Assamese* translation has been completed. + - Translations are now loaded from more places: instead of **only** + being compiled in to the Calamares executable, they can now be + read from the current directory (when Calamares is run in developer + mode) and from the application data directory.This allows updating the + translations without requiring a recompile: helpful for translators + and possibly for distributions with their own translation style. + See the translators and deployers wiki for details. + - A new `ViewStep` base class, `QmlViewStep`, has been added that loads + a configurable QML file and plays it. This is used by the new *notesqml* + module -- which is in itself a minimal wrapper around the same that + adds only a translatable module name. + +## Modules ## + - The *machineid* and *users* modules now prefer high-quality random + data from `/dev/urandom` rather than pseudo-random data. #1254 + - A new *notesqml* module supports loading QML. This can be used for + "fancy" release notes as a QML application, rather than a webview + or text widget. Note that this does not replace the slideshow-during- + installation module. + - The *users* module now has knobs for setting the hostname and writing + the `/etc/hosts` file. The new configuration options are documented + in `users.conf`. #1140 + - Multiple *netinstall* modules can exist side-by-side, and they each + control the package installation for their part of the package list. + Previously, a netinstall module would overwrite all of the package + configuration done by other netinstall modules. Translations can be + provided in the configuration file, `netinstall.conf`. #1303 + - The *fstab* module no longer "claims" all the swap partitions it finds + on disk. It only uses swap specified for the current installation. + This means that "replace" and "alongside" installations will have + no swap configured in the target system. + + +# 3.2.18 (2020-01-28) # + +This release contains contributions from (alphabetically by first name): + - Bill Auger + +## Core ## + - *Assamese* translation has been added (still in preliminary state). + - Timezone support code has migrated into the core of Calamares. This + means that modules now have easier access to timezone information. + Translations for timezones have also been enabled, so it is **possible** + at least to translate the displayed zones in the *locale* module. + - Branding can now specify whether to (try to) display the Calamares window + in the middle of the desktop or not. The *windowPlacement* key in + `branding.desc` specifies *center* or *free* placement. + +## Modules ## + - All modules can now set a new key in `module.desc` called *noconfig*. + If this key is set to `true` (the default is `false), no configuration + file is searched-for or loaded, and no warning is printed if the + configuration is missing. This should tidy up some unnecessary warnings + on startup. #1302 #1301 + - The *license* module has seen a significant change to its looks. + Actions are now labeled more clearly, and the URL (or filename) + for each license is displayed. + - The *locale* module now supports translations for timezone and + location names (e.g. "Berlin" is "Berlijn" in Dutch). + - *Packagechooser* is a little more careful with displaying + default and empty package names. (thanks to Bill Auger) + - The *unpackfs* module now carries a larger weight in the overall + progress of the installation, which should resolve downstream reports + like "progress stops at 24% for a long time". This is currently + hard-coded, but will become configurable in a future release. #1176 + + +# 3.2.17.1 (2019-12-02) # + +This is a hotfix release for a bug in the grubcfg module. +Reported by Philip Mueller and Erik Dubois. + +## Modules ## + - The *grubcfg* module had a typo in it that made installations fail. + + +# 3.2.17 (2019-11-28) # + +This release contains contributions from (alphabetically by first name): + - Bill Auger + +## Core ## + - A translation "string freeze" is now enforced by the release scripts. + +## Modules ## + - A new module, *hostinfo*, places information about the host into + Global Storage. This can support contextualprocess modules that + need that information. + - The password-checks in the *users* module are now ordered consistently. + A new check *nonempty* can be used to explicitly check for a non-empty + password. This was previously hard-coded. If you have no other + password-requirements set (e.g. minimum-length) and rely on + Calamares to filter out empty passwords, add this check. + - The *grubcfg* module has a new configuration setting *keepDistributor* + which prevents replacing the `GRUB_DISTRIBUTION` line when writing + the new configuration. #1201 + - *packagechooser* documentation has been updated. + - *welcome* module now works better with dark themes. + - The *license* module could get into a confused state, now fixed. #1271 + + +# 3.2.16 (2019-11-01) # + +This release contains contributions from (alphabetically by first name): + - Bill Auger + +## Core ## + - Some obscure build scenarios which would lead to bogus module-is- + misconfigured messages on startup have been resolved. + +## Modules ## + - The explanatory messages on the *users* page have moved to tooltips, + and placeholder text has been added to the fields. #1202 + - The bad-password messages in the *users* page have been improved. #1261 + - Password-checking in the *users* module has been substantially + changed. A new key *allowWeakPasswords* can be used to introduce + an additional checkbox to the page, which can then be used to + switch off strict password checking. (Thanks to Bill Auger) + - The icons used in password warnings on the *users* page have been + changed to the colorful status icons (rather than the thin red X). + + +# 3.2.15 (2019-10-11) # + +This release contains contributions from (alphabetically by first name): + - No other contributors this time around. + +## Core ## + - No changes to core functionality + +## Modules ## + + - *displaymanager* module now treats *sysconfig* as a regular entry in the + *displaymanagers* list, and the *sysconfigSetup* key is used as a + shorthand to force **only** that entry in the list. #1253 + - *machineid* module has been re-written in C++ and extended with + a new configuration key to generate urandom pool data. #1252 + - *unpackfs* now supports a special *sourcefs* value of `file` + for copying single files (optionally with renaming) or directory + trees to the target system. + - *unpackfs* now support an *exclude* and *excludeFile* setting for + excluding particular files or patters from unpacking. #1229 + + +# 3.2.14 (2019-09-30) # + +This release contains contributions from (alphabetically by first name): + - Andrius Štikonas + - Harald Sitter + +## Core ## + - No changes to core functionality + +## Modules ## + + - *locale* module no longer recognizes the legacy GeoIP configuration. + This has been deprecated since Calamares 3.2.8 and is now removed. + - *packagechooser* module can now be custom-labeled in the overall + progress (left-hand column). #1228 + - *displaymanager* module now recognizes KDE Plasma 5.17. + - *displaymanager* module now can handle Wayland sessions and can detect + sessions from their .desktop files. #1247 #1248 + - *unpackfs* now has special handling for *sourcefs* setting "file" + (so you can copy single files or directories that are on the source + system, directly to the target). #1188 #1181 + + +# 3.2.13 (2019-08-30) # + +This release contains contributions from (alphabetically by first name): + - Arnaud Ferraris + - Arnaud Rebillout + - Bill Auger + - Kevin Kofler + +## Core ## + +- The Calamares standard coding style -- embodied in `ci/calamaresstyle` + has had a few updates and has now been consistently applied across + the core codebase (e.g. libcalamares, libcalamaresui, calamares, but + not the modules). +- *KCoreAddons* is now a required dependency. This lets us drop a chunk + of code that was copied from KCoreAddons years ago, and use the + (maintained!) upstream version instead. It also gives us KMacroExpander + everywhere, which will simplify code for handling substitutions + in configuration files. +- *Slideshows* now have a new property *activatedInCalamares* which + controls the keyboard shortcuts (and can control timers and other + properties of the slideshow, too). + +## Modules ## + +- The *packagechooser* module can load data from the config-file, + from AppData XML files referred by the config-file, and (new) also + from AppStream caches by referring to an application's AppStream id. #1212 +- The *partition* module now understands the units *KB*, *MB*, *GB* which + are powers-of-ten sizes, alongside the powers-of-two sizes that it already + used. (thanks to Arnaud) +- The *welcome* module now supports a *Donate* button if *showDonateUrl* + is set to a non-empty URL. #1197 +- The *welcome* module can have URLs for the various buttons configured + directly in the module configuration (rather than in `branding.desc`). + + +# 3.2.12 (2019-08-07) # + +This release contains contributions from (alphabetically by first name): + - apt-ghetto + - Bill Auger + - embar + +## Core ## + + - Preliminary work to allow jobs to have a *weight* assigned to them + has been added. This will allow the progress bar to better reflect + progress by the amount of work done rather than purely by the + number of jobs. (Thanks to Bill Auger) + - Preliminary work has been added to post the installation log to a + pastebin for bug reporting. (Thanks to Bill Auger) + - Support for translated human-readable strings in Calamares + config files has been added. This is used only in the *packagechooser* + module (see below) but will expand to those modules that need + user-visible strings from the configuration file (existing + solutions need either gettext or Qt support). + - Esperanto is now available when Qt version 5.12.2 or later is used. + +## Modules ## + + - *fstab* A new configuration key *efiMountOptions* has been added, to + allow setting filesystem options specifically for the EFI partition. + (Thanks to apt-ghetto) + - *packagechooser* is a new module for low-density package choices, + e.g. for selecting a default desktop environment, or adding some + proprietary drivers, or chosing browsers of office suites. It presents + **one** collection of items -- at most ten or so, because of the UI -- + and the user can select zero or more of them. The behavior is + configurable, and package information can be set through the Calamares + configuration file or by reading AppData files for the packages. #426 + + +# 3.2.11 (2019-07-06) # + +This release contains contributions from (alphabetically by first name): + - No other contributors this time around. + +This is a security release with no functional changes (except for +improved security) relative to 3.2.10. The Calamares team would like +to acknowledge the help of the following people in reporting and +understanding the issues (alphabetically by first name): + - Kevin Kofler + - Seth Arnold + - Simon Quigley + - Thomas Ward +Both CVE's have been resolved. + +## Core ## + +No core changes. + +## Modules ## + + - *initramfs* could create an initramfs with insecure permissions. + Since the keyfile is included in the initramfs, an attacker could + read the file from the initramfs. #1190 CVE-2019-13178 + - *luksbootkeyfile* created a key file where a window of opportunity + existed where the key file could have too-lax file permissions. + #1191 CVE-2019-13179 + + +# 3.2.10 (2019-06-28) # + +This release contains contributions from (alphabetically by first name): + - No other contributors this time around. + +Distributions are **advised** to check the slideshow they use for the +installation step; changes in loading and translation mechanisms may +require changes in the slideshow. + +## Core ## + + - With this release, option *WITH_PYTHONQT* changes default to **off**. + There does not seem to be any serious use of the PythonQt API and + the UI opportunities it offers, so begin the process of deprecating + and removing that. Sometime in the future, QML pages will fill the + gap for easily-prototyped-yet-slick UI elements. + - A crash when no *finished* page (or rather, no page at all) is + configured after the last *exec* section of the sequence has been + solved. The *finished* page can be left out (but then you don't get + the restart-now functionality). #1168 + - The *slideshow* which is run during installation now has API versions. + API version 1 (the default) runs as before, where the slideshow is loaded + when the installation starts. API version 2 loads the slideshow on + Calamares startup, thus improving responsiveness. Documentation + in `src/branding/README.md`. #1152 + - The example slideshow now uses API version 2. + +## Modules ## + + - *initramfs* has been changed from a Python module to a C++ module. + Packaging will need to adjust now it installs a .so instead of a .py. + The module itself functions as before. It does have a new configuration + option, to change the version passed as to the `-k` option of + update-initramfs. #1180 + - *partition* Now has its own setting for *requiredStorage*, duplicating + the same setting in the *welcome* module. This is useful for + configurations where no *welcome* module is used, but a minimum + size must be checked anyway. #1169 + + +# 3.2.9 (2019-06-03) # + +This release contains contributions from (alphabetically by first name): + - Kevin Kofler + +## Core ## + +No user- or deployer-visible changes. Bugfixing as usual, see the +milestone for details. + +## Modules ## + + - *branding* now supports os-release variables in the *strings* section, + which allows re-using (at runtime) information set in /etc/os-release . + This requires KDE Frameworks 5.58. #1150 + - *branding* allows the use of FreeDesktop.org icon names for the + *productLogo* and *productIcon* keys. If a file is named there, then + the file is used, and otherwise the icon is looked up in the current + theme. #1160 + - *packages* On Arch, with the `pacman` package manager, avoid a hang + during system update. #1154 + - *welcome* allows a custom image path or icon name to be set for the + language-selection drop-down (instead of the international standard one). + + +# 3.2.8 (2019-05-10) # + +This is a **source-incompatible** release of Calamares. Include files +have been shuffled around, so third-party C++ modules will need +adjustment to the changed names. + +This release contains contributions from (alphabetically by first name): + - Arnaud Ferraris + - Kevin Kofler + +## Core ## + + - All user-visible texts referring to "MB" and "GB" now use the standard + "MiB" and "GiB" wording, which matches what we were actually calculating + with (i.e. 2^20 and 2^30 respectively). #1129 + - The side-pane, which shows the list of steps that will be executed, + now tries to fit the text (name of each module) into the available space + by shrinking the font as needed. #1137 + - *libcalamares* (accidentally) linked with Qt's GUI libraries when + PythonQt was found. This led to the odd situation where the non-GUI + Calamares library depends on a bunch of GUI libraries. + - *libcalamares* The `utils/` subdirectory has been hugely refactored, + with functionality split out into separate files. C++ modules will + need to have their `#include` names updated. Basically, users of + `utils/CalamaresUtils.h` will need to include the header file for + the functionality that is actually used. + +## Modules ## + + - *finished* has a new mechanism for configuring the behavior of the + *restart now* button. The old-style boolean configuration is still + supported but generates a warning. #1138 + - *locale* module GeoIP configuration has a new preferred format. + See `locale.conf` for details. The old configuration is still + supported but will be phased out before 3.3.0 -- in particular, + support for "legacy" format will be removed, since that was a + crutch for the disappearance of one GeoIP provider in 2018. + - *oemid* is a new module for configuring OEM phase-0 (image pre-mastering, + or pre-deployment) things. It has limited functionality at the moment, + writing only a single batch-identifier file. #943 + - *welcome* can now do GeoIP lookups as well (but be careful with the + configuration, since you need a GeoIP that provides country information, + not just timezones). This will let Calamares select a starting language + that matches where it is -- which might not be useful at all. #934 + - All Python modules now bail out gracefully on (at least some) bad + configurations, rather than raising an exception. The pre-release + scripts now test for exceptions to avoid shipping modules with + ImportError or SyntaxError results. + + +# 3.2.7 (2019-04-27) # + +This is a **hotfix** release for regressions introduced in the +Python modules. The *localecfg* module was unusable because of +a missing `import`. + + +# 3.2.6 (2019-04-25) # + +This release contains contributions from (alphabetically by first name): + - Arnaud Ferraris + - Dominic Hayes (feren) + - Raul Rodrigo Segura (raurodse) + +## Core ## + + * Under-the-hood code cleanups in lots of parts of the core. Calamares now + builds without warnings when Clang 8 is used. + * A new *disable-cancel-during-exec* setting provides more fine-grained + control than *disable-cancel*, which hides the button entirely. + #1122 (Thanks to Dominic, FerenOS) + * A branding module can now also cause a stylesheet to be loaded, which + will be applied to the widgets inside Calamares. #961 (Thanks to Raul) + +## Modules ## + + * All of the Python-based modules now have translations enabled. #991 + * *Displaymanager* module has improved support for LightDM configuration. + #1123 (Thanks to Dominic, FerenOS) + * *License* module can now display local files inline, and scrolls to + allow longer lists of licenses and to support long license texts + displayed inline. #1124 #1125 #1052 + * *Partition* module has additional checks for validity partition layouts. + #1127 (Thanks to Arnaud) + * *Welcome* module has improved usability: a standard icon + alongside the *Language* label, for improved recognition, + and improved language-list display and sorting. #1107 + + +# 3.2.5 (2019-04-15) # + +This release contains contributions from (alphabetically by first name): + - Arnaud Ferraris + - Dan Simmons + - Gabriel Craciunescu + +## Core ## + + * View modules (in C++) can now perform their own requirements-checking + to see if installation makes sense. This expands upon the existing + requirements checks in the welcome module (RAM, disk space, ..). + The checks have been made asynchronous, so that responsiveness during + requirements-checking is improved and the user has better feedback. + * Support for building an AppImage of Calamares has been added to the + `ci/` directory. There are use-cases where a containerized build and + configuration make sense rather than having Calamares installed in the + host system. (Thanks to the AppImage team, Alexis) + * OEM mode (phase-1) now correctly refers to Calamares as a "Setup Program" + rather than an installer. #1100 (Thanks to Arnaud) + +## Modules ## + + * *Bootloader* module: a serious bug introduced in 3.2.4 which prevents + succesful boot after installation on EFI machines, has been repaired. + (Thanks to Gabriel) #1104 + * *Displaymanager* module: it is no longer a fatal error to not have any + display-managers. #1095 + * *Partition* module: it is now possible to build without libparted. Since + KPMCore may not need this library anymore, it is a dependency that will + be dropped as soon as it is feasible. Add this to the CMake flags: + `-DCMAKE_DISABLE_FIND_PACKAGE_LIBPARTED=ON` + * *Partition* module: the location that is selected for the bootloader, + no longer changes when a new partition is created. #1098 + * Python modules: several modules have had translations added. This is + usually only visible when the module runs as part of the *exec* step, + when the module's *pretty name* is displayed. In addition, some error + messages are now translated. + * *UnpackFS* module: improved progress reporting and tests. #565 + + +# 3.2.4 (2019-02-12) # + +This release contains contributions from (alphabetically by first name): + - Alf Gaida + - aliveafter1000 + - Arnaud Ferraris + - Caio Jordão Carvalho + - Collabora LTD + - Gabriel Craciunescu + - Kevin Kofler + - Philip Mueller + - Scott Harvey + +## Core ## + + * The Calamares application now recognizes the `-X` or `--xdg-config` + option, which adds XDG_DATA_DIRS to the places used to find QML + and branding directories, and XDG_CONFIG_DIRS to the places used + to find the global settings and module configurations. This allows + a more fine-grained, and more layered, approach to setting up + Calamares configurations (in particular, distro's can **add** + configuration files and give them priority, instead of **forking** + configuration files). + * The *branding* file now contains settings that control the size + and resize behavior of Calamares. See the branding file for + more documentation. In particular, the setting *windowExpanding* + can be set to *normal*, *fullscreen* or *noexpand*. + * The `settings.conf` file can now configure whether the *Cancel* button + is shown (this isn't a branding thing, because it's quite fundamental + to the workflow of the installer). + +## Modules ## + + * The *partition* module supports RAID devices, but only when Calamares + is compiled with the newest KPMCore release (3.3.0). + * The calculation of required space -- including swap -- has been simplified, + and Calamares no longer reserves 2GiB of space in calculations for internal + use (this means that it no longer mysteriously drops swap when the disk + size is close to the required installation size). + * The name of the type of default filesystem (e.g. ext4 or btrfs) is now handled + case- and localization-insensitively. This means that *btrfs* is now always + an acceptable spelling. + * The currently-selected disk device is remembered between manual partitioning + and the partitioning-overview pages. (Thanks to Arnaud) + * *partition* There is new support for partitioning layout presets. + See `partition.conf` for documentation and details. + * The *keyboard* module now handles the (bogus) Austrian keymap for + the system console properly. (Thanks to Kevin) + * The *preservefiles* module now has a mechanism for setting the permissions + (and ownership) of preserved files. (Thanks to Scott) + * New module *fsresizer* can be used to resize filesystems. It is intended + for use in OEM installs where an image of fixed size is created, + and then sized to the actual SD card the user has used. + * The *mount* module now handles missing *extraMounts* and *extraMountsEfi* + keys gracefully (this is probably a misconfiguration, though, and gives a + warning). + * The *packages* module now supports pre- and post-script options + for all operations, not just during install (keep in mind that + these run as three separate shells, though). + * A new *rawfs* module supports straightforward copying of filesystems from + the installation media to the target stystem. This can be used, for instance, + for block-level-identical installations. + + +# 3.2.3 (2019-01-09) # + +This release contains contributions from (alphabetically by first name): + - aliveafter1000 + +## Core ## + +There are no core changes in this release. + +## Modules ## + + * *partition* Fixed bug where, during detection of existing systems, the + existing system partitions may be mounted and then files deleted. + This is a **limited** version of the patch from aliveafter1000 + that will be in 3.2.4, which tries harder to mount filesystems + read-only and unmodifiable. + * *locale* It was possible to set the installer and system language + (e.g. to German) while the global storage value for *locale* + remained set to English. Then no localization packages are installed + (see feature `${LOCALE}` in `packages.conf`). Reported downstream + in Netrunner. + + +# 3.2.2 (2018-09-04) # + +This release contains contributions from (alphabetically by first name): + - Andrius Štikonas + - artoo@cromnix.org + - Caio Jordão Carvalho + - Harald Sitter + - Philip Müller + - Simon Quigley + - Walter Lapchynski + +## Core ## + + * Example configurations are **no longer installed** by default. + The default setting for *INSTALL_CONFIG* has changed. Distributions + are strongly encouraged to write their own configuration files and + not rely on the example configuration files. Example configurations + may change unpredictably. + * It is now possible to express module dependencies through the + *requiredModules* key in `module.desc`. All of the required modules + for a given module must occur in the sequence **before** the module + requiring them. None of the core modules use this facility. + * The search paths for QML files, branding descriptors and module + descriptors have been revamped and now self-document in the log. + * A new `ci/RELEASE.sh` script has been added to streamline releases; + it is not guaranteed to work anywhere in particular though. + +## Modules ## + + * When multiple modules are mutually exclusive, or don't make sense + to enable concurrectly, a new `USE_` framework has been added + to CMake to simplify the selection of modules. This is in addition + to the existing `SKIP_MODULES` mechanism. + * Various off-by-one-sector errors in the automatic partitioning + mode have been corrected. In addition, swap space is calculated + a little more conservatively. + * A new module has been added to the core which can configure openrc + services. To make services configuration consistent: + - The *services* module has been **renamed** *services-systemd*, + - The openrc module is named *services-openrc*, + - At CMake time, it is possible to select all of the services modules, + or one specific one, by setting the *USE_services* CMake variable. + By default, all of the modules are built and installed. + * The systemd-services module can now disable targets and mask both + targets and services (which will allow you to break the system with + a bad configuration). The configuration is a little more flexible + because a service (or target) name can be used on its own with + sensible defaults. + * The displaymanager module has been entirely revamped. A long-standing + bug which ignored the settings for default desktop has been fixed + (thanks to Walter Lapchynski). Translations have been added to the + error messages. Each DM now has an implementation class for doing + all the configuration steps it needs. This groups the code needed for + a specific DM (and presumably, per-distro) in one place. + Distro's are **strongly advised** to re-test their DM configuration + and installation with the revamped code. + +# 3.2.1 (2018-06-25) # + +This release contains contributions from (alphabetically by first name): + - Bill Auguer + - Gabriel Craciunescu + - Phil Mueller + - Raul Rodrigo Segura + +## Core ## + + * Qt 5.7 is now the minimum required Qt version. Because KPMCore + (a fairly fundamental dependency) requires Qt 5.7, Calamares + has followed suit. + * New testing application `loadmodule` for loading and running a + single Calamares module. + * New translations Belarussian and Korean. + * Jobs can now be *emergency jobs* which run even after a failure. + * Improved debugging when modules fail to load. + * Bad configuration files will now cause the user-interface of + Calamares to display an error message, rather than silently + ignoring some configuration errors. This will certainly cause + problems for distributions with sloppy configurations. + +## Modules ## + + * New module preservefiles, keeps (log) files around after install; + this duplicates functionality with the unmount module, but unmount + is very late, rather limited, and fragile. + * Interactiveterminal module now disables itself if build requirements + are not met, rather than blocking the build. + * Fixes in the timezone map data make the southern hemisphere more + usable and put Reykjavik in its place. + * The packages module can now update the target system if explicitly + told to do so. + * More paths and executables are configurable in the bootloader module. + * Distributions are advised to review the `users.conf` setup **again**, + as some changes in version 3.2.0 caused regressions downstream. + * Distributions are advised to review their `locale.gen` files + **again**. Previous changes were too restrictive, matching only + the specific format Chakra Linux uses. Calamares now preserves + all the comment-lines in the file and writes enabled locales + at the end, with a descriptive comment. + +# 3.2.0 (2018-05-17) # + +This release contains contributions from (alphabetically by first name): + - Alf Gaida + - AlmAck + - Caio Jordão Carvalho + - Frede H + +## Modules ## + + * UI annoyances in the partitioning module were fixed; the + mount-point selector is now more obvious when no mount-point + has been chosen, and the mount-point and flags are preserved + when (re)editing partitions. + * The handling of `@@ROOT@@` substitution in shellprocesses was + backwards; this has been fixed (the substitution is made when + running in the **host**). + * The user shell is no longer hard-coded to `/bin/bash`, + but follows the default setting for useradd(8), e.g. + those set in `/etc/default/useradd`. From 72701aae213a2d8357e9cd170b2ad94a20fdca31 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 29 Mar 2021 10:15:29 +0200 Subject: [PATCH 002/160] CMake: pick a build type (if none given explicitly) --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4ac77946..b17e99ac3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,6 +201,15 @@ set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" ) set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings" ) +# If no build type is set, pick a reasonable one +if( NOT CMAKE_BUILD_TYPE ) + if ( CALAMARES_RELEASE_MODE ) + set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) + else() + set( CMAKE_BUILD_TYPE "Debug" ) + endif() +endif() + if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." ) From 8ab1a4fb30bea32b73d7de9e451427109b0950b9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 28 Mar 2021 18:51:44 +0200 Subject: [PATCH 003/160] CMake: require 3.16 This is just prep-work: from here, we can re-work FindBoost usage and the FindPython things as well. --- CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b17e99ac3..18eeae5cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,15 +38,24 @@ # One special target is "show-version", which can be built # to obtain the version number from here. -# TODO:3.3: Require CMake 3.12 -cmake_minimum_required( VERSION 3.3 FATAL_ERROR ) +cmake_minimum_required( VERSION 3.16 FATAL_ERROR ) + +set( CALAMARES_VERSION 3.3.0 ) +set( CALAMARES_RELEASE_MODE OFF ) # Set to ON during a release + +if ( CMAKE_SCRIPT_MODE_FILE ) + include( ${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake ) + set( CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} ) + extend_version( ${CALAMARES_VERSION} OFF _vshort _vlong ) + message( "${_vlong}" ) + return() +endif() + project( CALAMARES - VERSION 3.2.43 + VERSION ${CALAMARES_VERSION} LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development - ### OPTIONS # option( INSTALL_CONFIG "Install configuration files" OFF ) From 5a82c8123bd36ada05a92b741f6739b9011480f6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 28 Mar 2021 18:31:51 +0200 Subject: [PATCH 004/160] CMake: require Qt 5.15 (the LTS, all current distro's have it) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18eeae5cc..ef707fc54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,7 +154,7 @@ set( _tx_incomplete eo es_PE fr_CH gu id_ID ie kk kn ko_KR lo lv mk ### Required versions # # See DEPENDENCIES section below. -set( QT_VERSION 5.9.0 ) +set( QT_VERSION 5.15.0 ) set( YAMLCPP_VERSION 0.5.1 ) set( ECM_VERSION 5.18 ) set( PYTHONLIBS_VERSION 3.3 ) From adc3af0345b23db7716567e134e2b9aebcf34573 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 28 Mar 2021 18:46:39 +0200 Subject: [PATCH 005/160] CMake: explicitly suppress old API --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef707fc54..6bab3738b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,6 +280,8 @@ if( CMAKE_COMPILER_IS_GNUCXX ) endif() endif() +# API that was deprecated before Qt 5.15 causes a compile error +add_compile_definitions( QT_DISABLE_DEPRECATED_BEFORE=0x050f00 ) ### DEPENDENCIES # From 396746acc11ac1457e8020c7f8171fe9588a59da Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sun, 28 Mar 2021 18:47:34 +0200 Subject: [PATCH 006/160] [libcalamares] Warnings-- for renamed enum value Remove the before-Qt 5.15 ifdeffery and just keep the current flags for NetworkManager. --- src/libcalamares/network/Manager.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/libcalamares/network/Manager.cpp b/src/libcalamares/network/Manager.cpp index 6cb270ecd..536474b2b 100644 --- a/src/libcalamares/network/Manager.cpp +++ b/src/libcalamares/network/Manager.cpp @@ -29,16 +29,11 @@ namespace Network void RequestOptions::applyToRequest( QNetworkRequest* request ) const { -#if QT_VERSION < QT_VERSION_CHECK( 5, 15, 0 ) - constexpr const auto RedirectPolicyAttribute = QNetworkRequest::FollowRedirectsAttribute; -#else - constexpr const auto RedirectPolicyAttribute = QNetworkRequest::RedirectPolicyAttribute; -#endif if ( m_flags & Flag::FollowRedirect ) { // Follows all redirects except unsafe ones (https to http). - request->setAttribute( RedirectPolicyAttribute, true ); + request->setAttribute( QNetworkRequest::RedirectPolicyAttribute, true ); } if ( m_flags & Flag::FakeUserAgent ) From a27b72e893ef915c6cce5959296bff77e83fa7d7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 28 Apr 2021 11:50:57 +0200 Subject: [PATCH 007/160] CMake: introduce consistent CMake style The tool "gersemi" [1] formats CMake code. It is an opinionated and slightly simplistic "just work" formatter. Let's see how it does on Calamares CMake code. [1] https://github.com/BlankSpruce/gersemi --- .gersemirc | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gersemirc diff --git a/.gersemirc b/.gersemirc new file mode 100644 index 000000000..11ad22911 --- /dev/null +++ b/.gersemirc @@ -0,0 +1,6 @@ +color: false +definitions: [ CMakeModules/CalamaresAddTest.cmake ] +line_length: 120 +quiet: false +unsafe: false + From 5975ff9e423553624dc1a274cb34348edb4be129 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 11:45:12 +0200 Subject: [PATCH 008/160] CMake: drop NAME option from add_test - drop the unused "NAME" option for calamares_add_test - while here reformat the module with the CMake style tool --- CMakeModules/CalamaresAddTest.cmake | 33 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/CMakeModules/CalamaresAddTest.cmake b/CMakeModules/CalamaresAddTest.cmake index cd757bb88..b40e92939 100644 --- a/CMakeModules/CalamaresAddTest.cmake +++ b/CMakeModules/CalamaresAddTest.cmake @@ -18,19 +18,17 @@ # SOURCES # ) -include( CMakeParseArguments ) -include( CalamaresAutomoc ) +include(CMakeParseArguments) +include(CalamaresAutomoc) -function( calamares_add_test ) - # parse arguments (name needs to be saved before passing ARGN into the macro) - set( NAME ${ARGV0} ) - set( options GUI ) - set( oneValueArgs NAME RESOURCES ) - set( multiValueArgs SOURCES LIBRARIES DEFINITIONS ) - cmake_parse_arguments( TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) - set( TEST_NAME ${NAME} ) +function(calamares_add_test name) + set(options GUI) + set(oneValueArgs RESOURCES) + set(multiValueArgs SOURCES LIBRARIES DEFINITIONS) + cmake_parse_arguments(TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(TEST_NAME ${name}) - if( ECM_FOUND AND BUILD_TESTING ) + if(ECM_FOUND AND BUILD_TESTING) ecm_add_test( ${TEST_SOURCES} ${TEST_RESOURCES} TEST_NAME @@ -40,15 +38,18 @@ function( calamares_add_test ) ${TEST_LIBRARIES} Qt5::Core Qt5::Test - ) + ) calamares_automoc( ${TEST_NAME} ) # We specifically pass in the source directory of the test-being- # compiled, so that it can find test-files in that source dir. - target_compile_definitions( ${TEST_NAME} PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} ) - if( TEST_GUI ) - target_link_libraries( ${TEST_NAME} Calamares::calamaresui Qt5::Gui ) + target_compile_definitions( + ${TEST_NAME} + PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS} + ) + if(TEST_GUI) + target_link_libraries(${TEST_NAME} Calamares::calamaresui Qt5::Gui) endif() - if( TEST_RESOURCES ) + if(TEST_RESOURCES) calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} ) endif() endif() From 714605ebaa38940b0aaefdeb00bc591d0c7595fc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 12:04:29 +0200 Subject: [PATCH 009/160] [libcalamaresui] Missing header, needed in Qt 5.15 --- src/libcalamaresui/utils/ImageRegistry.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index 3ae519f55..647893d64 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -8,6 +8,7 @@ #include "ImageRegistry.h" +#include #include #include #include From 1bd56282566d1a32b56e176df6ae666e50b8ba56 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 12:04:50 +0200 Subject: [PATCH 010/160] [libcalamaresui] Redundant call, not available in Qt 5.15 anyway --- src/libcalamaresui/utils/CalamaresUtilsGui.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp index e16763a70..1014527af 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp @@ -181,7 +181,6 @@ void unmarginLayout( QLayout* layout ) { layout->setContentsMargins( 0, 0, 0, 0 ); - layout->setMargin( 0 ); layout->setSpacing( 0 ); for ( int i = 0; i < layout->count(); i++ ) From a6ba3dfce0ac3c286c1be9fdc0fff8910081c42c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 12:08:14 +0200 Subject: [PATCH 011/160] [license] Adjust to Qt 5.15 deprecations --- src/modules/license/LicensePage.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/license/LicensePage.cpp b/src/modules/license/LicensePage.cpp index 8700aad60..bafc9f463 100644 --- a/src/modules/license/LicensePage.cpp +++ b/src/modules/license/LicensePage.cpp @@ -98,7 +98,12 @@ LicensePage::LicensePage( QWidget* parent ) CalamaresUtils::unmarginLayout( ui->verticalLayout ); ui->acceptFrame->setStyleSheet( mustAccept ); - ui->acceptFrame->layout()->setMargin( CalamaresUtils::defaultFontHeight() / 2 ); + { + // The inner frame was unmargined (above), reinstate margins so all are + // the same *x* (an x-height, approximately). + const auto x = CalamaresUtils::defaultFontHeight() / 2; + ui->acceptFrame->layout()->setContentsMargins( x, x, x, x ); + } updateGlobalStorage( false ); // Have not agreed yet From 261c3587a5efa0d1171f7d9a0fa1a5d1d727c7a2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 13:37:38 +0200 Subject: [PATCH 012/160] [calamares] Use DBus activation instead of KDSAG --- .../kdsingleapplicationguard/LICENSE.LGPL.txt | 488 ------- .../kdlockedsharedmemorypointer.cpp | 481 ------- .../kdlockedsharedmemorypointer.h | 121 -- .../kdsharedmemorylocker.cpp | 46 - .../kdsharedmemorylocker.h | 42 - .../kdsingleapplicationguard.cpp | 1256 ----------------- .../kdsingleapplicationguard.h | 147 -- .../kdtoolsglobal.cpp | 42 - .../kdsingleapplicationguard/kdtoolsglobal.h | 120 -- .../kdsingleapplicationguard/pimpl_ptr.cpp | 209 --- 3rdparty/kdsingleapplicationguard/pimpl_ptr.h | 50 - CHANGES | 7 +- CMakeLists.txt | 15 +- LICENSES/LGPL-2.0-only.txt | 488 ------- src/calamares/CMakeLists.txt | 16 +- src/calamares/main.cpp | 26 - 16 files changed, 14 insertions(+), 3540 deletions(-) delete mode 100644 3rdparty/kdsingleapplicationguard/LICENSE.LGPL.txt delete mode 100644 3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp delete mode 100644 3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.h delete mode 100644 3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp delete mode 100644 3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.h delete mode 100644 3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp delete mode 100644 3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h delete mode 100644 3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp delete mode 100644 3rdparty/kdsingleapplicationguard/kdtoolsglobal.h delete mode 100644 3rdparty/kdsingleapplicationguard/pimpl_ptr.cpp delete mode 100644 3rdparty/kdsingleapplicationguard/pimpl_ptr.h delete mode 100644 LICENSES/LGPL-2.0-only.txt diff --git a/3rdparty/kdsingleapplicationguard/LICENSE.LGPL.txt b/3rdparty/kdsingleapplicationguard/LICENSE.LGPL.txt deleted file mode 100644 index df942b1ff..000000000 --- a/3rdparty/kdsingleapplicationguard/LICENSE.LGPL.txt +++ /dev/null @@ -1,488 +0,0 @@ - - The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - - You may use, distribute and copy the KD Tools Library under the terms of - GNU Library General Public License version 2, which is displayed below. - -------------------------------------------------------------------------- - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp b/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp deleted file mode 100644 index 284870e06..000000000 --- a/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#include "kdlockedsharedmemorypointer.h" - -#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) -#ifndef QT_NO_SHAREDMEMORY - -namespace kdtools -{ -} -using namespace kdtools; - -KDLockedSharedMemoryPointerBase::KDLockedSharedMemoryPointerBase( QSharedMemory * m ) - : locker( m ), - mem( m ) -{ - -} - -KDLockedSharedMemoryPointerBase::KDLockedSharedMemoryPointerBase( QSharedMemory & m ) - : locker( &m ), - mem( &m ) -{ - -} - -KDLockedSharedMemoryPointerBase::~KDLockedSharedMemoryPointerBase() {} - -void * KDLockedSharedMemoryPointerBase::get() { - return mem ? mem->data() : 0 ; -} - -const void * KDLockedSharedMemoryPointerBase::get() const { - return mem ? mem->data() : 0 ; -} - -size_t KDLockedSharedMemoryPointerBase::byteSize() const { - return mem ? mem->size() : 0; -} - -/*! - \class KDLockedSharedMemoryPointer - \ingroup core raii smartptr - \brief Locking pointer for Qt shared memory segments - \since_c 2.1 - - (The exception safety of this class has not been evaluated yet.) - - KDLockedSharedMemoryPointer is a smart immutable pointer, which gives convenient and safe access to a QSharedMemory data segment. - The content of a KDLockedSharedMemoryPointer cannot be changed during it's lifetime. - - You can use this class like a normal pointer to the shared memory segment and be sure it's locked while accessing it. - \note You can only put simple types/structs/classes into it. structs and classes shall not contain any other pointers. See the - documentation of QSharedMemory for details. -*/ - -/*! - \fn KDLockedSharedMemoryPointer::KDLockedSharedMemoryPointer( QSharedMemory * mem ) - - Constructor. Constructs a KDLockedSharedMemory pointer which points to the data segment of \a mem. - The constructor locks \a mem. If the memory segment is already locked by another process, this constructor - blocks until the lock is released. - - \post data() == mem->data() and the memory segment has been locked -*/ - -/*! - \fn KDLockedSharedMemoryPointer::KDLockedSharedMemoryPointer( QSharedMemory & mem ) - - \overload - - \post data() == mem.data() and the memory segment has been locked -*/ - -/*! - \fn KDLockedSharedMemoryPointer::~KDLockedSharedMemoryPointer() - - Destructor. Unlocks the shared memory segment. - - \post The shared memory segment has been unlocked -*/ - -/*! - \fn T * KDLockedSharedMemoryPointer::get() - - \returns a pointer to the contained object. -*/ - -/*! - \fn const T * KDLockedSharedMemoryPointer::get() const - - \returns a const pointer to the contained object - \overload -*/ - -/*! - \fn T * KDLockedSharedMemoryPointer::data() - - Equivalent to get(), provided for consistency with Qt naming conventions. -*/ - -/*! - \fn const T * KDLockedSharedMemoryPointer::data() const - - \overload -*/ - -/*! - \fn T & KDLockedSharedMemoryPointer::operator*() - - Dereference operator. Returns \link get() *get()\endlink. -*/ - -/*! - \fn const T & KDLockedSharedMemoryPointer::operator*() const - - Dereference operator. Returns \link get() *get()\endlink. - \overload -*/ - -/*! - \fn T * KDLockedSharedMemoryPointer::operator->() - - Member-by-pointer operator. Returns get(). -*/ - -/*! - \fn const T * KDLockedSharedMemoryPointer::operator->() const - - Member-by-pointer operator. Returns get(). - \overload -*/ - -/*! - \class KDLockedSharedMemoryArray - \ingroup core raii smartptr - \brief Locking array pointer to Qt shared memory segments - \since_c 2.1 - - (The exception safety of this class has not been evaluated yet.) - - KDLockedSharedMemoryArray is a smart immutable pointer, which gives convenient and safe access to array data stored in a QSharedMemory - data segment. - The content of a KDLockedSharedMemoryArray cannot be changed during it's lifetime. - - You can use this class like a normal pointer to the shared memory segment and be sure it's locked while accessing it. - \note You can only put arrays of simple types/structs/classes into it. structs and classes shall not contain any other pointers. See the - documentation of QSharedMemory for details. - - \sa KDLockedSharedMemoryPointer -*/ - -/*! - \fn KDLockedSharedMemoryArray::KDLockedSharedMemoryArray( QSharedMemory* mem ) - Constructor. Constructs a KDLockedSharedMemoryArray which points to the data segment of \a mem. The constructor locks \a mem. If the memory - segment is already locked by another process, this constructor blocks until the lock is release. - - \post get() == mem->data() and the memory segment has been locked -*/ - -/*! - \fn KDLockedSharedMemoryArray::KDLockedSharedMemoryArray( QSharedMemory& mem ) - \overload - - \post get() == mem->data() and the memory segment has been locked -*/ - - -/*! - \typedef KDLockedSharedMemoryArray::size_type - Typedef for std::size_t. Provided for STL compatibility. -*/ - -/*! - \typedef KDLockedSharedMemoryArray::difference_type - Typedef for std::ptrdiff_t. Provided for STL compatibility. -*/ - -/*! - \typedef KDLockedSharedMemoryArray::iterator - Typedef for T*. Provided for STL compatibility. - \since_t 2.2 -*/ - -/*! - \typedef KDLockedSharedMemoryArray::const_iterator - Typedef for const T*. Provided for STL compatibility. - \since_t 2.2 -*/ - -/*! - \typedef KDLockedSharedMemoryArray::reverse_iterator - Typedef for std::reverse_iterator< \link KDLockedSharedMemoryArray::iterator iterator\endlink >. Provided for STL compatibility. - \since_t 2.2 -*/ - -/*! - \typedef KDLockedSharedMemoryArray::const_reverse_iterator - Typedef for std::reverse_iterator< \link KDLockedSharedMemoryArray::const_iterator const_iterator\endlink >. Provided for STL compatibility. - \since_t 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::iterator KDLockedSharedMemoryArray::begin() - Returns an \link KDLockedSharedMemoryArray::iterator iterator\endlink pointing to the first item of the array. - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::const_iterator KDLockedSharedMemoryArray::begin() const - \overload - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::iterator KDLockedSharedMemoryArray::end() - Returns an \link KDLockedSharedMemoryArray::iterator iterator\endlink pointing to the item after the last item of the array. - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::const_iterator KDLockedSharedMemoryArray::end() const - \overload - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::reverse_iterator KDLockedSharedMemoryArray::rbegin() - Returns an \link KDLockedSharedMemoryArray::reverse_iterator reverse_iterator\endlink pointing to the item after the last item of the array. - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::const_reverse_iterator KDLockedSharedMemoryArray::rbegin() const - \overload - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::reverse_iterator KDLockedSharedMemoryArray::rend() - Returns an \link KDLockedSharedMemoryArray::reverse_iterator reverse_iterator\endlink pointing to the first item of the array. - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::const_reverse_iterator KDLockedSharedMemoryArray::rend() const - \overload - \since_f 2.2 -*/ - -/*! - \fn KDLockedSharedMemoryArray::size_type KDLockedSharedMemoryArray::size() const - Returns the size of this array. The size is calculated from the storage size of T and - the size of the shared memory segment. - \since_f 2.2 -*/ - -/*! - \fn T& KDLockedSharedMemoryArray::operator[]( difference_type n ) - Array access operator. Returns a reference to the item at index position \a n. -*/ - -/*! - \fn const T& KDLockedSharedMemoryArray::operator[]( difference_type n ) const - \overload -*/ - -/*! - \fn T& KDLockedSharedMemoryArray::front() - Returns a reference to the first item in the array. This is the same as operator[](0). -*/ - -/*! - \fn const T& KDLockedSharedMemoryArray::front() const - \overload -*/ - -/*! - \fn T& KDLockedSharedMemoryArray::back() - Returns a reference to the last item in the array. This is the same as operator[](size()-1). - \since_f 2.2 -*/ - -/*! - \fn const T& KDLockedSharedMemoryArray::back() const - \overload - \since_f 2.2 -*/ - - -#ifdef eKDTOOLSCORE_UNITTESTS - -#include - -#include -#include - -namespace -{ - struct TestStruct - { - TestStruct( uint nn = 0 ) - : n( nn ), - f( 0.0 ), - c( '\0' ), - b( false ) - { - } - uint n; - double f; - char c; - bool b; - }; - - bool operator==( const TestStruct& lhs, const TestStruct& rhs ) - { - return lhs.n == rhs.n && lhs.f == rhs.f && lhs.c == rhs.c && lhs.b == rhs.b; - } - - class TestThread : public QThread - { - public: - TestThread( const QString& key ) - : mem( key ) - { - mem.attach(); - } - - void run() - { - while( true ) - { - msleep( 100 ); - kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem ); - if( !p->b ) - continue; - - p->n = 5; - p->f = 3.14; - p->c = 'A'; - p->b = false; - return; - } - } - - QSharedMemory mem; - }; - - bool isConst( TestStruct* ) - { - return false; - } - - bool isConst( const TestStruct* ) - { - return true; - } -} - - -KDAB_UNITTEST_SIMPLE( KDLockedSharedMemoryPointer, "kdcoretools" ) { - - const QString key = QUuid::createUuid(); - QSharedMemory mem( key ); - const bool created = mem.create( sizeof( TestStruct ) ); - assertTrue( created ); - if ( !created ) - return; // don't execute tests if shm coulnd't be created - - // On Windows, shared mem is only available in increments of page - // size (4k), so don't fail if the segment is larger: - const unsigned long mem_size = mem.size(); - assertGreaterOrEqual( mem_size, sizeof( TestStruct ) ); - - { - kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem ); - assertTrue( p ); - *p = TestStruct(); - assertEqual( p->n, 0u ); - assertEqual( p->f, 0.0 ); - assertEqual( p->c, '\0' ); - assertFalse( p->b ); - } - - { - TestThread thread( key ); - assertEqual( thread.mem.key().toStdString(), key.toStdString() ); - assertEqual( static_cast< unsigned long >( thread.mem.size() ), mem_size ); - thread.start(); - - assertTrue( thread.isRunning() ); - thread.wait( 2000 ); - assertTrue( thread.isRunning() ); - - { - kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem ); - p->b = true; - } - - thread.wait( 2000 ); - assertFalse( thread.isRunning() ); - } - - { - kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem ); - assertEqual( p->n, 5u ); - assertEqual( p->f, 3.14 ); - assertEqual( p->c, 'A' ); - assertFalse( p->b ); - } - - { - kdtools::KDLockedSharedMemoryPointer< TestStruct > p( mem ); - assertEqual( mem.data(), p.get() ); - assertEqual( p.get(), p.operator->() ); - assertEqual( p.get(), &(*p) ); - assertEqual( p.get(), p.data() ); - assertFalse( isConst( p.get() ) ); - } - - { - const kdtools::KDLockedSharedMemoryPointer< TestStruct > p( &mem ); - assertEqual( mem.data(), p.get() ); - assertEqual( p.get(), p.operator->() ); - assertEqual( p.get(), &(*p) ); - assertEqual( p.get(), p.data() ); - assertTrue( isConst( p.get() ) ); - } - - { - QSharedMemory mem2( key + key ); - const bool created2 = mem2.create( 16 * sizeof( TestStruct ) ); - assertTrue( created2 ); - if ( !created2 ) - return; // don't execute tests if shm coulnd't be created - - kdtools::KDLockedSharedMemoryArray a( mem2 ); - assertTrue( a ); - assertEqual( a.get(), mem2.data() ); - assertEqual( &a[0], a.get() ); - - a[1] = a[0]; - assertTrue( a[0] == a[1] ); - - TestStruct ts; - ts.n = 5; - ts.f = 3.14; - a[0] = ts; - assertFalse( a[0] == a[1] ); - assertEqual( a.front().n, ts.n ); - assertEqual( a[0].f, ts.f ); - a[0].n = 10; - assertEqual( a.front().n, 10u ); - ts = a[0]; - assertEqual( ts.n, 10u ); - - std::vector< TestStruct > v; - for( uint i = 0; i < a.size(); ++i ) - v.push_back( TestStruct( i ) ); - - std::copy( v.begin(), v.end(), a.begin() ); - for( uint i = 0; i < a.size(); ++i ) - assertEqual( a[ i ].n, i ); - assertEqual( a.front().n, 0u ); - assertEqual( a.back().n, a.size() - 1 ); - - std::copy( v.begin(), v.end(), a.rbegin() ); - for( uint i = 0; i < a.size(); ++i ) - assertEqual( a[ i ].n, a.size() - 1 - i ); - assertEqual( a.front().n, a.size() - 1 ); - assertEqual( a.back().n, 0u ); - } - -} -#endif // KDTOOLSCORE_UNITTESTS -#endif // QT_NO_SHAREDMEMORY -#endif // QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) diff --git a/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.h b/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.h deleted file mode 100644 index 19fdaa082..000000000 --- a/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#ifndef __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__ -#define __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__ - -#include - -#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) -#ifndef QT_NO_SHAREDMEMORY - -#include "kdsharedmemorylocker.h" -#include - -#include - -#ifndef DOXYGEN_RUN -namespace kdtools { -#endif - -class KDLockedSharedMemoryPointerBase { -protected: - explicit KDLockedSharedMemoryPointerBase( QSharedMemory * mem ); - explicit KDLockedSharedMemoryPointerBase( QSharedMemory & mem ); - ~KDLockedSharedMemoryPointerBase(); - - // PENDING(marc) do we really want const propagation here? I - // usually declare all my RAII objects const... - void * get(); - const void * get() const; - - KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() ) - - size_t byteSize() const; - -private: - KDSharedMemoryLocker locker; - QSharedMemory * const mem; -}; - -template< typename T> -class MAKEINCLUDES_EXPORT KDLockedSharedMemoryPointer : KDLockedSharedMemoryPointerBase { - KDAB_DISABLE_COPY( KDLockedSharedMemoryPointer ); -public: - explicit KDLockedSharedMemoryPointer( QSharedMemory * m ) - : KDLockedSharedMemoryPointerBase( m ) {} - explicit KDLockedSharedMemoryPointer( QSharedMemory & m ) - : KDLockedSharedMemoryPointerBase( m ) {} - - T * get() { return static_cast( KDLockedSharedMemoryPointerBase::get() ); } - const T * get() const { return static_cast( KDLockedSharedMemoryPointerBase::get() ); } - - T * data() { return static_cast( get() ); } - const T * data() const { return static_cast( get() ); } - - T & operator*() { assert( get() ); return *get(); } - const T & operator*() const { assert( get() ); return *get(); } - - T * operator->() { return get(); } - const T * operator->() const { return get(); } - - KDAB_USING_SAFE_BOOL_OPERATOR( KDLockedSharedMemoryPointerBase ) -}; - -template -class MAKEINCLUDES_EXPORT KDLockedSharedMemoryArray : KDLockedSharedMemoryPointerBase { - KDAB_DISABLE_COPY( KDLockedSharedMemoryArray ); -public: - explicit KDLockedSharedMemoryArray( QSharedMemory * m ) - : KDLockedSharedMemoryPointerBase( m ) {} - explicit KDLockedSharedMemoryArray( QSharedMemory & m ) - : KDLockedSharedMemoryPointerBase( m ) {} - - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef T* iterator; - typedef const T* const_iterator; - typedef std::reverse_iterator< const_iterator > const_reverse_iterator; - typedef std::reverse_iterator< iterator > reverse_iterator; - - iterator begin() { return get(); } - const_iterator begin() const { return get(); } - - iterator end() { return begin() + size(); } - const_iterator end() const { return begin() + size(); } - - reverse_iterator rbegin() { return reverse_iterator( end() ); } - const_reverse_iterator rbegin() const { return reverse_iterator( end() ); } - - reverse_iterator rend() { return reverse_iterator( begin() ); } - const_reverse_iterator rend() const { return const_reverse_iterator( begin() ); } - - size_type size() const { return byteSize() / sizeof( T ); } - - T * get() { return static_cast( KDLockedSharedMemoryPointerBase::get() ); } - const T * get() const { return static_cast( KDLockedSharedMemoryPointerBase::get() ); } - - T & operator[]( difference_type n ) { assert( get() ); return *(get()+n); } - const T & operator[]( difference_type n ) const { assert( get() ); return *(get()+n); } - - T & front() { assert( get() ); return *get(); } - const T & front() const { assert( get() ); return *get(); } - - T & back() { assert( get() ); return *( get() + size() - 1 ); } - const T & back() const { assert( get() ); return *( get() + size() - 1 ); } - - KDAB_USING_SAFE_BOOL_OPERATOR( KDLockedSharedMemoryPointerBase ) -}; - -#ifndef DOXYGEN_RUN -} -#endif - -#endif /* QT_NO_SHAREDMEMORY */ - -#endif /* QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) */ - -#endif /* __KDTOOLS__CORE__KDLOCKEDSHAREDMEMORYPOINTER_H__ */ diff --git a/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp b/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp deleted file mode 100644 index 3af326193..000000000 --- a/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#include "kdsharedmemorylocker.h" - -#if QT_VERSION >= 0x040400 || defined( DOXYGEN_RUN ) - -#include - -using namespace kdtools; - -/*! - \class KDSharedMemoryLocker - \ingroup raii core - \brief Exception-safe and convenient wrapper around QSharedMemory::lock() -*/ - -/** - * Constructor. Locks the shared memory segment \a mem. - * If another process has locking the segment, this constructor blocks - * until the lock is released. The memory segments needs to be properly created or attached. - */ -KDSharedMemoryLocker::KDSharedMemoryLocker( QSharedMemory* mem ) - : mem( mem ) -{ - mem->lock(); -} - -/** - * Destructor. Unlocks the shared memory segment associated with this - * KDSharedMemoryLocker. - */ -KDSharedMemoryLocker::~KDSharedMemoryLocker() -{ - mem->unlock(); -} - -#ifdef KDAB_EVAL -#include KDAB_EVAL -static const EvalDialogChecker evalChecker( "KD Tools", false ); -#endif - -#endif diff --git a/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.h b/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.h deleted file mode 100644 index 64b5c267f..000000000 --- a/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#ifndef __KDTOOLS__CORE__KDSHAREDMEMORYLOCKER_H -#define __KDTOOLS__CORE__KDSHAREDMEMORYLOCKER_H - -#include "kdtoolsglobal.h" - -#if QT_VERSION < 0x040400 && !defined( DOXYGEN_RUN ) -#ifdef Q_CC_GNU -#warning "Can't use KDTools KDSharedMemoryLocker with Qt versions prior to 4.4" -#endif -#else - -class QSharedMemory; - -#ifndef DOXYGEN_RUN -namespace kdtools -{ -#endif - -class KDTOOLSCORE_EXPORT KDSharedMemoryLocker -{ - Q_DISABLE_COPY( KDSharedMemoryLocker ) -public: - KDSharedMemoryLocker( QSharedMemory* mem ); - ~KDSharedMemoryLocker(); - -private: - QSharedMemory* const mem; -}; - -#ifndef DOXYGEN_RUN -} -#endif - -#endif - -#endif diff --git a/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp b/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp deleted file mode 100644 index 52eb60d37..000000000 --- a/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp +++ /dev/null @@ -1,1256 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#include "kdsingleapplicationguard.h" - -#if QT_VERSION >= 0x040400 || defined(DOXYGEN_RUN) -#ifndef QT_NO_SHAREDMEMORY - -#include "kdsharedmemorylocker.h" -#include "kdlockedsharedmemorypointer.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#ifndef Q_WS_WIN -#include -#include -#endif - -#ifdef Q_WS_WIN -#include -#ifndef _SSIZE_T_DEFINED -typedef signed int ssize_t; -#endif -#endif - -using namespace kdtools; - -#ifndef KDSINGLEAPPLICATIONGUARD_TIMEOUT_SECONDS -#define KDSINGLEAPPLICATIONGUARD_TIMEOUT_SECONDS 10 -#endif - -#ifndef KDSINGLEAPPLICATIONGUARD_NUMBER_OF_PROCESSES -#define KDSINGLEAPPLICATIONGUARD_NUMBER_OF_PROCESSES 10 -#endif - -#ifndef KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE -#define KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE 32768 -#endif - -static unsigned int KDSINGLEAPPLICATIONGUARD_SHM_VERSION = 0; - -Q_GLOBAL_STATIC_WITH_ARGS( int, registerInstanceType, - (qRegisterMetaType()) ) - -/*! - \class KDSingleApplicationGuard::Instance - \relates KDSingleApplicationGuard - \ingroup core - \brief Information about instances a KDSingleApplicationGuard knows about - - Instance represents instances of applications under - KDSingleApplicationGuard protection, and allows access to their - pid() and the arguments() they were started with. -*/ - -class KDSingleApplicationGuard::Instance::Private : public QSharedData { - friend class ::KDSingleApplicationGuard::Instance; -public: - Private( const QStringList & args, bool truncated, qint64 pid ) - : pid( pid ), arguments( args ), truncated( truncated ) {} - -private: - qint64 pid; - QStringList arguments; - bool truncated; -}; - -struct ProcessInfo; - -/*! - \internal - */ -class KDSingleApplicationGuard::Private -{ - friend class ::KDSingleApplicationGuard; - friend class ::KDSingleApplicationGuard::Instance; - friend struct ::ProcessInfo; - KDSingleApplicationGuard * const q; -public: - Private( Policy policy, KDSingleApplicationGuard* qq ); - ~Private(); - - void create( const QStringList& arguments ); - - bool checkOperational( const char * function, const char * act ) const; - bool checkOperationalPrimary( const char * function, const char * act ) const; - - struct segmentheader - { - size_t size : 16; - }; - - static void sharedmem_free( char* ); - static char* sharedmem_malloc( size_t size ); - -private: - void shutdownInstance(); - void poll(); - -private: - static KDSingleApplicationGuard* primaryInstance; - -private: - QBasicTimer timer; - QSharedMemory mem; - int id; - Policy policy; - bool operational; - bool exitRequested; -}; - -/*! - \internal -*/ -KDSingleApplicationGuard::Instance::Instance( const QStringList & args, bool truncated, qint64 p ) - : d( new Private( args, truncated, p ) ) -{ - d->ref.ref(); - (void)registerInstanceType(); -} - -/*! - Default constructor. Constructs in Instance that is \link isNull() - null\endlink. - - \sa isNull() -*/ -KDSingleApplicationGuard::Instance::Instance() : d( 0 ) {} - -/*! - Copy constructor. -*/ -KDSingleApplicationGuard::Instance::Instance( const Instance & other ) - : d( other.d ) -{ - if ( d ) - d->ref.ref(); -} - -/*! - Destructor. -*/ -KDSingleApplicationGuard::Instance::~Instance() -{ - if ( d && !d->ref.deref() ) - delete d; -} - -/*! - \fn KDSingleApplicationGuard::Instance::swap( Instance & other ) - - Swaps the contents of this and \a other. - - This function never throws exceptions. -*/ - -/*! - \fn KDSingleApplicationGuard::Instance::operator=( Instance other ) - - Assigns the contents of \a other to this. - - This function is strongly exception-safe. -*/ - -/*! - \fn std::swap( KDSingleApplicationGuard::Instance & lhs, KDSingleApplicationGuard::Instance & rhs ) - \relates KDSingleApplicationGuard::Instance - - Specialisation of std::swap() for - KDSingleApplicationGuard::Instance. Calls swap(). -*/ - -/*! - \fn qSwap( KDSingleApplicationGuard::Instance & lhs, KDSingleApplicationGuard::Instance & rhs ) - \relates KDSingleApplicationGuard::Instance - - Specialisation of qSwap() for - KDSingleApplicationGuard::Instance. Calls swap(). -*/ - -/*! - \fn KDSingleApplicationGuard::Instance::isNull() const - - Returns whether this instance is null. -*/ - -/*! - Returns whether this instance is valid. A valid instance is neither - null, nor does it have a negative PID. -*/ -bool KDSingleApplicationGuard::Instance::isValid() const -{ - return d && d->pid >= 0 ; -} - -/*! - Returns whether the #arguments are complete (\c false) or not (\c - true), e.g. because they have been truncated due to limited storage - space. - - \sa arguments() -*/ -bool KDSingleApplicationGuard::Instance::areArgumentsTruncated() const -{ - return d && d->truncated; -} - -/*! - Returns the arguments that this instance was started with. - - \sa areArgumentsTruncated() -*/ -const QStringList & KDSingleApplicationGuard::Instance::arguments() const -{ - if ( d ) - return d->arguments; - static const QStringList empty; - return empty; -} - -/*! - Returns the process-id (PID) of this instance. -*/ -qint64 KDSingleApplicationGuard::Instance::pid() const -{ - if ( d ) - return d->pid; - else - return -1; -} - -/*! - \class KDSingleApplicationGuard KDSingleApplicationGuard - \ingroup core - \brief A guard to protect an application from having several instances. - - KDSingleApplicationGuard can be used to make sure only one instance of an - application is running at the same time. - - \note As KDSingleApplicationGuard currently uses QSharedMemory, Qt - 4.4 or later is required. - */ - -/*! - \fn void KDSingleApplicationGuard::instanceStarted(const KDSingleApplicationGuard::Instance & instance) - - This signal is emitted by the primary instance whenever another - instance \a instance started. - */ - -/*! - \fn void KDSingleApplicationGuard::instanceExited(const KDSingleApplicationGuard::Instance & instance) - - This signal is emitted by the primary instance whenever another - instance \a instance exited. - */ - -/*! - \fn void KDSingleApplicationGuard::raiseRequested() - - This signal is emitted when the current running application is requested - to raise its main window. -*/ - -/*! - \fn void KDSingleApplicationGuard::exitRequested() - - This signal is emitted when the current running application has been asked to exit - by calling kill on the instance. -*/ - -/*! - \fn void KDSingleApplicationGuard::becamePrimaryInstance() - - This signal is emitted when the current running application becomes - the new primary application. The old primary application has quit. - */ - -/*! - \fn void KDSingleApplicationGuard::becameSecondaryInstance() - - This signal is emmited when the primary instance became secondary instance. - This happens when the instance doesn't update its status for some (default 10) seconds. Another instance - got primary instance in that case. - */ - -/*! - \fn void KDSingleApplicationGuard::policyChanged( KDSingleApplicationGuard::Policy policy ) - - This signal is emitted when the #policy of the system changes. -*/ - -enum Command -{ - NoCommand = 0x00, - ExitedInstance = 0x01, - NewInstance = 0x02, - FreeInstance = 0x04, - ShutDownCommand = 0x08, - KillCommand = 0x10, - BecomePrimaryCommand = 0x20, - RaiseCommand = 0x40 -}; - -static const quint16 PrematureEndOfOptions = -1; -static const quint16 RegularEndOfOptions = -2; - -struct ProcessInfo -{ - static const size_t MarkerSize = sizeof(quint16); - - explicit ProcessInfo( Command c = FreeInstance, const QStringList& arguments = QStringList(), qint64 p = -1 ) - : pid( p ), - command( c ), - timestamp( 0 ), - commandline( 0 ) - { - setArguments( arguments ); - } - - void setArguments( const QStringList & arguments ); - QStringList arguments( bool * prematureEnd ) const; - - qint64 pid; - quint32 command; - quint32 timestamp; - char* commandline; -}; - -static inline bool operator==( const ProcessInfo & lhs, const ProcessInfo & rhs ) -{ - return lhs.command == rhs.command && - ( lhs.commandline == rhs.commandline || ( lhs.commandline != 0 && rhs.commandline != 0 && ::strcmp( lhs.commandline, rhs.commandline ) == 0 ) ); -} - -static inline bool operator!=( const ProcessInfo & lhs, const ProcessInfo & rhs ) -{ - return !operator==( lhs, rhs ); -} - -/*! - This struct contains information about the managed process system. - \internal - */ -struct InstanceRegister -{ - explicit InstanceRegister( KDSingleApplicationGuard::Policy policy = KDSingleApplicationGuard::NoPolicy ) - : policy( policy ), - maxInstances( KDSINGLEAPPLICATIONGUARD_NUMBER_OF_PROCESSES ), - version( 0 ) - { - std::fill_n( commandLines, KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE, 0 ); - ::memcpy( magicCookie, "kdsingleapp", 12 ); - } - - /*! - Returns whether this register was properly initialized by the first instance. - */ - bool isValid() const - { - return ::strcmp( magicCookie, "kdsingleapp" ) == 0; - } - - char magicCookie[ 12 ]; - unsigned int policy : 8; - quint32 maxInstances : 20; - unsigned int version : 4; - ProcessInfo info[ KDSINGLEAPPLICATIONGUARD_NUMBER_OF_PROCESSES ]; - - char commandLines[ KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE ]; - - Q_DISABLE_COPY( InstanceRegister ) -}; - -void ProcessInfo::setArguments( const QStringList & arguments ) -{ - if( commandline != 0 ) - KDSingleApplicationGuard::Private::sharedmem_free( commandline ); - - commandline = 0; - if( arguments.isEmpty() ) - return; - - size_t totalsize = MarkerSize; - for ( const QString& arg : arguments ) - { - const QByteArray utf8 = arg.toUtf8(); - totalsize += utf8.size() + MarkerSize; - } - InstanceRegister* const reg = reinterpret_cast( KDSingleApplicationGuard::Private::primaryInstance->d->mem.data() ); - this->commandline = KDSingleApplicationGuard::Private::sharedmem_malloc( totalsize ); - if( this->commandline == 0 ) - { - qWarning("KDSingleApplicationguard: out of memory when trying to save arguments.\n"); - return; - } - - char* const commandline = this->commandline + reinterpret_cast(reg->commandLines); - - int argpos = 0; - for ( const QString & arg : arguments ) - { - const QByteArray utf8 = arg.toUtf8(); - const int required = MarkerSize + utf8.size() + MarkerSize ; - const int available = KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE - argpos ; - if ( required > available || utf8.size() > std::numeric_limits::max() ) { - // write a premature-eoo marker, and quit - memcpy( commandline + argpos, &PrematureEndOfOptions, MarkerSize ); - argpos += MarkerSize; - qWarning( "KDSingleApplicationGuard: argument list is too long (bytes required: %d, used: %d, available: %d", - required, argpos - 2, available ); - return; - } else { - const quint16 len16 = utf8.size(); - // write the size of the data... - memcpy( commandline + argpos, &len16, MarkerSize ); - argpos += MarkerSize; - // then the data - memcpy( commandline + argpos, utf8.data(), len16 ); - argpos += len16; - } - } - const ssize_t available = KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE - argpos; - assert( available >= static_cast( MarkerSize ) ); - memcpy( commandline + argpos, &RegularEndOfOptions, MarkerSize ); - argpos += MarkerSize; -} - -QStringList ProcessInfo::arguments( bool * prematureEnd ) const -{ - QStringList result; - if( commandline == 0 ) - { - if( prematureEnd ) - *prematureEnd = true; - return result; - } - - InstanceRegister* const reg = reinterpret_cast( KDSingleApplicationGuard::Private::primaryInstance->d->mem.data() ); - const char* const commandline = this->commandline + reinterpret_cast(reg->commandLines); - - int argpos = 0; - while ( true ) { - const int available = KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE - argpos ; - assert( available >= 2 ); - - quint16 marker; - memcpy( &marker, commandline + argpos, MarkerSize ); - argpos += MarkerSize; - - if ( marker == PrematureEndOfOptions ) { - if ( prematureEnd ) *prematureEnd = true; - break; - } - if ( marker == RegularEndOfOptions ) { - if ( prematureEnd ) *prematureEnd = false; - break; - } - - const int requested = MarkerSize + marker + MarkerSize ; - if ( requested > available ) { - const long long int p = pid; - qWarning( "KDSingleApplicationGuard: inconsistency detected when parsing command-line argument for process %lld", p ); - if ( prematureEnd ) *prematureEnd = true; - break; - } - - result.push_back( QString::fromUtf8( commandline + argpos, marker ) ); - argpos += marker; - } - - return result; -} - -KDSingleApplicationGuard::Private::~Private() -{ - if( primaryInstance == q ) - primaryInstance = 0; -} - -bool KDSingleApplicationGuard::Private::checkOperational( const char * function, const char * act ) const -{ - assert( function ); - assert( act ); - if ( !operational ) - qWarning( "KDSingleApplicationGuard::%s: need to be operational to %s", function, act ); - return operational; -} - -bool KDSingleApplicationGuard::Private::checkOperationalPrimary( const char * function, const char * act ) const -{ - if ( !checkOperational( function, act ) ) - return false; - if ( id != 0 ) - qWarning( "KDSingleApplicationGuard::%s: need to be primary to %s", function, act ); - return id == 0; -} - -struct segmentheader -{ - size_t size : 16; -}; - -void KDSingleApplicationGuard::Private::sharedmem_free( char* pointer ) -{ - InstanceRegister* const reg = reinterpret_cast( KDSingleApplicationGuard::Private::primaryInstance->d->mem.data() ); - char* const heap = reg->commandLines; - char* const heap_ptr = heap + reinterpret_cast(pointer) - sizeof( segmentheader ); - const segmentheader* const header = reinterpret_cast< const segmentheader* >( heap_ptr ); - const size_t size = header->size; - - char* end = heap + KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE; - - std::copy( heap_ptr + size, end, heap_ptr ); - std::fill( end - size, end, 0 ); - - for( uint i = 0; i < reg->maxInstances; ++i ) - { - if( reg->info[ i ].commandline > pointer ) - reg->info[ i ].commandline -= size + sizeof( segmentheader ); - } -} - -char* KDSingleApplicationGuard::Private::sharedmem_malloc( size_t size ) -{ - InstanceRegister* const reg = reinterpret_cast( KDSingleApplicationGuard::Private::primaryInstance->d->mem.data() ); - char* heap = reg->commandLines; - - while( heap + sizeof( segmentheader ) + size < reg->commandLines + KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE ) - { - segmentheader* const header = reinterpret_cast< segmentheader* >( heap ); - if( header->size == 0 ) - { - header->size = size; - return heap + sizeof( segmentheader ) - reinterpret_cast(reg->commandLines); - } - heap += sizeof( header ) + header->size; - } - return 0; -} - -void KDSingleApplicationGuard::Private::shutdownInstance() -{ - KDLockedSharedMemoryPointer< InstanceRegister > instances( &q->d->mem ); - instances->info[ q->d->id ].command |= ExitedInstance; - - if( q->isPrimaryInstance() ) - { - // ohh... we need a new primary instance... - for ( int i = 1, end = instances->maxInstances ; i < end ; ++i ) - { - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance | ShutDownCommand | KillCommand ) ) == 0 ) - { - instances->info[ i ].command |= BecomePrimaryCommand; - return; - } - } - // none found? then my species is dead :-( - } -} - -KDSingleApplicationGuard* KDSingleApplicationGuard::Private::primaryInstance = 0; - -/*! - Requests that the instance kills itself (by emitting exitRequested). - - If the instance has since exited, does nothing. - - \sa shutdown(), raise() -*/ -void KDSingleApplicationGuard::Instance::kill() -{ - KDLockedSharedMemoryPointer< InstanceRegister > instances( &KDSingleApplicationGuard::Private::primaryInstance->d->mem ); - for ( int i = 0, end = instances->maxInstances ; i < end ; ++i ) - { - if( instances->info[ i ].pid != d->pid ) - continue; - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance ) ) == 0 ) - instances->info[ i ].command = KillCommand; - } -} - -/*! - Requests that the instance shuts itself down (by calling QCoreApplication::quit()). - - If the instance has since exited, does nothing. - - \sa kill(), raise() -*/ -void KDSingleApplicationGuard::Instance::shutdown() -{ - KDLockedSharedMemoryPointer< InstanceRegister > instances( &KDSingleApplicationGuard::Private::primaryInstance->d->mem ); - for ( int i = 0, end = instances->maxInstances ; i < end ; ++i ) - { - if( instances->info[ i ].pid != d->pid ) - continue; - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance ) ) == 0 ) - instances->info[ i ].command = ShutDownCommand; - } -} - -/*! - - Requests that the instance raises its main window. - - The effects are implementation-defined: the KDSingleApplicationGuard - corresponding to the instance will emit its \link - KDSingleApplicationGuard::raiseRequested() raiseRequested()\endlink - signal. - - If the instance has since exited, does nothing. - - \sa kill(), shutdown() -*/ -void KDSingleApplicationGuard::Instance::raise() -{ - KDLockedSharedMemoryPointer< InstanceRegister > instances( &KDSingleApplicationGuard::Private::primaryInstance->d->mem ); - for ( int i = 0, end = instances->maxInstances ; i < end ; ++i ) - { - if( instances->info[ i ].pid != d->pid ) - continue; - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance ) ) == 0 ) - instances->info[ i ].command = RaiseCommand; - } -} - - -#ifndef Q_WS_WIN -// static -void KDSingleApplicationGuard::SIGINT_handler( int sig ) -{ - if( sig == SIGINT && Private::primaryInstance != 0 ) - Private::primaryInstance->d->shutdownInstance(); - ::exit( 1 ); -} -#endif - -/*! - \enum KDSingleApplicationGuard::Policy - - Defines the policy that a KDSingleApplicationGuard can enforce: -*/ - -/*! - \var KDSingleApplicationGuard::NoPolicy - - instanceStarted() is emitted, and the new instance allowed to continue. -*/ - -/*! - \var KDSingleApplicationGuard::AutoKillOtherInstances - - instanceStarted() is emitted, and the new instance is killed (Instance::kill()). -*/ - -/*! - Creates a new KDSingleApplicationGuard with arguments - QCoreApplication::arguments() and policy AutoKillOtherInstances, - passing \a parent to the base class constructor, as usual. -*/ -KDSingleApplicationGuard::KDSingleApplicationGuard( QObject * parent ) - : QObject( parent ), d( new Private( AutoKillOtherInstances, this ) ) -{ - d->create( QCoreApplication::arguments() ); -} - -/*! - Creates a new KDSingleApplicationGuard with arguments - QCoreApplication::arguments() and policy \a policy, passing \a - parent to the base class constructor, as usual. -*/ -KDSingleApplicationGuard::KDSingleApplicationGuard( Policy policy, QObject * parent ) - : QObject( parent ), d( new Private( policy, this ) ) -{ - d->create( QCoreApplication::arguments() ); -} - -/*! - Creates a new KDSingleApplicationGuard with arguments \a arguments - and policy AutoKillOtherInstances, passing \a parent to the base - class constructor, as usual. -*/ -KDSingleApplicationGuard::KDSingleApplicationGuard( const QStringList & arguments, QObject * parent ) - : QObject( parent ), d( new Private( AutoKillOtherInstances, this ) ) -{ - d->create( arguments ); -} - -/*! - Creates a new KDSingleApplicationGuard with arguments \a arguments - and policy \a policy, passing \a parent to the base class - constructor, as usual. -*/ -KDSingleApplicationGuard::KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent ) - : QObject( parent ), d( new Private( policy, this ) ) -{ - d->create( arguments ); -} - -KDSingleApplicationGuard::Private::Private( Policy policy_, KDSingleApplicationGuard * qq ) - : q( qq ), - id( -1 ), - policy( policy_ ), - operational( false ), - exitRequested( false ) -{ -} - -void KDSingleApplicationGuard::Private::create( const QStringList & arguments ) -{ - if ( !QCoreApplication::instance() ) { - qWarning( "KDSingleApplicationGuard: you need to construct a Q(Core)Application before you can construct a KDSingleApplicationGuard" ); - return; - } - - const QString name = QCoreApplication::applicationName(); - if ( name.isEmpty() ) { - qWarning( "KDSingleApplicationGuard: QCoreApplication::applicationName must not be empty" ); - return; - } - - (void)registerInstanceType(); - if ( primaryInstance == 0 ) - primaryInstance = q; - - mem.setKey( name ); - - // if another instance crashed, the shared memory segment is still there on Unix - // the following lines trigger deletion in that case -#ifndef Q_WS_WIN - mem.attach(); - mem.detach(); -#endif - - const bool created = mem.create( sizeof( InstanceRegister ) ); - if( !created ) - { - QString errorMsg; - if( mem.error() != QSharedMemory::NoError && mem.error() != QSharedMemory::AlreadyExists ) - errorMsg += QString::fromLatin1( "QSharedMemomry::create() failed: %1" ).arg( mem.errorString() ); - - if( !mem.attach() ) - { - if( mem.error() != QSharedMemory::NoError ) - errorMsg += QString::fromLatin1( "QSharedMemomry::attach() failed: %1" ).arg( mem.errorString() ); - - qWarning( "KDSingleApplicationGuard: Could neither create nor attach to shared memory segment." ); - qWarning( "%s\n", errorMsg.toLocal8Bit().constData() ); - return; - } - - const int maxWaitMSecs = 1000 * 60; // stop waiting after 60 seconds - QElapsedTimer waitTimer; - waitTimer.start(); - - // lets wait till the other instance initialized the register - bool initialized = false; - while( !initialized && waitTimer.elapsed() < maxWaitMSecs ) - { - const KDLockedSharedMemoryPointer< InstanceRegister > instances( &mem ); - initialized = instances->isValid(); -#ifdef Q_WS_WIN - ::Sleep(20); -#else - usleep(20000); -#endif - } - - const KDLockedSharedMemoryPointer< InstanceRegister > instances( &mem ); - if ( instances->version != 0 ) { - qWarning( "KDSingleApplicationGuard: Detected version mismatch. " - "Highest supported version: %ud, actual version: %ud", - KDSINGLEAPPLICATIONGUARD_SHM_VERSION, instances->version ); - return; - } - - } - - - KDLockedSharedMemoryPointer< InstanceRegister > instances( &mem ); - - if( !created ) - { - assert( instances->isValid() ); - - // we're _not_ the first instance - // but the - bool killOurSelf = false; - - // find a new slot... - id = std::find( instances->info, instances->info + instances->maxInstances, ProcessInfo() ) - instances->info; - ProcessInfo& info = instances->info[ id ]; - info = ProcessInfo( NewInstance, arguments, QCoreApplication::applicationPid() ); - killOurSelf = instances->policy == AutoKillOtherInstances; - policy = static_cast( instances->policy ); - - // but the signal that we tried to start was sent to the primary application - if( killOurSelf ) - exitRequested = true; - } - else - { - // ok.... we are the first instance - new ( instances.get() ) InstanceRegister( policy ); // create a new list (in shared memory) - id = 0; // our id = 0 - // and we've no command - instances->info[ 0 ] = ProcessInfo( NoCommand, arguments, QCoreApplication::applicationPid() ); - } - -#ifndef Q_WS_WIN - ::signal( SIGINT, SIGINT_handler ); -#endif - - // now listen for commands - timer.start( 750, q ); - - operational = true; -} - -/*! - Destroys this SingleApplicationGuard. - If this instance has been the primary instance and no other instance is existing anymore, - the application is shut down completely. Otherwise the destructor selects another instance to - be the primary instances. - */ -KDSingleApplicationGuard::~KDSingleApplicationGuard() -{ - if( d->id == -1 ) - return; - - d->shutdownInstance(); -} - -/*! - \property KDSingleApplicationGuard::operational - - Contains whether this KDSingleApplicationGuard is operational. - - A non-operational KDSingleApplicationGuard cannot be used in any meaningful way. - - Reasons for a KDSingleApplicationGuard being non-operational include: - \li it was constructed before QApplication (or at least QCoreApplication) was constructed - \li it failed to create or attach to the shared memory segment that is used for communication - - Get this property's value using %isOperational(). -*/ -bool KDSingleApplicationGuard::isOperational() const -{ - return d->operational; -} - -/*! - \property KDSingleApplicationGuard::exitRequested - - Contains wheter this istance has been requested to exit. This will happen when this instance - was just started, but the policy is AutoKillOtherInstances or by explicitely calling kill on - this instance(). - - Get this property's value using %isExitRequested(). -*/ -bool KDSingleApplicationGuard::isExitRequested() const -{ - return d->exitRequested; -}; - -/*! - \property KDSingleApplicationGuard::primaryInstance - - Contains whether this instance is the primary instance. - - The primary instance is the first instance which was started or else the instance which - got selected by KDSingleApplicationGuard's destructor, when the primary instance was - shut down. - - Get this property's value using %isPrimaryInstance(), and monitor changes to it - using becamePrimaryInstance(). - */ -bool KDSingleApplicationGuard::isPrimaryInstance() const -{ - return d->id == 0; -} - -/*! - \property KDSingleApplicationGuard::policy - Specifies the policy KDSingleApplicationGuard is using when new instances are started. - This can only be set in the primary instance. - - Get this property's value using %policy(), set it using %setPolicy(), and monitor changes - to it using policyChanged(). - */ -KDSingleApplicationGuard::Policy KDSingleApplicationGuard::policy() const -{ - return d->policy; -} - -void KDSingleApplicationGuard::setPolicy( Policy policy ) -{ - if ( !d->checkOperationalPrimary( "setPolicy", "change the policy" ) ) - return; - - if( d->policy == policy ) - return; - - d->policy = policy; - emit policyChanged( policy ); - KDLockedSharedMemoryPointer< InstanceRegister > instances( &d->mem ); - instances->policy = policy; -} - -/*! - Returns a list of all currently running instances. - */ -QVector -KDSingleApplicationGuard::instances() const -{ - if ( !d->checkOperational( "instances", "report on other instances" ) ) - return QVector(); - - if ( Private::primaryInstance == 0 ) { - Private::primaryInstance = const_cast( this ); - } - - QVector result; - const KDLockedSharedMemoryPointer< InstanceRegister > instances( const_cast< QSharedMemory* >( &d->mem ) ); - for ( int i = 0, end = instances->maxInstances ; i < end ; ++i ) - { - const ProcessInfo& info = instances->info[ i ]; - if( ( info.command & ( FreeInstance | ExitedInstance ) ) == 0 ) - { - bool truncated; - const QStringList arguments = info.arguments( &truncated ); - result.push_back( Instance( arguments, truncated, info.pid ) ); - } - } - return result; -} - -/*! - Shuts down all other instances. This can only be called from the - the primary instance. - Shut down is done gracefully via QCoreApplication::quit(). - */ -void KDSingleApplicationGuard::shutdownOtherInstances() -{ - if ( !d->checkOperationalPrimary( "shutdownOtherInstances", "shut other instances down" ) ) - return; - - KDLockedSharedMemoryPointer< InstanceRegister > instances( &d->mem ); - for ( int i = 1, end = instances->maxInstances ; i < end ; ++i ) - { - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance ) ) == 0 ) - instances->info[ i ].command = ShutDownCommand; - } -} - -/*! - Kills all other instances. This can only be called from the - the primary instance. - Killing is done via emitting exitRequested. It's up to the receiving - instance to react properly. - */ -void KDSingleApplicationGuard::killOtherInstances() -{ - if ( !d->checkOperationalPrimary( "killOtherInstances", "kill other instances" ) ) - return; - - KDLockedSharedMemoryPointer< InstanceRegister > instances( &d->mem ); - for ( int i = 1, end = instances->maxInstances ; i < end ; ++i ) - { - if( ( instances->info[ i ].command & ( FreeInstance | ExitedInstance ) ) == 0 ) - instances->info[ i ].command = KillCommand; - } -} - -bool KDSingleApplicationGuard::event( QEvent * event ) -{ - if ( event->type() == QEvent::Timer ) { - const QTimerEvent * const te = static_cast( event ); - if ( te->timerId() == d->timer.timerId() ) { - d->poll(); - return true; - } - } - return QObject::event( event ); -} - -void KDSingleApplicationGuard::Private::poll() { - - const quint32 now = QDateTime::currentDateTime().toTime_t(); - - if ( primaryInstance == 0 ) { - primaryInstance = q; - } - - if ( q->isPrimaryInstance() ) - { - // only the primary instance will get notified about new instances - QVector< Instance > exitedInstances; - QVector< Instance > startedInstances; - - { - KDLockedSharedMemoryPointer< InstanceRegister > instances( &mem ); - - if( instances->info[ id ].pid != QCoreApplication::applicationPid() ) - { - for ( int i = 1, end = instances->maxInstances ; i < end && id == 0 ; ++i ) - { - if( instances->info[ i ].pid == QCoreApplication::applicationPid() ) - id = i; - } - emit q->becameSecondaryInstance(); - return; - } - - instances->info[ id ].timestamp = now; - - for ( int i = 1, end = instances->maxInstances ; i < end ; ++i ) - { - ProcessInfo& info = instances->info[ i ]; - if( info.command & NewInstance ) - { - bool truncated; - const QStringList arguments = info.arguments( &truncated ); - startedInstances.push_back( Instance( arguments, truncated, info.pid ) ); - info.command &= ~NewInstance; // clear NewInstance flag - } - if( info.command & ExitedInstance ) - { - bool truncated; - const QStringList arguments = info.arguments( &truncated ); - exitedInstances.push_back( Instance( arguments, truncated, info.pid ) ); - info.command = FreeInstance; // set FreeInstance flag - } - } - } - - // one signal for every new instance - _after_ the memory segment was unlocked again - for( QVector< Instance >::const_iterator it = startedInstances.constBegin(); it != startedInstances.constEnd(); ++it ) - emit q->instanceStarted( *it ); - for( QVector< Instance >::const_iterator it = exitedInstances.constBegin(); it != exitedInstances.constEnd(); ++it ) - emit q->instanceExited( *it ); - } - else - { - // do we have a command? - bool killOurSelf = false; - bool shutDownOurSelf = false; - bool policyDidChange = false; - - { - KDLockedSharedMemoryPointer< InstanceRegister > instances( &mem ); - - const Policy oldPolicy = policy; - policy = static_cast( instances->policy ); - policyDidChange = policy != oldPolicy; - - // check for the primary instance health status - if( now - instances->info[ 0 ].timestamp > KDSINGLEAPPLICATIONGUARD_TIMEOUT_SECONDS ) - { - std::swap( instances->info[ 0 ], instances->info[ id ] ); - id = 0; - instances->info[ id ].timestamp = now; - emit q->becamePrimaryInstance(); - instances->info[ id ].command &= ~BecomePrimaryCommand; // afterwards, reset the flag - } - - if( instances->info[ id ].command & BecomePrimaryCommand ) - { - // we became primary! - instances->info[ 0 ] = instances->info[ id ]; - instances->info[ id ] = ProcessInfo(); // change our id to 0 and declare the old slot as free - id = 0; - instances->info[ id ].timestamp = now; - emit q->becamePrimaryInstance(); - } - - if( instances->info[ id ].command & RaiseCommand ) - { - // raise ourself! - emit q->raiseRequested(); - instances->info[ id ].command &= ~RaiseCommand; // afterwards, reset the flag - } - - - killOurSelf = instances->info[ id ].command & KillCommand; // check for kill command - shutDownOurSelf = instances->info[ id ].command & ShutDownCommand; // check for shut down command - instances->info[ id ].command &= ~( KillCommand | ShutDownCommand | BecomePrimaryCommand ); // reset both flags - if( killOurSelf ) - { - instances->info[ id ].command |= ExitedInstance; // upon kill, we have to set the ExitedInstance flag - id = -1; // becauso our d'tor won't be called anymore - } - } - - if( killOurSelf ) // kill our self takes precedence - { - exitRequested = true; - emit q->exitRequested(); - } - else if( shutDownOurSelf ) - qApp->quit(); - else if( policyDidChange ) - emit q->policyChanged( policy ); - } -} - -// #include "moc_kdsingleapplicationguard.cpp" - -#ifdef KDTOOLSCORE_UNITTESTS - -#include - -#include "kdautopointer.h" - -#include - -#include -#include -#include - -static void wait( int msec, QSignalSpy * spy=0, int expectedCount=INT_MAX ) -{ - QTime t; - t.start(); - while ( ( !spy || spy->count() < expectedCount ) && t.elapsed() < msec ) - { - qApp->processEvents( QEventLoop::WaitForMoreEvents, qMax( 10, msec - t.elapsed() ) ); - } -} - -static std::ostream& operator<<( std::ostream& stream, const QStringList& list ) -{ - stream << "QStringList("; - for( QStringList::const_iterator it = list.begin(); it != list.end(); ++it ) - { - stream << " " << it->toLocal8Bit().data(); - if( it + 1 != list.end() ) - stream << ","; - } - stream << " )"; - return stream; -} - -namespace { - class ApplicationNameSaver { - Q_DISABLE_COPY( ApplicationNameSaver ) - const QString oldname; - public: - explicit ApplicationNameSaver( const QString & name ) - : oldname( QCoreApplication::applicationName() ) - { - QCoreApplication::setApplicationName( name ); - } - ~ApplicationNameSaver() { - QCoreApplication::setApplicationName( oldname ); - } - }; -} - -KDAB_UNITTEST_SIMPLE( KDSingleApplicationGuard, "kdcoretools" ) { - - // set it to an unique name - const ApplicationNameSaver saver( QUuid::createUuid().toString() ); - - KDAutoPointer guard3; - KDAutoPointer spy3; - KDAutoPointer spy4; - - { - KDSingleApplicationGuard guard1; - assertEqual( guard1.policy(), KDSingleApplicationGuard::AutoKillOtherInstances ); - assertEqual( guard1.instances().count(), 1 ); - assertTrue( guard1.isPrimaryInstance() ); - - guard1.setPolicy( KDSingleApplicationGuard::NoPolicy ); - assertEqual( guard1.policy(), KDSingleApplicationGuard::NoPolicy ); - - QSignalSpy spy1( &guard1, SIGNAL(instanceStarted(KDSingleApplicationGuard::Instance)) ); - - KDSingleApplicationGuard guard2; - assertEqual( guard1.instances().count(), 2 ); - assertEqual( guard2.instances().count(), 2 ); - assertEqual( guard2.policy(), KDSingleApplicationGuard::NoPolicy ); - assertFalse( guard2.isPrimaryInstance() ); - - wait( 1000, &spy1, 1 ); - - assertEqual( spy1.count(), 1 ); - guard3.reset( new KDSingleApplicationGuard ); - spy3.reset( new QSignalSpy( guard3.get(), SIGNAL(becamePrimaryInstance()) ) ); - spy4.reset( new QSignalSpy( guard3.get(), SIGNAL(instanceExited(KDSingleApplicationGuard::Instance) ) ) ); - assertFalse( guard3->isPrimaryInstance() ); - } - - wait( 1000, spy3.get(), 1 ); - wait( 1000, spy4.get(), 1 ); - assertEqual( spy3->count(), 1 ); - assertEqual( guard3->instances().count(), 1 ); - assertTrue( guard3->isPrimaryInstance() ); - guard3.reset( new KDSingleApplicationGuard ); - - assertEqual( guard3->instances().first().arguments(), qApp->arguments() ); - - QSignalSpy spyStarted( guard3.get(), SIGNAL(instanceStarted(KDSingleApplicationGuard::Instance)) ); - QSignalSpy spyExited( guard3.get(), SIGNAL(instanceExited(KDSingleApplicationGuard::Instance)) ); - - { - KDSingleApplicationGuard guard1; - KDSingleApplicationGuard guard2; - - wait( 1000, &spyStarted, 2 ); - - assertEqual( spyStarted.count(), 2 ); - } - - wait( 1000, &spyExited, 2 ); - assertEqual( spyExited.count(), 2 ); - - spyStarted.clear(); - spyExited.clear(); - - { - // check arguments-too-long handling: - QStringList args; - for ( unsigned int i = 0, end = KDSINGLEAPPLICATIONGUARD_MAX_COMMAND_LINE/16 ; i != end ; ++i ) - args.push_back( QLatin1String( "0123456789ABCDEF" ) ); - KDSingleApplicationGuard guard3( args ); - - wait( 1000, &spyStarted, 1 ); - - const QVector instances = guard3.instances(); - assertEqual( instances.size(), 2 ); - - assertTrue( instances[1].areArgumentsTruncated() ); - } -} - -#endif // KDTOOLSCORE_UNITTESTS - -#endif // QT_NO_SHAREDMEMORY -#endif // QT_VERSION >= 0x040400 || defined(DOXYGEN_RUN) diff --git a/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h b/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h deleted file mode 100644 index f75825cef..000000000 --- a/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#ifndef KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H -#define KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H - -#include - -#ifndef QT_NO_SHAREDMEMORY - -#include -#include - -#include "pimpl_ptr.h" -#include "DllMacro.h" - -#include - -template class QVector; -class QCoreApplication; - -class DLLEXPORT KDSingleApplicationGuard : public QObject -{ - Q_OBJECT - Q_ENUMS( Policy ) - Q_PROPERTY( bool operational READ isOperational ) - Q_PROPERTY( bool exitRequested READ isExitRequested ) - Q_PROPERTY( bool primaryInstance READ isPrimaryInstance NOTIFY becamePrimaryInstance ) - Q_PROPERTY( Policy policy READ policy WRITE setPolicy NOTIFY policyChanged ) -public: - enum Policy - { - NoPolicy = 0, - AutoKillOtherInstances = 1 - }; - - explicit KDSingleApplicationGuard( QObject * parent=nullptr ); - explicit KDSingleApplicationGuard( Policy policy, QObject * parent=nullptr ); - explicit KDSingleApplicationGuard( const QStringList & arguments, QObject * parent=nullptr ); - explicit KDSingleApplicationGuard( const QStringList & arguments, Policy policy, QObject * parent=nullptr ); - ~KDSingleApplicationGuard() override; - - bool isOperational() const; - - bool isExitRequested() const; - - bool isPrimaryInstance() const; - - Policy policy() const; - void setPolicy( Policy policy ); - - class Instance; - - QVector instances() const; - -Q_SIGNALS: - void instanceStarted( const KDSingleApplicationGuard::Instance & instance ); - void instanceExited( const KDSingleApplicationGuard::Instance & instance ); - void exitRequested(); - void raiseRequested(); - void becamePrimaryInstance(); - void becameSecondaryInstance(); - void policyChanged( KDSingleApplicationGuard::Policy policy ); - -public Q_SLOTS: - void shutdownOtherInstances(); - void killOtherInstances(); - -protected: - /*! \reimp */ bool event( QEvent * event ) override; - -private: -#ifndef Q_WS_WIN - static void SIGINT_handler( int ); -#endif - -private: - friend struct ProcessInfo; - - class Private; - kdtools::pimpl_ptr< Private > d; -}; - -class DLLEXPORT KDSingleApplicationGuard::Instance { - friend class ::KDSingleApplicationGuard; - friend class ::KDSingleApplicationGuard::Private; - Instance( const QStringList &, bool, qint64 ); -public: - Instance(); - Instance( const Instance & other ); - ~Instance(); - - void swap( Instance & other ) { - std::swap( d, other.d ); - } - - Instance & operator=( Instance other ) { - swap( other ); - return *this; - } - - bool isNull() const { return !d; } - bool isValid() const; - - bool areArgumentsTruncated() const; - - const QStringList & arguments() const; - qint64 pid() const; - - void shutdown(); - void kill(); - void raise(); - -private: - class Private; - Private * d; -}; - -namespace std { - template <> - inline void swap( KDSingleApplicationGuard::Instance & lhs, - KDSingleApplicationGuard::Instance & rhs ) - { - lhs.swap( rhs ); - } -} // namespace std - -QT_BEGIN_NAMESPACE - -template <> -inline void qSwap( KDSingleApplicationGuard::Instance & lhs, - KDSingleApplicationGuard::Instance & rhs ) -{ - lhs.swap( rhs ); -} -Q_DECLARE_METATYPE( KDSingleApplicationGuard::Instance ) -Q_DECLARE_TYPEINFO( KDSingleApplicationGuard::Instance, Q_MOVABLE_TYPE ); - -QT_END_NAMESPACE - - -#endif // QT_NO_SHAREDMEMORY - -#endif /* KDTOOLSCORE_KDSINGLEAPPLICATIONGUARD_H */ diff --git a/3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp b/3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp deleted file mode 100644 index f886189c3..000000000 --- a/3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#include "kdtoolsglobal.h" - -#include - -#include - -namespace { - struct Version { - unsigned char v[3]; - }; - - static inline bool operator<( const Version & lhs, const Version & rhs ) { - return std::lexicographical_compare( lhs.v, lhs.v + 3, rhs.v, rhs.v + 3 ); - } - static inline bool operator==( const Version & lhs, const Version & rhs ) { - return std::equal( lhs.v, lhs.v + 3, rhs.v ); - } - KDTOOLS_MAKE_RELATION_OPERATORS( Version, static inline ) -} - -static Version kdParseQtVersion( const char * const version ) { - if ( !version || qstrlen( version ) < 5 || version[1] != '.' || version[3] != '.' || ( version[5] != 0 && version[5] != '.' && version[5] != '-' ) ) - return Version(); // parse error - const Version result = { { static_cast< unsigned char >( version[0] - '0' ), - static_cast< unsigned char >( version[2] - '0' ), - static_cast< unsigned char >( version[4] - '0' ) } }; - return result; -} - -bool _kdCheckQtVersion_impl( unsigned int major, unsigned int minor, unsigned int patchlevel ) { - static const Version actual = kdParseQtVersion( qVersion() ); // do this only once each run... - const Version requested = { { static_cast< unsigned char >( major ), - static_cast< unsigned char >( minor ), - static_cast< unsigned char >( patchlevel ) } }; - return actual >= requested; -} diff --git a/3rdparty/kdsingleapplicationguard/kdtoolsglobal.h b/3rdparty/kdsingleapplicationguard/kdtoolsglobal.h deleted file mode 100644 index 5086ddd71..000000000 --- a/3rdparty/kdsingleapplicationguard/kdtoolsglobal.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#ifndef KDTOOLS_KDTOOLSGLOBAL_H -#define KDTOOLS_KDTOOLSGLOBAL_H - -#include - -#define KDAB_DISABLE_COPY( x ) private: x( const x & ); x & operator=( const x & ) - -#ifdef KDTOOLS_SHARED -# ifdef BUILD_SHARED_KDTOOLSCORE -# define KDTOOLSCORE_EXPORT Q_DECL_EXPORT -# else -# define KDTOOLSCORE_EXPORT Q_DECL_IMPORT -# endif -# ifdef BUILD_SHARED_KDTOOLSGUI -# define KDTOOLSGUI_EXPORT Q_DECL_EXPORT -# else -# define KDTOOLSGUI_EXPORT Q_DECL_IMPORT -# endif -# ifdef BUILD_SHARED_KDTOOLSXML -# define KDTOOLSXML_EXPORT Q_DECL_EXPORT -# else -# define KDTOOLSXML_EXPORT Q_DECL_IMPORT -# endif -# ifdef BUILD_SHARED_KDUPDATER -# define KDTOOLS_UPDATER_EXPORT Q_DECL_EXPORT -# else -# define KDTOOLS_UPDATER_EXPORT Q_DECL_IMPORT -# endif -#else // KDTOOLS_SHARED -# define KDTOOLSCORE_EXPORT -# define KDTOOLSGUI_EXPORT -# define KDTOOLSXML_EXPORT -# define KDTOOLS_UPDATER_EXPORT -#endif // KDTOOLS_SHARED - -#define MAKEINCLUDES_EXPORT - -#define DOXYGEN_PROPERTY( x ) -#ifdef DOXYGEN_RUN -# define KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( func ) operator unspecified_bool_type() const { return func; } -# define KDAB_USING_SAFE_BOOL_OPERATOR( Class ) operator unspecified_bool_type() const; -#else -# define KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( func ) \ - private: \ - struct __safe_bool_dummy__ { void nonnull() {} }; \ - public: \ - typedef void ( __safe_bool_dummy__::*unspecified_bool_type )(); \ - operator unspecified_bool_type() const { \ - return ( func ) ? &__safe_bool_dummy__::nonnull : 0 ; \ - } -#define KDAB_USING_SAFE_BOOL_OPERATOR( Class ) \ - using Class::operator Class::unspecified_bool_type; -#endif - -#define KDTOOLS_MAKE_RELATION_OPERATORS( Class, linkage ) \ - linkage bool operator>( const Class & lhs, const Class & rhs ) { \ - return operator<( rhs, lhs ); \ - } \ - linkage bool operator!=( const Class & lhs, const Class & rhs ) { \ - return !operator==( lhs, rhs ); \ - } \ - linkage bool operator<=( const Class & lhs, const Class & rhs ) { \ - return !operator>( lhs, rhs ); \ - } \ - linkage bool operator>=( const Class & lhs, const Class & rhs ) { \ - return !operator<( lhs, rhs ); \ - } - -template -inline T & __kdtools__dereference_for_methodcall( T & o ) { - return o; -} - -template -inline T & __kdtools__dereference_for_methodcall( T * o ) { - return *o; -} - -#define KDAB_SET_OBJECT_NAME( x ) __kdtools__dereference_for_methodcall( x ).setObjectName( QLatin1String( #x ) ) - -KDTOOLSCORE_EXPORT bool _kdCheckQtVersion_impl( unsigned int major, unsigned int minor=0, unsigned int patchlevel=0 ); -static inline bool kdCheckQtVersion( unsigned int major, unsigned int minor=0, unsigned int patchlevel=0 ) { - return (major<<16|minor<<8|patchlevel) <= static_cast(QT_VERSION) - || _kdCheckQtVersion_impl( major, minor, patchlevel ); -} - -#define KDTOOLS_DECLARE_PRIVATE_BASE( Class ) \ -protected: \ - class Private; \ - Private * d_func() { return _d; } \ - const Private * d_func() const { return _d; } \ - Class( Private * _d_, bool b ) : _d( _d_ ) { init(b); } \ -private: \ - void init(bool); \ -private: \ - Private * _d - -#define KDTOOLS_DECLARE_PRIVATE_DERIVED( Class, Base ) \ -protected: \ - class Private; \ - Private * d_func() { \ - return reinterpret_cast( Base::d_func() ); \ - } \ - const Private * d_func() const { \ - return reinterpret_cast( Base::d_func() ); \ - } \ - Class( Private * _d_, bool b ) \ - : Base( reinterpret_cast(_d_), b ) { init(b); } \ -private: \ - void init(bool) - - -#endif /* KDTOOLS_KDTOOLSGLOBAL_H */ - diff --git a/3rdparty/kdsingleapplicationguard/pimpl_ptr.cpp b/3rdparty/kdsingleapplicationguard/pimpl_ptr.cpp deleted file mode 100644 index f2b0a4dd9..000000000 --- a/3rdparty/kdsingleapplicationguard/pimpl_ptr.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#include "pimpl_ptr.h" - -/*! - \class pimpl_ptr: - \ingroup core smartptr - \brief Owning pointer for private implementations - \since_c 2.1 - - (The exception safety of this class has not been evaluated yet.) - - pimpl_ptr is a smart immutable pointer, which owns the contained object. Unlike other smart pointers, - it creates a standard constructed object when instanciated via the - \link pimpl_ptr() standard constructor\endlink. - Additionally, pimpl_ptr respects constness of the pointer object and returns \c const \c T* for - a const pimpl_ptr object. - - The content of a pimpl_ptr cannot be changed during it's lifetime. - - \section general-use General Use - - The general use case of pimpl_ptr is the "Pimpl Idiom", i.e. hiding the private implementation of a class - from the user's compiler which see \c MyClass as - - \code - class MyClass - { - public: - MyClass(); - ~MyClass(); - - // public class API - int value() const; - - private: - class Private; // defined later - kdtools::pimpl_ptr< Private > d; - }; - \endcode - - but not the private parts of it. These can only be seen (and accessed) by the code knowing \c MyClass::Private: - - \code - class MyClass::Private - { - public: - int value; - }; - - MyClass::MyClass() - { - // d was automatically filled with new Private - d->value = 42; - } - - MyClass::~MyClass() - { - // the content of d gets deleted automatically - } - - int MyClass::value() const - { - // access the private part: - // since MyClass::value() is const, the returned pointee is const, too - return d->value; - } - \endcode - -*/ - -/*! - \fn pimpl_ptr::pimpl_ptr() - - Default constructor. Constructs a pimpl_tr that contains (owns) a standard constructed - instance of \c T. - - \post \c *this owns a new object. -*/ - -/*! - \fn pimpl_ptr::pimpl_ptr( T * t ) - - Constructor. Constructs a pimpl_ptr that contains (owns) \a t. - - \post get() == obj -*/ - -/*! - \fn pimpl_ptr::~pimpl_ptr() - - Destructor. - - \post The object previously owned by \c *this has been deleted. -*/ - -/*! - \fn const T * pimpl_ptr::get() const - - \returns a const pointer to the contained (owned) object. - \overload -*/ - -/*! - \fn T * pimpl_ptr::get() - - \returns a pointer to the contained (owned) object. -*/ - -/*! - \fn const T & pimpl_ptr::operator*() const - - Dereference operator. Returns \link get() *get()\endlink. - \overload -*/ - -/*! - \fn T & pimpl_ptr::operator*() - - Dereference operator. Returns \link get() *get()\endlink. -*/ - -/*! - \fn const T * pimpl_ptr::operator->() const - - Member-by-pointer operator. Returns get(). - \overload -*/ - -/*! - \fn T * pimpl_ptr::operator->() - - Member-by-pointer operator. Returns get(). -*/ - -#ifdef KDTOOLSCORE_UNITTESTS - -#include - -#include -#include - -namespace -{ - struct ConstTester - { - bool isConst() - { - return false; - } - - bool isConst() const - { - return true; - } - }; -} - -KDAB_UNITTEST_SIMPLE( pimpl_ptr, "kdcoretools" ) { - - { - kdtools::pimpl_ptr< QObject > p; - assertNotNull( p.get() ); - assertNull( p->parent() ); - } - - - { - QPointer< QObject > o; - { - kdtools::pimpl_ptr< QObject > qobject( new QObject ); - o = qobject.get(); - assertEqual( o, qobject.operator->() ); - assertEqual( o, &(qobject.operator*()) ); - } - assertNull( o ); - } - - { - const kdtools::pimpl_ptr< QObject > qobject( new QObject ); - const QObject* o = qobject.get(); - assertEqual( o, qobject.operator->() ); - assertEqual( o, &(qobject.operator*()) ); - } - - { - kdtools::pimpl_ptr< QObject > o1; - assertTrue( o1 ); - kdtools::pimpl_ptr< QObject > o2( 0 ); - assertFalse( o2 ); - } - - { - const kdtools::pimpl_ptr< ConstTester > o1; - kdtools::pimpl_ptr< ConstTester > o2; - assertTrue( o1->isConst() ); - assertFalse( o2->isConst() ); - assertTrue( (*o1).isConst() ); - assertFalse( (*o2).isConst() ); - assertTrue( o1.get()->isConst() ); - assertFalse( o2.get()->isConst() ); - } -} - -#endif // KDTOOLSCORE_UNITTESTS diff --git a/3rdparty/kdsingleapplicationguard/pimpl_ptr.h b/3rdparty/kdsingleapplicationguard/pimpl_ptr.h deleted file mode 100644 index b8b4786ba..000000000 --- a/3rdparty/kdsingleapplicationguard/pimpl_ptr.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2001-2010 Klaralvdalens Datakonsult AB. - * SPDX-License-Identifier: LGPL-2.0-only - * - * The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - */ -#ifndef KDTOOLSCORE_PIMPL_PTR_H -#define KDTOOLSCORE_PIMPL_PTR_H - -#include "kdtoolsglobal.h" - -#ifndef DOXYGEN_RUN -namespace kdtools { -#endif - - template - class pimpl_ptr { - KDAB_DISABLE_COPY( pimpl_ptr ); - T * d; - public: - pimpl_ptr() : d( new T ) {} - explicit pimpl_ptr( T * t ) : d( t ) {} - ~pimpl_ptr() { delete d; d = nullptr; } - - T * get() { return d; } - const T * get() const { return d; } - - T * operator->() { return get(); } - const T * operator->() const { return get(); } - - T & operator*() { return *get(); } - const T & operator*() const { return *get(); } - - KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() ) - }; - - // these are not implemented, so's we can catch their use at - // link-time. Leaving them undeclared would open up a comparison - // via operator unspecified-bool-type(). - template - void operator==( const pimpl_ptr &, const pimpl_ptr & ); - template - void operator!=( const pimpl_ptr &, const pimpl_ptr & ); - -#ifndef DOXYGEN_RUN -} // namespace kdtools -#endif - -#endif /* KDTOOLSCORE_PIMPL_PTR_H */ - diff --git a/CHANGES b/CHANGES index d9e8bffc4..24a43594b 100644 --- a/CHANGES +++ b/CHANGES @@ -13,7 +13,12 @@ This release contains contributions from (alphabetically by first name): - No external contributors yet ## Core ## - - No core changes yet + - KDE Framework "DBusAddons" is now required, and is used to "activate" + Calamares; the KDAB Single Application Guard is no longer used. + KDSAG needed patching to chase Qt 5.15 deprecations, and the DBus + activation code is tried and tested in Frameworks (tier 1). + Running `calamares -d` no longer enforces a single-application + (it is for debugging purposes, after all). ## Modules ## - No module changes yet diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bab3738b..7e6fba700 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,6 @@ option( INSTALL_POLKIT "Install Polkit configuration" ON ) option( INSTALL_COMPLETION "Install shell completions" OFF ) # Options for the calamares executable option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) # TODO:3.3: WITH->BUILD (this isn't an ABI thing) -option( WITH_KF5DBus "Use DBus service for unique-application." OFF ) # TODO:3.3: WITH->BUILD # When adding WITH_* that affects the ABI offered by libcalamares, # also update libcalamares/CalamaresConfig.h.in option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) @@ -329,18 +328,19 @@ set_package_properties( URL "https://api.kde.org/frameworks/kcoreaddons/" PURPOSE "About Calamares" ) +set_package_properties( + KF5::DBusAddons PROPERTIES + TYPE REQUIRED + DESCRIPTION "Classes for DBus activation" + URL "https://api.kde.org/frameworks/dbusaddons/" + PURPOSE "Unique instance of Calamares" +) if( NOT KF5Crash_FOUND ) if( WITH_KF5Crash ) message(WARNING "WITH_KF5Crash is set, but KF5::Crash is not available.") endif() set( WITH_KF5Crash OFF ) endif() -if( NOT KF5DBusAddons_FOUND ) - if( WITH_KF5DBus ) - message(WARNING "WITH_KF5DBus is set, but KF5::DBusAddons is not available.") - endif() - set( WITH_KF5DBus OFF ) -endif() # TODO:3.3: Use FindPython3 instead find_package( PythonInterp ${PYTHONLIBS_VERSION} ) @@ -576,7 +576,6 @@ add_feature_info(Python ${WITH_PYTHON} "Python job modules") add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules") add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") -add_feature_info(KDBusAddons ${WITH_KF5DBus} "Unique-application via DBus") ### CMake infrastructure installation # diff --git a/LICENSES/LGPL-2.0-only.txt b/LICENSES/LGPL-2.0-only.txt deleted file mode 100644 index df942b1ff..000000000 --- a/LICENSES/LGPL-2.0-only.txt +++ /dev/null @@ -1,488 +0,0 @@ - - The KD Tools Library is Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. - - You may use, distribute and copy the KD Tools Library under the terms of - GNU Library General Public License version 2, which is displayed below. - -------------------------------------------------------------------------- - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index d06a53d83..eb1fbe694 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -16,17 +16,6 @@ set( calamaresSources progresstree/ProgressTreeView.cpp ) -if( NOT WITH_KF5DBus ) - set( kdsagSources - ${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.cpp - ${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdsharedmemorylocker.cpp - ${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdtoolsglobal.cpp - ${CMAKE_SOURCE_DIR}/3rdparty/kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp - ) - mark_thirdparty_code( ${kdsagSources} ) - list( APPEND calamaresSources ${kdsagSources} ) -endif() - include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_SOURCE_DIR}/src/libcalamaresui @@ -65,15 +54,12 @@ target_link_libraries( calamares_bin Qt5::Core Qt5::Widgets KF5::CoreAddons + KF5::DBusAddons ) if( WITH_KF5Crash ) target_link_libraries( calamares_bin PRIVATE KF5::Crash ) target_compile_definitions( calamares_bin PRIVATE WITH_KF5Crash ) endif() -if( WITH_KF5DBus ) - target_link_libraries( calamares_bin PRIVATE KF5::DBusAddons ) - target_compile_definitions( calamares_bin PRIVATE WITH_KF5DBus ) -endif() install( TARGETS calamares_bin BUNDLE DESTINATION . diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index de709156f..6c03bd52c 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -16,14 +16,8 @@ #include "utils/Logger.h" #include "utils/Retranslator.h" -#ifndef WITH_KF5DBus -#include "3rdparty/kdsingleapplicationguard/kdsingleapplicationguard.h" -#endif - #include -#ifdef WITH_KF5DBus #include -#endif #ifdef WITH_KF5Crash #include #endif @@ -133,27 +127,7 @@ main( int argc, char* argv[] ) bool is_debug = handle_args( a ); -#ifdef WITH_KF5DBus KDBusService service( is_debug ? KDBusService::Multiple : KDBusService::Unique ); -#else - KDSingleApplicationGuard guard( is_debug ? KDSingleApplicationGuard::NoPolicy - : KDSingleApplicationGuard::AutoKillOtherInstances ); - if ( !is_debug && !guard.isPrimaryInstance() ) - { - // Here we have not yet set-up the logger system, so qDebug() is ok - auto instancelist = guard.instances(); - qDebug() << "Calamares is already running, shutting down."; - if ( instancelist.count() > 0 ) - { - qDebug() << "Other running Calamares instances:"; - } - for ( const auto& i : instancelist ) - { - qDebug() << " " << i.isValid() << i.pid() << i.arguments(); - } - return 69; // EX_UNAVAILABLE on FreeBSD - } -#endif Calamares::Settings::init( is_debug ); if ( !Calamares::Settings::instance() || !Calamares::Settings::instance()->isValid() ) From 1f5bdef96eef6620abaed1bcb3a8608dc02893d4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 30 Mar 2021 12:20:16 +0200 Subject: [PATCH 013/160] CMake: bump Python requirements - Python 3.6 for f-string support - Boost 1.67 because it has consistent library naming and some CMake support --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e6fba700..d430fd2d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,8 +156,8 @@ set( _tx_incomplete eo es_PE fr_CH gu id_ID ie kk kn ko_KR lo lv mk set( QT_VERSION 5.15.0 ) set( YAMLCPP_VERSION 0.5.1 ) set( ECM_VERSION 5.18 ) -set( PYTHONLIBS_VERSION 3.3 ) -set( BOOSTPYTHON_VERSION 1.55.0 ) +set( PYTHONLIBS_VERSION 3.6 ) +set( BOOSTPYTHON_VERSION 1.67.0 ) ### CMAKE SETUP From df256b608a73cb6cb83da940c67f5d7e8c369e5a Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Sun, 6 Dec 2020 17:40:18 +0000 Subject: [PATCH 014/160] [initcpiocfg] code tidy up --- src/modules/initcpiocfg/main.py | 55 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 4fb0923cd..f0070c4dd 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -12,7 +12,6 @@ # Calamares is Free Software: see the License-Identifier above. # -import libcalamares from libcalamares.utils import debug, target_env_call import os from collections import OrderedDict @@ -41,7 +40,7 @@ def cpuinfo(): nprocs = 0 - with open('/proc/cpuinfo') as cpuinfo_file: + with open("/proc/cpuinfo") as cpuinfo_file: for line in cpuinfo_file: if not line.strip(): # end of one processor @@ -50,11 +49,11 @@ def cpuinfo(): # Reset procinfo = OrderedDict() else: - if len(line.split(':')) == 2: - splitted_line = line.split(':')[1].strip() - procinfo[line.split(':')[0].strip()] = splitted_line + if len(line.split(":")) == 2: + splitted_line = line.split(":")[1].strip() + procinfo[line.split(":")[0].strip()] = splitted_line else: - procinfo[line.split(':')[0].strip()] = '' + procinfo[line.split(":")[0].strip()] = "" return cpu_info @@ -78,14 +77,14 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): for i in range(len(mklins)): if mklins[i].startswith("HOOKS"): - joined_hooks = ' '.join(hooks) - mklins[i] = "HOOKS=\"{!s}\"".format(joined_hooks) + joined_hooks = " ".join(hooks) + mklins[i] = "HOOKS='{!s}'".format(joined_hooks) elif mklins[i].startswith("MODULES"): joined_modules = ' '.join(modules) - mklins[i] = "MODULES=\"{!s}\"".format(joined_modules) + mklins[i] = "MODULES='{!s}'".format(joined_modules) elif mklins[i].startswith("FILES"): joined_files = ' '.join(files) - mklins[i] = "FILES=\"{!s}\"".format(joined_files) + mklins[i] = "FILES='{!s}'".format(joined_files) path = os.path.join(root_mount_point, "etc/mkinitcpio.conf") @@ -112,10 +111,17 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): """ cpu = cpuinfo() swap_uuid = "" - btrfs = "" - lvm2 = "" - hooks = ["base", "udev", "autodetect", "modconf", "block", "keyboard", - "keymap"] + btrfs = False + lvm2 = False + hooks = [ + "base", + "udev", + "autodetect", + "modconf", + "block", + "keyboard", + "keymap" + ] modules = [] files = [] encrypt_hook = False @@ -137,10 +143,10 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): openswap_hook = True if partition["fs"] == "btrfs": - btrfs = "yes" + btrfs = True if "lvm2" in partition["fs"]: - lvm2 = "yes" + lvm2 = True if partition["mountPoint"] == "/" and "luksMapperName" in partition: encrypt_hook = True @@ -156,11 +162,12 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): hooks.append("plymouth-encrypt") else: hooks.append("encrypt") + crypto_file = "crypto_keyfile.bin" if not unencrypted_separate_boot and \ os.path.isfile( - os.path.join(root_mount_point, "crypto_keyfile.bin") + os.path.join(root_mount_point, crypto_file) ): - files.append("/crypto_keyfile.bin") + files.append("/{!s}".format(crypto_file)) if lvm2: hooks.append("lvm2") @@ -172,10 +179,10 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): else: hooks.extend(["filesystems"]) - if btrfs == "yes" and cpu['proc0']['vendor_id'].lower() != "genuineintel": + cpu_intel = "genuineintel" + if btrfs and cpu["proc0"]["vendor_id"].lower() != cpu_intel: modules.append("crc32c") - elif (btrfs == "yes" - and cpu['proc0']['vendor_id'].lower() == "genuineintel"): + elif (btrfs and cpu["proc0"]["vendor_id"].lower() == cpu_intel): modules.append("crc32c-intel") else: hooks.append("fsck") @@ -185,7 +192,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): def run(): """ - Calls routine with given parameters to modify '/etc/mkinitcpio.conf'. + Calls routine with given parameters to modify "/etc/mkinitcpio.conf". :return: """ @@ -195,11 +202,11 @@ def run(): if not partitions: libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) return (_("Configuration Error"), - _("No partitions are defined for
{!s}
to use." ).format("initcpiocfg")) + _("No partitions are defined for
{!s}
to use.").format("initcpiocfg")) if not root_mount_point: libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) return (_("Configuration Error"), - _("No root mount point is given for
{!s}
to use." ).format("initcpiocfg")) + _("No root mount point is given for
{!s}
to use.").format("initcpiocfg")) modify_mkinitcpio_conf(partitions, root_mount_point) From 5da736466cdc1b784116d4583b5ab04cbb66a2ca Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Tue, 8 Dec 2020 15:54:05 +0000 Subject: [PATCH 015/160] [initcpiocfg] rework is_intel_cpu --- src/modules/initcpiocfg/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index f0070c4dd..f1b72a97e 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -127,6 +127,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): encrypt_hook = False openswap_hook = False unencrypted_separate_boot = False + is_cpu_intel = cpu["proc0"]["vendor_id"].lower() == "genuineintel" # It is important that the plymouth hook comes before any encrypt hook if detect_plymouth(): @@ -179,12 +180,13 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): else: hooks.extend(["filesystems"]) - cpu_intel = "genuineintel" - if btrfs and cpu["proc0"]["vendor_id"].lower() != cpu_intel: + if btrfs and not is_cpu_intel: modules.append("crc32c") - elif (btrfs and cpu["proc0"]["vendor_id"].lower() == cpu_intel): + + elif btrfs and is_cpu_intel: modules.append("crc32c-intel") - else: + + elif not btrfs: hooks.append("fsck") write_mkinitcpio_lines(hooks, modules, files, root_mount_point) From 0ad9242ab7dc9b5d315b6c8dd277b7c5104a1600 Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Tue, 8 Dec 2020 16:01:53 +0000 Subject: [PATCH 016/160] [initcpiocfg] mkinitcpio.conf might not understand single quotes --- src/modules/initcpiocfg/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index f1b72a97e..50a199f32 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -78,13 +78,13 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): for i in range(len(mklins)): if mklins[i].startswith("HOOKS"): joined_hooks = " ".join(hooks) - mklins[i] = "HOOKS='{!s}'".format(joined_hooks) + mklins[i] = 'HOOKS="{!s}"'.format(joined_hooks) elif mklins[i].startswith("MODULES"): joined_modules = ' '.join(modules) - mklins[i] = "MODULES='{!s}'".format(joined_modules) + mklins[i] = 'MODULES="{!s}"'.format(joined_modules) elif mklins[i].startswith("FILES"): joined_files = ' '.join(files) - mklins[i] = "FILES='{!s}'".format(joined_files) + mklins[i] = 'FILES="{!s}"'.format(joined_files) path = os.path.join(root_mount_point, "etc/mkinitcpio.conf") From 453e760709d1c513f66067292bd080d78e2e8737 Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Tue, 8 Dec 2020 16:05:40 +0000 Subject: [PATCH 017/160] [initcpiocfg] use format instead of % --- src/modules/initcpiocfg/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 50a199f32..78640055a 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -72,7 +72,7 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): with open(hostfile, "r") as mkinitcpio_file: mklins = [x.strip() for x in mkinitcpio_file.readlines()] except FileNotFoundError: - libcalamares.utils.debug("Could not open host file '%s'" % hostfile) + libcalamares.utils.debug("Could not open host file {!s}".format(hostfile)) mklins = [] for i in range(len(mklins)): From 1fe27effe578c9f91d2dd2c8a2ea438901c4d913 Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Tue, 8 Dec 2020 16:34:58 +0000 Subject: [PATCH 018/160] [initcpiocfg] rework swap_uuid statement and filesystem hook --- src/modules/initcpiocfg/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 78640055a..2cef52f19 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -134,6 +134,8 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): hooks.append("plymouth") for partition in partitions: + hooks.extend(["filesystems"]) + if partition["fs"] == "linuxswap" and not partition.get("claimed", None): # Skip foreign swap continue @@ -174,11 +176,9 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): hooks.append("lvm2") if swap_uuid != "": + hooks.extend(["resume"]) if encrypt_hook and openswap_hook: hooks.extend(["openswap"]) - hooks.extend(["resume", "filesystems"]) - else: - hooks.extend(["filesystems"]) if btrfs and not is_cpu_intel: modules.append("crc32c") From 4b08aebe7f344c9fcec81b8a1b513dc63d16b3a2 Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Wed, 9 Dec 2020 13:32:39 +0000 Subject: [PATCH 019/160] [initcpiocfg] Use F strings, python3.6 only --- src/modules/initcpiocfg/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 2cef52f19..5fdcc32c1 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -72,7 +72,7 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): with open(hostfile, "r") as mkinitcpio_file: mklins = [x.strip() for x in mkinitcpio_file.readlines()] except FileNotFoundError: - libcalamares.utils.debug("Could not open host file {!s}".format(hostfile)) + libcalamares.utils.debug(f"Could not open host file {hostfile}") mklins = [] for i in range(len(mklins)): @@ -170,7 +170,7 @@ def modify_mkinitcpio_conf(partitions, root_mount_point): os.path.isfile( os.path.join(root_mount_point, crypto_file) ): - files.append("/{!s}".format(crypto_file)) + files.append(f"/{crypto_file}") if lvm2: hooks.append("lvm2") @@ -202,13 +202,13 @@ def run(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") if not partitions: - libcalamares.utils.warning("partitions is empty, {!s}".format(partitions)) + libcalamares.utils.warning(f"partitions is empty, {partitions}") return (_("Configuration Error"), - _("No partitions are defined for
{!s}
to use.").format("initcpiocfg")) + _("No partitions are defined for
initcpiocfg
to use.")) if not root_mount_point: - libcalamares.utils.warning("rootMountPoint is empty, {!s}".format(root_mount_point)) + libcalamares.utils.warning(f"rootMountPoint is empty, {root_mount_point}") return (_("Configuration Error"), - _("No root mount point is given for
{!s}
to use.").format("initcpiocfg")) + _("No root mount point is given for
initcpiocfg
to use.")) modify_mkinitcpio_conf(partitions, root_mount_point) From f9dc932f6265921c7b8e5acafc1e0e6e3b443173 Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Wed, 9 Dec 2020 13:35:29 +0000 Subject: [PATCH 020/160] [initcpiocfg] fix english in human-visible string --- src/modules/initcpiocfg/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index 5fdcc32c1..029a02195 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -202,13 +202,13 @@ def run(): root_mount_point = libcalamares.globalstorage.value("rootMountPoint") if not partitions: - libcalamares.utils.warning(f"partitions is empty, {partitions}") + libcalamares.utils.warning(f"partitions are empty, {partitions}") return (_("Configuration Error"), - _("No partitions are defined for
initcpiocfg
to use.")) + _("No partitions are defined for
initcpiocfg
.")) if not root_mount_point: libcalamares.utils.warning(f"rootMountPoint is empty, {root_mount_point}") return (_("Configuration Error"), - _("No root mount point is given for
initcpiocfg
to use.")) + _("No root mount point for
initcpiocfg
.")) modify_mkinitcpio_conf(partitions, root_mount_point) From bd3f89fb57b0eb4a0ac24a0fd4117380aaf00e6d Mon Sep 17 00:00:00 2001 From: Vitor Lopes Date: Wed, 9 Dec 2020 17:18:10 +0000 Subject: [PATCH 021/160] [grubcfg] tidy code + pep8 --- src/modules/grubcfg/main.py | 75 ++++++++++++++----------------------- 1 file changed, 28 insertions(+), 47 deletions(-) diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index 9e9615a0c..230ea5dd9 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -48,8 +48,12 @@ def get_grub_config_path(root_mount_point): if not os.path.exists(default_dir): try: os.mkdir(default_dir) - except: - libcalamares.utils.debug("Failed to create '%r'" % default_dir) + except Exception as error: + # exception as error is still redundant, but it print out the error + # identify a solution for each exception and + # if possible and code it within. + libcalamares.utils.debug(f"Failed to create {default_dir}") + libcalamares.utils.debug(f"{error}") raise return os.path.join(default_dir, default_config_file) @@ -111,14 +115,12 @@ def modify_grub_default(partitions, root_mount_point, distributor): if partition["fs"] == "linuxswap" and not has_luks: swap_uuid = partition["uuid"] - if (partition["fs"] == "linuxswap" and has_luks): + if partition["fs"] == "linuxswap" and has_luks: swap_outer_uuid = partition["luksUuid"] swap_outer_mappername = partition["luksMapperName"] - if (partition["mountPoint"] == "/" and has_luks): - cryptdevice_params = [ - "rd.luks.uuid={!s}".format(partition["luksUuid"]) - ] + if partition["mountPoint"] == "/" and has_luks: + cryptdevice_params = [f"rd.luks.uuid={partition['luksUuid']}"] else: for partition in partitions: if partition["fs"] == "linuxswap" and not partition.get("claimed", None): @@ -128,21 +130,16 @@ def modify_grub_default(partitions, root_mount_point, distributor): if partition["fs"] == "linuxswap" and not has_luks: swap_uuid = partition["uuid"] - if (partition["fs"] == "linuxswap" and has_luks): + if partition["fs"] == "linuxswap" and has_luks: swap_outer_mappername = partition["luksMapperName"] - if (partition["mountPoint"] == "/" and has_luks): + if partition["mountPoint"] == "/" and has_luks: cryptdevice_params = [ - "cryptdevice=UUID={!s}:{!s}".format( - partition["luksUuid"], partition["luksMapperName"] - ), - "root=/dev/mapper/{!s}".format( - partition["luksMapperName"] - ) + f"cryptdevice=UUID={partition['luksUuid']}:{partition['luksMapperName']}", + f"root=/dev/mapper/{partition['luksMapperName']}" ] kernel_params = ["quiet"] - if cryptdevice_params: kernel_params.extend(cryptdevice_params) @@ -150,33 +147,28 @@ def modify_grub_default(partitions, root_mount_point, distributor): kernel_params.append(use_splash) if swap_uuid: - kernel_params.append("resume=UUID={!s}".format(swap_uuid)) + kernel_params.append(f"resume=UUID={swap_uuid}") if have_dracut and swap_outer_uuid: - kernel_params.append("rd.luks.uuid={!s}".format(swap_outer_uuid)) + kernel_params.append(f"rd.luks.uuid={swap_outer_uuid}") if swap_outer_mappername: - kernel_params.append("resume=/dev/mapper/{!s}".format( - swap_outer_mappername)) - - distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace) - - have_kernel_cmd = False - have_distributor_line = False + kernel_params.append(f"resume=/dev/mapper/{swap_outer_mappername}") if "overwrite" in libcalamares.job.configuration: overwrite = libcalamares.job.configuration["overwrite"] else: overwrite = False + distributor_line = f"GRUB_DISTRIBUTOR='{distributor_replace}'" + kernel_cmd = f'GRUB_CMDLINE_LINUX_DEFAULT="{" ".join(kernel_params)}"' + have_kernel_cmd = False + have_distributor_line = False if os.path.exists(default_grub) and not overwrite: with open(default_grub, 'r') as grub_file: lines = [x.strip() for x in grub_file.readlines()] for i in range(len(lines)): if lines[i].startswith("#GRUB_CMDLINE_LINUX_DEFAULT"): - kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"{!s}\"".format( - " ".join(kernel_params) - ) lines[i] = kernel_cmd have_kernel_cmd = True elif lines[i].startswith("GRUB_CMDLINE_LINUX_DEFAULT"): @@ -198,9 +190,6 @@ def modify_grub_default(partitions, root_mount_point, distributor): "quiet", "resume", "splash"]: kernel_params.append(existing_param) - kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"{!s}\"".format( - " ".join(kernel_params) - ) lines[i] = kernel_cmd have_kernel_cmd = True elif (lines[i].startswith("#GRUB_DISTRIBUTOR") @@ -229,12 +218,9 @@ def modify_grub_default(partitions, root_mount_point, distributor): else: escaped_value = str(value).replace("'", "'\\''") - lines.append("{!s}='{!s}'".format(key, escaped_value)) + lines.append(f"{key}='{escaped_value}'") if not have_kernel_cmd: - kernel_cmd = "GRUB_CMDLINE_LINUX_DEFAULT=\"{!s}\"".format( - " ".join(kernel_params) - ) lines.append(kernel_cmd) if not have_distributor_line: @@ -255,28 +241,23 @@ def run(): :return: """ - fw_type = libcalamares.globalstorage.value("firmwareType") - - if (libcalamares.globalstorage.value("bootLoader") is None - and fw_type != "efi"): - return None - partitions = libcalamares.globalstorage.value("partitions") + root_mount_point = libcalamares.globalstorage.value("rootMountPoint") + branding = libcalamares.globalstorage.value("branding") + distributor = branding["bootloaderEntryName"] + + if libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi": + return None if fw_type == "efi": esp_found = False for partition in partitions: - if (partition["mountPoint"] - == libcalamares.globalstorage.value("efiSystemPartition")): + if partition["mountPoint"] == libcalamares.globalstorage.value("efiSystemPartition"): esp_found = True if not esp_found: return None - root_mount_point = libcalamares.globalstorage.value("rootMountPoint") - branding = libcalamares.globalstorage.value("branding") - distributor = branding["bootloaderEntryName"] - return modify_grub_default(partitions, root_mount_point, distributor) From e1df2a245088e9b7466dff0cc9563536769bd542 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 16 Sep 2021 14:15:12 +0200 Subject: [PATCH 022/160] Changes: document Python work and other deps-updates --- CHANGES | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 24a43594b..c1158c641 100644 --- a/CHANGES +++ b/CHANGES @@ -10,15 +10,20 @@ the history of the 3.2 series (2018-05 - 2021-12). # 3.3.0 (unreleased) # This release contains contributions from (alphabetically by first name): - - No external contributors yet + - Vitor Lopes ## Core ## + - CMake 3.16, Qt 5.15 are now required; the newer CMake is to support + new features (also for KDE Frameworks), Qt is the current LTS version. - KDE Framework "DBusAddons" is now required, and is used to "activate" Calamares; the KDAB Single Application Guard is no longer used. KDSAG needed patching to chase Qt 5.15 deprecations, and the DBus activation code is tried and tested in Frameworks (tier 1). Running `calamares -d` no longer enforces a single-application (it is for debugging purposes, after all). + - Python 3.6 or later is now required, to allow for F-strings in + Python code and allow other tidy-ups in the Python modules. + Boost::Python now requires 1.67 or later (for CMake support). ## Modules ## - No module changes yet From ca4dbabf7060fc2e3eaa86e90155f7356fe7fb54 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 23:49:08 +0200 Subject: [PATCH 023/160] Remove PythonQt support Nothing beyond the example module was ever built with the PythonQt bindings, as far as I can tell. They have been deprecated, defaulting OFF for over two years now. QML modules fill the gap with customizable, run-time interpreted UI and stronger support from the C++ side of Calamares. --- CMakeLists.txt | 15 -- .../CalamaresAddModuleSubdirectory.cmake | 3 +- CMakeModules/FindPythonQt.cmake | 185 ---------------- CONTRIBUTING.md | 1 - CalamaresConfig.cmake.in | 1 - src/calamares/DebugWindow.cpp | 76 +------ src/libcalamares/CalamaresConfig.h.in | 1 - src/libcalamaresui/CMakeLists.txt | 16 -- .../modulesystem/ModuleFactory.cpp | 8 - .../modulesystem/PythonQtViewModule.cpp | 184 ---------------- .../modulesystem/PythonQtViewModule.h | 50 ----- src/libcalamaresui/utils/PythonQtUtils.cpp | 37 ---- src/libcalamaresui/utils/PythonQtUtils.h | 29 --- .../PythonQtGlobalStorageWrapper.cpp | 61 ------ .../viewpages/PythonQtGlobalStorageWrapper.h | 48 ----- src/libcalamaresui/viewpages/PythonQtJob.cpp | 62 ------ src/libcalamaresui/viewpages/PythonQtJob.h | 53 ----- .../viewpages/PythonQtUtilsWrapper.cpp | 116 ---------- .../viewpages/PythonQtUtilsWrapper.h | 57 ----- .../viewpages/PythonQtViewStep.cpp | 203 ------------------ .../viewpages/PythonQtViewStep.h | 57 ----- src/libcalamaresui/viewpages/ViewStep.h | 3 +- src/modules/README.md | 11 - src/modules/dummypythonqt/dummypythonqt.conf | 24 --- .../lang/ar/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/as/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/ast/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/be/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/bg/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/bn/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/ca/LC_MESSAGES/dummypythonqt.po | 46 ---- .../ca@valencia/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/cs_CZ/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/da/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/de/LC_MESSAGES/dummypythonqt.po | 46 ---- .../dummypythonqt/lang/dummypythonqt.pot | 42 ---- .../lang/el/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/en_GB/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/eo/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/es/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/es_MX/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/es_PR/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/et/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/eu/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/fa/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/fi_FI/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/fr/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/fr_CH/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/gl/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/gu/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/he/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/hi/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/hr/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/hu/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/id/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/is/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/it_IT/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/ja/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/kk/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/kn/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/ko/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/lo/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/lt/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/lv/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/mk/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/ml/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/mr/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/nb/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/ne_NP/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/nl/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/pl/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/pt_BR/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/pt_PT/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/ro/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/ru/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/sk/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/sl/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/sq/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/sr/LC_MESSAGES/dummypythonqt.po | 46 ---- .../sr@latin/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/sv/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/th/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/tr_TR/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/uk/LC_MESSAGES/dummypythonqt.po | 46 ---- .../lang/ur/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/uz/LC_MESSAGES/dummypythonqt.po | 42 ---- .../lang/zh_CN/LC_MESSAGES/dummypythonqt.po | 47 ---- .../lang/zh_TW/LC_MESSAGES/dummypythonqt.po | 46 ---- src/modules/dummypythonqt/main.py | 188 ---------------- src/modules/dummypythonqt/module.desc | 9 - 90 files changed, 4 insertions(+), 4378 deletions(-) delete mode 100644 CMakeModules/FindPythonQt.cmake delete mode 100644 src/libcalamaresui/modulesystem/PythonQtViewModule.cpp delete mode 100644 src/libcalamaresui/modulesystem/PythonQtViewModule.h delete mode 100644 src/libcalamaresui/utils/PythonQtUtils.cpp delete mode 100644 src/libcalamaresui/utils/PythonQtUtils.h delete mode 100644 src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.cpp delete mode 100644 src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.h delete mode 100644 src/libcalamaresui/viewpages/PythonQtJob.cpp delete mode 100644 src/libcalamaresui/viewpages/PythonQtJob.h delete mode 100644 src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp delete mode 100644 src/libcalamaresui/viewpages/PythonQtUtilsWrapper.h delete mode 100644 src/libcalamaresui/viewpages/PythonQtViewStep.cpp delete mode 100644 src/libcalamaresui/viewpages/PythonQtViewStep.h delete mode 100644 src/modules/dummypythonqt/dummypythonqt.conf delete mode 100644 src/modules/dummypythonqt/lang/ar/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/as/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ast/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/bg/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/bn/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ca/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ca@valencia/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/cs_CZ/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/da/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/de/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/dummypythonqt.pot delete mode 100644 src/modules/dummypythonqt/lang/el/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/en_GB/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/eo/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/es/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/es_MX/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/es_PR/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/et/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/eu/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/fa/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/fi_FI/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/fr/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/fr_CH/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/gl/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/gu/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/he/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/hi/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/hr/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/hu/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/id/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/is/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/it_IT/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ja/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/kk/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/kn/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ko/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/lo/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/lt/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/lv/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/mk/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ml/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/mr/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/nb/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ne_NP/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/nl/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/pl/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/pt_BR/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/pt_PT/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ro/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ru/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sk/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sl/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sq/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sr/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sr@latin/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/sv/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/th/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/tr_TR/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/uk/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/ur/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/uz/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/zh_CN/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/lang/zh_TW/LC_MESSAGES/dummypythonqt.po delete mode 100644 src/modules/dummypythonqt/main.py delete mode 100644 src/modules/dummypythonqt/module.desc diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c70c4538..a39dc616c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,6 @@ # CMake once. These affect the ABI offered by Calamares. # - PYTHON (enable Python Job modules) # - QML (enable QML UI View modules) -# - PYTHONQT # TODO:3.3: remove # BUILD_ : choose additional things to build # - TESTING (standard CMake option) # - SCHEMA_TESTING (requires Python, see ci/configvalidator.py) @@ -66,7 +65,6 @@ option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) # TODO:3.3: WI # When adding WITH_* that affects the ABI offered by libcalamares, # also update libcalamares/CalamaresConfig.h.in option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) -option( WITH_PYTHONQT "Enable Python view modules API (deprecated, requires PythonQt)." OFF ) # TODO:3.3: remove option( WITH_QML "Enable QML UI options." ON ) # # Additional parts to build @@ -397,29 +395,17 @@ if ( PYTHONLIBS_FOUND ) Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules." ) - # TODO:3.3: Remove PythonQt support - find_package( PythonQt ) - set_package_properties( PythonQt PROPERTIES - DESCRIPTION "A Python embedding solution for Qt applications." - URL "http://pythonqt.sourceforge.net" - PURPOSE "PythonQt is used for Python view modules." - ) endif() if( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND ) message(STATUS "Disabling Boost::Python modules") set( WITH_PYTHON OFF ) endif() -if( NOT PYTHONLIBS_FOUND OR NOT PYTHONQT_FOUND ) - message(STATUS "Disabling PythonQt modules") - set( WITH_PYTHONQT OFF ) -endif() # Now we know the state of the ABI-options, copy them into "Calamares_" # prefixed variables, to match how the variables would-be-named # when building out-of-tree. set(Calamares_WITH_PYTHON ${WITH_PYTHON}) -set(Calamares_WITH_PYTHONQT ${WITH_PYTHONQT}) set(Calamares_WITH_QML ${WITH_QML}) ### Transifex Translation status @@ -573,7 +559,6 @@ set( Calamares_LIBRARIES calamares ) add_subdirectory( src ) add_feature_info(Python ${WITH_PYTHON} "Python job modules") -add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules") add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index 91524a09e..e0eed223e 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -121,7 +121,8 @@ function( _calamares_add_module_subdirectory_impl ) # _mod_testing boolean if the module should be added to the loadmodule tests file(STRINGS "${_mod_dir}/module.desc" MODULE_INTERFACE REGEX "^interface") if ( MODULE_INTERFACE MATCHES "pythonqt" ) - set( _mod_enabled ${Calamares_WITH_PYTHONQT} ) + message( FATAL_ERROR "PythonQt is no longer supported" ) + set( _mod_enabled OFF ) set( _mod_reason "No PythonQt support" ) set( _mod_testing OFF ) elseif ( MODULE_INTERFACE MATCHES "python" ) diff --git a/CMakeModules/FindPythonQt.cmake b/CMakeModules/FindPythonQt.cmake deleted file mode 100644 index 81208a86e..000000000 --- a/CMakeModules/FindPythonQt.cmake +++ /dev/null @@ -1,185 +0,0 @@ -# === This file is part of Calamares - === -# -# SPDX-FileCopyrightText: 2016 Teo Mrnjavac -# SPDX-FileCopyrightText: 2017 Adriaan de Groot -# SPDX-License-Identifier: BSD-2-Clause -# -### -# -# Find PythonQt -# -# Sets PYTHONQT_FOUND, PYTHONQT_INCLUDE_DIR, PYTHONQT_LIBRARY, PYTHONQT_LIBRARIES -# -# Also sets PYTHONQT_INCLUDE_DIRS to add whatever directories -# that are needed for extensions. -# - -# Python is required -find_package(PythonLibs) -if(NOT PYTHONLIBS_FOUND) - message(FATAL_ERROR "error: Python is required to build PythonQt") -endif() - -# Cut X.Y[.Z] down to just X.Y -string(REGEX REPLACE - "^([0-9][0-9]*)\.([0-9][0-9]*)" - "\\1.\\2@" - _PYTHONLIBS_MAJMIN - ${PYTHONLIBS_VERSION_STRING} -) -string(REGEX REPLACE - "@.*" - "" - PYTHONLIBS_MAJMIN - ${_PYTHONLIBS_MAJMIN} -) - -if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}") - find_path(PYTHONQT_INSTALL_DIR - NAMES - include/PythonQt/PythonQt.h - include/PythonQt5/PythonQt.h - DOC "Directory where PythonQt was installed.") -endif() - -# XXX Since PythonQt 3.0 is not yet cmakeified, depending -# on how PythonQt is built, headers will not always be -# installed in "include/PythonQt". That is why "src" -# is added as an option. See [1] for more details. -# [1] https://github.com/commontk/CTK/pull/538#issuecomment-86106367 -find_path(PYTHONQT_INCLUDE_DIR PythonQt.h - PATHS - "${PYTHONQT_INSTALL_DIR}/include/PythonQt" - "${PYTHONQT_INSTALL_DIR}/include/PythonQt5" - "${PYTHONQT_INSTALL_DIR}/src" - DOC "Path to the PythonQt include directory") -find_path(PYTHONQT_ALL_INCLUDE_DIR PythonQt_QtAll.h - PATHS - "${PYTHONQT_INCLUDE_DIR}" - "${PYTHONQT_INSTALL_DIR}" - PATH_SUFFIXES - "extensions/PythonQt_QtAll" - "src" - DOC "Path to the PythonQt 'all' header") - -if ( NOT PythonQt_FIND_QUIETLY ) - message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." ) - if ( PYTHONQT_INCLUDE_DIR ) - message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" ) - message( STATUS " .. found all include ${PYTHONQT_ALL_INCLUDE_DIR}" ) - endif() -endif() - -# Minimum v3.1 is needed -find_library(PYTHONQT_LIBRARY_RELEASE - NAMES - PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN} - PythonQt-Qt5-Python3 - PythonQt - PATHS "${PYTHONQT_INSTALL_DIR}/lib" - DOC "The PythonQt library." -) -find_library(PYTHONQT_LIBRARY_DEBUG - NAMES - PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}JMIN${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX} - PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN} - PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} - PythonQt-Qt5-Python3 - PythonQt${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt${CMAKE_DEBUG_POSTFIX} - PythonQt - PATHS "${PYTHONQT_INSTALL_DIR}/lib" - DOC "The PythonQt library (debug build)." -) -find_library(PYTHONQT_QTALL_LIBRARY_RELEASE - NAMES - PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN} - PythonQt_QtAll-Qt5-Python3 - PythonQt_QtAll - PATHS "${PYTHONQT_INSTALL_DIR}/lib" - DOC "Full Qt bindings for the PythonQt library." -) -find_library(PYTHONQT_QTALL_LIBRARY_DEBUG - NAMES - PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN} - PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll-Qt5-Python3 - PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} - PythonQt_QtAll - PATHS "${PYTHONQT_INSTALL_DIR}/lib" - DOC "Full Qt bindings for the PythonQt library (debug build)." -) - -set(PYTHONQT_LIBRARY) -if(PYTHONQT_LIBRARY_RELEASE) - list(APPEND PYTHONQT_LIBRARY optimized ${PYTHONQT_LIBRARY_RELEASE}) -endif() -if(PYTHONQT_LIBRARY_DEBUG) - list(APPEND PYTHONQT_LIBRARY debug ${PYTHONQT_LIBRARY_DEBUG}) -endif() - -set(PYTHONQT_QTALL_LIBRARY) -if(PYTHONQT_QTALL_LIBRARY_RELEASE) - list(APPEND PYTHONQT_QTALL_LIBRARY optimized ${PYTHONQT_QTALL_LIBRARY_RELEASE}) -endif() -if(PYTHONQT_QTALL_LIBRARY_DEBUG) - list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG}) -endif() - -if ( NOT PythonQt_FIND_QUIETLY ) - if ( PYTHONQT_LIBRARY ) - message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) - endif() - if ( PYTHONQT_QTALL_LIBRARY ) - message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) - endif() -endif() - - -mark_as_advanced(PYTHONQT_INSTALL_DIR) -mark_as_advanced(PYTHONQT_INCLUDE_DIR) -mark_as_advanced(PYTHONQT_LIBRARY_RELEASE) -mark_as_advanced(PYTHONQT_LIBRARY_DEBUG) -mark_as_advanced(PYTHONQT_QTALL_LIBRARY_RELEASE) -mark_as_advanced(PYTHONQT_QTALL_LIBRARY_DEBUG) - -# On linux, also find libutil -if(UNIX AND NOT APPLE) - find_library(PYTHONQT_LIBUTIL util) - mark_as_advanced(PYTHONQT_LIBUTIL) -endif() - -# All upper case _FOUND variable is maintained for backwards compatibility. -set(PYTHONQT_FOUND 0) -set(PythonQt_FOUND 0) - -if(PYTHONQT_INCLUDE_DIR AND PYTHONQT_LIBRARY AND PYTHONQT_QTALL_LIBRARY) - # Currently CMake'ified PythonQt only supports building against a python Release build. - # This applies independently of CTK build type (Release, Debug, ...) - add_definitions(-DPYTHONQT_USE_RELEASE_PYTHON_FALLBACK) - set(PYTHONQT_FOUND 1) - set(PythonQt_FOUND ${PYTHONQT_FOUND}) - set(PYTHONQT_LIBRARIES ${PYTHONQT_LIBRARY} ${PYTHONQT_LIBUTIL} ${PYTHONQT_QTALL_LIBRARY}) - set(PYTHONQT_INCLUDE_DIRS ${PYTHONQT_INCLUDE_DIR}) - if(PYTHONQT_ALL_INCLUDE_DIR) - list(APPEND PYTHONQT_INCLUDE_DIRS ${PYTHONQT_ALL_INCLUDE_DIR}) - endif() -elseif(NOT PythonQt_FIND_QUIETLY) - set(_missing "") - if (NOT PYTHONQT_INCLUDE_DIR) - list(APPEND _missing "includes") - endif() - if (NOT PYTHONQT_LIBRARY) - list(APPEND _missing "library") - endif() - if (NOT PYTHONQT_QTALL_LIBRARY) - list(APPEND _missing "qtall") - endif() - message(STATUS "PythonQt not found, missing components ${_missing}") -endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0be408ba0..aec9cb9e6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -86,7 +86,6 @@ Main: * KDE extra-cmake-modules >= 5.18 (recommended; required for some modules; required for some tests) * KDE Frameworks KCoreAddons (>= 5.58 recommended) -* PythonQt (optional, deprecated) Individual modules may have their own requirements; these are listed in CMake output. diff --git a/CalamaresConfig.cmake.in b/CalamaresConfig.cmake.in index 4fb9621ca..7b7f5aff9 100644 --- a/CalamaresConfig.cmake.in +++ b/CalamaresConfig.cmake.in @@ -87,5 +87,4 @@ include(CalamaresAddPlugin) # This list should match the one in libcalamares/CalamaresConfig.h, # which is the C++-language side of the same configuration. set(Calamares_WITH_PYTHON @WITH_PYTHON@) -set(Calamares_WITH_PYTHONQT @WITH_PYTHONQT@) set(Calamares_WITH_QML @WITH_QML@) diff --git a/src/calamares/DebugWindow.cpp b/src/calamares/DebugWindow.cpp index b5fd899d4..0ac8d2f60 100644 --- a/src/calamares/DebugWindow.cpp +++ b/src/calamares/DebugWindow.cpp @@ -23,13 +23,6 @@ #include "utils/Paste.h" #include "utils/Retranslator.h" -#ifdef WITH_PYTHONQT -#include "ViewManager.h" -#include "viewpages/PythonQtViewStep.h" - -#include -#endif - #include #include #include @@ -110,73 +103,10 @@ DebugWindow::DebugWindow() m_ui->moduleConfigView->setModel( m_module_model.get() ); -#ifdef WITH_PYTHONQT - QPushButton* pythonConsoleButton = new QPushButton; - pythonConsoleButton->setText( "Attach Python console" ); - m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton ); - pythonConsoleButton->hide(); - - QObject::connect( pythonConsoleButton, &QPushButton::clicked, this, [this, moduleConfigModel] { - QString moduleName = m_ui->modulesListView->currentIndex().data().toString(); - Module* module = ModuleManager::instance()->moduleInstance( moduleName ); - if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View ) - return; - - for ( ViewStep* step : ViewManager::instance()->viewSteps() ) - { - if ( step->moduleInstanceKey() == module->instanceKey() ) - { - PythonQtViewStep* pqvs = qobject_cast< PythonQtViewStep* >( step ); - if ( pqvs ) - { - QWidget* consoleWindow = new QWidget; - - QWidget* console = pqvs->createScriptingConsole(); - console->setParent( consoleWindow ); - - QVBoxLayout* layout = new QVBoxLayout; - consoleWindow->setLayout( layout ); - layout->addWidget( console ); - - QHBoxLayout* bottomLayout = new QHBoxLayout; - layout->addLayout( bottomLayout ); - - QLabel* bottomLabel = new QLabel( consoleWindow ); - bottomLayout->addWidget( bottomLabel ); - QString line = QString( "Module: %1
" - "Python class: %2" ) - .arg( module->instanceKey() ) - .arg( console->property( "classname" ).toString() ); - bottomLabel->setText( line ); - - QPushButton* closeButton = new QPushButton( consoleWindow ); - closeButton->setText( "&Close" ); - QObject::connect( closeButton, &QPushButton::clicked, [consoleWindow] { consoleWindow->close(); } ); - bottomLayout->addWidget( closeButton ); - bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - - consoleWindow->setParent( this ); - consoleWindow->setWindowFlags( Qt::Window ); - consoleWindow->setWindowTitle( "Calamares Python console" ); - consoleWindow->setAttribute( Qt::WA_DeleteOnClose, true ); - consoleWindow->showNormal(); - break; - } - } - } - } ); - -#endif - connect( m_ui->modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged, this, - [this -#ifdef WITH_PYTHONQT - , - pythonConsoleButton -#endif - ] { + [this] { QString moduleName = m_ui->modulesListView->currentIndex().data().toString(); Module* module = ModuleManager::instance()->moduleInstance( ModuleSystem::InstanceKey::fromString( moduleName ) ); @@ -187,10 +117,6 @@ DebugWindow::DebugWindow() m_ui->moduleConfigView->expandAll(); m_ui->moduleTypeLabel->setText( module->typeString() ); m_ui->moduleInterfaceLabel->setText( module->interfaceString() ); -#ifdef WITH_PYTHONQT - pythonConsoleButton->setVisible( module->interface() == Module::Interface::PythonQt - && module->type() == Module::Type::View ); -#endif } } ); diff --git a/src/libcalamares/CalamaresConfig.h.in b/src/libcalamares/CalamaresConfig.h.in index 3d551b8e8..23d4ebfd0 100644 --- a/src/libcalamares/CalamaresConfig.h.in +++ b/src/libcalamares/CalamaresConfig.h.in @@ -25,7 +25,6 @@ * which is the CMake-time side of the same configuration. */ #cmakedefine WITH_PYTHON -#cmakedefine WITH_PYTHONQT #cmakedefine WITH_QML #endif // CALAMARESCONFIG_H diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index a704b7484..72f3bd09f 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -50,17 +50,6 @@ if( WITH_PYTHON ) ) endif() -if( WITH_PYTHONQT ) - list( APPEND calamaresui_SOURCES - modulesystem/PythonQtViewModule.cpp - utils/PythonQtUtils.cpp - viewpages/PythonQtJob.cpp - viewpages/PythonQtViewStep.cpp - viewpages/PythonQtGlobalStorageWrapper.cpp - viewpages/PythonQtUtilsWrapper.cpp - ) -endif() - if( WITH_QML ) list( APPEND calamaresui_SOURCES utils/Qml.cpp @@ -81,11 +70,6 @@ target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp ) if( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 ) target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease ) endif() -if( WITH_PYTHONQT ) - # *_DIRS because we also use extensions - target_include_directories( calamaresui PRIVATE ${PYTHON_INCLUDE_DIRS} ${PYTHONQT_INCLUDE_DIRS} ) - target_link_libraries( calamaresui PRIVATE ${PYTHON_LIBRARIES} ${PYTHONQT_LIBRARIES} ) -endif() if( WITH_QML ) target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets ) endif() diff --git a/src/libcalamaresui/modulesystem/ModuleFactory.cpp b/src/libcalamaresui/modulesystem/ModuleFactory.cpp index a7193d3f5..99bba5955 100644 --- a/src/libcalamaresui/modulesystem/ModuleFactory.cpp +++ b/src/libcalamaresui/modulesystem/ModuleFactory.cpp @@ -24,10 +24,6 @@ #include "PythonJobModule.h" #endif -#ifdef WITH_PYTHONQT -#include "PythonQtViewModule.h" -#endif - #include #include #include @@ -61,11 +57,7 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto } else if ( moduleDescriptor.interface() == Interface::PythonQt ) { -#ifdef WITH_PYTHONQT - m.reset( new PythonQtViewModule() ); -#else cError() << "PythonQt view modules are not supported in this version of Calamares."; -#endif } else { diff --git a/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp b/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp deleted file mode 100644 index ae2b2915f..000000000 --- a/src/libcalamaresui/modulesystem/PythonQtViewModule.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-FileCopyrightText: 2018 Adriaan de Groot - * SPDX-FileCopyrightText: 2018 Raul Rodrigo Segura - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtViewModule.h" - -#include "CalamaresConfig.h" -#include "GlobalStorage.h" -#include "JobQueue.h" -#include "ViewManager.h" -#include "utils/Logger.h" -#include "viewpages/PythonQtGlobalStorageWrapper.h" -#include "viewpages/PythonQtUtilsWrapper.h" -#include "viewpages/PythonQtViewStep.h" -#include "viewpages/ViewStep.h" - -#include -#include - -#include -#include - - -static QPointer< GlobalStorage > s_gs = nullptr; -static QPointer< Utils > s_utils = nullptr; - -namespace Calamares -{ - -Module::Type -PythonQtViewModule::type() const -{ - return Module::Type::View; -} - - -Module::Interface -PythonQtViewModule::interface() const -{ - return Module::Interface::PythonQt; -} - - -void -PythonQtViewModule::loadSelf() -{ - if ( !m_scriptFileName.isEmpty() ) - { - if ( PythonQt::self() == nullptr ) - { - if ( Py_IsInitialized() ) - PythonQt::init( PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut - | PythonQt::PythonAlreadyInitialized ); - else - { - PythonQt::init(); - } - - PythonQt_QtAll::init(); - cDebug() << "Initializing PythonQt bindings." - << "This should only happen once."; - - //TODO: register classes here into the PythonQt environment, like this: - //PythonQt::self()->registerClass( &PythonQtViewStep::staticMetaObject, - // "calamares" ); - - // We only do the following to force PythonQt to create a submodule - // "calamares" for us to put our static objects in - PythonQt::self()->registerClass( &::GlobalStorage::staticMetaObject, "calamares" ); - - // Get a PythonQtObjectPtr to the PythonQt.calamares submodule - PythonQtObjectPtr pqtm = PythonQt::priv()->pythonQtModule(); - PythonQtObjectPtr cala = PythonQt::self()->lookupObject( pqtm, "calamares" ); - - // Prepare GlobalStorage object, in module PythonQt.calamares - if ( !s_gs ) - { - s_gs = new ::GlobalStorage( Calamares::JobQueue::instance()->globalStorage() ); - } - cala.addObject( "global_storage", s_gs ); - - // Prepare Utils object, in module PythonQt.calamares - if ( !s_utils ) - { - s_utils = new ::Utils( Calamares::JobQueue::instance()->globalStorage() ); - } - cala.addObject( "utils", s_utils ); - - // Append configuration object, in module PythonQt.calamares - cala.addVariable( "configuration", m_configurationMap ); - - // Basic stdout/stderr handling - QObject::connect( PythonQt::self(), &PythonQt::pythonStdOut, []( const QString& message ) { - cDebug() << "PythonQt OUT>" << message; - } ); - QObject::connect( PythonQt::self(), &PythonQt::pythonStdErr, []( const QString& message ) { - cDebug() << "PythonQt ERR>" << message; - } ); - } - - QDir workingDir( m_workingPath ); - if ( !workingDir.exists() ) - { - cDebug() << "Invalid working directory" << m_workingPath << "for module" << name(); - return; - } - - QString fullPath = workingDir.absoluteFilePath( m_scriptFileName ); - QFileInfo scriptFileInfo( fullPath ); - if ( !scriptFileInfo.isReadable() ) - { - cDebug() << "Invalid main script file path" << fullPath << "for module" << name(); - return; - } - - // Construct empty Python module with the given name - PythonQtObjectPtr cxt = PythonQt::self()->createModuleFromScript( name() ); - if ( cxt.isNull() ) - { - cDebug() << "Cannot load PythonQt context from file" << fullPath << "for module" << name(); - return; - } - - static const QLatin1String calamares_module_annotation( - "_calamares_module_typename = ''\n" - "def calamares_module(viewmodule_type):\n" - " global _calamares_module_typename\n" - " _calamares_module_typename = viewmodule_type.__name__\n" - " return viewmodule_type\n" ); - - // Load in the decorator - PythonQt::self()->evalScript( cxt, calamares_module_annotation ); - - // Load the module - PythonQt::self()->evalFile( cxt, fullPath ); - - m_viewStep = new PythonQtViewStep( cxt ); - - cDebug() << "PythonQtViewModule loading self for instance" << instanceKey() << "\nPythonQtViewModule at address" - << this << "\nViewStep at address" << m_viewStep; - - m_viewStep->setModuleInstanceKey( instanceKey() ); - m_viewStep->setConfigurationMap( m_configurationMap ); - ViewManager::instance()->addViewStep( m_viewStep ); - m_loaded = true; - cDebug() << "PythonQtViewModule" << instanceKey() << "loading complete."; - } -} - - -JobList -PythonQtViewModule::jobs() const -{ - return m_viewStep->jobs(); -} - - -void -PythonQtViewModule::initFrom( const QVariantMap& moduleDescriptor ) -{ - QDir directory( location() ); - m_workingPath = directory.absolutePath(); - - if ( !moduleDescriptor.value( "script" ).toString().isEmpty() ) - { - m_scriptFileName = moduleDescriptor.value( "script" ).toString(); - } -} - -PythonQtViewModule::PythonQtViewModule() - : Module() -{ -} - -PythonQtViewModule::~PythonQtViewModule() {} - -} // namespace Calamares diff --git a/src/libcalamaresui/modulesystem/PythonQtViewModule.h b/src/libcalamaresui/modulesystem/PythonQtViewModule.h deleted file mode 100644 index 8267dd2cb..000000000 --- a/src/libcalamaresui/modulesystem/PythonQtViewModule.h +++ /dev/null @@ -1,50 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef CALAMARES_PYTHONQTVIEWMODULE_H -#define CALAMARES_PYTHONQTVIEWMODULE_H - -#include "DllMacro.h" -#include "Module.h" - -namespace Calamares -{ - -class ViewStep; - -class UIDLLEXPORT PythonQtViewModule : public Module -{ -public: - Type type() const override; - Interface interface() const override; - - void loadSelf() override; - JobList jobs() const override; - -protected: - void initFrom( const QVariantMap& moduleDescriptor ) override; - -private: - explicit PythonQtViewModule(); - virtual ~PythonQtViewModule(); - - ViewStep* m_viewStep = nullptr; - - QString m_scriptFileName; - QString m_workingPath; - - friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor, - const QString& instanceId, - const QString& configFileName, - const QString& moduleDirectory ); -}; - -} // namespace Calamares - -#endif // CALAMARES_PYTHONQTVIEWMODULE_H diff --git a/src/libcalamaresui/utils/PythonQtUtils.cpp b/src/libcalamaresui/utils/PythonQtUtils.cpp deleted file mode 100644 index bc4e034f0..000000000 --- a/src/libcalamaresui/utils/PythonQtUtils.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtUtils.h" - -namespace CalamaresUtils -{ - -QVariant -lookupAndCall( PyObject* object, - const QStringList& candidateNames, - const QVariantList& args, - const QVariantMap& kwargs ) -{ - Q_ASSERT( object ); - Q_ASSERT( !candidateNames.isEmpty() ); - - for ( const QString& name : candidateNames ) - { - PythonQtObjectPtr callable = PythonQt::self()->lookupCallable( object, name ); - if ( callable ) - { - return callable.call( args, kwargs ); - } - } - - // If we haven't found a callable with the given names, we force an error: - return PythonQt::self()->call( object, candidateNames.first(), args, kwargs ); -} - -} // namespace CalamaresUtils diff --git a/src/libcalamaresui/utils/PythonQtUtils.h b/src/libcalamaresui/utils/PythonQtUtils.h deleted file mode 100644 index 49f3bb1c4..000000000 --- a/src/libcalamaresui/utils/PythonQtUtils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef PYTHONQTUTILS_H -#define PYTHONQTUTILS_H - -#include - -#include - - -namespace CalamaresUtils -{ -//NOTE: when running this, it is assumed that Python is initialized and -// PythonQt::self() is valid. -QVariant lookupAndCall( PyObject* object, - const QStringList& candidateNames, - const QVariantList& args = QVariantList(), - const QVariantMap& kwargs = QVariantMap() ); - -} // namespace CalamaresUtils - -#endif // PYTHONQTUTILS_H diff --git a/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.cpp b/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.cpp deleted file mode 100644 index 0d667a097..000000000 --- a/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtGlobalStorageWrapper.h" - -#include "GlobalStorage.h" - - -GlobalStorage::GlobalStorage( Calamares::GlobalStorage* gs ) - : QObject( gs ) - , m_gs( gs ) -{ -} - - -bool -GlobalStorage::contains( const QString& key ) const -{ - return m_gs->contains( key ); -} - - -int -GlobalStorage::count() const -{ - return m_gs->count(); -} - - -void -GlobalStorage::insert( const QString& key, const QVariant& value ) -{ - m_gs->insert( key, value ); -} - - -QStringList -GlobalStorage::keys() const -{ - return m_gs->keys(); -} - - -int -GlobalStorage::remove( const QString& key ) -{ - return m_gs->remove( key ); -} - - -QVariant -GlobalStorage::value( const QString& key ) const -{ - return m_gs->value( key ); -} diff --git a/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.h b/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.h deleted file mode 100644 index 5d1282d0f..000000000 --- a/src/libcalamaresui/viewpages/PythonQtGlobalStorageWrapper.h +++ /dev/null @@ -1,48 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-FileCopyrightText: 2018 Adriaan de Groot - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef PYTHONQTGLOBALSTORAGEWRAPPER_H -#define PYTHONQTGLOBALSTORAGEWRAPPER_H - -#include -#include -#include - -namespace Calamares -{ -class GlobalStorage; -} - - -/** - * @brief This GlobalStorage class is a namespace-free wrapper for - * Calamares::GlobalStorage. This is unfortunately a necessity - * because PythonQt doesn't like namespaces. - */ -class GlobalStorage : public QObject -{ - Q_OBJECT -public: - explicit GlobalStorage( Calamares::GlobalStorage* gs ); - virtual ~GlobalStorage() {} - -public slots: - bool contains( const QString& key ) const; - int count() const; - void insert( const QString& key, const QVariant& value ); - QStringList keys() const; - int remove( const QString& key ); - QVariant value( const QString& key ) const; - -private: - Calamares::GlobalStorage* m_gs; -}; - -#endif // PYTHONQTGLOBALSTORAGEWRAPPER_H diff --git a/src/libcalamaresui/viewpages/PythonQtJob.cpp b/src/libcalamaresui/viewpages/PythonQtJob.cpp deleted file mode 100644 index d41c70f1f..000000000 --- a/src/libcalamaresui/viewpages/PythonQtJob.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtJob.h" - -#include "utils/PythonQtUtils.h" - -PythonQtJob::PythonQtJob( PythonQtObjectPtr cxt, PythonQtObjectPtr pyJob, QObject* parent ) - : Calamares::Job( parent ) - , m_cxt( cxt ) - , m_pyJob( pyJob ) -{ -} - - -QString -PythonQtJob::prettyName() const -{ - return CalamaresUtils::lookupAndCall( m_pyJob, { "prettyName", "prettyname", "pretty_name" } ).toString(); -} - - -QString -PythonQtJob::prettyDescription() const -{ - return CalamaresUtils::lookupAndCall( m_pyJob, { "prettyDescription", "prettydescription", "pretty_description" } ) - .toString(); -} - - -QString -PythonQtJob::prettyStatusMessage() const -{ - return CalamaresUtils::lookupAndCall( m_pyJob, - { "prettyStatusMessage", "prettystatusmessage", "pretty_status_message" } ) - .toString(); -} - - -Calamares::JobResult -PythonQtJob::exec() -{ - QVariant response = m_pyJob.call( "exec" ); - if ( response.isNull() ) - { - return Calamares::JobResult::ok(); - } - - QVariantMap map = response.toMap(); - if ( map.isEmpty() || map.value( "ok" ).toBool() ) - { - return Calamares::JobResult::ok(); - } - - return Calamares::JobResult::error( map.value( "message" ).toString(), map.value( "details" ).toString() ); -} diff --git a/src/libcalamaresui/viewpages/PythonQtJob.h b/src/libcalamaresui/viewpages/PythonQtJob.h deleted file mode 100644 index 4d48921e1..000000000 --- a/src/libcalamaresui/viewpages/PythonQtJob.h +++ /dev/null @@ -1,53 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef PYTHONQTJOB_H -#define PYTHONQTJOB_H - -#include "Job.h" - -#include - -namespace Calamares -{ -class PythonQtViewStep; -} - -class PythonQtJobResult : public QObject, public Calamares::JobResult -{ - Q_OBJECT -public: - explicit PythonQtJobResult( bool ok, const QString& message, const QString& details ) - : QObject( nullptr ) - , Calamares::JobResult( message, details, ok ? 0 : Calamares::JobResult::GenericError ) - { - } -}; - - -class PythonQtJob : public Calamares::Job -{ - Q_OBJECT -public: - virtual ~PythonQtJob() {} - - QString prettyName() const override; - QString prettyDescription() const override; - QString prettyStatusMessage() const override; - Calamares::JobResult exec() override; - -private: - explicit PythonQtJob( PythonQtObjectPtr cxt, PythonQtObjectPtr pyJob, QObject* parent = nullptr ); - friend class Calamares::PythonQtViewStep; // only this one can call the ctor - - PythonQtObjectPtr m_cxt; - PythonQtObjectPtr m_pyJob; -}; - -#endif // PYTHONQTJOB_H diff --git a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp b/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp deleted file mode 100644 index 4cd72f8c0..000000000 --- a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-FileCopyrightText: 2019 Adriaan de Groot - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtUtilsWrapper.h" - -#include "partition/Mount.h" -#include "utils/CalamaresUtilsSystem.h" -#include "utils/Logger.h" -#include "utils/String.h" - -#include - - -Utils::Utils( QObject* parent ) - : QObject( parent ) - , m_exceptionCxt( PythonQt::self()->createUniqueModule() ) -{ - PythonQt::self()->evalScript( m_exceptionCxt, "import subprocess" ); -} - - -void -Utils::debug( const QString& s ) const -{ - cDebug() << "PythonQt DBG>" << s; -} - - -int -Utils::mount( const QString& device_path, - const QString& mount_point, - const QString& filesystem_name, - const QString& options ) const -{ - return CalamaresUtils::Partition::mount( device_path, mount_point, filesystem_name, options ); -} - - -int -Utils::target_env_call( const QString& command, const QString& stdin, int timeout ) const -{ - return CalamaresUtils::System::instance()->targetEnvCall( - command, QString(), stdin, std::chrono::seconds( timeout > 0 ? timeout : 0 ) ); -} - - -int -Utils::target_env_call( const QStringList& args, const QString& stdin, int timeout ) const -{ - return CalamaresUtils::System::instance()->targetEnvCall( - args, QString(), stdin, std::chrono::seconds( timeout > 0 ? timeout : 0 ) ); -} - - -int -Utils::check_target_env_call( const QString& command, const QString& stdin, int timeout ) const -{ - int ec = target_env_call( command, stdin, timeout ); - return _handle_check_target_env_call_error( ec, command ); -} - - -int -Utils::check_target_env_call( const QStringList& args, const QString& stdin, int timeout ) const -{ - int ec = target_env_call( args, stdin, timeout ); - return _handle_check_target_env_call_error( ec, args.join( ' ' ) ); -} - - -QString -Utils::check_target_env_output( const QString& command, const QString& stdin, int timeout ) const -{ - QString output; - int ec = CalamaresUtils::System::instance()->targetEnvOutput( - command, output, QString(), stdin, std::chrono::seconds( timeout > 0 ? timeout : 0 ) ); - _handle_check_target_env_call_error( ec, command ); - return output; -} - - -QString -Utils::check_target_env_output( const QStringList& args, const QString& stdin, int timeout ) const -{ - QString output; - int ec = CalamaresUtils::System::instance()->targetEnvOutput( - args, output, QString(), stdin, std::chrono::seconds( timeout > 0 ? timeout : 0 ) ); - _handle_check_target_env_call_error( ec, args.join( ' ' ) ); - return output; -} - - -QString -Utils::obscure( const QString& string ) const -{ - return CalamaresUtils::obscure( string ); -} - - -int -Utils::_handle_check_target_env_call_error( int ec, const QString& cmd ) const -{ - if ( ec ) - { - QString raise = QString( "raise subprocess.CalledProcessError(%1,\"%2\")" ).arg( ec ).arg( cmd ); - PythonQt::self()->evalScript( m_exceptionCxt, raise ); - } - return ec; -} diff --git a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.h b/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.h deleted file mode 100644 index e39249185..000000000 --- a/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.h +++ /dev/null @@ -1,57 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef PYTHONQTUTILSWRAPPER_H -#define PYTHONQTUTILSWRAPPER_H - -#include - -#include - - -/** - * @brief The Utils class wraps around functions from CalamaresUtils to make them - * available in the PythonQt interface. - */ -class Utils : public QObject -{ - Q_OBJECT -public: - explicit Utils( QObject* parent = nullptr ); - virtual ~Utils() {} - -public slots: - void debug( const QString& s ) const; - - int mount( const QString& device_path, - const QString& mount_point, - const QString& filesystem_name, - const QString& options ) const; - - int target_env_call( const QString& command, const QString& stdin = QString(), int timeout = 0 ) const; - - int target_env_call( const QStringList& args, const QString& stdin = QString(), int timeout = 0 ) const; - - int check_target_env_call( const QString& command, const QString& stdin = QString(), int timeout = 0 ) const; - - int check_target_env_call( const QStringList& args, const QString& stdin = QString(), int timeout = 0 ) const; - - QString check_target_env_output( const QString& command, const QString& stdin = QString(), int timeout = 0 ) const; - - QString check_target_env_output( const QStringList& args, const QString& stdin = QString(), int timeout = 0 ) const; - - QString obscure( const QString& string ) const; - -private: - inline int _handle_check_target_env_call_error( int ec, const QString& cmd ) const; - - PythonQtObjectPtr m_exceptionCxt; -}; - -#endif // PYTHONQTUTILSWRAPPER_H diff --git a/src/libcalamaresui/viewpages/PythonQtViewStep.cpp b/src/libcalamaresui/viewpages/PythonQtViewStep.cpp deleted file mode 100644 index df3c11994..000000000 --- a/src/libcalamaresui/viewpages/PythonQtViewStep.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-FileCopyrightText: 2018 Adriaan de Groot - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "PythonQtViewStep.h" -#include "utils/CalamaresUtilsGui.h" -#include "utils/Logger.h" -#include "utils/PythonQtUtils.h" -#include "utils/Retranslator.h" -#include "viewpages/PythonQtJob.h" - -#include - -#include -#include - - -namespace Calamares -{ - -PythonQtViewStep::PythonQtViewStep( PythonQtObjectPtr cxt, QObject* parent ) - : ViewStep( parent ) - , m_widget( new QWidget() ) - , m_cxt( cxt ) -{ - PythonQt* pq = PythonQt::self(); - Q_ASSERT( pq ); - - // The @calamares_module decorator should have filled _calamares_module_typename - // for us. - QString className = m_cxt.getVariable( "_calamares_module_typename" ).toString(); - - // Instantiate an object of the class marked with @calamares_module and - // store it as _calamares_module. - pq->evalScript( m_cxt, QString( "_calamares_module = %1()" ).arg( className ) ); - m_obj = pq->lookupObject( m_cxt, "_calamares_module" ); - - Q_ASSERT( !m_obj.isNull() ); // no entry point, no party - - // Prepare the base widget for the module's pages - m_widget->setLayout( new QVBoxLayout ); - CalamaresUtils::unmarginLayout( m_widget->layout() ); - m_cxt.addObject( "_calamares_module_basewidget", m_widget ); - - CALAMARES_RETRANSLATE_FOR( - m_widget, - CalamaresUtils::lookupAndCall( m_obj, { "retranslate" }, { CalamaresUtils::translatorLocaleName() } ); ) -} - - -QString -PythonQtViewStep::prettyName() const -{ - return CalamaresUtils::lookupAndCall( m_obj, { "prettyName", "prettyname", "pretty_name" } ).toString(); -} - - -QWidget* -PythonQtViewStep::widget() -{ - if ( m_widget->layout()->count() > 1 ) - cWarning() << "PythonQtViewStep wrapper widget has more than 1 child. " - "This should never happen."; - - bool nothingChanged - = m_cxt.evalScript( "_calamares_module.widget() in _calamares_module_basewidget.children()" ).toBool(); - if ( nothingChanged ) - { - return m_widget; - } - - // Else, we either don't have a child widget, or we have a child widget that - // was previously set and doesn't apply any more since the Python module - // set a new one. - - // First we clear the layout, which should only ever have 1 item. - // We only remove from the layout and not delete because Python is in charge - // of memory management for these widgets. - while ( m_widget->layout()->itemAt( 0 ) ) - { - m_widget->layout()->takeAt( 0 ); - } - - m_cxt.evalScript( "_calamares_module_basewidget.layout().addWidget(_calamares_module.widget())" ); - - return m_widget; -} - - -void -PythonQtViewStep::next() -{ - CalamaresUtils::lookupAndCall( m_obj, { "next" } ); -} - - -void -PythonQtViewStep::back() -{ - CalamaresUtils::lookupAndCall( m_obj, { "back" } ); -} - - -bool -PythonQtViewStep::isNextEnabled() const -{ - return CalamaresUtils::lookupAndCall( m_obj, { "isNextEnabled", "isnextenabled", "is_next_enabled" } ).toBool(); -} - - -bool -PythonQtViewStep::isBackEnabled() const -{ - return CalamaresUtils::lookupAndCall( m_obj, { "isBackEnabled", "isbackenabled", "is_back_enabled" } ).toBool(); -} - - -bool -PythonQtViewStep::isAtBeginning() const -{ - return CalamaresUtils::lookupAndCall( m_obj, { "isAtBeginning", "isatbeginning", "is_at_beginning" } ).toBool(); -} - - -bool -PythonQtViewStep::isAtEnd() const -{ - return CalamaresUtils::lookupAndCall( m_obj, { "isAtEnd", "isatend", "is_at_end" } ).toBool(); -} - -void -PythonQtViewStep::onActivate() -{ - CalamaresUtils::lookupAndCall( m_obj, { "onActivate", "onactivate", "on_activate" } ); -} - -void -PythonQtViewStep::onLeave() -{ - CalamaresUtils::lookupAndCall( m_obj, { "onLeave", "onleave", "on_leave" } ); -} - - -JobList -PythonQtViewStep::jobs() const -{ - JobList jobs; - - PythonQtObjectPtr jobsCallable = PythonQt::self()->lookupCallable( m_obj, "jobs" ); - if ( jobsCallable.isNull() ) - { - return jobs; - } - - PythonQtObjectPtr response = PythonQt::self()->callAndReturnPyObject( jobsCallable ); - if ( response.isNull() ) - { - return jobs; - } - - PythonQtObjectPtr listPopCallable = PythonQt::self()->lookupCallable( response, "pop" ); - if ( listPopCallable.isNull() ) - { - return jobs; - } - - forever - { - PythonQtObjectPtr aJob = PythonQt::self()->callAndReturnPyObject( listPopCallable, { 0 } ); - if ( aJob.isNull() ) - { - break; - } - - jobs.append( Calamares::job_ptr( new PythonQtJob( m_cxt, aJob ) ) ); - } - - return jobs; -} - - -void -PythonQtViewStep::setConfigurationMap( const QVariantMap& configurationMap ) -{ - m_obj.addVariable( "configuration", configurationMap ); -} - - -QWidget* -PythonQtViewStep::createScriptingConsole() -{ - PythonQtScriptingConsole* console = new PythonQtScriptingConsole( nullptr, m_cxt ); - console->setProperty( "classname", m_cxt.getVariable( "_calamares_module_typename" ).toString() ); - return console; -} - -} // namespace Calamares diff --git a/src/libcalamaresui/viewpages/PythonQtViewStep.h b/src/libcalamaresui/viewpages/PythonQtViewStep.h deleted file mode 100644 index b23a540b9..000000000 --- a/src/libcalamaresui/viewpages/PythonQtViewStep.h +++ /dev/null @@ -1,57 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2016 Teo Mrnjavac - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef PYTHONQTVIEWSTEP_H -#define PYTHONQTVIEWSTEP_H - -#include "ViewStep.h" - -#include - -namespace Calamares -{ - -class PythonQtViewStep : public Calamares::ViewStep -{ - Q_OBJECT -public: - PythonQtViewStep( PythonQtObjectPtr cxt, QObject* parent = nullptr ); - - QString prettyName() const override; - - QWidget* widget() override; - - void next() override; - void back() override; - void onLeave() override; - void onActivate() override; - - bool isNextEnabled() const override; - bool isBackEnabled() const override; - - bool isAtBeginning() const override; - bool isAtEnd() const override; - - JobList jobs() const override; - - void setConfigurationMap( const QVariantMap& configurationMap ) override; - - QWidget* createScriptingConsole(); - -protected: - QWidget* m_widget; - -private: - PythonQtObjectPtr m_cxt; - PythonQtObjectPtr m_obj; -}; - -} // namespace Calamares - -#endif // PYTHONQTVIEWSTEP_H diff --git a/src/libcalamaresui/viewpages/ViewStep.h b/src/libcalamaresui/viewpages/ViewStep.h index c20a9d396..22e72e5fd 100644 --- a/src/libcalamaresui/viewpages/ViewStep.h +++ b/src/libcalamaresui/viewpages/ViewStep.h @@ -29,8 +29,7 @@ namespace Calamares * A view module is a Calamares module which has at least one UI page (exposed as * ViewStep::widget), and can optionally create Calamares jobs at runtime. * As of early 2020, a view module can be implemented by deriving from ViewStep - * in C++ (as a Qt Plugin or a Qml ViewStep) or in Python with the PythonQt interface - * (which also mimics the ViewStep class). + * in C++ (as a Qt Plugin or a Qml ViewStep). * * A ViewStep can describe itself in human-readable format for the SummaryPage * (which shows all of the things which have been collected to be done in the diff --git a/src/modules/README.md b/src/modules/README.md index d3611448c..859b4e688 100644 --- a/src/modules/README.md +++ b/src/modules/README.md @@ -283,17 +283,6 @@ description if something went wrong. **TODO:** this needs documentation - -## PythonQt modules (deprecated) - -> Type: viewmodule, jobmodule -> Interface: pythonqt - -The PythonQt modules are deprecated and will be removed in Calamares 3.3. -Their documentation is also almost completely lacking. - - - ## Process modules Use of this kind of module is **not** recommended. diff --git a/src/modules/dummypythonqt/dummypythonqt.conf b/src/modules/dummypythonqt/dummypythonqt.conf deleted file mode 100644 index 6caf9cc18..000000000 --- a/src/modules/dummypythonqt/dummypythonqt.conf +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-FileCopyrightText: no -# SPDX-License-Identifier: CC0-1.0 -# -# This is a dummy (example) module for PythonQt. -# -# The code is the documentation for the configuration file. ---- -syntax: "YAML map of anything" -example: - whats_this: "module-specific configuration" - from_where: "dummypythonqt.conf" -a_list: - - "item1" - - "item2" - - "item3" - - "item4" -a_list_of_maps: - - name: "an Item" - contents: - - "an element" - - "another element" - - name: "another item" - contents: - - "not much" diff --git a/src/modules/dummypythonqt/lang/ar/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ar/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 91d430930..000000000 --- a/src/modules/dummypythonqt/lang/ar/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Abubakaragoub Y , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Abubakaragoub Y , 2018\n" -"Language-Team: Arabic (https://www.transifex.com/calamares/teams/20061/ar/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ar\n" -"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "اضغط علي!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "QLabel جديد" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "دميه خطوة PythonQt " - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "دميه عملية PythonQt " - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "هذة دميه عملية خطوة PythonQt. و تقول: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "رسالة حاله دميه عملية خطوة PythonQt" diff --git a/src/modules/dummypythonqt/lang/as/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/as/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 75d63e46e..000000000 --- a/src/modules/dummypythonqt/lang/as/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Deep Jyoti Choudhury , 2020 -# Wrishiraj Kaushik , 2020 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-19 17:27+0100\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Wrishiraj Kaushik , 2020\n" -"Language-Team: Assamese (https://www.transifex.com/calamares/teams/20061/as/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: as\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "ইয়াত ক্লিক কৰক!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "এটা নতুন QLabel।" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ডামী পাইথন-কিউট্ ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "ডামী পাইথন-কিউট্ কায্য" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "এইটোৱে ডামী পাইথন-কিউট্ কাৰ্য্য। ডামী কাৰ্য্যটোৱে কয় যে: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "ডামী পাইথন-কিউট্ কায্যৰ বাবে এটা অৱস্থা বাৰ্তা।" diff --git a/src/modules/dummypythonqt/lang/ast/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ast/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 1807e45d6..000000000 --- a/src/modules/dummypythonqt/lang/ast/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# enolp , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-22 07:09-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: enolp , 2019\n" -"Language-Team: Asturian (https://www.transifex.com/calamares/teams/20061/ast/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ast\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "¡Cálcame!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Una QLabel nueva." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ViewStep maniquín en PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "El trabayu maniquín en PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Esti ye'l trabayu maniquín en PythonQt. El trabayu maniquín diz: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un mensaxe d'estáu pal trabayu maniquín en PythonQt." diff --git a/src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index c14151114..000000000 --- a/src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Zmicer Turok , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-05-10 19:18-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Zmicer Turok , 2018\n" -"Language-Team: Belarusian (https://www.transifex.com/calamares/teams/20061/be/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: be\n" -"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Націсніце сюды! " - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Новы QLabel. " - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "The Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Гэта Dummy PythonQt Job. Фіктыўная задача паведамляе: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Паведамленне статусу Dummy PythonQt Job. " diff --git a/src/modules/dummypythonqt/lang/bg/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/bg/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 831105b95..000000000 --- a/src/modules/dummypythonqt/lang/bg/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Georgi Georgiev , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Georgi Georgiev , 2018\n" -"Language-Team: Bulgarian (https://www.transifex.com/calamares/teams/20061/bg/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: bg\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Натисни ме!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Нов QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Фиктивен PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Фиктивната задача PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Това е фиктивната задача PythonQt. Фиктивната задача заявява: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Съобщение за състоянието на фиктивната задача PythonQt." diff --git a/src/modules/dummypythonqt/lang/bn/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/bn/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index d2783e5e3..000000000 --- a/src/modules/dummypythonqt/lang/bn/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-30 23:13+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Bengali (https://www.transifex.com/calamares/teams/20061/bn/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: bn\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/ca/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ca/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 19f669849..000000000 --- a/src/modules/dummypythonqt/lang/ca/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Davidmp , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-05-10 19:18-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Davidmp , 2019\n" -"Language-Team: Catalan (https://www.transifex.com/calamares/teams/20061/ca/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ca\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Clica'm!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Una etiqueta Q nova." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Vistes de Dummy PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "La tasca Dummy PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Soc la tasca Dummy PythonQt. La tasca diu el següent: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un missatge d'estat per a la tasca Dummy PythonQt." diff --git a/src/modules/dummypythonqt/lang/ca@valencia/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ca@valencia/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index e67e371f3..000000000 --- a/src/modules/dummypythonqt/lang/ca@valencia/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-05-10 19:18-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Catalan (Valencian) (https://www.transifex.com/calamares/teams/20061/ca@valencia/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ca@valencia\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/cs_CZ/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/cs_CZ/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 44cd1e2d4..000000000 --- a/src/modules/dummypythonqt/lang/cs_CZ/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# pavelrz, 2017 -# Pavel Borecki , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-22 07:09-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Pavel Borecki , 2017\n" -"Language-Team: Czech (Czech Republic) (https://www.transifex.com/calamares/teams/20061/cs_CZ/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: cs_CZ\n" -"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klikněte na mě!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Nový QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Testovací PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Testovací úloha PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Toto je testovací úloha PythonQt. Testovací úloha sděluje: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Stavová zpráva o testovací úloze PythonQt." diff --git a/src/modules/dummypythonqt/lang/da/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/da/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 5a1473add..000000000 --- a/src/modules/dummypythonqt/lang/da/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# scootergrisen, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: scootergrisen, 2017\n" -"Language-Team: Danish (https://www.transifex.com/calamares/teams/20061/da/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: da\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klik på mig!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "En ny QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt-visningstrin" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Dummy PythonQt-jobbet" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Dette er dummy PythonQt-jobbet. Dummy-jobbet siger: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "En statusmeddelelse til dummy PythonQt-job." diff --git a/src/modules/dummypythonqt/lang/de/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/de/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index b0121397f..000000000 --- a/src/modules/dummypythonqt/lang/de/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Christian Spaan, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Christian Spaan, 2017\n" -"Language-Team: German (https://www.transifex.com/calamares/teams/20061/de/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klick mich!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Ein neues QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Der Dummy-PythonQt-Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Dies ist der Dummy-PythonQt-Job. Der Dummy-Job lautet: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Eine Statusmeldung für den Dummy-PythonQt-Job." diff --git a/src/modules/dummypythonqt/lang/dummypythonqt.pot b/src/modules/dummypythonqt/lang/dummypythonqt.pot deleted file mode 100644 index 57546f55e..000000000 --- a/src/modules/dummypythonqt/lang/dummypythonqt.pot +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-03-14 16:14+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: \n" - -#: src/modules/dummypythonqt/main.py:75 -msgid "Click me!" -msgstr "Click me!" - -#: src/modules/dummypythonqt/main.py:85 -msgid "A new QLabel." -msgstr "A new QLabel." - -#: src/modules/dummypythonqt/main.py:88 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:174 -msgid "The Dummy PythonQt Job" -msgstr "The Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:177 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "This is the Dummy PythonQt Job. The dummy job says: {}" - -#: src/modules/dummypythonqt/main.py:181 -msgid "A status message for Dummy PythonQt Job." -msgstr "A status message for Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/el/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/el/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 316384619..000000000 --- a/src/modules/dummypythonqt/lang/el/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Greek (https://www.transifex.com/calamares/teams/20061/el/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: el\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/en_GB/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/en_GB/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index a0e21be1f..000000000 --- a/src/modules/dummypythonqt/lang/en_GB/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Jason Collins , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Jason Collins , 2018\n" -"Language-Team: English (United Kingdom) (https://www.transifex.com/calamares/teams/20061/en_GB/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en_GB\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Click me!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "A new QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "The Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "This is the Dummy PythonQt Job. The dummy job says: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "A status message for Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/eo/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/eo/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index a656d0608..000000000 --- a/src/modules/dummypythonqt/lang/eo/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Kurt Ankh Phoenix , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Kurt Ankh Phoenix , 2018\n" -"Language-Team: Esperanto (https://www.transifex.com/calamares/teams/20061/eo/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: eo\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Alklaku min!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Nova QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Formala PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "La Formala PythonQt Laboro" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ĉi tiu estas la Formala PythonQt Laboro. La formala laboro diras: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Statusa mesaĝo por Formala PythonQt Laboro." diff --git a/src/modules/dummypythonqt/lang/es/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/es/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index b29ba10b3..000000000 --- a/src/modules/dummypythonqt/lang/es/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# strel, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: strel, 2017\n" -"Language-Team: Spanish (https://www.transifex.com/calamares/teams/20061/es/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "¡Púlsame!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Una nueva QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ViewStep de PythonQt Ficticia" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "La Tarea PythonQt Ficticia" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Esta es la Tarea PythonQt Ficticia. La tarea ficticia dice: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un mensaje de estado para la Tarea PythonQt Ficticia." diff --git a/src/modules/dummypythonqt/lang/es_MX/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/es_MX/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 6dc2d8278..000000000 --- a/src/modules/dummypythonqt/lang/es_MX/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# guillermo pacheco , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: guillermo pacheco , 2018\n" -"Language-Team: Spanish (Mexico) (https://www.transifex.com/calamares/teams/20061/es_MX/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: es_MX\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "¡Haz clic en mí!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Una nueva QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Vision del PythonQt ficticio" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Trabajo del PythonQt ficticio" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Este es el Trabajo PythonQt ficticio. El trabajo ficticio dice: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un mensaje de estado para el trabajo PythonQt ficticio." diff --git a/src/modules/dummypythonqt/lang/es_PR/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/es_PR/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 1b767f1ad..000000000 --- a/src/modules/dummypythonqt/lang/es_PR/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Spanish (Puerto Rico) (https://www.transifex.com/calamares/teams/20061/es_PR/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: es_PR\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/et/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/et/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 4ab56cc0f..000000000 --- a/src/modules/dummypythonqt/lang/et/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Madis Otenurm, 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-06 01:16+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Madis Otenurm, 2018\n" -"Language-Team: Estonian (https://www.transifex.com/calamares/teams/20061/et/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: et\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klõpsa mind!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Uus QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Testiv PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Testiv PythonQt Töö" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "See on testiv PythonQt töö. Testiv töö ütleb: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Olekusõnum testivale PythonQt tööle." diff --git a/src/modules/dummypythonqt/lang/eu/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/eu/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index a336c22a0..000000000 --- a/src/modules/dummypythonqt/lang/eu/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Ander Elortondo, 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Ander Elortondo, 2019\n" -"Language-Team: Basque (https://www.transifex.com/calamares/teams/20061/eu/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: eu\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Egidazu klik!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "QLabel berria." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt pauso-ikuspegia" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr " Dummy PythonQt lana" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Hau Dummy PythonQt lana da. Dummy lanak zera dio: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Dummy PythonQt lanaren egoera mezua." diff --git a/src/modules/dummypythonqt/lang/fa/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/fa/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 373a4c3e9..000000000 --- a/src/modules/dummypythonqt/lang/fa/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Danial Behzadi , 2020 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-30 23:13+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Danial Behzadi , 2020\n" -"Language-Team: Persian (https://www.transifex.com/calamares/teams/20061/fa/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fa\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "کلیکم کنید!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "یک QLabel جدید." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "گام نمایش PythonQt الکی" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "کار PythonQt الکی" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "این کار PythonQt الکی است. کار الکی می‌گوید: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "پیام وضعیتی برای کار PythonQt الکی." diff --git a/src/modules/dummypythonqt/lang/fi_FI/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/fi_FI/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 1d8526f2a..000000000 --- a/src/modules/dummypythonqt/lang/fi_FI/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Assalat3 , 2017 -# Kimmo Kujansuu , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-05-10 19:18-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Kimmo Kujansuu , 2019\n" -"Language-Team: Finnish (Finland) (https://www.transifex.com/calamares/teams/20061/fi_FI/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fi_FI\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klikkaa minua!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Uusi Qtyönimi." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Näppärä Python Qt-näkymä" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Näppärä Python Qt-työkalu" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Tämä on näppärä Python Qt-työkalu. Näennäinen työ sanoo: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Python Qt-työkalun tilailmoitus." diff --git a/src/modules/dummypythonqt/lang/fr/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/fr/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index fe75d0c55..000000000 --- a/src/modules/dummypythonqt/lang/fr/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Paul Combal , 2017 -# Aestan , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Aestan , 2018\n" -"Language-Team: French (https://www.transifex.com/calamares/teams/20061/fr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fr\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Cliquez-moi!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Un nouveau QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ViewStep Factice PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Tâche Factice PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ceci est la tâche factice PythonQt. La tâche factice dit : {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un message d'état pour la tâche factice PythonQt." diff --git a/src/modules/dummypythonqt/lang/fr_CH/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/fr_CH/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 9e8862d54..000000000 --- a/src/modules/dummypythonqt/lang/fr_CH/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: French (Switzerland) (https://www.transifex.com/calamares/teams/20061/fr_CH/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fr_CH\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/gl/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/gl/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index c7917c72b..000000000 --- a/src/modules/dummypythonqt/lang/gl/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Xosé, 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Xosé, 2018\n" -"Language-Team: Galician (https://www.transifex.com/calamares/teams/20061/gl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: gl\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Prémeme!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Unha QLabel nova." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ViewStep parvo de PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "A tarefa parva de PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Esta é a tarefa parva de PythonQt. A tarefa parva di: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Unha mensaxe parva para Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/gu/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/gu/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 62b6d5560..000000000 --- a/src/modules/dummypythonqt/lang/gu/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Gujarati (https://www.transifex.com/calamares/teams/20061/gu/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: gu\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/he/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/he/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 1d4c544a8..000000000 --- a/src/modules/dummypythonqt/lang/he/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Eli Shleifer , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Eli Shleifer , 2017\n" -"Language-Team: Hebrew (https://www.transifex.com/calamares/teams/20061/he/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: he\n" -"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "לחץ עליי!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "QLabel חדש." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "שלב הצפייה של משימת הדמה של PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "משימת הדמה של PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "זוהי משימת הדמה של PythonQt. משימת הדמה אומרת: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "הודעת מצב עבור משימת דמה של PythonQt." diff --git a/src/modules/dummypythonqt/lang/hi/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/hi/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 4f43a75f8..000000000 --- a/src/modules/dummypythonqt/lang/hi/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Panwar108 , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Panwar108 , 2018\n" -"Language-Team: Hindi (https://www.transifex.com/calamares/teams/20061/hi/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: hi\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "यहाँ क्लिक करें!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "नया QLabel।" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "डमी पाइथन प्रक्रिया की चरण संख्या देखें" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "डमी पाइथन प्रक्रिया" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "यह डमी पाइथन प्रक्रिया है। डमी प्रक्रिया संबंधी संदेश : {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "डमी पाइथन प्रक्रिया की अवस्था संबंधी संदेश।" diff --git a/src/modules/dummypythonqt/lang/hr/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/hr/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index a6e05ada6..000000000 --- a/src/modules/dummypythonqt/lang/hr/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Lovro Kudelić , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Lovro Kudelić , 2017\n" -"Language-Team: Croatian (https://www.transifex.com/calamares/teams/20061/hr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: hr\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klikni me!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Novi QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Testni PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Testni PythonQt posao" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ovo je testni PythonQt posao. Testni posao kaže: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Statusna poruka za testni PythonQt posao." diff --git a/src/modules/dummypythonqt/lang/hu/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/hu/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index bae97b375..000000000 --- a/src/modules/dummypythonqt/lang/hu/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Lajos Pasztor , 2016 -# miku84, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: miku84, 2017\n" -"Language-Team: Hungarian (https://www.transifex.com/calamares/teams/20061/hu/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: hu\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Kattints ide!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Egy új QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Hamis PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Egy PythonQt Job teszt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ez egy PythonQt Job teszt. A teszt job azt mondja: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Sztátus üzenet egy PythonQt Job-hoz." diff --git a/src/modules/dummypythonqt/lang/id/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/id/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 41a0444c0..000000000 --- a/src/modules/dummypythonqt/lang/id/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Kukuh Syafaat , 2016 -# Wantoyèk , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-30 23:13+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Wantoyèk , 2017\n" -"Language-Team: Indonesian (https://www.transifex.com/calamares/teams/20061/id/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: id\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klik saya!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Sebuah QLabel baru." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ini adalah Dummy PythonQt Job. Dummy job mengatakan: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Sebuah pesan status untuk Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/is/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/is/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index ed89dbc18..000000000 --- a/src/modules/dummypythonqt/lang/is/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Kristján Magnússon, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Kristján Magnússon, 2017\n" -"Language-Team: Icelandic (https://www.transifex.com/calamares/teams/20061/is/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: is\n" -"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Smelltu mig!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Nýtt QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Þetta er Dummy PythonQt Job. Dummy job segir: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Stöðuskilaboð fyrir Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/it_IT/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/it_IT/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 211f9d9c2..000000000 --- a/src/modules/dummypythonqt/lang/it_IT/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Teo Mrnjavac , 2016 -# Saverio , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-22 07:09-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Saverio , 2018\n" -"Language-Team: Italian (Italy) (https://www.transifex.com/calamares/teams/20061/it_IT/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: it_IT\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Clicca qui!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Una nuova QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "PythonQt ViewStep fittizio" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Il Job Dummy PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Questo è il Job Dummy PythonQt. Il dummy job notifica: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un messaggio di stato per il Job Dummy PythonQt." diff --git a/src/modules/dummypythonqt/lang/ja/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ja/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 6ed47ce1b..000000000 --- a/src/modules/dummypythonqt/lang/ja/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Takefumi Nagata, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Takefumi Nagata, 2017\n" -"Language-Team: Japanese (https://www.transifex.com/calamares/teams/20061/ja/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ja\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "クリックしてください!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "新しいQLabel" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "The Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "これはDummy PythonQtジョブです。Dummy ジョブの出力: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "ダミーのPythonQtジョブの状態" diff --git a/src/modules/dummypythonqt/lang/kk/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/kk/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 1d941e24e..000000000 --- a/src/modules/dummypythonqt/lang/kk/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Kazakh (https://www.transifex.com/calamares/teams/20061/kk/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: kk\n" -"Plural-Forms: nplurals=2; plural=(n!=1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/kn/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/kn/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index ff9def1e0..000000000 --- a/src/modules/dummypythonqt/lang/kn/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Kannada (https://www.transifex.com/calamares/teams/20061/kn/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: kn\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/ko/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ko/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index e6dc4af27..000000000 --- a/src/modules/dummypythonqt/lang/ko/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# MarongHappy , 2019 -# 김지현 , 2020 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-19 17:27+0100\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: 김지현 , 2020\n" -"Language-Team: Korean (https://www.transifex.com/calamares/teams/20061/ko/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ko\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "여기를 클릭하세요!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "새로운 QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "더미 PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "더미 PythonQt 작업" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "더미 PythonQt 작업입니다. 이 더미 작업의 출력은 다음과 같습니다: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "더미 PythonQt 작업의 상태 메시지" diff --git a/src/modules/dummypythonqt/lang/lo/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/lo/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 87614dc88..000000000 --- a/src/modules/dummypythonqt/lang/lo/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Lao (https://www.transifex.com/calamares/teams/20061/lo/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: lo\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/lt/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/lt/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 443ab99d8..000000000 --- a/src/modules/dummypythonqt/lang/lt/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Moo, 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Moo, 2017\n" -"Language-Team: Lithuanian (https://www.transifex.com/calamares/teams/20061/lt/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: lt\n" -"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Spustelėkite mane!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Naujas QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Fiktyvi PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Fiktyvi PythonQt užduotis" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Tai yra fiktyvi PythonQt užduotis. Fiktyvi užduotis sako: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Fiktyvios PythonQt užduoties būsenos pranešimas." diff --git a/src/modules/dummypythonqt/lang/lv/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/lv/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 651fe2fa4..000000000 --- a/src/modules/dummypythonqt/lang/lv/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-30 23:13+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Latvian (https://www.transifex.com/calamares/teams/20061/lv/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: lv\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/mk/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/mk/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 82998bf47..000000000 --- a/src/modules/dummypythonqt/lang/mk/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Martin Ristovski , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Martin Ristovski , 2018\n" -"Language-Team: Macedonian (https://www.transifex.com/calamares/teams/20061/mk/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: mk\n" -"Plural-Forms: nplurals=2; plural=(n % 10 == 1 && n % 100 != 11) ? 0 : 1;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Кликни ме!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Нов QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/ml/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ml/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index faf773770..000000000 --- a/src/modules/dummypythonqt/lang/ml/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Balasankar C , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-09-15 21:54+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Balasankar C , 2019\n" -"Language-Team: Malayalam (https://www.transifex.com/calamares/teams/20061/ml/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ml\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "എന്നെ ക്ലിക്ക് ചെയ്യൂ!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "ഒരു പുതിയ QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/mr/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/mr/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index eaafadeac..000000000 --- a/src/modules/dummypythonqt/lang/mr/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Marathi (https://www.transifex.com/calamares/teams/20061/mr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: mr\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/nb/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/nb/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 4bf83c283..000000000 --- a/src/modules/dummypythonqt/lang/nb/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Norwegian Bokmål (https://www.transifex.com/calamares/teams/20061/nb/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: nb\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/ne_NP/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ne_NP/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 37f213df2..000000000 --- a/src/modules/dummypythonqt/lang/ne_NP/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Ghost Hackz , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-25 08:04-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Ghost Hackz , 2019\n" -"Language-Team: Nepali (Nepal) (https://www.transifex.com/calamares/teams/20061/ne_NP/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ne_NP\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "यहाँ क्लिक गर्नुहोस्!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "नयाँ QLabel।" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "डमी पाइथन भ्यूस्टेप" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "डमी पाइथन प्रकृया" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "यो डमी पाइथन प्रकृया हो। डमी प्रकृया सम्बन्धित सन्देश: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "डमी पाइथन प्रकृयाको अवस्था सम्बन्धित सन्देश।" diff --git a/src/modules/dummypythonqt/lang/nl/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/nl/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 7f17f9973..000000000 --- a/src/modules/dummypythonqt/lang/nl/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# De Zeeappel , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: De Zeeappel , 2017\n" -"Language-Team: Dutch (https://www.transifex.com/calamares/teams/20061/nl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: nl\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klik mij!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Een nieuw QLabel" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "De Dummy PythonQt opdracht" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Dit is de Dummy PythonQt opdracht. De opdracht zegt: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Een statusbericht voor de Dummy PythonQt opdracht." diff --git a/src/modules/dummypythonqt/lang/pl/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/pl/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 8502113bd..000000000 --- a/src/modules/dummypythonqt/lang/pl/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Marcin Mikołajczak , 2016 -# Piotr Strębski , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-05-10 19:18-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Piotr Strębski , 2017\n" -"Language-Team: Polish (https://www.transifex.com/calamares/teams/20061/pl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: pl\n" -"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Naciśnij mnie!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Nowy QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Podgląd kroków fikcyjnego PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Zadanie fikcyjne PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "To jest zadanie fikcyjne PythonQt mówiące: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Wiadomość o stanie zadania fikcyjnego PythonQt." diff --git a/src/modules/dummypythonqt/lang/pt_BR/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/pt_BR/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 4e5391043..000000000 --- a/src/modules/dummypythonqt/lang/pt_BR/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Rodrigo de Almeida Sottomaior Macedo , 2017 -# Guilherme, 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-01-25 23:02+0100\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Guilherme, 2018\n" -"Language-Team: Portuguese (Brazil) (https://www.transifex.com/calamares/teams/20061/pt_BR/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: pt_BR\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Clique em mim!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Uma nova QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "ViewStep do Modelo PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "A Tarefa de Modelo PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Esta é a Tarefa Modelo PythonQt. A tarefa modelo diz: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Uma mensagem de status para a Tarefa Modelo PythonQt." diff --git a/src/modules/dummypythonqt/lang/pt_PT/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/pt_PT/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 952413cfa..000000000 --- a/src/modules/dummypythonqt/lang/pt_PT/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Ricardo Simões , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Ricardo Simões , 2017\n" -"Language-Team: Portuguese (Portugal) (https://www.transifex.com/calamares/teams/20061/pt_PT/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: pt_PT\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Clique-me!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Uma nova QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "A Tarefa Dummy PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Esta é a tarefa Dummy PythonQt. A tarefa dummy diz: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Uma mensagem de estado para a Tarefa Dummy PythonQt." diff --git a/src/modules/dummypythonqt/lang/ro/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ro/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 3ac2bfcba..000000000 --- a/src/modules/dummypythonqt/lang/ro/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Baadur Jobava , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Baadur Jobava , 2018\n" -"Language-Team: Romanian (https://www.transifex.com/calamares/teams/20061/ro/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ro\n" -"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Clic aici!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Un nou QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Un job job fictiv PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Acesta este jobul fictiv PythonQt. Descrierea jobului: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Un mesaj de stare pentru jobul fictiv PythonQt." diff --git a/src/modules/dummypythonqt/lang/ru/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ru/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index cedc4d483..000000000 --- a/src/modules/dummypythonqt/lang/ru/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Вадим Сабынич , 2017 -# Simon Schwartz , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Simon Schwartz , 2017\n" -"Language-Team: Russian (https://www.transifex.com/calamares/teams/20061/ru/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ru\n" -"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Нажать здесь!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Новый QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "The Dummy PythonQt Job" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Сообщение состояния для Dummy PythonQt Job." diff --git a/src/modules/dummypythonqt/lang/sk/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sk/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 9c1d60dfd..000000000 --- a/src/modules/dummypythonqt/lang/sk/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Dušan Kazik , 2016 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Dušan Kazik , 2016\n" -"Language-Team: Slovak (https://www.transifex.com/calamares/teams/20061/sk/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sk\n" -"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n == 1 ? 0 : n % 1 == 0 && n >= 2 && n <= 4 ? 1 : n % 1 != 0 ? 2: 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Kliknite sem!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Nová menovka QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Fiktívna úloha PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Toto je fiktívna úloha PythonQt. Fiktívna úloha hovorí: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Stavová správa pre fiktívnu úlohu PythonQt." diff --git a/src/modules/dummypythonqt/lang/sl/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sl/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 178fc694a..000000000 --- a/src/modules/dummypythonqt/lang/sl/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Slovenian (https://www.transifex.com/calamares/teams/20061/sl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sl\n" -"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/sq/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sq/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 6335e9c56..000000000 --- a/src/modules/dummypythonqt/lang/sq/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Besnik Bleta , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-04-15 13:39+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Besnik Bleta , 2017\n" -"Language-Team: Albanian (https://www.transifex.com/calamares/teams/20061/sq/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sq\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klikomëni!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Një QLabel e re." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Dummy PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Akti PythonQt Dummy" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ky është Akti PythonQt Dummy. Akti dummy thotë: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Një mesazh gjendjeje nga Akti PythonQt Dummy." diff --git a/src/modules/dummypythonqt/lang/sr/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sr/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 6660b1500..000000000 --- a/src/modules/dummypythonqt/lang/sr/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Slobodan Simić , 2019 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-06-18 15:54+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Slobodan Simić , 2019\n" -"Language-Team: Serbian (https://www.transifex.com/calamares/teams/20061/sr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sr\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Кликни ме!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Нова КуОзнака" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Провизорни ПитонКуТ корак прегледа" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Провизорни ПитонКуТ посао" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Ово је провизорни ПитонКуТ посао. Он каже: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Порука стања за провизорни ПитонКуТ посао." diff --git a/src/modules/dummypythonqt/lang/sr@latin/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sr@latin/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index b3e4fe47b..000000000 --- a/src/modules/dummypythonqt/lang/sr@latin/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-22 07:09-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Serbian (Latin) (https://www.transifex.com/calamares/teams/20061/sr@latin/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sr@latin\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/sv/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/sv/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 192ed25e6..000000000 --- a/src/modules/dummypythonqt/lang/sv/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Luna Jernberg , 2020 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-19 00:13+0100\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Luna Jernberg , 2020\n" -"Language-Team: Swedish (https://www.transifex.com/calamares/teams/20061/sv/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sv\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Klicka på mig!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "En ny QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Exempel PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Exempel PythonQt jobb" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Detta är ett exempel PythonQt jobb. Exempel jobbet säger: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Ett statusmeddelande för exempel PythonQt jobb." diff --git a/src/modules/dummypythonqt/lang/th/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/th/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 22d304458..000000000 --- a/src/modules/dummypythonqt/lang/th/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Thai (https://www.transifex.com/calamares/teams/20061/th/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: th\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/tr_TR/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/tr_TR/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index fe0f567c5..000000000 --- a/src/modules/dummypythonqt/lang/tr_TR/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Demiray Muhterem , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Demiray Muhterem , 2017\n" -"Language-Team: Turkish (Turkey) (https://www.transifex.com/calamares/teams/20061/tr_TR/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: tr_TR\n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Buraya tıkla!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Yeni bir QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Sahte PythonQt görünümü" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Sahte PythonQt işleri" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Kukla PythonQt işleri. Sahte işleri şöyle diyor: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Kukla PythonQt Çalışması için bir durum mesajı." diff --git a/src/modules/dummypythonqt/lang/uk/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/uk/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index bcf3b814a..000000000 --- a/src/modules/dummypythonqt/lang/uk/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Yuri Chornoivan , 2020 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-19 17:27+0100\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: Yuri Chornoivan , 2020\n" -"Language-Team: Ukrainian (https://www.transifex.com/calamares/teams/20061/uk/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: uk\n" -"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "Натисни мене!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "Нова QLabel." - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "Фіктивний ViewStep PythonQt" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "Фіктивне завдання PythonQt" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "Це фіктивне завдання PythonQt. Фіктивне завдання повідомляє: {}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "Повідомлення щодо стану фіктивного завдання PythonQt." diff --git a/src/modules/dummypythonqt/lang/ur/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/ur/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 54352d479..000000000 --- a/src/modules/dummypythonqt/lang/ur/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Urdu (https://www.transifex.com/calamares/teams/20061/ur/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ur\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/uz/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/uz/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index 75584e15c..000000000 --- a/src/modules/dummypythonqt/lang/uz/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,42 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-05 11:34-0400\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Language-Team: Uzbek (https://www.transifex.com/calamares/teams/20061/uz/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: uz\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "" diff --git a/src/modules/dummypythonqt/lang/zh_CN/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/zh_CN/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index d7baa50f2..000000000 --- a/src/modules/dummypythonqt/lang/zh_CN/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# Mingcong Bai , 2017 -# soenggam , 2018 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-22 07:09-0500\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: soenggam , 2018\n" -"Language-Team: Chinese (China) (https://www.transifex.com/calamares/teams/20061/zh_CN/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: zh_CN\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "按我按我!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "一个新的QLabel。" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "坠吼滴 PythonQt ViewStep" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "PythonQt 任务" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "我是个 PythonQt 任务。任务提示:{}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "来自 PythonQt 任务的状态消息。" diff --git a/src/modules/dummypythonqt/lang/zh_TW/LC_MESSAGES/dummypythonqt.po b/src/modules/dummypythonqt/lang/zh_TW/LC_MESSAGES/dummypythonqt.po deleted file mode 100644 index bc2056e1e..000000000 --- a/src/modules/dummypythonqt/lang/zh_TW/LC_MESSAGES/dummypythonqt.po +++ /dev/null @@ -1,46 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -# Translators: -# 黃柏諺 , 2017 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-06 01:16+0200\n" -"PO-Revision-Date: 2016-12-16 12:18+0000\n" -"Last-Translator: 黃柏諺 , 2017\n" -"Language-Team: Chinese (Taiwan) (https://www.transifex.com/calamares/teams/20061/zh_TW/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: zh_TW\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: src/modules/dummypythonqt/main.py:84 -msgid "Click me!" -msgstr "點擊我!" - -#: src/modules/dummypythonqt/main.py:94 -msgid "A new QLabel." -msgstr "一個新的 QLabel。" - -#: src/modules/dummypythonqt/main.py:97 -msgid "Dummy PythonQt ViewStep" -msgstr "假的 PythonQt 檢視步驟" - -#: src/modules/dummypythonqt/main.py:183 -msgid "The Dummy PythonQt Job" -msgstr "假的 PythonQt 工作" - -#: src/modules/dummypythonqt/main.py:186 -msgid "This is the Dummy PythonQt Job. The dummy job says: {}" -msgstr "這是一個假的 PythonQt 工作。假工作表示:{}" - -#: src/modules/dummypythonqt/main.py:190 -msgid "A status message for Dummy PythonQt Job." -msgstr "假的 PythonQt 工作的狀態訊息。" diff --git a/src/modules/dummypythonqt/main.py b/src/modules/dummypythonqt/main.py deleted file mode 100644 index e33c20e6f..000000000 --- a/src/modules/dummypythonqt/main.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# === This file is part of Calamares - === -# -# SPDX-FileCopyrightText: 2016-2017 Teo Mrnjavac -# SPDX-FileCopyrightText: 2017 Alf Gaida -# SPDX-License-Identifier: GPL-3.0-or-later -# -# Calamares is Free Software: see the License-Identifier above. -# - -import platform - -from PythonQt.QtGui import * -import PythonQt.calamares as calamares - -# WARNING: the Calamares PythonQt API is considered EXPERIMENTAL as of -# Calamares 2.5. It comes with no promise or commitment to API stability. - - -# Set up translations. -# You may skip this if your Calamares module has no user visible strings. -# DO NOT install _ into the builtin namespace because each module loads -# its own catalog. -# DO use the gettext class-based API and manually alias _ as described in: -# https://docs.python.org/3.5/library/gettext.html#localizing-your-module -import gettext -import inspect -import os -_filename = inspect.getframeinfo(inspect.currentframe()).filename -_path = os.path.dirname(os.path.abspath(_filename)) - -_ = gettext.gettext - -# Example Python ViewModule. -# A Python ViewModule is a Python program which defines a ViewStep class. -# One UI module ==> one ViewStep. -# This class must be marked with the @calamares_module decorator. A -# ViewModule may define other classes, but only one may be decorated with -# @calamares_module. Such a class must conform to the Calamares ViewStep -# interface and functions as the entry point of the module. -# A ViewStep manages one or more "wizard pages" through methods like -# back/next, and reports its status through isNextEnabled/isBackEnabled/ -# isAtBeginning/isAtEnd. The whole UI, including all the pages, must be -# exposed as a single QWidget, returned by the widget function. -# -# For convenience, both C++ and PythonQt ViewSteps are considered to be -# implementations of ViewStep.h. Additionally, the Calamares PythonQt API -# allows Python developers to keep their identifiers more Pythonic on the -# Python side. Thus, all of the following are considered valid method -# identifiers in a ViewStep implementation: isNextEnabled, isnextenabled, -# is_next_enabled. - - -@calamares_module -class DummyPythonQtViewStep: - def __init__(self): - # Importing PythonQt.QtGui provides access to most Qt widget classes. - self.main_widget = QFrame() - - self.main_widget.setLayout(QVBoxLayout()) - - label = QLabel() - self.main_widget.layout().addWidget(label) - - accumulator = "\nCalamares+PythonQt running embedded Python " +\ - platform.python_version() - label.text = accumulator - - btn = QPushButton() - - # Python strings can be used wherever a method wants a QString. Python - # gettext translations can be used seamlessly as well. - btn.setText(_("Click me!")) - self.main_widget.layout().addWidget(btn) - - # The syntax for signal-slot connections is very simple, though - # slightly different from the C++ equivalent. There are no SIGNAL and - # SLOT macros, and a signal can be connected to any Python method - # (without a special "slot" designation). - btn.connect("clicked(bool)", self.on_btn_clicked) - - def on_btn_clicked(self): - self.main_widget.layout().addWidget(QLabel(_("A new QLabel."))) - - def prettyName(self): - return _("Dummy PythonQt ViewStep") - - def isNextEnabled(self): - return True # The "Next" button should be clickable - - def isBackEnabled(self): - return True # The "Back" button should be clickable - - def isAtBeginning(self): - # True means the currently shown UI page is the first page of this - # module, thus a "Back" button click will not be handled by this - # module and will cause a skip to the previous ViewStep instead - # (if any). False means that the present ViewStep provides other UI - # pages placed logically "before" the current one, thus a "Back" button - # click will be handled by this module instead of skipping to another - # ViewStep. A module (ViewStep) with only one page will always return - # True here. - return True - - def isAtEnd(self): - # True means the currently shown UI page is the last page of this - # module, thus a "Next" button click will not be handled by this - # module and will cause a skip to the next ViewStep instead (if any). - # False means that the present ViewStep provides other UI pages placed - # logically "after" the current one, thus a "Next" button click will - # be handled by this module instead of skipping to another ViewStep. - # A module (ViewStep) with only one page will always return True here. - return True - - def jobs(self): - # Returns a list of objects that implement Calamares::Job. - return [DummyPQJob("Dummy PythonQt job reporting for duty")] - - def widget(self): - # Returns the base QWidget of this module's UI. - return self.main_widget - - def retranslate(self, locale_name): - # This is where it gets slightly weird. In most desktop applications we - # shouldn't need this kind of mechanism, because we could assume that - # the operating environment is configured to use a certain language. - # Usually the user would change the system-wide language in a settings - # UI, restart the application, done. - # Alas, Calamares runs on an unconfigured live system, and one of the - # core features of Calamares is to allow the user to pick a language. - # Unfortunately, strings in the UI do not automatically react to a - # runtime language change. To get UI strings in a new language, all - # user-visible strings must be retranslated (by calling tr() in C++ or - # _() in Python) and reapplied on the relevant widgets. - # When the user picks a new UI translation language, Qt raises a QEvent - # of type LanguageChange, which propagates through the QObject - # hierarchy. By catching and reacting to this event, we can show - # user-visible strings in the new language at the right time. - # The C++ side of the Calamares PythonQt API catches the LanguageChange - # event and calls the present method. It is then up to the module - # developer to add here all the needed code to load the module's - # translation catalog for the new language (which is separate from the - # main Calamares strings catalog) and reapply any user-visible strings. - calamares.utils.debug("PythonQt retranslation event " - "for locale name: {}".format(locale_name)) - - # First we load the catalog file for the new language... - try: - global _ - _t = gettext.translation('dummypythonqt', - localedir=os.path.join(_path, 'lang'), - languages=[locale_name]) - _ = _t.gettext - except OSError as e: - calamares.utils.debug(e) - pass - - # ... and then we can call setText(_("foo")) and similar methods on - # the relevant widgets here to reapply the strings. - -# An example Job class. Implements Calamares::Job. For method identifiers, the -# same rules apply as for ViewStep. No decorators are necessary here, because -# only the ViewStep implementation is the unique entry point, and a module can -# have any number of jobs. - - -class DummyPQJob: - def __init__(self, my_msg): - self.my_msg = my_msg - - def pretty_name(self): - return _("The Dummy PythonQt Job") - - def pretty_description(self): - return _("This is the Dummy PythonQt Job. " - "The dummy job says: {}").format(self.my_msg) - - def pretty_status_message(self): - return _("A status message for Dummy PythonQt Job.") - - def exec(self): - # As an example, we touch a file in the target root filesystem. - rmp = calamares.global_storage['rootMountPoint'] - os.system("touch {}/calamares_dpqt_was_here".format(rmp)) - calamares.utils.debug("the dummy job says {}".format(self.my_msg)) - return {'ok': True} diff --git a/src/modules/dummypythonqt/module.desc b/src/modules/dummypythonqt/module.desc deleted file mode 100644 index a747daeaa..000000000 --- a/src/modules/dummypythonqt/module.desc +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-FileCopyrightText: no -# SPDX-License-Identifier: CC0-1.0 -# Module metadata file for dummy pythonqt jobmodule -# Syntax is YAML 1.2 ---- -type: "view" -name: "dummypythonqt" -interface: "pythonqt" -script: "main.py" #assumed relative to the current directory From 60cc8696e336e004b7cf7e2db903ca8660070abc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 23:56:52 +0200 Subject: [PATCH 024/160] Remove PythonQt support -- C++ bits --- src/libcalamares/modulesystem/Descriptor.cpp | 2 -- src/libcalamares/modulesystem/Descriptor.h | 3 +-- src/libcalamaresui/modulesystem/ModuleFactory.cpp | 4 ---- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libcalamares/modulesystem/Descriptor.cpp b/src/libcalamares/modulesystem/Descriptor.cpp index 71b50d867..62c376a3d 100644 --- a/src/libcalamares/modulesystem/Descriptor.cpp +++ b/src/libcalamares/modulesystem/Descriptor.cpp @@ -40,7 +40,6 @@ interfaceNames() { QStringLiteral("process"), Interface::Process }, { QStringLiteral("qtplugin"), Interface::QtPlugin }, { QStringLiteral("python"), Interface::Python }, - { QStringLiteral("pythonqt"), Interface::PythonQt } }; // *INDENT-ON* // clang-format on @@ -98,7 +97,6 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc ) consumedKeys << "load"; break; case Interface::Python: - case Interface::PythonQt: d.m_script = CalamaresUtils::getString( moduleDesc, "script" ); if ( d.m_script.isEmpty() ) { diff --git a/src/libcalamares/modulesystem/Descriptor.h b/src/libcalamares/modulesystem/Descriptor.h index 614d5f15a..6ab47269d 100644 --- a/src/libcalamares/modulesystem/Descriptor.h +++ b/src/libcalamares/modulesystem/Descriptor.h @@ -42,7 +42,6 @@ enum class Interface QtPlugin, // Jobs or Views Python, // Jobs only Process, // Deprecated interface - PythonQt // Views only, available as enum even if PythonQt isn't used }; const NamedEnumTable< Interface >& interfaceNames(); @@ -111,7 +110,7 @@ public: */ QString script() const { - return ( m_interface == Interface::Python || m_interface == Interface::PythonQt ) ? m_script : QString(); + return m_interface == Interface::Python ? m_script : QString(); } private: diff --git a/src/libcalamaresui/modulesystem/ModuleFactory.cpp b/src/libcalamaresui/modulesystem/ModuleFactory.cpp index 99bba5955..7f44a0052 100644 --- a/src/libcalamaresui/modulesystem/ModuleFactory.cpp +++ b/src/libcalamaresui/modulesystem/ModuleFactory.cpp @@ -55,10 +55,6 @@ moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescripto { m.reset( new ViewModule() ); } - else if ( moduleDescriptor.interface() == Interface::PythonQt ) - { - cError() << "PythonQt view modules are not supported in this version of Calamares."; - } else { cError() << "Bad interface" From cb3b2422a90537a4e98969dcc02357e658290138 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Sep 2021 23:59:45 +0200 Subject: [PATCH 025/160] Changes: update requirements / dependencies documentation --- CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aec9cb9e6..0eaf4d00f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,12 +77,12 @@ instructions are on the wiki. ### Dependencies Main: -* Compiler with C++17 support: GCC >= 7 or Clang >= 5 -* CMake >= 3.3 -* Qt >= 5.9 +* Compiler with C++17 support +* CMake >= 3.16 +* Qt >= 5.15 * yaml-cpp >= 0.5.1 -* Python >= 3.3 (required for some modules) -* Boost.Python >= 1.55.0 (required for some modules) +* Python >= 3.6 (required for some modules) +* Boost.Python >= 1.67.0 (required for some modules) * KDE extra-cmake-modules >= 5.18 (recommended; required for some modules; required for some tests) * KDE Frameworks KCoreAddons (>= 5.58 recommended) From bcde8b87b19874a3e8cc073ff65a13c7326e46c7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 29 Sep 2021 23:55:40 +0200 Subject: [PATCH 026/160] [partition] Remove unreachable `break` statements --- src/modules/partition/PartitionViewStep.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index a6b5e1dd8..dad8a0558 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -146,15 +146,12 @@ modeDescription( Config::InstallChoice choice ) case Config::InstallChoice::Alongside: return QCoreApplication::translate( context, "Install %1 alongside another operating system." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::Erase: return QCoreApplication::translate( context, "Erase disk and install %1." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::Replace: return QCoreApplication::translate( context, "Replace a partition with %1." ) .arg( branding->shortVersionedName() ); - break; case Config::InstallChoice::NoChoice: case Config::InstallChoice::Manual: return QCoreApplication::translate( context, "Manual partitioning." ); @@ -187,21 +184,18 @@ diskDescription( int listLength, const PartitionCoreModule::SummaryInfo& info, C .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::Erase: return QCoreApplication::translate( context, "Erase disk %2 (%3) and install %1." ) .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::Replace: return QCoreApplication::translate( context, "Replace a partition on disk %2 (%3) with %1." ) .arg( branding->shortVersionedName() ) .arg( info.deviceNode ) .arg( info.deviceName ); - break; case Config::NoChoice: case Config::Manual: return QCoreApplication::translate( From 605ad788d0b3bb72a0998191e1873820ea2acf98 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 30 Sep 2021 00:02:43 +0200 Subject: [PATCH 027/160] [partition] Fix build against Qt deprecations setMargin() has been deprecated for a long time, and Calamares has a utility function for it anyway. --- src/modules/partition/PartitionViewStep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index dad8a0558..ced08f7fc 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -248,7 +248,7 @@ PartitionViewStep::createSummaryWidget() const QWidget* widget = new QWidget; QVBoxLayout* mainLayout = new QVBoxLayout; widget->setLayout( mainLayout ); - mainLayout->setMargin( 0 ); + CalamaresUtils::unmarginLayout( mainLayout ); Config::InstallChoice choice = m_config->installChoice(); From 04e927e67f6f4dca0b7506d131ac5156904487e5 Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 21 Feb 2021 17:27:46 -0600 Subject: [PATCH 028/160] EndeavourOS customizations --- src/modules/bootloader/bootloader.conf | 16 +- src/modules/bootloader/bootloader.schema.yaml | 10 +- src/modules/bootloader/main.py | 176 +++++++++++------- 3 files changed, 126 insertions(+), 76 deletions(-) diff --git a/src/modules/bootloader/bootloader.conf b/src/modules/bootloader/bootloader.conf index f471c2ee0..a8a82c368 100644 --- a/src/modules/bootloader/bootloader.conf +++ b/src/modules/bootloader/bootloader.conf @@ -7,21 +7,21 @@ --- # Define which bootloader you want to use for EFI installations # Possible options are 'grub', 'sb-shim' and 'systemd-boot'. -efiBootLoader: "grub" +efiBootLoader: "systemd-boot" -# systemd-boot configuration files settings, set kernel and initramfs file names +# systemd-boot configuration files settings, set kernel search path, kernel name # and amount of time before default selection boots -kernel: "/vmlinuz-linux" -img: "/initramfs-linux.img" -fallback: "/initramfs-linux-fallback.img" +kernelSearchPath: "/usr/lib/modules" +kernelName: "vmlinuz" timeout: "10" -# Optionally set the menu entry name and kernel name to use in systemd-boot. +# additionalInitrdFiles is a comma seperated list of file names +additionalInitrdFiles: "/boot/amd-ucode,/boot/intel-ucode" + +# Optionally set the menu entry name to use in systemd-boot. # If not specified here, these settings will be taken from branding.desc. # # bootloaderEntryName: "Generic GNU/Linux" -# kernelLine: ", with Stable-Kernel" -# fallbackKernelLine: ", with Stable-Kernel (fallback initramfs)" # GRUB 2 binary names and boot directory # Some distributions (e.g. Fedora) use grub2-* (resp. /boot/grub2/) names. diff --git a/src/modules/bootloader/bootloader.schema.yaml b/src/modules/bootloader/bootloader.schema.yaml index 152d3ab72..4554cbf73 100644 --- a/src/modules/bootloader/bootloader.schema.yaml +++ b/src/modules/bootloader/bootloader.schema.yaml @@ -7,10 +7,10 @@ additionalProperties: false type: object properties: efiBootLoader: { type: string } - kernel: { type: string } - img: { type: string } - fallback: { type: string } + kernelSearchPath: { type: string } + kernelName: { type: string } timeout: { type: string } # Inserted verbatim + additionalInitrdFiles: { type: string } bootloaderEntryName: { type: string } kernelLine: { type: string } fallbackKernelLine: { type: string } @@ -27,8 +27,8 @@ properties: required: - efiBootLoader - - kernel - - img + - kernelSearchPath + - kernelName - grubInstall - grubMkconfig - grubCfg diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 68cbddd0e..e42f33b3e 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -73,26 +73,7 @@ def get_bootloader_entry_name(): return branding["bootloaderEntryName"] -def get_kernel_line(kernel_type): - """ - Passes 'kernel_line' to other routine based on configuration file. - - :param kernel_type: - :return: - """ - if kernel_type == "fallback": - if "fallbackKernelLine" in libcalamares.job.configuration: - return libcalamares.job.configuration["fallbackKernelLine"] - else: - return " (fallback)" - else: - if "kernelLine" in libcalamares.job.configuration: - return libcalamares.job.configuration["kernelLine"] - else: - return "" - - -def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, kernel_type): +def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, kernel, kernel_type, kernel_version): """ Creates systemd-boot configuration files based on given parameters. @@ -101,9 +82,10 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker :param uuid: :param entry: :param entry_name: + :param kernel: :param kernel_type: + :param kernel_version: """ - kernel = libcalamares.job.configuration["kernel"] kernel_params = ["quiet"] partitions = libcalamares.globalstorage.value("partitions") @@ -151,43 +133,84 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker kernel_params.append("resume=/dev/mapper/{!s}".format( swap_outer_mappername)) - kernel_line = get_kernel_line(kernel_type) + kernel_line = entry_name + " " + kernel_version libcalamares.utils.debug("Configure: \"{!s}\"".format(kernel_line)) if kernel_type == "fallback": - img = libcalamares.job.configuration["fallback"] - entry_name = entry_name + "-fallback" + version_string = kernel_version + "-fallback" + initrd = "initrd-fallback" + mkinitcpio_option = "-S autodetect" else: - img = libcalamares.job.configuration["img"] + version_string = kernel_version + initrd = "initrd" + mkinitcpio_option = "" + + # get the machine-id + with open(os.path.join(install_path, "etc", "machine-id"), 'r') as machineid_file: + machine_id = machineid_file.read().rstrip('\n') + + # Copy kernel to a subdirectory of /efi partition + machine_dir = os.path.join(install_path + efi_dir, machine_id) + try: + os.mkdir(machine_dir) + except FileExistsError: # We can ignore errors caused by the directory existing already + pass + + files_dir = os.path.join(machine_dir, kernel_version) + try: + os.mkdir(files_dir) + except FileExistsError: # We can ignore errors caused by the directory existing already + pass + + kernel_path = os.path.join(install_path, kernel) + kernel_name = os.path.basename(kernel_path) + shutil.copyfile(kernel_path, os.path.join(files_dir, "linux")) + + # generate the initramfs - this is Arch specific and should be replaced for other distros + try: + subprocess.run(["chroot " + + install_path + + " mkinitcpio -k " + kernel_version + " -g " + os.path.join("/", os.path.relpath(files_dir, install_path), initrd)], + shell=True, + capture_output=True, + check=True) + except subprocess.CalledProcessError as cpe: + libcalamares.utils.debug("mkiniticpio failed") + libcalamares.utils.debug("STDOUT: " + cpe.stdout.decode()) + libcalamares.utils.debug("STDERR: " + cpe.stderr.decode()) + raise + + + # write the entry + lines = [ + '## Generated by Calamares\n', + '\n', + "title {!s}\n".format(entry), + "version {!s}\n".format(version_string), + "machine-id {!s}\n".format(machine_id), + "linux {!s}\n".format(os.path.join("/", machine_id, kernel_version, "linux")), + ] + + try: + additional_initrd_files = libcalamares.job.configuration["additionalInitrdFiles"] + for initrd_file in additional_initrd_files.split(','): + libcalamares.utils.debug("Attempting to handle initrd image " + initrd_file) + if os.path.isfile(os.path.join(install_path, initrd_file)): + libcalamares.utils.debug("Found image " + initrd_file) + shutil.copyfile(os.path.join(install_path, initrd_file), os.path.join(files_dir, os.path.basename(initrd_file))) + lines.append("initrd {!s}\n".format(os.path.join("/", machine_id, kernel_version, os.path.basename(initrd_file)))) + except KeyError: # If the configuration option isn't set, we can just move on + libcalamares.utils.debug("Failed to find key additionalInitrdFiles") + pass + + lines.append("initrd {!s}\n".format(os.path.join("/", machine_id, kernel_version, initrd))) + lines.append("options {!s} rw\n".format(" ".join(kernel_params))) conf_path = os.path.join(install_path + efi_dir, "loader", "entries", - entry_name + ".conf") - - # Copy kernel and initramfs to a subdirectory of /efi partition - files_dir = os.path.join(install_path + efi_dir, entry_name) - os.mkdir(files_dir) - - kernel_path = install_path + kernel - kernel_name = os.path.basename(kernel_path) - shutil.copyfile(kernel_path, os.path.join(files_dir, kernel_name)) - - img_path = install_path + img - img_name = os.path.basename(img_path) - shutil.copyfile(img_path, os.path.join(files_dir, img_name)) - - lines = [ - '## This is just an example config file.\n', - '## Please edit the paths and kernel parameters according\n', - '## to your system.\n', - '\n', - "title {!s}{!s}\n".format(entry, kernel_line), - "linux {!s}\n".format(os.path.join("/", entry_name, kernel_name)), - "initrd {!s}\n".format(os.path.join("/", entry_name, img_name)), - "options {!s} rw\n".format(" ".join(kernel_params)), - ] - + machine_id + "-" + version_string + ".conf") + with open(conf_path, 'w') as conf_file: for line in lines: conf_file.write(line) @@ -261,6 +284,8 @@ def install_systemd_boot(efi_directory): """ libcalamares.utils.debug("Bootloader: systemd-boot") install_path = libcalamares.globalstorage.value("rootMountPoint") + kernel_search_path = libcalamares.job.configuration["kernelSearchPath"] + source_kernel_name = libcalamares.job.configuration["kernelName"] install_efi_directory = install_path + efi_directory uuid = get_uuid() distribution = get_bootloader_entry_name() @@ -271,21 +296,46 @@ def install_systemd_boot(efi_directory): subprocess.call(["bootctl", "--path={!s}".format(install_efi_directory), "install"]) - create_systemd_boot_conf(install_path, - efi_directory, - uuid, - distribution, - distribution_translated, - "default") - if "fallback" in libcalamares.job.configuration: - create_systemd_boot_conf(install_path, - efi_directory, - uuid, - distribution, - distribution_translated, - "fallback") + + # find all the installed kernels and generate default and fallback entries for each + # This is Arch-specific and may need adjustment for other distros + for root, dirs, files in os.walk(os.path.join(install_path, kernel_search_path)): + for file in files: + if file == source_kernel_name: + rel_root = os.path.relpath(root, install_path) + create_systemd_boot_conf(install_path, + efi_directory, + uuid, + distribution, + distribution_translated, + os.path.join(rel_root, file), + "default", + os.path.basename(root)) + create_systemd_boot_conf(install_path, + efi_directory, + uuid, + distribution, + distribution_translated, + os.path.join(rel_root, file), + "fallback", + os.path.basename(root)) + create_loader(loader_path, distribution_translated) + # clean up redundant kernel and initrd + try: + os.remove(os.path.join(install_path, "boot/vmlinuz-linux")) + except FileNotFoundError: + pass + try: + os.remove(os.path.join(install_path, "boot/initramfs-linux.img")) + except FileNotFoundError: + pass + try: + os.remove(os.path.join(install_path, "boot/initramfs-linux-fallback.img")) + except FileNotFoundError: + pass + def get_grub_efi_parameters(): """ From e0f40cb4a4b7691ebb54092adb2ccced6c2f59a7 Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 21 Feb 2021 17:36:11 -0600 Subject: [PATCH 029/160] Remove EOS-specific changes --- src/modules/bootloader/bootloader.conf | 2 +- src/modules/bootloader/main.py | 14 -------------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/modules/bootloader/bootloader.conf b/src/modules/bootloader/bootloader.conf index a8a82c368..278c345ad 100644 --- a/src/modules/bootloader/bootloader.conf +++ b/src/modules/bootloader/bootloader.conf @@ -7,7 +7,7 @@ --- # Define which bootloader you want to use for EFI installations # Possible options are 'grub', 'sb-shim' and 'systemd-boot'. -efiBootLoader: "systemd-boot" +efiBootLoader: "grub" # systemd-boot configuration files settings, set kernel search path, kernel name # and amount of time before default selection boots diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index e42f33b3e..ba61cc665 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -322,20 +322,6 @@ def install_systemd_boot(efi_directory): create_loader(loader_path, distribution_translated) - # clean up redundant kernel and initrd - try: - os.remove(os.path.join(install_path, "boot/vmlinuz-linux")) - except FileNotFoundError: - pass - try: - os.remove(os.path.join(install_path, "boot/initramfs-linux.img")) - except FileNotFoundError: - pass - try: - os.remove(os.path.join(install_path, "boot/initramfs-linux-fallback.img")) - except FileNotFoundError: - pass - def get_grub_efi_parameters(): """ From c1f7a2c8553f177b0ce1728b2d04ce1d1579197c Mon Sep 17 00:00:00 2001 From: dalto Date: Wed, 24 Feb 2021 09:41:42 -0600 Subject: [PATCH 030/160] Fix issue with absolute paths --- src/modules/bootloader/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index ba61cc665..867764558 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -299,7 +299,7 @@ def install_systemd_boot(efi_directory): # find all the installed kernels and generate default and fallback entries for each # This is Arch-specific and may need adjustment for other distros - for root, dirs, files in os.walk(os.path.join(install_path, kernel_search_path)): + for root, dirs, files in os.walk(os.path.join(install_path, kernel_search_path.lstrip('/'))): for file in files: if file == source_kernel_name: rel_root = os.path.relpath(root, install_path) From 9d9cd44617495bd1499ecddbeb1710ba791e288b Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 19 Sep 2021 19:23:56 -0500 Subject: [PATCH 031/160] Changes from review comments --- src/modules/bootloader/bootloader.schema.yaml | 1 + src/modules/bootloader/main.py | 132 ++++++++---------- 2 files changed, 58 insertions(+), 75 deletions(-) diff --git a/src/modules/bootloader/bootloader.schema.yaml b/src/modules/bootloader/bootloader.schema.yaml index 4554cbf73..914a17c27 100644 --- a/src/modules/bootloader/bootloader.schema.yaml +++ b/src/modules/bootloader/bootloader.schema.yaml @@ -33,3 +33,4 @@ required: - grubMkconfig - grubCfg - grubProbe + - machineid diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 867764558..7c5007050 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -73,18 +73,17 @@ def get_bootloader_entry_name(): return branding["bootloaderEntryName"] -def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, kernel, kernel_type, kernel_version): +def create_systemd_boot_conf(installation_root_path, efi_dir, uuid, entry, kernel, kernel_type, kernel_version): """ Creates systemd-boot configuration files based on given parameters. - :param install_path: - :param efi_dir: - :param uuid: - :param entry: - :param entry_name: - :param kernel: - :param kernel_type: - :param kernel_version: + :param installation_root_path: A string containing the absolute path to the root of the installation + :param efi_dir: A string containing the path to the efi dir relative to the root of the installation + :param uuid: A string containing the UUID of the root volume + :param entry: A string containing the name of the entry as it will be displayed on boot + :param kernel: A string containing the path to the kernel relative to the root of the installation + :param kernel_type: A string which should be set if there is a special version of the entry, for example "fallback" + :param kernel_version: The kernel version string """ kernel_params = ["quiet"] @@ -133,53 +132,29 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker kernel_params.append("resume=/dev/mapper/{!s}".format( swap_outer_mappername)) - kernel_line = entry_name + " " + kernel_version - libcalamares.utils.debug("Configure: \"{!s}\"".format(kernel_line)) + libcalamares.utils.debug("Configure: \"{!s}\"".format(f"{entry} {kernel_version}")) if kernel_type == "fallback": version_string = kernel_version + "-fallback" initrd = "initrd-fallback" - mkinitcpio_option = "-S autodetect" else: version_string = kernel_version initrd = "initrd" - mkinitcpio_option = "" # get the machine-id - with open(os.path.join(install_path, "etc", "machine-id"), 'r') as machineid_file: + with open(os.path.join(installation_root_path, "etc", "machine-id"), 'r') as machineid_file: machine_id = machineid_file.read().rstrip('\n') # Copy kernel to a subdirectory of /efi partition - machine_dir = os.path.join(install_path + efi_dir, machine_id) - try: - os.mkdir(machine_dir) - except FileExistsError: # We can ignore errors caused by the directory existing already - pass + machine_dir = os.path.join(installation_root_path + efi_dir, machine_id) + os.makedirs(machine_dir, exist_ok=True) - files_dir = os.path.join(machine_dir, kernel_version) - try: - os.mkdir(files_dir) - except FileExistsError: # We can ignore errors caused by the directory existing already - pass + target_efi_files_dir = os.path.join(machine_dir, kernel_version) + os.makedirs(target_efi_files_dir, exist_ok=True) - kernel_path = os.path.join(install_path, kernel) + kernel_path = os.path.join(installation_root_path, kernel) kernel_name = os.path.basename(kernel_path) - shutil.copyfile(kernel_path, os.path.join(files_dir, "linux")) - - # generate the initramfs - this is Arch specific and should be replaced for other distros - try: - subprocess.run(["chroot " + - install_path + - " mkinitcpio -k " + kernel_version + " -g " + os.path.join("/", os.path.relpath(files_dir, install_path), initrd)], - shell=True, - capture_output=True, - check=True) - except subprocess.CalledProcessError as cpe: - libcalamares.utils.debug("mkiniticpio failed") - libcalamares.utils.debug("STDOUT: " + cpe.stdout.decode()) - libcalamares.utils.debug("STDERR: " + cpe.stderr.decode()) - raise - + shutil.copyfile(kernel_path, os.path.join(target_efi_files_dir, "linux")) # write the entry lines = [ @@ -195,9 +170,9 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker additional_initrd_files = libcalamares.job.configuration["additionalInitrdFiles"] for initrd_file in additional_initrd_files.split(','): libcalamares.utils.debug("Attempting to handle initrd image " + initrd_file) - if os.path.isfile(os.path.join(install_path, initrd_file)): + if os.path.isfile(os.path.join(installation_root_path, initrd_file.lstrip('/'))): libcalamares.utils.debug("Found image " + initrd_file) - shutil.copyfile(os.path.join(install_path, initrd_file), os.path.join(files_dir, os.path.basename(initrd_file))) + shutil.copyfile(os.path.join(installation_root_path, initrd_file.lstrip('/')), os.path.join(target_efi_files_dir, os.path.basename(initrd_file))) lines.append("initrd {!s}\n".format(os.path.join("/", machine_id, kernel_version, os.path.basename(initrd_file)))) except KeyError: # If the configuration option isn't set, we can just move on libcalamares.utils.debug("Failed to find key additionalInitrdFiles") @@ -206,7 +181,7 @@ def create_systemd_boot_conf(install_path, efi_dir, uuid, entry, entry_name, ker lines.append("initrd {!s}\n".format(os.path.join("/", machine_id, kernel_version, initrd))) lines.append("options {!s} rw\n".format(" ".join(kernel_params))) - conf_path = os.path.join(install_path + efi_dir, + conf_path = os.path.join(installation_root_path + efi_dir, "loader", "entries", machine_id + "-" + version_string + ".conf") @@ -275,6 +250,30 @@ def efi_boot_next(): if boot_entry: subprocess.call([boot_mgr, "-n", boot_entry]) +def get_kernels(installation_root_path): + """ + Gets a list of kernels and associated values for each kernel. This will work as is for many distros. + If not, it should be safe to modify it to better support your distro + + :param installation_root_path: A string with the absolute path to the root of the installation + + Returns a list of 3-tuples + + Each 3-tuple contains the kernel, kernel_type and kernel_version + """ + kernel_search_path = libcalamares.job.configuration["kernelSearchPath"] + source_kernel_name = libcalamares.job.configuration["kernelName"] + kernel_list = [] + + # find all the installed kernels and generate default and fallback entries for each + for root, dirs, files in os.walk(os.path.join(installation_root_path, kernel_search_path.lstrip('/'))): + for file in files: + if file == source_kernel_name: + rel_root = os.path.relpath(root, installation_root_path) + kernel_list.append((os.path.join(rel_root, file),"default",os.path.basename(root))) + kernel_list.append((os.path.join(rel_root, file),"fallback",os.path.basename(root))) + + return kernel_list def install_systemd_boot(efi_directory): """ @@ -283,10 +282,8 @@ def install_systemd_boot(efi_directory): :param efi_directory: """ libcalamares.utils.debug("Bootloader: systemd-boot") - install_path = libcalamares.globalstorage.value("rootMountPoint") - kernel_search_path = libcalamares.job.configuration["kernelSearchPath"] - source_kernel_name = libcalamares.job.configuration["kernelName"] - install_efi_directory = install_path + efi_directory + installation_root_path = libcalamares.globalstorage.value("rootMountPoint") + install_efi_directory = installation_root_path + efi_directory uuid = get_uuid() distribution = get_bootloader_entry_name() distribution_translated = distribution.translate(file_name_sanitizer) @@ -297,32 +294,17 @@ def install_systemd_boot(efi_directory): "--path={!s}".format(install_efi_directory), "install"]) - # find all the installed kernels and generate default and fallback entries for each - # This is Arch-specific and may need adjustment for other distros - for root, dirs, files in os.walk(os.path.join(install_path, kernel_search_path.lstrip('/'))): - for file in files: - if file == source_kernel_name: - rel_root = os.path.relpath(root, install_path) - create_systemd_boot_conf(install_path, - efi_directory, - uuid, - distribution, - distribution_translated, - os.path.join(rel_root, file), - "default", - os.path.basename(root)) - create_systemd_boot_conf(install_path, - efi_directory, - uuid, - distribution, - distribution_translated, - os.path.join(rel_root, file), - "fallback", - os.path.basename(root)) + for (kernel, kernel_type, kernel_version) in get_kernels(installation_root_path): + create_systemd_boot_conf(installation_root_path, + efi_directory, + uuid, + distribution, + kernel, + kernel_type, + kernel_version) create_loader(loader_path, distribution_translated) - def get_grub_efi_parameters(): """ Returns a 3-tuple of suitable parameters for GRUB EFI installation, @@ -359,8 +341,8 @@ def install_grub(efi_directory, fw_type): """ if fw_type == "efi": libcalamares.utils.debug("Bootloader: grub (efi)") - install_path = libcalamares.globalstorage.value("rootMountPoint") - install_efi_directory = install_path + efi_directory + installation_root_path = libcalamares.globalstorage.value("rootMountPoint") + install_efi_directory = installation_root_path + efi_directory if not os.path.isdir(install_efi_directory): os.makedirs(install_efi_directory) @@ -430,8 +412,8 @@ def install_secureboot(efi_directory): """ efi_bootloader_id = efi_label() - install_path = libcalamares.globalstorage.value("rootMountPoint") - install_efi_directory = install_path + efi_directory + installation_root_path = libcalamares.globalstorage.value("rootMountPoint") + install_efi_directory = installation_root_path + efi_directory if efi_word_size() == "64": install_efi_bin = "shimx64.efi" From b5f8e30093879bec84b3cd0555e8b0f785f2d1db Mon Sep 17 00:00:00 2001 From: dalto Date: Wed, 13 Oct 2021 15:09:27 -0500 Subject: [PATCH 032/160] Change additionalInitrdFiles to an array --- src/modules/bootloader/bootloader.conf | 4 +++- src/modules/bootloader/bootloader.schema.yaml | 5 ++++- src/modules/bootloader/main.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/bootloader/bootloader.conf b/src/modules/bootloader/bootloader.conf index 278c345ad..60235e5d2 100644 --- a/src/modules/bootloader/bootloader.conf +++ b/src/modules/bootloader/bootloader.conf @@ -16,7 +16,9 @@ kernelName: "vmlinuz" timeout: "10" # additionalInitrdFiles is a comma seperated list of file names -additionalInitrdFiles: "/boot/amd-ucode,/boot/intel-ucode" +additionalInitrdFiles: + - "/boot/amd-ucode" + - "/boot/intel-ucode" # Optionally set the menu entry name to use in systemd-boot. # If not specified here, these settings will be taken from branding.desc. diff --git a/src/modules/bootloader/bootloader.schema.yaml b/src/modules/bootloader/bootloader.schema.yaml index 914a17c27..0849f6865 100644 --- a/src/modules/bootloader/bootloader.schema.yaml +++ b/src/modules/bootloader/bootloader.schema.yaml @@ -10,7 +10,10 @@ properties: kernelSearchPath: { type: string } kernelName: { type: string } timeout: { type: string } # Inserted verbatim - additionalInitrdFiles: { type: string } + additionalInitrdFiles: + type: array + items: + type: string bootloaderEntryName: { type: string } kernelLine: { type: string } fallbackKernelLine: { type: string } diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index 7c5007050..bcb7f230a 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -168,7 +168,7 @@ def create_systemd_boot_conf(installation_root_path, efi_dir, uuid, entry, kerne try: additional_initrd_files = libcalamares.job.configuration["additionalInitrdFiles"] - for initrd_file in additional_initrd_files.split(','): + for initrd_file in additional_initrd_files: libcalamares.utils.debug("Attempting to handle initrd image " + initrd_file) if os.path.isfile(os.path.join(installation_root_path, initrd_file.lstrip('/'))): libcalamares.utils.debug("Found image " + initrd_file) From 8e959105c64758d1d86de45267e2927fd929dcc1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 30 Oct 2021 15:02:03 +0200 Subject: [PATCH 033/160] Changes: avoid constant merge-conflicts by separating 3.2 and 3.3 --- CHANGES => CHANGES-3.3 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CHANGES => CHANGES-3.3 (100%) diff --git a/CHANGES b/CHANGES-3.3 similarity index 100% rename from CHANGES rename to CHANGES-3.3 From 1667d75a70d913673ac2b21b8d6f108fe3cd7120 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 30 Nov 2021 11:49:43 +0100 Subject: [PATCH 034/160] CMake: WITH_KF5Crash -> BUILD_KF5Crash ABI-changing flags are WITH_*, features and dependencies are BUILD_* --- CMakeLists.txt | 20 +++++++++++++------- src/calamares/CMakeLists.txt | 4 ++-- src/calamares/main.cpp | 5 ++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5a106ce9..cc5ff8b66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,9 +25,13 @@ # CMake once. These affect the ABI offered by Calamares. # - PYTHON (enable Python Job modules) # - QML (enable QML UI View modules) +# The WITH_* options affect the ABI of Calamares: you must +# build (C++) modules for Calamares with the same WITH_* +# settings, or they may not load at all. # BUILD_ : choose additional things to build # - TESTING (standard CMake option) # - SCHEMA_TESTING (requires Python, see ci/configvalidator.py) +# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting) # DEBUG_ : special developer flags for debugging # # Example usage: @@ -64,15 +68,15 @@ endif() option( INSTALL_CONFIG "Install configuration files" OFF ) option( INSTALL_POLKIT "Install Polkit configuration" ON ) option( INSTALL_COMPLETION "Install shell completions" OFF ) -# Options for the calamares executable -option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) # TODO:3.3: WITH->BUILD (this isn't an ABI thing) # When adding WITH_* that affects the ABI offered by libcalamares, # also update libcalamares/CalamaresConfig.h.in option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( WITH_QML "Enable QML UI options." ON ) # -# Additional parts to build +# Additional parts to build that do not affect ABI option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON ) +# Options for the calamares executable +option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) # Possible debugging flags are: @@ -338,10 +342,10 @@ set_package_properties( PURPOSE "Unique instance of Calamares" ) if( NOT KF5Crash_FOUND ) - if( WITH_KF5Crash ) - message(WARNING "WITH_KF5Crash is set, but KF5::Crash is not available.") + if( BUILD_KF5Crash ) + message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.") endif() - set( WITH_KF5Crash OFF ) + set( BUILD_KF5Crash OFF ) endif() # TODO:3.3: Use FindPython3 instead @@ -563,8 +567,10 @@ set( Calamares_LIBRARIES calamares ) add_subdirectory( src ) add_feature_info(Python ${WITH_PYTHON} "Python job modules") +add_feature_info(Qml ${WITH_QML} "QML UI support") add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") -add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") +add_feature_info(Polkit ${INSTALL_POLKIT} "Install Polkit files") +add_feature_info(KCrash ${BUILD_KF5Crash} "Crash dumps via KCrash") ### CMake infrastructure installation # diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index eb1fbe694..cf9fdd8a7 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -56,9 +56,9 @@ target_link_libraries( calamares_bin KF5::CoreAddons KF5::DBusAddons ) -if( WITH_KF5Crash ) +if( BUILD_KF5Crash ) target_link_libraries( calamares_bin PRIVATE KF5::Crash ) - target_compile_definitions( calamares_bin PRIVATE WITH_KF5Crash ) + target_compile_definitions( calamares_bin PRIVATE BUILD_KF5Crash ) endif() install( TARGETS calamares_bin diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index 6c03bd52c..fcc946485 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -18,7 +18,7 @@ #include #include -#ifdef WITH_KF5Crash +#ifdef BUILD_KF5Crash #include #endif @@ -117,12 +117,11 @@ main( int argc, char* argv[] ) KAboutData::setApplicationData( aboutData ); a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file -#ifdef WITH_KF5Crash +#ifdef BUILD_KF5Crash KCrash::initialize(); // KCrash::setCrashHandler(); KCrash::setDrKonqiEnabled( true ); KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly ); - // TODO: umount anything in /tmp/calamares-... as an emergency save function #endif bool is_debug = handle_args( a ); From e4a3b66024c0a5a499d5b5dd83c9954e6bd642bd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 30 Nov 2021 12:16:14 +0100 Subject: [PATCH 035/160] CI: add abi-consistency-checking --- ci/abicheck.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 ci/abicheck.sh diff --git a/ci/abicheck.sh b/ci/abicheck.sh new file mode 100755 index 000000000..6bf8f9b54 --- /dev/null +++ b/ci/abicheck.sh @@ -0,0 +1,73 @@ +#! /bin/sh +# +# SPDX-FileCopyrightText: 2021 Adriaan de Groot +# SPDX-License-Identifier: BSD-2-Clause +# +# Compares the ABI of the current working tree with the ABI +# from a base-version. Uses libabigail for the actual comparison. +# +# To use the tool, just run the script. It will build Calamares at +# least once, maybe twice (if it needs the base-version ABI information +# and hasn't cached it). + +# The base version can be a tag or git-hash; it will be checked-out +# in a worktree. +# +# Note that the hash here now is the very start of 3.3, when ABI +# compatibility was not expected yet at **all**. +BASE_VERSION=419be4df25bc6fcc1958cb6e44afc1b9e64fce71 + +### Build a tree and cache the ABI info into ci/ +# +# +do_build() { + LABEL=$1 + SOURCE_DIR=$2 + + BUILD_DIR=build-abi-$LABEL + rm -rf $BUILD_DIR + mkdir $BUILD_DIR + + if ( cd $BUILD_DIR && cmake $SOURCE_DIR -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-Og -g -gdwarf" -DCMAKE_C_FLAGS="-Og -g -gdwarf" && make -j12 ) > /dev/null 2>&1 + then + ls -1 $BUILD_DIR/libcalamares*.so.* + # Copy the un-versioned files; .so is a symlink to the just-built one + for lib in $BUILD_DIR/libcalamares*.so + do + cp $lib ci/`basename $lib`.$LABEL + done + else + echo "! failed to build $LABEL" + exit 1 + fi +} + +### Build current tree and get ABI info +# +# +do_build current `pwd -P` + +### Build ABI base version +# +# We cache this to save on some build time, if we are chasing a +# single branch from an unchanging base version. +# +if test -f ci/libcalamares.so.$BASE_VERSION +then + # The ABI version is cached, so we're good + : +else + git worktree remove --force tree-abi-$BASE_VERSION + git worktree add tree-abi-$BASE_VERSION $BASE_VERSION > /dev/null 2>&1 || { echo "! could not create worktree for $BASE_VERSION" ; exit 1 ; } + do_build $BASE_VERSION $( cd tree-abi-$BASE_VERSION && pwd -P ) +fi + +### Compare & Report +# +# abidiff compares the Application Binary Interfaces (ABI) of two +# shared libraries in ELF format. It emits a meaningful report describing +# the differences between the two ABIs. +# +# -l prints only the leaf changes, leaving out explanations of why. +# +abidiff -l ci/libcalamares.so.$BASE_VERSION ci/libcalamares.so.current From 03f2e45605b73bc7304115e63e613497cff06e68 Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 26 Dec 2021 09:39:06 -0600 Subject: [PATCH 036/160] [mount,fstab] Move mounting logic to the mount module --- src/modules/fstab/fstab.conf | 51 +------------ src/modules/fstab/fstab.schema.yaml | 19 ----- src/modules/fstab/main.py | 45 +++--------- src/modules/mount/main.py | 104 ++++++++++++++++++++++++--- src/modules/mount/mount.conf | 25 +++++-- src/modules/mount/mount.schema.yaml | 27 +++---- src/modules/partition/partition.conf | 2 +- 7 files changed, 142 insertions(+), 131 deletions(-) diff --git a/src/modules/fstab/fstab.conf b/src/modules/fstab/fstab.conf index 560aa0073..79d2de54d 100644 --- a/src/modules/fstab/fstab.conf +++ b/src/modules/fstab/fstab.conf @@ -5,57 +5,8 @@ # Also creates mount points for all the filesystems. # # When creating fstab entries for a filesystem, this module -# uses the options for the filesystem type to write to the -# options field of the file. +# uses the options previously defined in the mount module --- -# Mount options to use for all filesystems. If a specific filesystem -# is listed here, use those options, otherwise use the *default* -# options from this mapping. -# -# With kernels 5.15 and newer be cautious of adding the option space_cache -# to the btrfs mount options. The default in 5.15 changed to space_cache=v2. -# If space_cache or space_cache=v1 are specified, it may fail to remount. -# -# btrfs_swap options are used when a swapfile is chosen with a btrfs root -# the options are applied to the subvolume which holds the swap partition -# -# The settings shown here apply only the btrfs defaults; these -# are generally the right ones. Commented-out lines show other -# options wich **might** be applicable for specific situations. -mountOptions: - default: defaults,noatime - # btrfs: defaults,noatime,autodefrag,compress=zstd - btrfs: defaults - # btrfs_swap: defaults,noatime - btrfs_swap: defaults - -# Mount options to use for the EFI System Partition. If not defined, the -# *mountOptions* for *vfat* are used, or if that is not set either, -# *default* from *mountOptions*. -efiMountOptions: umask=0077 - -# If a filesystem is on an SSD, add the following options. If a specific -# filesystem is listed here, use those options, otherwise no additional -# options are set (i.e. there is no *default* like in *mountOptions*). -# -# This example configuration applies the *discard* option to most -# common filesystems on an SSD. This may not be the right option -# for your distribution. If you use a systemd timer to trim the -# SSD, it may interfere with the *discard* option. Opinions vary -# as to whether *discard* is worth the effort -- it depends on -# the usage pattern of the disk as well. -# -# ssdExtraMountOptions: -# ext4: discard -# jfs: discard -# xfs: discard -# swap: discard -# btrfs: discard,compress=lzo -# -# The standard configuration applies asynchronous discard support and ssd optimizations to btrfs -# and does nothing for other filesystems. -ssdExtraMountOptions: - btrfs: discard=async,ssd # Additional options added to each line in /etc/crypttab crypttabOptions: luks diff --git a/src/modules/fstab/fstab.schema.yaml b/src/modules/fstab/fstab.schema.yaml index 087e82cac..d2b4177ac 100644 --- a/src/modules/fstab/fstab.schema.yaml +++ b/src/modules/fstab/fstab.schema.yaml @@ -6,23 +6,4 @@ $id: https://calamares.io/schemas/fstab additionalProperties: false type: object properties: - mountOptions: - type: object - additionalProperties: true # we don't know which FS exist - properties: - default: { type: string } - btrfs: { type: string } - required: [ default ] - ssdExtraMountOptions: - type: object - additionalProperties: true # we don't know which FS exist - properties: - ext4: { type: string } - jfs: { type: string } - xfs: { type: string } - swap: { type: string } - btrfs: { type: string } - btrfs_swap: { type: string } - efiMountOptions: { type: string } crypttabOptions: { type: string } -required: [ mountOptions ] diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index 6a771a24b..8c768b5dd 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -103,15 +103,13 @@ class FstabGenerator(object): :param partitions: :param root_mount_point: - :param mount_options: - :param ssd_extra_mount_options: + :param mount_options_list: """ - def __init__(self, partitions, root_mount_point, mount_options, - ssd_extra_mount_options, crypttab_options): + def __init__(self, partitions, root_mount_point, mount_options_list, + crypttab_options): self.partitions = partitions self.root_mount_point = root_mount_point - self.mount_options = mount_options - self.ssd_extra_mount_options = ssd_extra_mount_options + self.mount_options_list = mount_options_list self.crypttab_options = crypttab_options self.ssd_disks = set() self.root_is_ssd = False @@ -236,17 +234,7 @@ class FstabGenerator(object): libcalamares.utils.debug("Ignoring foreign swap {!s} {!s}".format(disk_name, partition.get("uuid", None))) return None - # If this is btrfs subvol a dedicated to a swapfile, use different options than a normal btrfs subvol - if filesystem == "btrfs" and partition.get("subvol", None) == "/@swap": - options = self.get_mount_options("btrfs_swap", mount_point) - else: - options = self.get_mount_options(filesystem, mount_point) - - if is_ssd: - extra = self.ssd_extra_mount_options.get(filesystem) - - if extra: - options += "," + extra + options = self.get_mount_options(filesystem, mount_point) if mount_point == "/" and filesystem != "btrfs": check = 1 @@ -258,10 +246,6 @@ class FstabGenerator(object): if mount_point == "/": self.root_is_ssd = is_ssd - # If there's a set-and-not-empty subvolume set, add it - if filesystem == "btrfs" and partition.get("subvol",None): - options = "subvol={},".format(partition["subvol"]) + options - if has_luks: device = "/dev/mapper/" + partition["luksMapperName"] elif partition["uuid"] is not None: @@ -292,15 +276,8 @@ class FstabGenerator(object): if partition["mountPoint"]: mkdir_p(self.root_mount_point + partition["mountPoint"]) - def get_mount_options(self, filesystem, mount_point): - efiMountPoint = libcalamares.globalstorage.value("efiSystemPartition") - job_config = libcalamares.job.configuration - - if (mount_point == efiMountPoint and "efiMountOptions" in job_config): - return job_config["efiMountOptions"] - - return self.mount_options.get(filesystem, - self.mount_options["default"]) + def get_mount_options(self, filesystem, mountpoint): + return next((x for x in self.mount_options_list if x["mountpoint"] == mountpoint), "defaults") def create_swapfile(root_mount_point, root_btrfs): @@ -383,21 +360,19 @@ def run(): swap_choice = None libcalamares.job.setprogress(0.1) - mount_options = conf.get("mountOptions", {}) - ssd_extra_mount_options = conf.get("ssdExtraMountOptions", {}) + mount_options_list = global_storage.value("mountOptionsList") crypttab_options = conf.get("crypttabOptions", "luks") # We rely on mount_options having a default; if there wasn't one, # bail out with a meaningful error. - if not mount_options: + if not mount_options_list: return (_("Configuration Error"), _("No
{!s}
configuration is given for
{!s}
to use.") .format("mountOptions", "fstab")) generator = FstabGenerator(partitions, root_mount_point, - mount_options, - ssd_extra_mount_options, + mount_options_list, crypttab_options) if swap_choice is not None: diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index a3318d1a0..90609cb56 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -16,6 +16,7 @@ import tempfile import subprocess import os +import re import libcalamares @@ -42,6 +43,72 @@ def pretty_name(): return _("Mounting partitions.") +def disk_name_for_partition(partition): + """ Returns disk name for each found partition. + + :param partition: + :return: + """ + name = os.path.basename(partition["device"]) + + if name.startswith("/dev/mmcblk") or name.startswith("/dev/nvme"): + return re.sub("p[0-9]+$", "", name) + + return re.sub("[0-9]+$", "", name) + + +def is_ssd_disk(partition): + """ Checks if given disk is actually a ssd disk. + + :param partition: + :return: + """ + + disk_name = disk_name_for_partition(partition) + filename = os.path.join("/sys/block", disk_name, "queue/rotational") + + if not os.path.exists(filename): + # Should not happen unless sysfs changes, but better safe than sorry + return False + + with open(filename) as sysfile: + return sysfile.read() == "0\n" + + +def get_mount_options(filesystem, mount_options, partition): + """ + + :param filesystem: + :param mount_options: + :param partition: + :return: + """ + # If there are no mount options defined then we use the defaults + if mount_options is None: + return "defaults" + + options = next((x for x in mount_options if x["filesystem"] == filesystem), None) + + # If there is no match then check for default options + if options is None: + options = next((x for x in mount_options if x["filesystem"] == "default"), None) + + # If it is still None, then fallback to returning defaults + if options is None: + return "defaults" + + option_items = options.get("options", []) + if is_ssd_disk(partition): + option_items.extend(options.get("ssdOptions", [])) + else: + option_items.extend(options.get("hddOptions", [])) + + if option_items: + return ",".join(option_items) + else: + return "defaults" + + def get_btrfs_subvolumes(partitions): """ Gets the job-configuration for btrfs subvolumes, or if there is @@ -69,7 +136,9 @@ def get_btrfs_subvolumes(partitions): # If we have a swap **file**, give it a separate subvolume. swap_choice = libcalamares.globalstorage.value("partitionChoices") if swap_choice and swap_choice.get("swap", None) == "file": - btrfs_subvolumes.append({'mountPoint': '/swap', 'subvolume': '/@swap'}) + swap_subvol = libcalamares.job.configuration.get("btrfsSwapSubvol", "/@swap") + btrfs_subvolumes.append({'mountPoint': '/swap', 'subvolume': swap_subvol}) + libcalamares.globalstorage.insert("btrfsSwapSubvol", swap_subvol) return btrfs_subvolumes @@ -138,7 +207,7 @@ def mount_zfs(root_mount_point, partition): raise ZfsException(_("Failed to set zfs mountpoint")) -def mount_partition(root_mount_point, partition, partitions): +def mount_partition(root_mount_point, partition, partitions, mount_options, mount_options_list): """ Do a single mount of @p partition inside @p root_mount_point. """ @@ -176,11 +245,13 @@ def mount_partition(root_mount_point, partition, partitions): if fstype == "zfs": mount_zfs(root_mount_point, partition) else: # fstype == "zfs" + mount_options_string = get_mount_options(fstype, mount_options, partition) if libcalamares.utils.mount(device, mount_point, fstype, - partition.get("options", "")) != 0: + mount_options_string) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) + mount_options_list.append({"mountpoint": mount_point, "option_string": mount_options_string}) # Special handling for btrfs subvolumes. Create the subvolumes listed in mount.conf if fstype == "btrfs" and partition["mountPoint"] == '/': @@ -207,13 +278,19 @@ def mount_partition(root_mount_point, partition, partitions): device = os.path.join("/dev/mapper", partition["luksMapperName"]) # Mount the subvolumes + swap_subvol = libcalamares.job.configuration.get("btrfsSwapSubvol", "/@swap") for s in btrfs_subvolumes: mount_option = "subvol={}".format(s['subvolume']) + if s['subvolume'] == swap_subvol: + mount_option += "," + get_mount_options("btrfs_swap", mount_options, partition) + else: + mount_option += "," + get_mount_options(fstype, mount_options, partition) subvolume_mountpoint = mount_point[:-1] + s['mountPoint'] + mount_options_list.append({"mountpoint": subvolume_mountpoint, "option_string": mount_option}) if libcalamares.utils.mount(device, subvolume_mountpoint, fstype, - ",".join([mount_option, partition.get("options", "")])) != 0: + mount_option) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) @@ -222,6 +299,7 @@ def run(): Mount all the partitions from GlobalStorage and from the job configuration. Partitions are mounted in-lexical-order of their mountPoint. """ + partitions = libcalamares.globalstorage.value("partitions") if not partitions: @@ -231,14 +309,18 @@ def run(): root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") + # Get the mountOptions, if this is None, that is OK and will be handled later + mount_options = libcalamares.job.configuration.get("mountOptions") + # Guard against missing keys (generally a sign that the config file is bad) extra_mounts = libcalamares.job.configuration.get("extraMounts") or [] - extra_mounts_efi = libcalamares.job.configuration.get("extraMountsEfi") or [] - if not extra_mounts and not extra_mounts_efi: + if not extra_mounts: libcalamares.utils.warning("No extra mounts defined. Does mount.conf exist?") - if libcalamares.globalstorage.value("firmwareType") == "efi": - extra_mounts.extend(extra_mounts_efi) + if libcalamares.globalstorage.value("firmwareType") != "efi": + for mount in extra_mounts: + if mount.get("efi", None) is True: + extra_mounts.remove(mount) # Add extra mounts to the partitions list and sort by mount points. # This way, we ensure / is mounted before the rest, and every mount point @@ -246,13 +328,17 @@ def run(): # under /tmp, we make sure /tmp is mounted before the partition) mountable_partitions = [p for p in partitions + extra_mounts if "mountPoint" in p and p["mountPoint"]] mountable_partitions.sort(key=lambda x: x["mountPoint"]) + + # mount_options_list will be inserted into global storage for use in fstab later + mount_options_list = [] try: for partition in mountable_partitions: - mount_partition(root_mount_point, partition, partitions) + mount_partition(root_mount_point, partition, partitions, mount_options, mount_options_list) except ZfsException as ze: return _("zfs mounting error"), ze.message libcalamares.globalstorage.insert("rootMountPoint", root_mount_point) + libcalamares.globalstorage.insert("mountOptionsList", mount_options_list) # Remember the extra mounts for the unpackfs module libcalamares.globalstorage.insert("extraMounts", extra_mounts) diff --git a/src/modules/mount/mount.conf b/src/modules/mount/mount.conf index 84dca05a7..56313b188 100644 --- a/src/modules/mount/mount.conf +++ b/src/modules/mount/mount.conf @@ -35,11 +35,10 @@ extraMounts: - device: /run/udev mountPoint: /run/udev options: bind - -extraMountsEfi: - device: efivarfs fs: efivarfs mountPoint: /sys/firmware/efi/efivars + efi: true # Btrfs subvolumes to create if root filesystem is on btrfs volume. # If *mountpoint* is mounted already to another partition, it is ignored. @@ -47,9 +46,7 @@ extraMountsEfi: # # It is possible to prevent subvolume creation -- this is likely only relevant # for the root (/) subvolume -- by giving an empty string as a subvolume -# name. In this case no subvolume will be created. When using snapper as -# a rollback mechanism, it is recommended to **not** create a subvolume -# for root. +# name. In this case no subvolume will be created. btrfsSubvolumes: - mountPoint: / @@ -63,3 +60,21 @@ btrfsSubvolumes: subvolume: /@cache - mountPoint: /var/log subvolume: /@log + +btrfsSwapSubvol: /@swap + +mountOptions: + - filesystem: default + options: [ defaults, noatime ] + - filesystem: efi + options: [ defaults, umask=0077 ] + - filesystem: btrfs + options: [ defaults, noatime, compress ] + ssdOptions: [ discard=async ] + hddOptions: [ autodefrag ] + - filesystem: btrfs_swap + options: [ defaults, noatime ] + + + + diff --git a/src/modules/mount/mount.schema.yaml b/src/modules/mount/mount.schema.yaml index fb5dfb69c..0392c1120 100644 --- a/src/modules/mount/mount.schema.yaml +++ b/src/modules/mount/mount.schema.yaml @@ -6,7 +6,6 @@ $id: https://calamares.io/schemas/mount additionalProperties: false type: object properties: - # TODO: share the schema definition, since these are identical extraMounts: type: array items: @@ -17,17 +16,7 @@ properties: fs: { type: string } mountPoint: { type: string } options: { type: string } - required: [ device, mountPoint ] - extraMountsEfi: - type: array - items: - type: object - additionalProperties: false - properties: - device: { type: string } - fs: { type: string } - mountPoint: { type: string } - options: { type: string } + efi: { type: boolean, default: false } required: [ device, mountPoint ] btrfsSubvolumes: type: array @@ -38,3 +27,17 @@ properties: mountPoint: { type: string } subvolume: { type: string } required: [ subvolume, mountPoint ] + btrfsSwapSubvol: { type: string } + mountOptions: + type: array + items: + type: object + additionalProperties: false + properties: + filesystem: { type: string } + options: { type: array } + ssdOptions: { type: array } + hddOptions: { type: array } + required: [ filesystem ] + + diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index b03c855db..2cd7fb8ea 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -156,7 +156,7 @@ defaultFileSystemType: "ext4" # # If not specified at all, uses *defaultFileSystemType* without a # warning (this matches traditional no-choice-available behavior best). -# availableFileSystemTypes: ["ext4","f2fs"] +availableFileSystemTypes: ["ext4","f2fs","btrfs"] # Show/hide LUKS related functionality in automated partitioning modes. # Disable this if you choose not to deploy early unlocking support in GRUB2 From a50ffa74e177f515c67e92aa3720ee725773c429 Mon Sep 17 00:00:00 2001 From: dalto Date: Sun, 26 Dec 2021 16:03:48 -0600 Subject: [PATCH 037/160] [mount,fstab] Fix bugs in moving mount options to the mount module --- src/modules/fstab/main.py | 16 +++++++++++++--- src/modules/mount/main.py | 29 ++++++++++++++++++++++------- src/modules/mount/mount.conf | 4 ++-- 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/modules/fstab/main.py b/src/modules/fstab/main.py index 8c768b5dd..33dcd5ecc 100644 --- a/src/modules/fstab/main.py +++ b/src/modules/fstab/main.py @@ -234,7 +234,7 @@ class FstabGenerator(object): libcalamares.utils.debug("Ignoring foreign swap {!s} {!s}".format(disk_name, partition.get("uuid", None))) return None - options = self.get_mount_options(filesystem, mount_point) + options = self.get_mount_options(mount_point) if mount_point == "/" and filesystem != "btrfs": check = 1 @@ -276,8 +276,18 @@ class FstabGenerator(object): if partition["mountPoint"]: mkdir_p(self.root_mount_point + partition["mountPoint"]) - def get_mount_options(self, filesystem, mountpoint): - return next((x for x in self.mount_options_list if x["mountpoint"] == mountpoint), "defaults") + def get_mount_options(self, mountpoint): + """ + Returns the mount options for a given mountpoint + + :param mountpoint: A string containing the mountpoint for the fstab entry + :return: A string containing the mount options for the entry or "defaults" if nothing is found + """ + mount_options_item = next((x for x in self.mount_options_list if x.get("mountpoint") == mountpoint), None) + if mount_options_item: + return mount_options_item.get("option_string", "defaults") + else: + return "defaults" def create_swapfile(root_mount_point, root_btrfs): diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 90609cb56..9a2e92e69 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -77,12 +77,18 @@ def is_ssd_disk(partition): def get_mount_options(filesystem, mount_options, partition): """ + Returns the mount options for the partition object and filesystem - :param filesystem: - :param mount_options: - :param partition: - :return: + :param filesystem: A string containing the filesystem + :param mount_options: A list of dicts that descripes the mount options for each mountpoint + :param partition: A dict containing information about the partition + :return: A comma seperated string containing the mount options suitable for passing to mount """ + + # Extra mounts can optionally have "options" set, in this case, they override other all other settings + if "options" in partition: + return ",".join(partition["options"]) + # If there are no mount options defined then we use the defaults if mount_options is None: return "defaults" @@ -97,7 +103,9 @@ def get_mount_options(filesystem, mount_options, partition): if options is None: return "defaults" - option_items = options.get("options", []) + option_items = options.get("options", []).copy() + + # Append the appropriate options for ssd or hdd if set if is_ssd_disk(partition): option_items.extend(options.get("ssdOptions", [])) else: @@ -210,6 +218,13 @@ def mount_zfs(root_mount_point, partition): def mount_partition(root_mount_point, partition, partitions, mount_options, mount_options_list): """ Do a single mount of @p partition inside @p root_mount_point. + + :param root_mount_point: A string containing the root of the install + :param partition: A dict containing information about the partition + :param partitions: The full list of partitions used to filter out btrfs subvols which have duplicate mountpoints + :param mount_options: The mount options from the config file + :param mount_options_list: A list of options for each mountpoint to be placed in global storage for future modules + :return: """ # Create mount point with `+` rather than `os.path.join()` because # `partition["mountPoint"]` starts with a '/'. @@ -251,7 +266,7 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun fstype, mount_options_string) != 0: libcalamares.utils.warning("Cannot mount {}".format(device)) - mount_options_list.append({"mountpoint": mount_point, "option_string": mount_options_string}) + mount_options_list.append({"mountpoint": raw_mount_point, "option_string": mount_options_string}) # Special handling for btrfs subvolumes. Create the subvolumes listed in mount.conf if fstype == "btrfs" and partition["mountPoint"] == '/': @@ -286,7 +301,7 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun else: mount_option += "," + get_mount_options(fstype, mount_options, partition) subvolume_mountpoint = mount_point[:-1] + s['mountPoint'] - mount_options_list.append({"mountpoint": subvolume_mountpoint, "option_string": mount_option}) + mount_options_list.append({"mountpoint": s['mountPoint'], "option_string": mount_option}) if libcalamares.utils.mount(device, subvolume_mountpoint, fstype, diff --git a/src/modules/mount/mount.conf b/src/modules/mount/mount.conf index 56313b188..cff222b2d 100644 --- a/src/modules/mount/mount.conf +++ b/src/modules/mount/mount.conf @@ -28,13 +28,13 @@ extraMounts: mountPoint: /sys - device: /dev mountPoint: /dev - options: bind + options: [ bind ] - device: tmpfs fs: tmpfs mountPoint: /run - device: /run/udev mountPoint: /run/udev - options: bind + options: [ bind ] - device: efivarfs fs: efivarfs mountPoint: /sys/firmware/efi/efivars From bb1d3022e0ea1ded1b78d51dd6705d04d8962d8c Mon Sep 17 00:00:00 2001 From: dalto Date: Mon, 27 Dec 2021 10:41:59 -0600 Subject: [PATCH 038/160] [mount] Add additional documentation in mount.conf and main.py --- src/modules/mount/main.py | 19 ++++++----- src/modules/mount/mount.conf | 63 ++++++++++++++++++++++++++++++------ 2 files changed, 63 insertions(+), 19 deletions(-) diff --git a/src/modules/mount/main.py b/src/modules/mount/main.py index 9a2e92e69..d8041f9ce 100644 --- a/src/modules/mount/main.py +++ b/src/modules/mount/main.py @@ -58,22 +58,21 @@ def disk_name_for_partition(partition): def is_ssd_disk(partition): - """ Checks if given disk is actually a ssd disk. + """ Checks if given partition is on an ssd disk. - :param partition: - :return: + :param partition: A dict containing the partition information + :return: True is the partition in on an ssd, False otherwise """ - disk_name = disk_name_for_partition(partition) - filename = os.path.join("/sys/block", disk_name, "queue/rotational") + try: + disk_name = disk_name_for_partition(partition) + filename = os.path.join("/sys/block", disk_name, "queue/rotational") - if not os.path.exists(filename): - # Should not happen unless sysfs changes, but better safe than sorry + with open(filename) as sysfile: + return sysfile.read() == "0\n" + except: return False - with open(filename) as sysfile: - return sysfile.read() == "0\n" - def get_mount_options(filesystem, mount_options, partition): """ diff --git a/src/modules/mount/mount.conf b/src/modules/mount/mount.conf index cff222b2d..70067d61b 100644 --- a/src/modules/mount/mount.conf +++ b/src/modules/mount/mount.conf @@ -5,16 +5,15 @@ # target as a usable chroot / "live" system). Filesystems are # automatically mounted from the partitioning module. Filesystems # listed here are **extra**. The filesystems listed in *extraMounts* -# are mounted in all target systems. The filesystems listed in -# *extraMountsEfi* are mounted in the target system **only** if -# the host machine uses UEFI. +# are mounted in all target systems. --- # Extra filesystems to mount. The key's value is a list of entries; each -# entry has four keys: +# entry has five keys: # - device The device node to mount # - fs (optional) The filesystem type to use # - mountPoint Where to mount the filesystem -# - options (optional) Extra options to pass to mount(8) +# - options (optional) An array of options to pass to mount +# - efi (optional) A boolean that when true is only mounted for UEFI installs # # The device is not mounted if the mountPoint is unset or if the fs is # set to unformatted. @@ -47,7 +46,7 @@ extraMounts: # It is possible to prevent subvolume creation -- this is likely only relevant # for the root (/) subvolume -- by giving an empty string as a subvolume # name. In this case no subvolume will be created. - +# btrfsSubvolumes: - mountPoint: / subvolume: /@ @@ -61,17 +60,63 @@ btrfsSubvolumes: - mountPoint: /var/log subvolume: /@log +# The name of the btrfs subvolume holding the swapfile. This only used when +# a swapfile is selected and the root filesystem is btrfs +# btrfsSwapSubvol: /@swap +# The mount options used to mount each filesystem. +# +# filsystem contains the name of the filesystem or on of three special +# values, "default", efi" and "btrfs_swap". The logic is applied in this manner: +# - If the partition is the EFI partition, the "efi" entry will be used +# - If the fs is btrfs and the subvolume is for the swapfile, +# the "btrfs_swap" entry is used +# - If the filesystem is an exact match for filesystem, that entry is used +# - If no match is found in the above, the default entry is used +# - If there is no match and no default entry, "defaults" is used +# - If the mountOptions key is not present, "defaults" is used +# +# Each filesystem entry contains 3 keys, all of which are optional +# options - An array of mount options that is used on all disk types +# ssdOptions - An array of mount options combined with options for ssds +# hddOptions - An array of mount options combined with options for hdds +# If combining these options results in an empty array, "defaults" is used +# +# Example 1 +# In this example, there are specific options for ext4 and btrfs filesystems, +# the EFI partition and the subvolume holding the btrfs swapfile. All other +# filesystems use the default entry. For the btrfs filesystem, there are +# additional options specific to hdds and ssds +# +# mountOptions: +# - filesystem: default +# options: [ defaults ] +# - filesystem: efi +# options: [ defaults, umask=0077 ] +# - filesystem: ext4 +# options: [ defaults, noatime ] +# - filesystem: btrfs +# options: [ defaults, noatime, compress=zstd:1 ] +# ssdOptions: [ discard=async ] +# hddOptions: [ autodefrag ] +# - filesystem: btrfs_swap +# options: [ defaults, noatime ] +# +# Example 2 +# In this example there is a single default used by all filesystems +# +# mountOptions: +# - filesystem: default +# options: [ defaults, noatime ] +# mountOptions: - filesystem: default options: [ defaults, noatime ] - filesystem: efi options: [ defaults, umask=0077 ] - filesystem: btrfs - options: [ defaults, noatime, compress ] - ssdOptions: [ discard=async ] - hddOptions: [ autodefrag ] + options: [ defaults, noatime, compress=lzo ] - filesystem: btrfs_swap options: [ defaults, noatime ] From 3e1bc6cb2290eba59ae8b78e16e0ff5741607daf Mon Sep 17 00:00:00 2001 From: dalto Date: Thu, 30 Dec 2021 09:36:54 -0600 Subject: [PATCH 039/160] [partition] Revert change to partition.conf --- src/modules/partition/partition.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 2cd7fb8ea..b03c855db 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -156,7 +156,7 @@ defaultFileSystemType: "ext4" # # If not specified at all, uses *defaultFileSystemType* without a # warning (this matches traditional no-choice-available behavior best). -availableFileSystemTypes: ["ext4","f2fs","btrfs"] +# availableFileSystemTypes: ["ext4","f2fs"] # Show/hide LUKS related functionality in automated partitioning modes. # Disable this if you choose not to deploy early unlocking support in GRUB2 From 5b483ab26f582bff358cd1ae65150f84059dfd0b Mon Sep 17 00:00:00 2001 From: dalto Date: Thu, 30 Dec 2021 10:01:03 -0600 Subject: [PATCH 040/160] [mount] Fix typo in mount.conf comments --- src/modules/mount/mount.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/mount/mount.conf b/src/modules/mount/mount.conf index 70067d61b..97e512846 100644 --- a/src/modules/mount/mount.conf +++ b/src/modules/mount/mount.conf @@ -67,7 +67,7 @@ btrfsSwapSubvol: /@swap # The mount options used to mount each filesystem. # -# filsystem contains the name of the filesystem or on of three special +# filesystem contains the name of the filesystem or on of three special # values, "default", efi" and "btrfs_swap". The logic is applied in this manner: # - If the partition is the EFI partition, the "efi" entry will be used # - If the fs is btrfs and the subvolume is for the swapfile, From a352bd946ee3b593816ede4abe2a31c187d993d6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 2 Feb 2022 15:02:58 +0100 Subject: [PATCH 041/160] [grubcfg] snake-case one configuration key This makes all the keys in grubcfg consistently snake-case (rather than one being a camel). --- src/modules/grubcfg/grubcfg.conf | 6 ++---- src/modules/grubcfg/grubcfg.schema.yaml | 3 +-- src/modules/grubcfg/main.py | 10 +++++----- src/modules/grubcfg/tests/2.job | 2 +- src/modules/grubcfg/tests/3.job | 2 +- src/modules/grubcfg/tests/4.job | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/modules/grubcfg/grubcfg.conf b/src/modules/grubcfg/grubcfg.conf index afc5e89b8..2d58e5dc2 100644 --- a/src/modules/grubcfg/grubcfg.conf +++ b/src/modules/grubcfg/grubcfg.conf @@ -9,7 +9,7 @@ # # Calculated values are: # - GRUB_DISTRIBUTOR, branding module, *bootloaderEntryName* (this -# string is sanitized, and see also setting *keepDistributor*) +# string is sanitized, and see also setting *keep_distributor*) # - GRUB_ENABLE_CRYPTODISK, based on the presence of filesystems # that use LUKS # - GRUB_CMDLINE_LINUX_DEFAULT, adding LUKS setup and plymouth @@ -29,9 +29,7 @@ prefer_grub_d: false # kept, not updated to the *bootloaderEntryName* from the branding file. # Use this if the GRUB_DISTRIBUTOR setting in the file is "smart" in # some way (e.g. uses shell-command substitution). -# -# TODO:3.3:snake-case this key -keepDistributor: false +keep_distributor: false # The default kernel params that should always be applied. # This is an array of strings. If it is unset, the default is diff --git a/src/modules/grubcfg/grubcfg.schema.yaml b/src/modules/grubcfg/grubcfg.schema.yaml index 35d63c063..f10b03a83 100644 --- a/src/modules/grubcfg/grubcfg.schema.yaml +++ b/src/modules/grubcfg/grubcfg.schema.yaml @@ -7,8 +7,7 @@ additionalProperties: false type: object properties: overwrite: { type: boolean, default: false } - # TODO:3.3:snake-case this key - keepDistributor: { type: boolean, default: false } + keep_istributor: { type: boolean, default: false } prefer_grub_d: { type: boolean, default: false } kernel_params: { type: array, items: { type: string } } defaults: diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py index d7e581da6..b992629dd 100644 --- a/src/modules/grubcfg/main.py +++ b/src/modules/grubcfg/main.py @@ -95,10 +95,10 @@ def modify_grub_default(partitions, root_mount_point, distributor): :param root_mount_point: :param distributor: name of the distributor to fill in for GRUB_DISTRIBUTOR. Must be a string. If the job setting - *keepDistributor* is set, then this is only used if no - GRUB_DISTRIBUTOR is found at all (otherwise, when *keepDistributor* + *keep_distributor* is set, then this is only used if no + GRUB_DISTRIBUTOR is found at all (otherwise, when *keep_distributor* is set, the GRUB_DISTRIBUTOR lines are left unchanged). - If *keepDistributor* is unset or false, then GRUB_DISTRIBUTOR + If *keep_distributor* is unset or false, then GRUB_DISTRIBUTOR is always updated to set this value. :return: """ @@ -230,11 +230,11 @@ def modify_grub_default(partitions, root_mount_point, distributor): have_kernel_cmd = True elif (lines[i].startswith("#GRUB_DISTRIBUTOR") or lines[i].startswith("GRUB_DISTRIBUTOR")): - if libcalamares.job.configuration.get("keepDistributor", False): + if libcalamares.job.configuration.get("keep_distributor", False): lines[i] = distributor_line have_distributor_line = True else: - # We're not updating because of *keepDistributor*, but if + # We're not updating because of *keep_distributor*, but if # this was a comment line, then it's still not been set. have_distributor_line = have_distributor_line or not lines[i].startswith("#") # If btrfs or f2fs is used, don't save default diff --git a/src/modules/grubcfg/tests/2.job b/src/modules/grubcfg/tests/2.job index 92e598394..5265ef5c8 100644 --- a/src/modules/grubcfg/tests/2.job +++ b/src/modules/grubcfg/tests/2.job @@ -2,7 +2,7 @@ # SPDX-License-Identifier: CC0-1.0 --- overwrite: true -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved" diff --git a/src/modules/grubcfg/tests/3.job b/src/modules/grubcfg/tests/3.job index 7d579839c..94f394373 100644 --- a/src/modules/grubcfg/tests/3.job +++ b/src/modules/grubcfg/tests/3.job @@ -3,7 +3,7 @@ --- overwrite: true prefer_grub_d: true # But it doesn't exist -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved" diff --git a/src/modules/grubcfg/tests/4.job b/src/modules/grubcfg/tests/4.job index 58fd8bcb7..4fdc2e25c 100644 --- a/src/modules/grubcfg/tests/4.job +++ b/src/modules/grubcfg/tests/4.job @@ -3,7 +3,7 @@ --- overwrite: true prefer_grub_d: true -keepDistributor: false +keep_distributor: false defaults: GRUB_TIMEOUT: 5 GRUB_DEFAULT: "saved" From 0c7f06137add31f598d01ba7de468d97a04719af Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 2 Feb 2022 15:57:49 +0100 Subject: [PATCH 042/160] CMake: validate all the test-configurations as well --- CHANGES-3.3 | 7 +++++++ src/modules/CMakeLists.txt | 29 +++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index 79957dec9..f02f5cd81 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -13,6 +13,11 @@ This release contains contributions from (alphabetically by first name): - Evan James - Vitor Lopes +This is a "minor" version change, but the size of the changes is very +large. Configuration files from previous versions of Calamares will +**certainly** need to be re-validated. Take heed of the many changes +in the *Modules* heading, below. + ## Core ## - CMake 3.16, Qt 5.15 are now required; the newer CMake is to support new features (also for KDE Frameworks), Qt is the current LTS version. @@ -27,5 +32,7 @@ This release contains contributions from (alphabetically by first name): Boost::Python now requires 1.67 or later (for CMake support). ## Modules ## + - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. + Please update configurations. - *bootloader* now supports more options when building the kernel command-line. (Thanks Evan) diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 03384105e..dfb99a068 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -32,12 +32,29 @@ if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EX # regardless. foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml" ) - set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) - if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" ) - add_test( - NAME validate-${SUBDIRECTORY} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" - ) + # Collect config files from the module-directory and from a tests/ subdir, + # using the same mechanism to find those test-config-files as function + # calamares_add_module_subdirectory() would do. + set( _conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) + set( _count 1 ) + set( _testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests" ) + while ( EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job" ) + if ( EXISTS "${_testdir}/${_count}.job" ) + list( APPEND _conf_files "${_testdir}/${_count}.job" ) + endif() + math( EXPR _count "${_count} + 1" ) + endwhile() + + if ( EXISTS "${_schema_file}" ) + foreach( _conf_file ${_conf_files} ) + if ( EXISTS ${_conf_file} ) + get_filename_component( _conf_base "${_conf_file}" NAME_WE ) + add_test( + NAME validate-${SUBDIRECTORY}-${_conf_base} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + ) + endif() + endforeach() endif() endforeach() endif() From 2bf43ffbf2fd3fe8dac448a130d5144c30153849 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 2 Feb 2022 16:19:51 +0100 Subject: [PATCH 043/160] [unpackfs] Fix test validation (and document what the test is for) --- src/modules/unpackfs/tests/4.job | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/unpackfs/tests/4.job b/src/modules/unpackfs/tests/4.job index 8bc7de5ba..e6b067ddb 100644 --- a/src/modules/unpackfs/tests/4.job +++ b/src/modules/unpackfs/tests/4.job @@ -1,6 +1,10 @@ # SPDX-FileCopyrightText: no # SPDX-License-Identifier: CC0-1.0 +# +# Test that a "bogus" sourcefs (a filesystem kind that does not +# exist) fails gracefully. --- unpack: - source: . sourcefs: bogus + destination: / From 5160fdc26a3ef7d065e6f01c771cc6431b3a2ff8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 15:50:17 +0100 Subject: [PATCH 044/160] [libcalamares] Port away from KPluginFactory --- src/libcalamares/utils/PluginFactory.h | 111 ++++++++++++++----------- 1 file changed, 63 insertions(+), 48 deletions(-) diff --git a/src/libcalamares/utils/PluginFactory.h b/src/libcalamares/utils/PluginFactory.h index a3371dd72..8e841f5e7 100644 --- a/src/libcalamares/utils/PluginFactory.h +++ b/src/libcalamares/utils/PluginFactory.h @@ -4,10 +4,6 @@ * SPDX-FileCopyrightText: 2017-2018 Adriaan de Groot * SPDX-License-Identifier: GPL-3.0-or-later * - * Based on KPluginFactory from KCoreAddons, KDE project - * SPDX-FileCopyrightText: 2007 Matthias Kretz - * SPDX-FileCopyrightText: 2007 Bernhard Loos - * * Calamares is Free Software: see the License-Identifier above. * * @@ -16,81 +12,100 @@ #ifndef UTILS_PLUGINFACTORY_H #define UTILS_PLUGINFACTORY_H -#include +#include #define CalamaresPluginFactory_iid "io.calamares.PluginFactory" /** @brief Plugin factory for Calamares * - * Try to re-use KPluginFactory as much as possible (since the - * old code for PluginFactory was a fork of an old version of - * exactly that). + * A Calamares plugin contains just one kind of plugin -- either + * a job, or a viewstep -- so the factory is straightforward. + * It gets a single CreateInstanceFunction and calls that; + * the function is set when registerPlugin() is called in a subclass. * - * The current createInstance() method passes more arguments - * to the job and viewstep constructors than we want; chasing - * that change means modifying each Calamares module. This class - * implements a version of createInstance() with fewer arguments - * and overloads registerPlugin() to use that. */ -class CalamaresPluginFactory : public KPluginFactory +class CalamaresPluginFactory : public QObject { Q_OBJECT public: - explicit CalamaresPluginFactory() - : KPluginFactory() - { - } + explicit CalamaresPluginFactory() {} ~CalamaresPluginFactory() override; - /** @brief Create an object from the factory. - * - * Ignores all the @p args since they are not used. Calls - * Calamares constructors for the Jobs and ViewSteps. - */ - template < class impl, class ParentType > - static QObject* createInstance( QWidget* parentWidget, QObject* parent, const QVariantList& args ) + typedef QObject* ( *CreateInstanceFunction )( QObject* ); + + template < class T > + T* create( QObject* parent = nullptr ) { - Q_UNUSED( parentWidget ) - Q_UNUSED( args ) - ParentType* p = nullptr; - if ( parent ) + auto* op = fn ? fn( parent ) : nullptr; + if ( !op ) { - p = qobject_cast< ParentType* >( parent ); - Q_ASSERT( p ); + return nullptr; } - return new impl( p ); + T* tp = qobject_cast< T* >( op ); + if ( !tp ) + { + delete op; + } + return tp; } - /** @brief register a plugin - * - * The Calamares version doesn't accept keywords, and uses - * the Calamares createInstance() version which ignores - * the QVariantList of arguments. - */ - template < class T > - void registerPlugin() - { - KPluginFactory::registerPlugin< T >( QString(), &createInstance< T, QObject > ); - } +protected: + CreateInstanceFunction fn = nullptr; }; /** @brief declare a Calamares Plugin Factory * - * This would be defined as K_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY, - * except that does not actually use the base factory class that is - * passed in. + * There should be one declaration -- generally alongside the + * class definition for the Job or ViewStep that the plugin is + * going to provide, in the header -- and one definition -- in + * the corresponding implementation. */ #define CALAMARES_PLUGIN_FACTORY_DECLARATION( name ) \ class name : public CalamaresPluginFactory \ { \ Q_OBJECT \ - Q_INTERFACES( KPluginFactory ) \ + Q_INTERFACES( CalamaresPluginFactory ) \ Q_PLUGIN_METADATA( IID CalamaresPluginFactory_iid ) \ public: \ explicit name(); \ ~name() override; \ + template < class T > \ + static QObject* createInstance( QObject* parent ) \ + { \ + return new T( parent ); \ + } \ + template < class T > \ + void registerPlugin() \ + { \ + fn = createInstance< T >; \ + } \ }; + +/** @brief Define a Calamares Plugin Factory + * + * This should be done exactly once, generally in the translation + * unit containing the definitions for the main class of the plugin, + * either the Job or the ViewStep definitions. + * + * The @p name must match the name used in the declaration, while + * @p pluginRegistrations should be a single call to `registerPlugin()` + * where `T` is the type (subclass of Job or ViewStep) defined by the + * plugin, eg. + * + * ``` + * CALAMARES_PLUGIN_FACTORY_DEFINITION( MyPlugin, registerPlugin() ) + * ``` + * + * Leaving out the `()` will lead to generally-weird compiler warnings. + */ #define CALAMARES_PLUGIN_FACTORY_DEFINITION( name, pluginRegistrations ) \ - K_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY( name, CalamaresPluginFactory, pluginRegistrations ) + name::name() \ + : CalamaresPluginFactory() \ + { \ + pluginRegistrations; \ + } \ + name::~name() {} + +Q_DECLARE_INTERFACE( CalamaresPluginFactory, CalamaresPluginFactory_iid ) #endif From e507a23795cf7136bdee6261170897b69d6fbc98 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:12:25 +0100 Subject: [PATCH 045/160] Modules: make use of KF5::CoreAddons explicit --- src/modules/hostinfo/CMakeLists.txt | 16 +++++----------- src/modules/netinstall/CMakeLists.txt | 21 ++++++++------------- src/modules/tracking/CMakeLists.txt | 11 ++++------- 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/modules/hostinfo/CMakeLists.txt b/src/modules/hostinfo/CMakeLists.txt index 55be66f81..af1b3ff45 100644 --- a/src/modules/hostinfo/CMakeLists.txt +++ b/src/modules/hostinfo/CMakeLists.txt @@ -23,7 +23,7 @@ # - *hostCPU* the make (brand) of the CPU, if it can be determined. # Values are "Intel" or "AMD" or blank. -calamares_add_plugin( hostinfo +calamares_add_plugin(hostinfo TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -32,15 +32,9 @@ calamares_add_plugin( hostinfo NO_CONFIG ) -if ( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 ) - target_compile_definitions( calamares_job_hostinfo PRIVATE WITH_KOSRelease ) +if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58) + target_compile_definitions(calamares_job_hostinfo PRIVATE WITH_KOSRelease) + target_link_libraries(calamares_job_hostinfo PRIVATE KF5::CoreAddons) endif() -calamares_add_test( - hostinfotest - SOURCES - Tests.cpp - HostInfoJob.cpp - LIBRARIES - yamlcpp::yamlcpp -) +calamares_add_test(hostinfotest SOURCES Tests.cpp HostInfoJob.cpp LIBRARIES yamlcpp::yamlcpp) diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt index f31ac6d79..d50eab7b2 100644 --- a/src/modules/netinstall/CMakeLists.txt +++ b/src/modules/netinstall/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( netinstall +calamares_add_plugin(netinstall TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -20,15 +20,10 @@ calamares_add_plugin( netinstall SHARED_LIB ) -calamares_add_test( - netinstalltest - SOURCES - Tests.cpp - Config.cpp - LoaderQueue.cpp - PackageTreeItem.cpp - PackageModel.cpp - LIBRARIES - Qt5::Gui -) - +if(KF5CoreAddons_FOUND) + calamares_add_test( + netinstalltest + SOURCES Tests.cpp Config.cpp LoaderQueue.cpp PackageTreeItem.cpp PackageModel.cpp + LIBRARIES Qt5::Gui KF5::CoreAddons + ) +endif() diff --git a/src/modules/tracking/CMakeLists.txt b/src/modules/tracking/CMakeLists.txt index a878961b0..0dbbeb942 100644 --- a/src/modules/tracking/CMakeLists.txt +++ b/src/modules/tracking/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( tracking +calamares_add_plugin(tracking TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -16,11 +16,8 @@ calamares_add_plugin( tracking RESOURCES page_trackingstep.qrc SHARED_LIB + LINK_LIBRARIES + KF5::CoreAddons ) -calamares_add_test( - trackingtest - SOURCES - Tests.cpp - Config.cpp -) +calamares_add_test(trackingtest SOURCES Tests.cpp Config.cpp) From b167d8da03e404ec5b54a18aa31942f20ec9dd1d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:13:40 +0100 Subject: [PATCH 046/160] [libcalamares,ui] Make KF5::CoreAddons explicit - libcalamares doesn't need it anymore, because it ported away from KPluginLoader, - libcalamaresui does need it, because of KMacroExpander. --- src/libcalamares/CMakeLists.txt | 246 ++++++++++++------------------ src/libcalamaresui/CMakeLists.txt | 57 +++---- 2 files changed, 119 insertions(+), 184 deletions(-) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 2cf0342ec..407dc5f61 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -10,20 +10,17 @@ # (non-GUI) jobs. # -add_definitions( -DDLLEXPORT_PRO ) -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) +add_definitions(-DDLLEXPORT_PRO) +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in - ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in - ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in - ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h ) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h) -set( OPTIONAL_PRIVATE_LIBRARIES "" ) -set( OPTIONAL_PUBLIC_LIBRARIES "" ) +set(OPTIONAL_PRIVATE_LIBRARIES "") +set(OPTIONAL_PUBLIC_LIBRARIES "") -set( libSources +set(libSources CppJob.cpp GlobalStorage.cpp Job.cpp @@ -31,13 +28,11 @@ set( libSources JobQueue.cpp ProcessJob.cpp Settings.cpp - # GeoIP services geoip/Interface.cpp geoip/GeoIPFixed.cpp geoip/GeoIPJSON.cpp geoip/Handler.cpp - # Locale-data service locale/Global.cpp locale/Lookup.cpp @@ -46,7 +41,6 @@ set( libSources locale/TranslatableString.cpp locale/Translation.cpp locale/TranslationsModel.cpp - # Modules modulesystem/Config.cpp modulesystem/Descriptor.cpp @@ -55,19 +49,15 @@ set( libSources modulesystem/Preset.cpp modulesystem/RequirementsChecker.cpp modulesystem/RequirementsModel.cpp - # Network service network/Manager.cpp - # Packages service packages/Globals.cpp - # Partition service partition/Global.cpp partition/Mount.cpp partition/PartitionSize.cpp partition/Sync.cpp - # Utility service utils/CalamaresUtilsSystem.cpp utils/CommandList.cpp @@ -87,20 +77,16 @@ set( libSources ### OPTIONAL Automount support (requires dbus) # # -if( Qt5DBus_FOUND) - list( APPEND libSources partition/AutoMount.cpp ) - list( APPEND OPTIONAL_PRIVATE_LIBRARIES Qt5::DBus ) +if(Qt5DBus_FOUND) + list(APPEND libSources partition/AutoMount.cpp) + list(APPEND OPTIONAL_PRIVATE_LIBRARIES Qt5::DBus) endif() ### OPTIONAL Python support # # -if( WITH_PYTHON ) - list( APPEND libSources - PythonHelper.cpp - PythonJob.cpp - PythonJobApi.cpp - ) +if(WITH_PYTHON) + list(APPEND libSources PythonHelper.cpp PythonJob.cpp PythonJobApi.cpp) include_directories(${PYTHON_INCLUDE_DIRS}) link_directories(${PYTHON_LIBRARIES}) @@ -108,48 +94,48 @@ if( WITH_PYTHON ) include_directories(${Boost_INCLUDE_DIRS}) link_directories(${Boost_LIBRARY_DIRS}) - list( APPEND OPTIONAL_PRIVATE_LIBRARIES - ${PYTHON_LIBRARIES} - ${Boost_LIBRARIES} - ) + list(APPEND OPTIONAL_PRIVATE_LIBRARIES ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) endif() ### OPTIONAL GeoIP XML support # # find_package(Qt5 COMPONENTS Xml) -if( Qt5Xml_FOUND ) - list( APPEND libSources geoip/GeoIPXML.cpp ) - list( APPEND OPTIONAL_PUBLIC_LIBRARIES Qt5::Network Qt5::Xml ) +if(Qt5Xml_FOUND) + list(APPEND libSources geoip/GeoIPXML.cpp) + list(APPEND OPTIONAL_PUBLIC_LIBRARIES Qt5::Network Qt5::Xml) endif() ### OPTIONAL KPMcore support # # -include( KPMcoreHelper ) +include(KPMcoreHelper) -if ( KPMcore_FOUND ) - find_package( Qt5 REQUIRED DBus ) # Needed for KPMCore - find_package( KF5 REQUIRED I18n WidgetsAddons ) # Needed for KPMCore +if(KPMcore_FOUND) + find_package(Qt5 REQUIRED DBus) # Needed for KPMCore + find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore - foreach ( d ${KPMcore_API_DEFINITIONS} ) - add_definitions( -D${d} ) + foreach(d ${KPMcore_API_DEFINITIONS}) + add_definitions(-D${d}) endforeach() - include_directories( ${KPMCORE_INCLUDE_DIR} ) - list( APPEND libSources + include_directories(${KPMCORE_INCLUDE_DIR}) + list( + APPEND + libSources partition/FileSystem.cpp partition/KPMManager.cpp partition/PartitionIterator.cpp partition/PartitionQuery.cpp ) - list( APPEND OPTIONAL_PRIVATE_LIBRARIES kpmcore ) + list(APPEND OPTIONAL_PRIVATE_LIBRARIES kpmcore) endif() ### LIBRARY # # -add_library( calamares SHARED ${libSources} ) -set_target_properties( calamares +add_library(calamares SHARED ${libSources}) +set_target_properties( + calamares PROPERTIES VERSION ${CALAMARES_VERSION_SHORT} SOVERSION ${CALAMARES_VERSION_SHORT} @@ -157,14 +143,10 @@ set_target_properties( calamares ) calamares_automoc( calamares ) -target_link_libraries( calamares - LINK_PRIVATE - ${OPTIONAL_PRIVATE_LIBRARIES} - LINK_PUBLIC - yamlcpp::yamlcpp - Qt5::Core - KF5::CoreAddons - ${OPTIONAL_PUBLIC_LIBRARIES} +target_link_libraries( + calamares + LINK_PRIVATE ${OPTIONAL_PRIVATE_LIBRARIES} + LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core ${OPTIONAL_PUBLIC_LIBRARIES} ) add_library(Calamares::calamares ALIAS calamares) @@ -172,155 +154,129 @@ add_library(Calamares::calamares ALIAS calamares) ### Installation # # -install( TARGETS calamares +install( + TARGETS calamares EXPORT Calamares - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME + DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR} ) # Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so # lib/calamares can be used as module path for the Python interpreter. -install( CODE " +install( + CODE + " file( MAKE_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" ) execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ../libcalamares.so.${CALAMARES_VERSION_SHORT} libcalamares.so WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" ) -") +" +) # Install header files -file( GLOB rootHeaders "*.h" ) +file(GLOB rootHeaders "*.h") install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h - ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h - ${rootHeaders} + FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h ${rootHeaders} DESTINATION include/libcalamares ) # Install each subdir-worth of header files -foreach( subdir geoip locale modulesystem network partition utils ) - file( GLOB subdir_headers "${subdir}/*.h" ) - install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} ) +foreach(subdir geoip locale modulesystem network partition utils) + file(GLOB subdir_headers "${subdir}/*.h") + install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir}) endforeach() - ### TESTING # # -calamares_add_test( - libcalamarestest - SOURCES - Tests.cpp -) +calamares_add_test(libcalamarestest SOURCES Tests.cpp) -calamares_add_test( - libcalamaresgeoiptest - SOURCES - geoip/GeoIPTests.cpp - ${geoip_src} -) +calamares_add_test(libcalamaresgeoiptest SOURCES geoip/GeoIPTests.cpp ${geoip_src}) -function ( calamares_qrc_translations basename ) - set( NAME ${ARGV0} ) - set( options "" ) - set( oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE ) - set( multiValueArgs LANGUAGES ) - cmake_parse_arguments( _qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +function(calamares_qrc_translations basename) + set(NAME ${ARGV0}) + set(options "") + set(oneValueArgs SUBDIRECTORY OUTPUT_VARIABLE) + set(multiValueArgs LANGUAGES) + cmake_parse_arguments(_qrt "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - if( NOT _qrt_OUTPUT_VARIABLE ) - set( _qrt_OUTPUT_VARIABLE "qrc_translations_${basename}" ) + if(NOT _qrt_OUTPUT_VARIABLE) + set(_qrt_OUTPUT_VARIABLE "qrc_translations_${basename}") endif() - set( translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc ) - set( translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx ) + set(translations_qrc_infile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.qrc) + set(translations_qrc_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${basename}.cxx) # Must use this variable name because of the @ substitution - set( calamares_i18n_qrc_content "" ) - set( calamares_i18n_ts_filelist "" ) - foreach( lang ${_qrt_LANGUAGES} ) - string( APPEND calamares_i18n_qrc_content "${basename}_${lang}.qm" ) - list( APPEND calamares_i18n_ts_filelist "${CMAKE_CURRENT_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${basename}_${lang}.ts" ) + set(calamares_i18n_qrc_content "") + set(calamares_i18n_ts_filelist "") + foreach(lang ${_qrt_LANGUAGES}) + string(APPEND calamares_i18n_qrc_content "${basename}_${lang}.qm") + list( + APPEND + calamares_i18n_ts_filelist + "${CMAKE_CURRENT_SOURCE_DIR}/${_qrt_SUBDIRECTORY}/${basename}_${lang}.ts" + ) endforeach() - configure_file( ${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY ) + configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY) qt5_add_translation(QM_FILES ${calamares_i18n_ts_filelist}) # Run the resource compiler (rcc_options should already be set) add_custom_command( OUTPUT ${translations_qrc_outfile} COMMAND "${Qt5Core_RCC_EXECUTABLE}" - ARGS ${rcc_options} --format-version 1 -name ${basename} -o ${translations_qrc_outfile} ${translations_qrc_infile} + ARGS + ${rcc_options} + --format-version + 1 + -name + ${basename} + -o + ${translations_qrc_outfile} + ${translations_qrc_infile} MAIN_DEPENDENCY ${translations_qrc_infile} DEPENDS ${QM_FILES} ) - set( ${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE ) + set(${_qrt_OUTPUT_VARIABLE} ${translations_qrc_outfile} PARENT_SCOPE) endfunction() calamares_qrc_translations( localetest OUTPUT_VARIABLE localetest_qrc SUBDIRECTORY testdata LANGUAGES nl ) -calamares_add_test( - libcalamareslocaletest - SOURCES - locale/Tests.cpp - ${localetest_qrc} -) +calamares_add_test(libcalamareslocaletest SOURCES locale/Tests.cpp ${localetest_qrc}) -calamares_add_test( - libcalamaresmodulesystemtest - SOURCES - modulesystem/Tests.cpp -) +calamares_add_test(libcalamaresmodulesystemtest SOURCES modulesystem/Tests.cpp) -calamares_add_test( - libcalamaresnetworktest - SOURCES - network/Tests.cpp -) +calamares_add_test(libcalamaresnetworktest SOURCES network/Tests.cpp) -calamares_add_test( - libcalamarespackagestest - SOURCES - packages/Tests.cpp -) +calamares_add_test(libcalamarespackagestest SOURCES packages/Tests.cpp) calamares_add_test( libcalamarespartitiontest - SOURCES - partition/Global.cpp - partition/Tests.cpp - LIBRARIES - ${OPTIONAL_PRIVATE_LIBRARIES} + SOURCES partition/Global.cpp partition/Tests.cpp + LIBRARIES ${OPTIONAL_PRIVATE_LIBRARIES} ) -if( KPMcore_FOUND ) +if(KPMcore_FOUND) calamares_add_test( libcalamarespartitionkpmtest - SOURCES - partition/KPMTests.cpp - LIBRARIES - ${OPTIONAL_PRIVATE_LIBRARIES} + SOURCES partition/KPMTests.cpp + LIBRARIES ${OPTIONAL_PRIVATE_LIBRARIES} ) endif() -calamares_add_test( - libcalamaresutilstest - SOURCES - utils/Tests.cpp - utils/Runner.cpp -) - -calamares_add_test( - libcalamaresutilspathstest - SOURCES - utils/TestPaths.cpp -) +calamares_add_test(libcalamaresutilstest SOURCES utils/Tests.cpp utils/Runner.cpp) +calamares_add_test(libcalamaresutilspathstest SOURCES utils/TestPaths.cpp) # This is not an actual test, it's a test / demo application # for experimenting with GeoIP. -add_executable( test_geoip geoip/test_geoip.cpp ${geoip_src} ) -target_link_libraries( test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp ) +add_executable(test_geoip geoip/test_geoip.cpp ${geoip_src}) +target_link_libraries(test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp) calamares_automoc( test_geoip ) -if ( Qt5DBus_FOUND ) - add_executable( test_automount partition/calautomount.cpp ) - target_link_libraries( test_automount Calamares::calamares Qt5::DBus ) +if(Qt5DBus_FOUND) + add_executable(test_automount partition/calautomount.cpp) + target_link_libraries(test_automount Calamares::calamares Qt5::DBus) endif() diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index e3a7c2949..b798fc1ac 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -8,24 +8,21 @@ # view modules, view steps, widgets, and branding. # The UI libs use the non-UI library -include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/src/libcalamares ${CMAKE_SOURCE_DIR} ) +include_directories(${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/src/libcalamares ${CMAKE_SOURCE_DIR}) -set( calamaresui_SOURCES +set(calamaresui_SOURCES modulesystem/CppJobModule.cpp modulesystem/ModuleFactory.cpp modulesystem/ModuleManager.cpp modulesystem/ProcessJobModule.cpp modulesystem/ViewModule.cpp - utils/CalamaresUtilsGui.cpp utils/ImageRegistry.cpp utils/Paste.cpp - viewpages/BlankViewStep.cpp viewpages/ExecutionViewStep.cpp viewpages/Slideshow.cpp viewpages/ViewStep.cpp - widgets/ClickableLabel.cpp widgets/ErrorDialog.cpp widgets/FixedAspectRatioLabel.cpp @@ -33,7 +30,6 @@ set( calamaresui_SOURCES widgets/TranslationFix.cpp widgets/WaitingWidget.cpp ${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp - Branding.cpp ViewManager.cpp ) @@ -43,20 +39,15 @@ mark_thirdparty_code( ${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp ) -if( WITH_PYTHON ) - list( APPEND calamaresui_SOURCES - modulesystem/PythonJobModule.cpp - ) +if(WITH_PYTHON) + list(APPEND calamaresui_SOURCES modulesystem/PythonJobModule.cpp) endif() -if( WITH_QML ) - list( APPEND calamaresui_SOURCES - utils/Qml.cpp - viewpages/QmlViewStep.cpp - ) +if(WITH_QML) + list(APPEND calamaresui_SOURCES utils/Qml.cpp viewpages/QmlViewStep.cpp) endif() -calamares_add_library( calamaresui +calamares_add_library(calamaresui SOURCES ${calamaresui_SOURCES} EXPORT_MACRO UIDLLEXPORT_PRO LINK_LIBRARIES @@ -67,17 +58,17 @@ calamares_add_library( calamaresui utils/ErrorDialog/ErrorDialog.ui VERSION ${CALAMARES_VERSION_SHORT} ) -target_link_libraries( calamaresui PRIVATE yamlcpp::yamlcpp ) -if( KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58 ) - target_compile_definitions( calamaresui PRIVATE WITH_KOSRelease ) +target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp) +if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58) + target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease) + target_link_libraries(calamaresui PRIVATE KF5::CoreAddons) endif() -if( WITH_QML ) - target_link_libraries( calamaresui PUBLIC Qt5::QuickWidgets ) +if(WITH_QML) + target_link_libraries(calamaresui PUBLIC Qt5::QuickWidgets) endif() add_library(Calamares::calamaresui ALIAS calamaresui) - ### Installation # # @@ -86,24 +77,12 @@ add_library(Calamares::calamaresui ALIAS calamaresui) # where libcalamares and libcalamaresui live in different branches, # we're going to glom it all together in the installed headers location. -install( - FILES - Branding.h - ViewManager.h - DESTINATION include/libcalamares -) +install(FILES Branding.h ViewManager.h DESTINATION include/libcalamares) # Install each subdir-worth of header files -foreach( subdir modulesystem utils viewpages widgets ) - file( GLOB subdir_headers "${subdir}/*.h" ) - install( FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir} ) +foreach(subdir modulesystem utils viewpages widgets) + file(GLOB subdir_headers "${subdir}/*.h") + install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir}) endforeach() -calamares_add_test( - test_libcalamaresuipaste - SOURCES - utils/TestPaste.cpp - utils/Paste.cpp - LIBRARIES - calamaresui -) +calamares_add_test(test_libcalamaresuipaste SOURCES utils/TestPaste.cpp utils/Paste.cpp LIBRARIES calamaresui) From cf097850decb4574ebe0e87421de34f41bfc46cb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:18:47 +0100 Subject: [PATCH 047/160] CMake: apply gersemi styling --- CMakeLists.txt | 537 ++++++++++-------- lang/CMakeLists.txt | 30 +- src/CMakeLists.txt | 24 +- src/calamares/CMakeLists.txt | 54 +- src/modules/CMakeLists.txt | 43 +- src/modules/contextualprocess/CMakeLists.txt | 7 +- src/modules/dracutlukscfg/CMakeLists.txt | 2 +- src/modules/dummycpp/CMakeLists.txt | 2 +- src/modules/finished/CMakeLists.txt | 6 +- src/modules/finishedq/CMakeLists.txt | 12 +- src/modules/fsresizer/CMakeLists.txt | 21 +- src/modules/grubcfg/tests/CMakeTests.txt | 10 +- src/modules/initcpio/CMakeLists.txt | 5 +- src/modules/initramfs/CMakeLists.txt | 5 +- .../interactiveterminal/CMakeLists.txt | 20 +- src/modules/keyboard/CMakeLists.txt | 11 +- src/modules/keyboardq/CMakeLists.txt | 8 +- src/modules/license/CMakeLists.txt | 4 +- src/modules/locale/CMakeLists.txt | 24 +- src/modules/localeq/CMakeLists.txt | 24 +- src/modules/luksbootkeyfile/CMakeLists.txt | 2 +- .../luksopenswaphookcfg/CMakeLists.txt | 9 +- src/modules/machineid/CMakeLists.txt | 10 +- src/modules/notesqml/CMakeLists.txt | 4 +- src/modules/oemid/CMakeLists.txt | 2 +- src/modules/packagechooser/CMakeLists.txt | 42 +- src/modules/packagechooserq/CMakeLists.txt | 39 +- src/modules/packages/tests/CMakeTests.txt | 24 +- src/modules/partition/CMakeLists.txt | 45 +- src/modules/partition/tests/CMakeLists.txt | 30 +- src/modules/plasmalnf/CMakeLists.txt | 29 +- src/modules/preservefiles/CMakeLists.txt | 9 +- src/modules/removeuser/CMakeLists.txt | 2 +- src/modules/shellprocess/CMakeLists.txt | 10 +- src/modules/summary/CMakeLists.txt | 4 +- src/modules/summaryq/CMakeLists.txt | 8 +- src/modules/umount/CMakeLists.txt | 8 +- src/modules/users/CMakeLists.txt | 69 +-- src/modules/usersq/CMakeLists.txt | 42 +- src/modules/webview/CMakeLists.txt | 55 +- src/modules/welcome/CMakeLists.txt | 31 +- src/modules/welcomeq/CMakeLists.txt | 29 +- src/modules/zfs/CMakeLists.txt | 3 +- src/qml/calamares/CMakeLists.txt | 34 +- 44 files changed, 649 insertions(+), 740 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dde16b77d..6a67c4fcc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,43 +41,39 @@ # One special target is "show-version", which can be built # to obtain the version number from here. -cmake_minimum_required( VERSION 3.16 FATAL_ERROR ) +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) -set( CALAMARES_VERSION 3.3.0 ) -set( CALAMARES_RELEASE_MODE OFF ) # Set to ON during a release +set(CALAMARES_VERSION 3.3.0) +set(CALAMARES_RELEASE_MODE OFF) # Set to ON during a release -if ( CMAKE_SCRIPT_MODE_FILE ) - include( ${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake ) - set( CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} ) +if(CMAKE_SCRIPT_MODE_FILE) + include(${CMAKE_CURRENT_LIST_DIR}/CMakeModules/ExtendedVersion.cmake) + set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) extend_version( ${CALAMARES_VERSION} OFF _vshort _vlong ) - message( "${_vlong}" ) + message("${_vlong}") return() endif() -project( CALAMARES - VERSION ${CALAMARES_VERSION} - LANGUAGES C CXX -) +project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX) -if( CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) - message( FATAL_ERROR "Do not build development versions in the source-directory." ) +if(CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) + message(FATAL_ERROR "Do not build development versions in the source-directory.") endif() ### OPTIONS # -option( INSTALL_CONFIG "Install configuration files" OFF ) -option( INSTALL_POLKIT "Install Polkit configuration" ON ) -option( INSTALL_COMPLETION "Install shell completions" OFF ) +option(INSTALL_CONFIG "Install configuration files" OFF) +option(INSTALL_POLKIT "Install Polkit configuration" ON) +option(INSTALL_COMPLETION "Install shell completions" OFF) # When adding WITH_* that affects the ABI offered by libcalamares, # also update libcalamares/CalamaresConfig.h.in -option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) -option( WITH_QML "Enable QML UI options." ON ) +option(WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON) +option(WITH_QML "Enable QML UI options." ON) # # Additional parts to build that do not affect ABI -option( BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON ) +option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON) # Options for the calamares executable -option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) - +option(BUILD_KF5Crash "Enable crash reporting with KCrash." ON) # Possible debugging flags are: # - DEBUG_TIMEZONES draws latitude and longitude lines on the timezone @@ -88,7 +84,6 @@ option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) # - DEBUG_PARTITION_UNSAFE (see partition/CMakeLists.txt) # - DEBUG_PARTITION_LAME (see partition/CMakeLists.txt) - ### USE_* # # By convention, when there are multiple modules that implement similar @@ -112,15 +107,14 @@ option( BUILD_KF5Crash "Enable crash reporting with KCrash." ON ) # - *services* picks one of the two service-configuration modules, # for either systemd or openrc. This defaults to empty so that # **both** modules are available. -set( USE_services "" CACHE STRING "Select the services module to use" ) +set(USE_services "" CACHE STRING "Select the services module to use") ### Calamares application info # -set( CALAMARES_ORGANIZATION_NAME "Calamares" ) -set( CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares" ) -set( CALAMARES_APPLICATION_NAME "Calamares" ) -set( CALAMARES_DESCRIPTION_SUMMARY - "The distribution-independent installer framework" ) +set(CALAMARES_ORGANIZATION_NAME "Calamares") +set(CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares") +set(CALAMARES_APPLICATION_NAME "Calamares") +set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framework") ### Transifex (languages) info # @@ -147,40 +141,114 @@ set( CALAMARES_DESCRIPTION_SUMMARY # `txstats.py -e`. See also # # Total 74 languages -set( _tx_complete az az_AZ ca de fa fi_FI he hi hr ja ko lt pt_BR - pt_PT si sq sv tr_TR uk zh_TW ) -set( _tx_good as be ca@valencia cs_CZ da fr fur it_IT ml nl ru sk - tg vi zh_CN ) -set( _tx_ok ar ast bg bn el en_GB es es_MX et eu gl hu id is mr nb - pl ro sl sr sr@latin th ) -set( _tx_incomplete eo es_PR gu ie kk kn lo lv mk ne ne_NP ta_IN te - ur zh zh_HK ) +set(_tx_complete + az + az_AZ + ca + de + fa + fi_FI + he + hi + hr + ja + ko + lt + pt_BR + pt_PT + si + sq + sv + tr_TR + uk + zh_TW +) +set(_tx_good + as + be + ca@valencia + cs_CZ + da + fr + fur + it_IT + ml + nl + ru + sk + tg + vi + zh_CN +) +set(_tx_ok + ar + ast + bg + bn + el + en_GB + es + es_MX + et + eu + gl + hu + id + is + mr + nb + pl + ro + sl + sr + sr@latin + th +) +set(_tx_incomplete + eo + es_PR + gu + ie + kk + kn + lo + lv + mk + ne + ne_NP + ta_IN + te + ur + zh + zh_HK +) ### Required versions # # See DEPENDENCIES section below. -set( QT_VERSION 5.15.0 ) -set( YAMLCPP_VERSION 0.5.1 ) -set( ECM_VERSION 5.18 ) -set( PYTHONLIBS_VERSION 3.6 ) -set( BOOSTPYTHON_VERSION 1.67.0 ) - +set(QT_VERSION 5.15.0) +set(YAMLCPP_VERSION 0.5.1) +set(ECM_VERSION 5.18) +set(PYTHONLIBS_VERSION 3.6) +set(BOOSTPYTHON_VERSION 1.67.0) ### CMAKE SETUP # -set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" ) +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules") # Enable IN_LIST -if( POLICY CMP0057 ) - cmake_policy( SET CMP0057 NEW ) +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) endif() # Let ``AUTOMOC`` and ``AUTOUIC`` process ``GENERATED`` files. -if( POLICY CMP0071 ) - cmake_policy( SET CMP0071 NEW ) +if(POLICY CMP0071) + cmake_policy(SET CMP0071 NEW) endif() # Recognize more macros to trigger automoc if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") - list(APPEND CMAKE_AUTOMOC_MACRO_NAMES + list( + APPEND + CMAKE_AUTOMOC_MACRO_NAMES "K_PLUGIN_FACTORY_WITH_JSON" "K_EXPORT_PLASMA_DATAENGINE_WITH_JSON" "K_EXPORT_PLASMA_RUNNER" @@ -188,49 +256,50 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") endif() # CMake Modules -include( CMakePackageConfigHelpers ) -include( CTest ) -include( FeatureSummary ) +include(CMakePackageConfigHelpers) +include(CTest) +include(FeatureSummary) # Calamares Modules -include( CMakeColors ) +include(CMakeColors) ### C++ SETUP # -set( CMAKE_CXX_STANDARD 17 ) -set( CMAKE_CXX_STANDARD_REQUIRED ON ) -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type" ) -set( CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}" ) -set( CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) -set( CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" ) -set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g" ) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type") +set(CMAKE_CXX_FLAGS_DEBUG "-Og -g ${CMAKE_CXX_FLAGS_DEBUG}") +set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g") -set( CMAKE_C_STANDARD 99 ) -set( CMAKE_C_STANDARD_REQUIRED ON ) -set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" ) -set( CMAKE_C_FLAGS_DEBUG "-Og -g" ) -set( CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG" ) -set( CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG" ) -set( CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g" ) +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_STANDARD_REQUIRED ON) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +set(CMAKE_C_FLAGS_DEBUG "-Og -g") +set(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") +set(CMAKE_C_FLAGS_RELEASE "-O4 -DNDEBUG") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g") -set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings" ) +set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined -Wl,--fatal-warnings") # If no build type is set, pick a reasonable one -if( NOT CMAKE_BUILD_TYPE ) - if ( CALAMARES_RELEASE_MODE ) - set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) +if(NOT CMAKE_BUILD_TYPE) + if(CALAMARES_RELEASE_MODE) + set(CMAKE_BUILD_TYPE "RelWithDebInfo") else() - set( CMAKE_BUILD_TYPE "Debug" ) + set(CMAKE_BUILD_TYPE "Debug") endif() endif() -if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) - message( STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags." ) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + message(STATUS "Found Clang ${CMAKE_CXX_COMPILER_VERSION}, setting up Clang-specific compiler flags.") # Clang warnings: doing *everything* is counter-productive, since it warns # about things which we can't fix (e.g. C++98 incompatibilities, but # Calamares is C++17). - foreach( CLANG_WARNINGS + foreach( + CLANG_WARNINGS -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic @@ -242,70 +311,69 @@ if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) -Wno-documentation-unknown-command -Wno-unknown-warning-option ) - string( APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}" ) + string(APPEND CMAKE_CXX_FLAGS " ${CLANG_WARNINGS}") endforeach() # The dwarf-debugging flags are slightly different, too - string( APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf" ) - string( APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf" ) + string(APPEND CMAKE_CXX_FLAGS_DEBUG " -gdwarf") + string(APPEND CMAKE_C_FLAGS_DEBUG " -gdwarf") # Third-party code where we don't care so much about compiler warnings # (because it's uncomfortable to patch) get different flags; use # mark_thirdparty_code( [...] ) # to switch off warnings for those sources. - set( SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything" ) + set(SUPPRESS_3RDPARTY_WARNINGS "-Wno-everything") - set( CMAKE_TOOLCHAIN_PREFIX "llvm-" ) + set(CMAKE_TOOLCHAIN_PREFIX "llvm-") # The path prefix is only relevant for CMake 3.16 and later, fixes #1286 - set( CMAKE_AUTOMOC_PATH_PREFIX OFF ) - set( CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h" ) - set( CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h ) + set(CMAKE_AUTOMOC_PATH_PREFIX OFF) + set(CALAMARES_AUTOMOC_OPTIONS "-butils/moc-warnings.h") + set(CALAMARES_AUTOUIC_OPTIONS --include utils/moc-warnings.h) else() - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual" ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual") - set( SUPPRESS_3RDPARTY_WARNINGS "" ) + set(SUPPRESS_3RDPARTY_WARNINGS "") endif() # Use mark_thirdparty_code() to reduce warnings from the compiler # on code that we're not going to fix. Call this with a list of files. macro(mark_thirdparty_code) - set_source_files_properties( ${ARGV} - PROPERTIES - COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" - COMPILE_DEFINITIONS "THIRDPARTY" + set_source_files_properties( + ${ARGV} + PROPERTIES COMPILE_FLAGS "${SUPPRESS_3RDPARTY_WARNINGS}" COMPILE_DEFINITIONS "THIRDPARTY" ) endmacro() -if( CMAKE_COMPILER_IS_GNUCXX ) - if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR - CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9 ) - message( STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages." ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto" ) +if(CMAKE_COMPILER_IS_GNUCXX) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.9) + message(STATUS "Found GNU g++ ${CMAKE_CXX_COMPILER_VERSION}, enabling colorized error messages.") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=auto") endif() endif() # API that was deprecated before Qt 5.15 causes a compile error -add_compile_definitions( QT_DISABLE_DEPRECATED_BEFORE=0x050f00 ) +add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00) ### DEPENDENCIES # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui LinguistTools Network Svg Widgets ) -if( WITH_QML ) - find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core Gui LinguistTools Network Svg Widgets) +if(WITH_QML) + find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets) endif() # Optional Qt parts -find_package( Qt5DBus CONFIG ) +find_package(Qt5DBus CONFIG) -find_package( YAMLCPP ${YAMLCPP_VERSION} REQUIRED ) -if( INSTALL_POLKIT ) - find_package( PolkitQt5-1 REQUIRED ) +find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED) +if(INSTALL_POLKIT) + find_package(PolkitQt5-1 REQUIRED) else() # Find it anyway, for dependencies-reporting - find_package( PolkitQt5-1 ) + find_package(PolkitQt5-1) endif() set_package_properties( - PolkitQt5-1 PROPERTIES + PolkitQt5-1 + PROPERTIES DESCRIPTION "Qt5 support for Polkit" URL "https://cgit.kde.org/polkit-qt-1.git" PURPOSE "PolkitQt5-1 helps with installing Polkit configuration" @@ -316,98 +384,108 @@ set_package_properties( # find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE), # no need to mess with the module path after. find_package(ECM ${ECM_VERSION} NO_MODULE) -if( ECM_FOUND ) +if(ECM_FOUND) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) - if ( BUILD_TESTING ) + if(BUILD_TESTING) # ECM implies that we can build the tests, too - find_package( Qt5 COMPONENTS Test REQUIRED ) - include( ECMAddTests ) + find_package(Qt5 COMPONENTS Test REQUIRED) + include(ECMAddTests) endif() include(KDEInstallDirs) endif() -find_package( KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons ) +find_package(KF5 QUIET COMPONENTS CoreAddons Crash DBusAddons) set_package_properties( - KF5::CoreAddons PROPERTIES + KF5::CoreAddons + PROPERTIES TYPE REQUIRED DESCRIPTION "Classes built on QtCore for About Data" URL "https://api.kde.org/frameworks/kcoreaddons/" PURPOSE "About Calamares" ) set_package_properties( - KF5::DBusAddons PROPERTIES + KF5::DBusAddons + PROPERTIES TYPE REQUIRED DESCRIPTION "Classes for DBus activation" URL "https://api.kde.org/frameworks/dbusaddons/" PURPOSE "Unique instance of Calamares" ) -if( NOT KF5Crash_FOUND ) - if( BUILD_KF5Crash ) +if(NOT KF5Crash_FOUND) + if(BUILD_KF5Crash) message(WARNING "BUILD_KF5Crash is set, but KF5::Crash is not available.") endif() - set( BUILD_KF5Crash OFF ) + set(BUILD_KF5Crash OFF) endif() # TODO:3.3: Use FindPython3 instead -find_package( PythonInterp ${PYTHONLIBS_VERSION} ) +find_package(PythonInterp ${PYTHONLIBS_VERSION}) set_package_properties( - PythonInterp PROPERTIES + PythonInterp + PROPERTIES DESCRIPTION "Python 3 interpreter." URL "https://python.org" PURPOSE "Python 3 interpreter for certain tests." ) -set( _schema_explanation "" ) -if ( PYTHONINTERP_FOUND ) - if ( BUILD_SCHEMA_TESTING ) +set(_schema_explanation "") +if(PYTHONINTERP_FOUND) + if(BUILD_SCHEMA_TESTING) # The configuration validator script has some dependencies, # and if they are not installed, don't run. If errors out # with exit(1) on missing dependencies. - if ( CALAMARES_CONFIGVALIDATOR_CHECKED ) - set( _validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT} ) + if(CALAMARES_CONFIGVALIDATOR_CHECKED) + set(_validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT}) else() - exec_program( ${PYTHON_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x RETURN_VALUE _validator_deps ) - set( CALAMARES_CONFIGVALIDATOR_CHECKED TRUE CACHE INTERNAL "Dependencies for configvalidator checked" ) - set( CALAMARES_CONFIGVALIDATOR_RESULT ${_validator_deps} CACHE INTERNAL "Result of configvalidator dependency check" ) + exec_program( + ${PYTHON_EXECUTABLE} + ARGS + "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" + -x + RETURN_VALUE + _validator_deps + ) + set(CALAMARES_CONFIGVALIDATOR_CHECKED TRUE CACHE INTERNAL "Dependencies for configvalidator checked") + set(CALAMARES_CONFIGVALIDATOR_RESULT ${_validator_deps} + CACHE INTERNAL "Result of configvalidator dependency check" + ) endif() # It should never succeed, but only returns 1 when the imports fail - if ( _validator_deps EQUAL 1 ) - set( _schema_explanation " Missing dependencies for configvalidator.py." ) - set( BUILD_SCHEMA_TESTING OFF ) + if(_validator_deps EQUAL 1) + set(_schema_explanation " Missing dependencies for configvalidator.py.") + set(BUILD_SCHEMA_TESTING OFF) endif() endif() else() # Can't run schema tests without Python3. - set( _schema_explanation " Missing Python3." ) - set( BUILD_SCHEMA_TESTING OFF ) + set(_schema_explanation " Missing Python3.") + set(BUILD_SCHEMA_TESTING OFF) endif() -add_feature_info( yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}" ) +add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") -find_package( PythonLibs ${PYTHONLIBS_VERSION} ) +find_package(PythonLibs ${PYTHONLIBS_VERSION}) set_package_properties( - PythonLibs PROPERTIES + PythonLibs + PROPERTIES DESCRIPTION "C interface libraries for the Python 3 interpreter." URL "https://python.org" PURPOSE "Python 3 is used for Python job modules." ) -if ( PYTHONLIBS_FOUND ) +if(PYTHONLIBS_FOUND) # TODO:3.3: Require Boost + CMake; sort out Boost::Python # Since Boost provides CMake config files (starting with Boost 1.70. # or so) the mess that is the Calamares find code picks the wrong # bits. Suppress those CMake config files, as suggested by @jmrcpn set(Boost_NO_BOOST_CMAKE ON) - include( BoostPython3 ) + include(BoostPython3) find_boost_python3( ${BOOSTPYTHON_VERSION} ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND ) - set_package_properties( - Boost PROPERTIES - PURPOSE "Boost.Python is used for Python job modules." - ) + set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") endif() -if( NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND ) +if(NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND) message(STATUS "Disabling Boost::Python modules") - set( WITH_PYTHON OFF ) + set(WITH_PYTHON OFF) endif() # Now we know the state of the ABI-options, copy them into "Calamares_" @@ -423,39 +501,39 @@ set(Calamares_WITH_QML ${WITH_QML}) # for some obvious error. The actual work of compiling translations # is done in the lang/ directory. # -if( Qt5_VERSION VERSION_GREATER 5.12.1 ) +if(Qt5_VERSION VERSION_GREATER 5.12.1) # At least Qt 5.12.2 seems to support Esperanto in QLocale - if( "eo" IN_LIST _tx_incomplete ) + if("eo" IN_LIST _tx_incomplete) message(STATUS "Esperanto support since Qt 5.12.2, enabling Esperanto locale") - list( REMOVE_ITEM _tx_incomplete "eo" ) - list( APPEND _tx_ok "eo" ) + list(REMOVE_ITEM _tx_incomplete "eo") + list(APPEND _tx_ok "eo") endif() endif() -set( curr_tx ${_tx_complete} ${_tx_good} ${_tx_ok} ${_tx_incomplete} ) -set( tx_errors OFF ) -if ( curr_tx ) +set(curr_tx ${_tx_complete} ${_tx_good} ${_tx_ok} ${_tx_incomplete}) +set(tx_errors OFF) +if(curr_tx) # New in list - foreach( l ${curr_tx} ) - set( p_l "lang/calamares_${l}.ts" ) - if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${p_l} ) + foreach(l ${curr_tx}) + set(p_l "lang/calamares_${l}.ts") + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${p_l}) message(WARNING "Language ${l} has no .ts file yet.") - set( tx_errors ON ) + set(tx_errors ON) endif() endforeach() - unset( p_l ) - unset( l ) + unset(p_l) + unset(l) endif() -unset( curr_tx ) -if( tx_errors ) - message( FATAL_ERROR "Translation warnings, see above." ) +unset(curr_tx) +if(tx_errors) + message(FATAL_ERROR "Translation warnings, see above.") endif() -set( CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok} ) -list( SORT CALAMARES_TRANSLATION_LANGUAGES ) +set(CALAMARES_TRANSLATION_LANGUAGES en ${_tx_complete} ${_tx_good} ${_tx_ok}) +list(SORT CALAMARES_TRANSLATION_LANGUAGES) -add_subdirectory( lang ) # i18n tools +add_subdirectory(lang) # i18n tools ### Example Distro # @@ -474,22 +552,22 @@ add_subdirectory( lang ) # i18n tools # # make example-distro # -find_program( mksquashfs_PROGRAM mksquashfs ) -if( mksquashfs_PROGRAM ) - set( mksquashfs_FOUND ON ) - set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ ) - set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs ) - if( EXISTS ${src_fs} ) +find_program(mksquashfs_PROGRAM mksquashfs) +if(mksquashfs_PROGRAM) + set(mksquashfs_FOUND ON) + set(src_fs ${CMAKE_SOURCE_DIR}/data/example-root/) + set(dst_fs ${CMAKE_BINARY_DIR}/example.sqfs) + if(EXISTS ${src_fs}) # based on the build host. If /lib64 exists, assume it is needed. # Collect directories needed for a minimal binary distro, # Note that the last path component is added to the root, so # if you add /usr/sbin here, it will be put into /sbin_1. # Add such paths to /etc/profile under ${src_fs}. - set( candidate_fs /sbin /bin /lib /lib64 ) - set( host_fs "" ) - foreach( c_fs ${candidate_fs} ) - if( EXISTS ${c_fs} ) - list( APPEND host_fs ${c_fs} ) + set(candidate_fs /sbin /bin /lib /lib64) + set(host_fs "") + foreach(c_fs ${candidate_fs}) + if(EXISTS ${c_fs}) + list(APPEND host_fs ${c_fs}) endif() endforeach() add_custom_command( @@ -500,71 +578,63 @@ if( mksquashfs_PROGRAM ) add_custom_target(example-distro DEPENDS ${dst_fs}) endif() else() - set( mksquashfs_FOUND OFF ) + set(mksquashfs_FOUND OFF) endif() # Doesn't list mksquashfs as an optional dep, though, because it # hasn't been sent through the find_package() scheme. # # "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html" -add_feature_info( ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.") - +add_feature_info(ExampleDistro ${mksquashfs_FOUND} "Create example-distro target.") ### CALAMARES PROPER # -set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} ) +set(CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH}) # In rare cases we have hotfix-releases with a tweak -if( CALAMARES_VERSION_TWEAK ) - set( CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}" ) +if(CALAMARES_VERSION_TWEAK) + set(CALAMARES_VERSION "${CALAMARES_VERSION}.${CALAMARES_VERSION_TWEAK}") endif() -set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" ) +set(CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}") # Additional info for non-release builds. The "extended" version information # with date and git information (commit, dirty status) is used only # by CalamaresVersionX.h, which is included by consumers that need a full # version number with all that information; normal consumers can include # CalamaresVersion.h with more stable numbers. -if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" ) - include( ExtendedVersion ) +if(NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") + include(ExtendedVersion) extend_version( "${CALAMARES_VERSION}" OFF CALAMARES_VERSION_SHORT CALAMARES_VERSION ) endif() # Special target for not-RC (e.g. might-be-release) builds. # This is used by the release script to get the version. -if ( CALAMARES_VERSION_RC EQUAL 0 ) - add_custom_target(show-version - ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} - USES_TERMINAL - ) +if(CALAMARES_VERSION_RC EQUAL 0) + add_custom_target(show-version ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} USES_TERMINAL) endif() # enforce using constBegin, constEnd for const-iterators -add_definitions( - -DQT_STRICT_ITERATORS - -DQT_SHARED - -DQT_SHAREDPOINTER_TRACK_POINTERS -) +add_definitions(-DQT_STRICT_ITERATORS -DQT_SHARED -DQT_SHAREDPOINTER_TRACK_POINTERS) # set paths -set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) -set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) -set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") # Better default installation paths: GNUInstallDirs defines # CMAKE_INSTALL_FULL_SYSCONFDIR to be CMAKE_INSTALL_PREFIX/etc by default # but we really want /etc -if( NOT DEFINED CMAKE_INSTALL_SYSCONFDIR ) - set( CMAKE_INSTALL_SYSCONFDIR "/etc" ) +if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR) + set(CMAKE_INSTALL_SYSCONFDIR "/etc") endif() # make predefined install dirs available everywhere -include( GNUInstallDirs ) +include(GNUInstallDirs) # This is used by CalamaresAddLibrary; once Calamares is installed, # the CalamaresConfig.cmake module sets this variable to the IMPORTED # libraries for Calamares. -set( Calamares_LIBRARIES calamares ) +set(Calamares_LIBRARIES calamares) -add_subdirectory( src ) +add_subdirectory(src) add_feature_info(Python ${WITH_PYTHON} "Python job modules") add_feature_info(Qml ${WITH_QML} "QML UI support") @@ -575,30 +645,22 @@ add_feature_info(KCrash ${BUILD_KF5Crash} "Crash dumps via KCrash") ### CMake infrastructure installation # # -set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" ) -set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" ) +set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files") +set(CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}") -export( PACKAGE Calamares ) +export(PACKAGE Calamares) configure_package_config_file( "CalamaresConfig.cmake.in" "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - PATH_VARS - CMAKE_INSTALL_INCLUDEDIR - CMAKE_INSTALL_LIBDIR - CMAKE_INSTALL_DATADIR + PATH_VARS CMAKE_INSTALL_INCLUDEDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_DATADIR ) write_basic_package_version_file( ${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion ) -install( - EXPORT Calamares - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - FILE "CalamaresTargets.cmake" - NAMESPACE Calamares:: -) +install(EXPORT Calamares DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" FILE "CalamaresTargets.cmake" NAMESPACE Calamares::) # Install the cmake files install( @@ -615,69 +677,48 @@ install( "CMakeModules/CalamaresCheckModuleSelection.cmake" "CMakeModules/CMakeColors.cmake" "CMakeModules/FindYAMLCPP.cmake" - DESTINATION - "${CMAKE_INSTALL_CMAKEDIR}" + DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" ) ### Miscellaneous installs # # -if( INSTALL_CONFIG ) - install( - FILES settings.conf - DESTINATION share/calamares - ) +if(INSTALL_CONFIG) + install(FILES settings.conf DESTINATION share/calamares) endif() -if( INSTALL_POLKIT ) - install( - FILES com.github.calamares.calamares.policy - DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}" - ) +if(INSTALL_POLKIT) + install(FILES com.github.calamares.calamares.policy DESTINATION "${POLKITQT-1_POLICY_FILES_INSTALL_DIR}") endif() -if ( INSTALL_COMPLETION ) - if( NOT CMAKE_INSTALL_BASHCOMPLETIONDIR ) - set( CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions" ) +if(INSTALL_COMPLETION) + if(NOT CMAKE_INSTALL_BASHCOMPLETIONDIR) + set(CMAKE_INSTALL_BASHCOMPLETIONDIR "${CMAKE_INSTALL_DATADIR}/bash-completion/completions") endif() - install( FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}" ) + install(FILES ${CMAKE_SOURCE_DIR}/data/completion/bash/calamares DESTINATION "${CMAKE_INSTALL_BASHCOMPLETIONDIR}") endif() -install( - FILES calamares.desktop - DESTINATION ${CMAKE_INSTALL_DATADIR}/applications -) +install(FILES calamares.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) -install( - FILES man/calamares.8 - DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/ -) +install(FILES man/calamares.8 DESTINATION ${CMAKE_INSTALL_MANDIR}/man8/) # uninstall target configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY + IMMEDIATE + @ONLY ) -add_custom_target( uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake -) +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ### CMAKE SUMMARY REPORT # -get_directory_property( SKIPPED_MODULES - DIRECTORY src/modules - DEFINITION LIST_SKIPPED_MODULES -) +get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES) calamares_explain_skipped_modules( ${SKIPPED_MODULES} ) -feature_summary( - WHAT DISABLED_FEATURES - DESCRIPTION "The following features have been disabled:" - QUIET_ON_EMPTY -) +feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY) feature_summary( WHAT OPTIONAL_PACKAGES_NOT_FOUND DESCRIPTION "The following OPTIONAL packages were not found:" @@ -697,7 +738,9 @@ feature_summary( # TODO:3.3 With newer CMake, move HOMEPAGE_URL to the project()call set(CPACK_PACKAGE_VENDOR calamares) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Linux system installer") -set(CPACK_PACKAGE_DESCRIPTION "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families.") +set(CPACK_PACKAGE_DESCRIPTION + "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families." +) set(CPACK_PACKAGE_HOMEPAGE_URL "https://calamares.io") set(CPACK_PACKAGE_ICON "data/images/squid.png") diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt index 72aae9588..7494692c6 100644 --- a/lang/CMakeLists.txt +++ b/lang/CMakeLists.txt @@ -13,15 +13,15 @@ # - defines an OBJECT LIBRARY calamares-i18n for linking the compiled # translations into an executable. -include( CalamaresAddTranslations ) +include(CalamaresAddTranslations) find_package(Qt5 COMPONENTS Xml) -if( Qt5Xml_FOUND ) +if(Qt5Xml_FOUND) add_executable(txload txload.cpp) target_link_libraries(txload Qt5::Xml) endif() -install_calamares_gettext_translations( python +install_calamares_gettext_translations(python SOURCE_DIR ${CMAKE_SOURCE_DIR}/lang/python FILENAME python.mo RENAME calamares-python.mo @@ -30,25 +30,25 @@ install_calamares_gettext_translations( python ### TRANSLATIONS # # -set( TS_FILES "" ) -set( calamares_i18n_qrc_content "" ) +set(TS_FILES "") +set(calamares_i18n_qrc_content "") # calamares and qt language files -foreach( lang ${CALAMARES_TRANSLATION_LANGUAGES} ) - foreach( tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}" ) - if( EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" ) - string( APPEND calamares_i18n_qrc_content "${tlsource}.qm\n" ) - list( APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts" ) +foreach(lang ${CALAMARES_TRANSLATION_LANGUAGES}) + foreach(tlsource "calamares_${lang}" "tz_${lang}" "kb_${lang}") + if(EXISTS "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts") + string(APPEND calamares_i18n_qrc_content "${tlsource}.qm\n") + list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/lang/${tlsource}.ts") endif() endforeach() endforeach() -set( trans_file calamares_i18n ) -set( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc ) -set( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx ) -set( CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile} ) +set(trans_file calamares_i18n) +set(trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc) +set(trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/calamares-i18n.cxx) +set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile}) -configure_file( ${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY ) +configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY) qt5_add_translation(QM_FILES ${TS_FILES}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5ce5349fb..b1a536f91 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -3,26 +3,26 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include( CalamaresAddBrandingSubdirectory ) -include( CalamaresAddLibrary ) -include( CalamaresAddModuleSubdirectory ) -include( CalamaresAddPlugin ) -include( CalamaresAddTest ) -include( CalamaresAddTranslations ) +include(CalamaresAddBrandingSubdirectory) +include(CalamaresAddLibrary) +include(CalamaresAddModuleSubdirectory) +include(CalamaresAddPlugin) +include(CalamaresAddTest) +include(CalamaresAddTranslations) # library -add_subdirectory( libcalamares ) +add_subdirectory(libcalamares) -add_subdirectory( libcalamaresui ) +add_subdirectory(libcalamaresui) # all things qml -add_subdirectory( qml/calamares ) +add_subdirectory(qml/calamares) # application -add_subdirectory( calamares ) +add_subdirectory(calamares) # plugins -add_subdirectory( modules ) +add_subdirectory(modules) # branding components -add_subdirectory( branding ) +add_subdirectory(branding) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index cf9fdd8a7..b132f186a 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -4,14 +4,12 @@ # SPDX-License-Identifier: BSD-2-Clause # -set( calamaresSources +set(calamaresSources main.cpp CalamaresApplication.cpp CalamaresWindow.cpp - DebugWindow.cpp VariantModel.cpp - progresstree/ProgressTreeDelegate.cpp progresstree/ProgressTreeView.cpp ) @@ -31,42 +29,30 @@ include_directories( # The calamares-i18n.cxx file -- full path in CALAMARES_TRANSLATIONS_SOURCE -- # is created as a target in the lang/ directory. This is compiled to a # library (it's just the result of a QRC compile). -add_executable( calamares_bin ${calamaresSources} calamares.qrc ) -target_include_directories( calamares_bin PRIVATE ${CMAKE_SOURCE_DIR} ) -set_target_properties(calamares_bin - PROPERTIES - ENABLE_EXPORTS TRUE - RUNTIME_OUTPUT_NAME calamares -) +add_executable(calamares_bin ${calamaresSources} calamares.qrc) +target_include_directories(calamares_bin PRIVATE ${CMAKE_SOURCE_DIR}) +set_target_properties(calamares_bin PROPERTIES ENABLE_EXPORTS TRUE RUNTIME_OUTPUT_NAME calamares) calamares_automoc( calamares_bin ) calamares_autouic( calamares_bin ) calamares_autorcc( calamares_bin ) -if( kdsagSources ) - set_source_files_properties( ${kdsagSources} PROPERTIES AUTOMOC OFF ) +if(kdsagSources) + set_source_files_properties(${kdsagSources} PROPERTIES AUTOMOC OFF) endif() -target_link_libraries( calamares_bin - PRIVATE - calamares - calamaresui - calamares-i18n - Qt5::Core - Qt5::Widgets - KF5::CoreAddons - KF5::DBusAddons +target_link_libraries( + calamares_bin + PRIVATE calamares calamaresui calamares-i18n Qt5::Core Qt5::Widgets KF5::CoreAddons KF5::DBusAddons ) -if( BUILD_KF5Crash ) - target_link_libraries( calamares_bin PRIVATE KF5::Crash ) - target_compile_definitions( calamares_bin PRIVATE BUILD_KF5Crash ) +if(BUILD_KF5Crash) + target_link_libraries(calamares_bin PRIVATE KF5::Crash) + target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash) endif() -install( TARGETS calamares_bin - BUNDLE DESTINATION . - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) +install(TARGETS calamares_bin BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -install( FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg +install( + FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg RENAME calamares.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps ) @@ -74,11 +60,11 @@ install( FILES ${CMAKE_SOURCE_DIR}/data/images/squid.svg ### TESTS # # -if( BUILD_TESTING ) +if(BUILD_TESTING) # Don't install, these are just for enable_testing - add_executable( loadmodule testmain.cpp ) - target_link_libraries( loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui ) + add_executable(loadmodule testmain.cpp) + target_link_libraries(loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui) - add_executable( test_conf test_conf.cpp ) - target_link_libraries( test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core ) + add_executable(test_conf test_conf.cpp) + target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core) endif() diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index dfb99a068..07f415f75 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -8,7 +8,7 @@ # individual modules can also decide they must be skipped (e.g. OS-specific # modules, or ones with unmet dependencies). Collect the skipped modules # in this list. -set( LIST_SKIPPED_MODULES "" ) +set(LIST_SKIPPED_MODULES "") include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares @@ -16,46 +16,47 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamaresui ) -string( REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}" ) +string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}") -file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) -list( SORT SUBDIRECTORIES ) +file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") +list(SORT SUBDIRECTORIES) -foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) +foreach(SUBDIRECTORY ${SUBDIRECTORIES}) calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES ) endforeach() # TODO:3.3: Use FindPython3 -if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) # The tests for each config file are independent of whether the # module is enabled or not: the config file should match its schema # regardless. - foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) - set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml" ) + foreach(SUBDIRECTORY ${SUBDIRECTORIES}) + set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.schema.yaml") # Collect config files from the module-directory and from a tests/ subdir, # using the same mechanism to find those test-config-files as function # calamares_add_module_subdirectory() would do. - set( _conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf" ) - set( _count 1 ) - set( _testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests" ) - while ( EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job" ) - if ( EXISTS "${_testdir}/${_count}.job" ) - list( APPEND _conf_files "${_testdir}/${_count}.job" ) + set(_conf_files "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${SUBDIRECTORY}.conf") + set(_count 1) + set(_testdir "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/tests") + while(EXISTS "${_testdir}/${_count}.global" OR EXISTS "${_testdir}/${_count}.job") + if(EXISTS "${_testdir}/${_count}.job") + list(APPEND _conf_files "${_testdir}/${_count}.job") endif() - math( EXPR _count "${_count} + 1" ) + math(EXPR _count "${_count} + 1") endwhile() - if ( EXISTS "${_schema_file}" ) - foreach( _conf_file ${_conf_files} ) - if ( EXISTS ${_conf_file} ) - get_filename_component( _conf_base "${_conf_file}" NAME_WE ) + if(EXISTS "${_schema_file}") + foreach(_conf_file ${_conf_files}) + if(EXISTS ${_conf_file}) + get_filename_component(_conf_base "${_conf_file}" NAME_WE) add_test( NAME validate-${SUBDIRECTORY}-${_conf_base} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + COMMAND + ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" + "${_conf_file}" ) endif() endforeach() endif() endforeach() endif() - diff --git a/src/modules/contextualprocess/CMakeLists.txt b/src/modules/contextualprocess/CMakeLists.txt index d7716bbfb..9520515ce 100644 --- a/src/modules/contextualprocess/CMakeLists.txt +++ b/src/modules/contextualprocess/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( contextualprocess +calamares_add_plugin(contextualprocess TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -15,7 +15,6 @@ calamares_add_test( contextualprocesstest SOURCES Tests.cpp - ContextualProcessJob.cpp # Builds it a second time - LIBRARIES - yamlcpp::yamlcpp + ContextualProcessJob.cpp # Builds it a second time + LIBRARIES yamlcpp::yamlcpp ) diff --git a/src/modules/dracutlukscfg/CMakeLists.txt b/src/modules/dracutlukscfg/CMakeLists.txt index aaa7a8c17..85efccc0c 100644 --- a/src/modules/dracutlukscfg/CMakeLists.txt +++ b/src/modules/dracutlukscfg/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( dracutlukscfg +calamares_add_plugin(dracutlukscfg TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/dummycpp/CMakeLists.txt b/src/modules/dummycpp/CMakeLists.txt index 2916b4d67..b822a03be 100644 --- a/src/modules/dummycpp/CMakeLists.txt +++ b/src/modules/dummycpp/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( dummycpp +calamares_add_plugin(dummycpp TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/finished/CMakeLists.txt b/src/modules/finished/CMakeLists.txt index 619f6d8b0..ab435a9eb 100644 --- a/src/modules/finished/CMakeLists.txt +++ b/src/modules/finished/CMakeLists.txt @@ -3,11 +3,11 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( finished +calamares_add_plugin(finished TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/finishedq/CMakeLists.txt b/src/modules/finishedq/CMakeLists.txt index facc2d691..2e688c45d 100644 --- a/src/modules/finishedq/CMakeLists.txt +++ b/src/modules/finishedq/CMakeLists.txt @@ -3,21 +3,21 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "finishedq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network ) -if ( NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network ) +find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network) +if(NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network) calamares_skip_module( "finishedq (missing DBus or Network)" ) return() endif() -set( _finished ${CMAKE_CURRENT_SOURCE_DIR}/../finished ) -include_directories( ${_finished} ) +set(_finished ${CMAKE_CURRENT_SOURCE_DIR}/../finished) +include_directories(${_finished}) -calamares_add_plugin( finishedq +calamares_add_plugin(finishedq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/fsresizer/CMakeLists.txt b/src/modules/fsresizer/CMakeLists.txt index e721d7f6b..189e7c1dc 100644 --- a/src/modules/fsresizer/CMakeLists.txt +++ b/src/modules/fsresizer/CMakeLists.txt @@ -3,18 +3,18 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( KF5Config CONFIG ) -find_package( KF5I18n CONFIG ) -find_package( KF5WidgetsAddons CONFIG ) +find_package(KF5Config CONFIG) +find_package(KF5I18n CONFIG) +find_package(KF5WidgetsAddons CONFIG) -include( KPMcoreHelper ) +include(KPMcoreHelper) -if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) - include_directories( ${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition ) +if(KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND) + include_directories(${KPMCORE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/src/modules/partition) # The PartitionIterator is a small class, and it's easiest -- but also a # gross hack -- to just compile it again from the partition module tree. - calamares_add_plugin( fsresizer + calamares_add_plugin(fsresizer TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -27,15 +27,14 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND calamares_add_test( fsresizertest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES - calamares_job_fsresizer # From above + calamares_job_fsresizer # From above yamlcpp::yamlcpp DEFINITIONS ${KPMcore_API_DEFINITIONS} ) else() - if ( NOT KPMcore_FOUND ) + if(NOT KPMcore_FOUND) calamares_skip_module( "fsresizer (missing suitable KPMcore)" ) else() calamares_skip_module( "fsresizer (missing dependencies for KPMcore)" ) diff --git a/src/modules/grubcfg/tests/CMakeTests.txt b/src/modules/grubcfg/tests/CMakeTests.txt index 54a0721e4..7ecfffceb 100644 --- a/src/modules/grubcfg/tests/CMakeTests.txt +++ b/src/modules/grubcfg/tests/CMakeTests.txt @@ -8,12 +8,10 @@ add_test( NAME make-grubcfg-dirs - COMMAND ${CMAKE_COMMAND} -E make_directory - /tmp/calamares/grubcfg-test-2/etc/default - /tmp/calamares/grubcfg-test-3/etc/default - /tmp/calamares/grubcfg-test-4/etc/default/grub.d - ) + COMMAND + ${CMAKE_COMMAND} -E make_directory /tmp/calamares/grubcfg-test-2/etc/default + /tmp/calamares/grubcfg-test-3/etc/default /tmp/calamares/grubcfg-test-4/etc/default/grub.d +) set_tests_properties(load-grubcfg-2 PROPERTIES DEPENDS make-grubcfg-dirs) set_tests_properties(load-grubcfg-3 PROPERTIES DEPENDS make-grubcfg-dirs) set_tests_properties(load-grubcfg-4 PROPERTIES DEPENDS make-grubcfg-dirs) - diff --git a/src/modules/initcpio/CMakeLists.txt b/src/modules/initcpio/CMakeLists.txt index 48fd09371..1bbb9fdd9 100644 --- a/src/modules/initcpio/CMakeLists.txt +++ b/src/modules/initcpio/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( initcpio +calamares_add_plugin(initcpio TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -13,8 +13,7 @@ calamares_add_plugin( initcpio calamares_add_test( initcpiotest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES calamares_job_initcpio # From above yamlcpp::yamlcpp diff --git a/src/modules/initramfs/CMakeLists.txt b/src/modules/initramfs/CMakeLists.txt index 2dec41cba..45f29c387 100644 --- a/src/modules/initramfs/CMakeLists.txt +++ b/src/modules/initramfs/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( initramfs +calamares_add_plugin(initramfs TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -13,8 +13,7 @@ calamares_add_plugin( initramfs calamares_add_test( initramfstest - SOURCES - Tests.cpp + SOURCES Tests.cpp LIBRARIES calamares_job_initramfs # From above yamlcpp::yamlcpp diff --git a/src/modules/interactiveterminal/CMakeLists.txt b/src/modules/interactiveterminal/CMakeLists.txt index 20aee8257..8ade23dbd 100644 --- a/src/modules/interactiveterminal/CMakeLists.txt +++ b/src/modules/interactiveterminal/CMakeLists.txt @@ -5,21 +5,15 @@ # find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) -set( kf5_ver 5.41 ) +set(kf5_ver 5.41) -find_package( KF5Service ${kf5_ver} ) -find_package( KF5Parts ${kf5_ver} ) -set_package_properties( - KF5Service PROPERTIES - PURPOSE "For finding KDE services at runtime" -) -set_package_properties( - KF5Parts PROPERTIES - PURPOSE "For finding KDE parts at runtime" -) +find_package(KF5Service ${kf5_ver}) +find_package(KF5Parts ${kf5_ver}) +set_package_properties(KF5Service PROPERTIES PURPOSE "For finding KDE services at runtime") +set_package_properties(KF5Parts PROPERTIES PURPOSE "For finding KDE parts at runtime") -if ( KF5Parts_FOUND AND KF5Service_FOUND ) - calamares_add_plugin( interactiveterminal +if(KF5Parts_FOUND AND KF5Service_FOUND) + calamares_add_plugin(interactiveterminal TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/keyboard/CMakeLists.txt b/src/modules/keyboard/CMakeLists.txt index fe341cef0..a2e09dc41 100644 --- a/src/modules/keyboard/CMakeLists.txt +++ b/src/modules/keyboard/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( keyboard +calamares_add_plugin(keyboard TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -21,11 +21,4 @@ calamares_add_plugin( keyboard SHARED_LIB ) -calamares_add_test( - keyboardtest - SOURCES - Tests.cpp - SetKeyboardLayoutJob.cpp - RESOURCES - keyboard.qrc -) +calamares_add_test(keyboardtest SOURCES Tests.cpp SetKeyboardLayoutJob.cpp RESOURCES keyboard.qrc) diff --git a/src/modules/keyboardq/CMakeLists.txt b/src/modules/keyboardq/CMakeLists.txt index 2b0577aa7..9c7922d86 100644 --- a/src/modules/keyboardq/CMakeLists.txt +++ b/src/modules/keyboardq/CMakeLists.txt @@ -3,16 +3,16 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "keyboardq (QML is not supported in this build)" ) return() endif() -set( _keyboard ${CMAKE_CURRENT_SOURCE_DIR}/../keyboard ) +set(_keyboard ${CMAKE_CURRENT_SOURCE_DIR}/../keyboard) -include_directories( ${_keyboard} ) +include_directories(${_keyboard}) -calamares_add_plugin( keyboardq +calamares_add_plugin(keyboardq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/license/CMakeLists.txt b/src/modules/license/CMakeLists.txt index 0cd838799..d214d6ca7 100644 --- a/src/modules/license/CMakeLists.txt +++ b/src/modules/license/CMakeLists.txt @@ -3,9 +3,9 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( license +calamares_add_plugin(license TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/locale/CMakeLists.txt b/src/modules/locale/CMakeLists.txt index 272dea3de..bad6042a6 100644 --- a/src/modules/locale/CMakeLists.txt +++ b/src/modules/locale/CMakeLists.txt @@ -7,14 +7,14 @@ # When debugging the timezone widget, add this debugging definition # to have a debugging-friendly timezone widget, debug logging, # and no intrusive timezone-setting while clicking around. -option( DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF ) -if( DEBUG_TIMEZONES ) - add_definitions( -DDEBUG_TIMEZONES ) +option(DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF) +if(DEBUG_TIMEZONES) + add_definitions(-DDEBUG_TIMEZONES) endif() -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -calamares_add_plugin( locale +calamares_add_plugin(locale TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -39,15 +39,7 @@ calamares_add_plugin( locale calamares_add_test( localetest - SOURCES - Tests.cpp - Config.cpp - LocaleConfiguration.cpp - SetTimezoneJob.cpp - timezonewidget/TimeZoneImage.cpp - DEFINITIONS - SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/images" - DEBUG_TIMEZONES=1 - LIBRARIES - Qt5::Gui + SOURCES Tests.cpp Config.cpp LocaleConfiguration.cpp SetTimezoneJob.cpp timezonewidget/TimeZoneImage.cpp + DEFINITIONS SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/images" DEBUG_TIMEZONES=1 + LIBRARIES Qt5::Gui ) diff --git a/src/modules/localeq/CMakeLists.txt b/src/modules/localeq/CMakeLists.txt index ee3f07314..f086676e6 100644 --- a/src/modules/localeq/CMakeLists.txt +++ b/src/modules/localeq/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "localeq (QML is not supported in this build)" ) return() endif() @@ -11,28 +11,22 @@ endif() # When debugging the timezone widget, add this debugging definition # to have a debugging-friendly timezone widget, debug logging, # and no intrusive timezone-setting while clicking around. -option( DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF ) -if( DEBUG_TIMEZONES ) - add_definitions( -DDEBUG_TIMEZONES ) +option(DEBUG_TIMEZONES "Debug-friendly timezone widget." OFF) +if(DEBUG_TIMEZONES) + add_definitions(-DDEBUG_TIMEZONES) endif() find_package(Qt5Location CONFIG) -set_package_properties(Qt5Location PROPERTIES - DESCRIPTION "Used for rendering the map" - TYPE RUNTIME -) +set_package_properties(Qt5Location PROPERTIES DESCRIPTION "Used for rendering the map" TYPE RUNTIME) find_package(Qt5Positioning CONFIG) -set_package_properties(Qt5Positioning PROPERTIES - DESCRIPTION "Used for GeoLocation and GeoCoding" - TYPE RUNTIME -) +set_package_properties(Qt5Positioning PROPERTIES DESCRIPTION "Used for GeoLocation and GeoCoding" TYPE RUNTIME) # Because we're sharing sources with the regular locale module -set( _locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale ) +set(_locale ${CMAKE_CURRENT_SOURCE_DIR}/../locale) -include_directories( ${_locale} ) +include_directories(${_locale}) -calamares_add_plugin( localeq +calamares_add_plugin(localeq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/luksbootkeyfile/CMakeLists.txt b/src/modules/luksbootkeyfile/CMakeLists.txt index 6e98af468..6f5d45062 100644 --- a/src/modules/luksbootkeyfile/CMakeLists.txt +++ b/src/modules/luksbootkeyfile/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( luksbootkeyfile +calamares_add_plugin(luksbootkeyfile TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/luksopenswaphookcfg/CMakeLists.txt b/src/modules/luksopenswaphookcfg/CMakeLists.txt index caede06a7..f186fbdc6 100644 --- a/src/modules/luksopenswaphookcfg/CMakeLists.txt +++ b/src/modules/luksopenswaphookcfg/CMakeLists.txt @@ -6,7 +6,7 @@ # Because LUKS Open Swap Hook (Job) is such a mouthful, we'll # use LOSH all over the place as a shorthand. -calamares_add_plugin( luksopenswaphookcfg +calamares_add_plugin(luksopenswaphookcfg TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -14,9 +14,4 @@ calamares_add_plugin( luksopenswaphookcfg SHARED_LIB ) -calamares_add_test( - luksopenswaphooktest - SOURCES - LOSHJob.cpp - Tests.cpp -) +calamares_add_test(luksopenswaphooktest SOURCES LOSHJob.cpp Tests.cpp) diff --git a/src/modules/machineid/CMakeLists.txt b/src/modules/machineid/CMakeLists.txt index 0ab035ab4..869d11387 100644 --- a/src/modules/machineid/CMakeLists.txt +++ b/src/modules/machineid/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( machineid +calamares_add_plugin(machineid TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -12,10 +12,4 @@ calamares_add_plugin( machineid SHARED_LIB ) -calamares_add_test( - machineidtest - SOURCES - Tests.cpp - MachineIdJob.cpp - Workers.cpp -) +calamares_add_test(machineidtest SOURCES Tests.cpp MachineIdJob.cpp Workers.cpp) diff --git a/src/modules/notesqml/CMakeLists.txt b/src/modules/notesqml/CMakeLists.txt index 5eab06663..c76ab5179 100644 --- a/src/modules/notesqml/CMakeLists.txt +++ b/src/modules/notesqml/CMakeLists.txt @@ -3,12 +3,12 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "notesqml (QML is not supported in this build)" ) return() endif() -calamares_add_plugin( notesqml +calamares_add_plugin(notesqml TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/oemid/CMakeLists.txt b/src/modules/oemid/CMakeLists.txt index af7fe1ff7..45825c85e 100644 --- a/src/modules/oemid/CMakeLists.txt +++ b/src/modules/oemid/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( oemid +calamares_add_plugin(oemid TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/packagechooser/CMakeLists.txt b/src/modules/packagechooser/CMakeLists.txt index d2e6ff118..e565fd05e 100644 --- a/src/modules/packagechooser/CMakeLists.txt +++ b/src/modules/packagechooser/CMakeLists.txt @@ -3,45 +3,46 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 COMPONENTS Core Gui Widgets REQUIRED ) -set( _extra_libraries "" ) -set( _extra_src "" ) +find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +set(_extra_libraries "") +set(_extra_src "") ### OPTIONAL AppData XML support in PackageModel # # # TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option( WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON ) -if ( WITH_APPDATA ) +option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(WITH_APPDATA) find_package(Qt5 COMPONENTS Xml) - if ( Qt5Xml_FOUND ) - add_definitions( -DHAVE_APPDATA ) - list( APPEND _extra_libraries Qt5::Xml ) - list( APPEND _extra_src ItemAppData.cpp ) + if(Qt5Xml_FOUND) + add_definitions(-DHAVE_APPDATA) + list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_src ItemAppData.cpp) endif() endif() ### OPTIONAL AppStream support in PackageModel # # -option( WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON ) -if ( WITH_APPSTREAM ) +option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(WITH_APPSTREAM) find_package(AppStreamQt) set_package_properties( - AppStreamQt PROPERTIES + AppStreamQt + PROPERTIES DESCRIPTION "Support for AppStream (cache) data" URL "https://github.com/ximion/appstream" PURPOSE "AppStream provides package data" TYPE OPTIONAL ) - if ( AppStreamQt_FOUND ) - add_definitions( -DHAVE_APPSTREAM ) - list( APPEND _extra_libraries AppStreamQt ) - list( APPEND _extra_src ItemAppStream.cpp ) + if(AppStreamQt_FOUND) + add_definitions(-DHAVE_APPSTREAM) + list(APPEND _extra_libraries AppStreamQt) + list(APPEND _extra_src ItemAppStream.cpp) endif() endif() -calamares_add_plugin( packagechooser +calamares_add_plugin(packagechooser TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -62,9 +63,6 @@ calamares_add_plugin( packagechooser calamares_add_test( packagechoosertest GUI - SOURCES - Tests.cpp - LIBRARIES - calamares_viewmodule_packagechooser - ${_extra_libraries} + SOURCES Tests.cpp + LIBRARIES calamares_viewmodule_packagechooser ${_extra_libraries} ) diff --git a/src/modules/packagechooserq/CMakeLists.txt b/src/modules/packagechooserq/CMakeLists.txt index 51a17e215..0b2c4b23a 100644 --- a/src/modules/packagechooserq/CMakeLists.txt +++ b/src/modules/packagechooserq/CMakeLists.txt @@ -4,55 +4,56 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "packagechooserq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) # include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser ) -set( _packagechooser ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser ) -include_directories( ${_packagechooser} ) +set(_packagechooser ${CMAKE_CURRENT_SOURCE_DIR}/../packagechooser) +include_directories(${_packagechooser}) ### OPTIONAL AppData XML support in PackageModel # # # TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option( WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON ) -if ( WITH_APPDATA ) +option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(WITH_APPDATA) find_package(Qt5 COMPONENTS Xml) - if ( Qt5Xml_FOUND ) - add_definitions( -DHAVE_APPDATA ) - list( APPEND _extra_libraries Qt5::Xml ) - list( APPEND _extra_src ${_packagechooser}/ItemAppData.cpp ) + if(Qt5Xml_FOUND) + add_definitions(-DHAVE_APPDATA) + list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp) endif() endif() ### OPTIONAL AppStream support in PackageModel # # -option( WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON ) -if ( WITH_APPSTREAM ) +option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(WITH_APPSTREAM) find_package(AppStreamQt) set_package_properties( - AppStreamQt PROPERTIES + AppStreamQt + PROPERTIES DESCRIPTION "Support for AppStream (cache) data" URL "https://github.com/ximion/appstream" PURPOSE "AppStream provides package data" TYPE OPTIONAL ) - if ( AppStreamQt_FOUND ) - add_definitions( -DHAVE_APPSTREAM ) - list( APPEND _extra_libraries AppStreamQt ) - list( APPEND _extra_src ${_packagechooser}/ItemAppStream.cpp ) + if(AppStreamQt_FOUND) + add_definitions(-DHAVE_APPSTREAM) + list(APPEND _extra_libraries AppStreamQt) + list(APPEND _extra_src ${_packagechooser}/ItemAppStream.cpp) endif() endif() -calamares_add_plugin( packagechooserq +calamares_add_plugin(packagechooserq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/packages/tests/CMakeTests.txt b/src/modules/packages/tests/CMakeTests.txt index 4f7d6185f..a131735ce 100644 --- a/src/modules/packages/tests/CMakeTests.txt +++ b/src/modules/packages/tests/CMakeTests.txt @@ -14,29 +14,33 @@ add_test( ) add_test( NAME configure-packages-${_pm}-ops-1 - COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-1.yaml 4 1 1 + COMMAND + env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-1.yaml + 4 1 1 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) add_test( NAME configure-packages-${_pm}-ops-2 - COMMAND env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml 3 0 0 + COMMAND + env PYTHONPATH=.: python3 ${CMAKE_CURRENT_LIST_DIR}/test-pm-${_pm}.py ${CMAKE_CURRENT_LIST_DIR}/pm-pacman-2.yaml + 3 0 0 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -if ( BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE ) - set( _module packages ) - set( _schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml" ) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) + set(_module packages) + set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml") message(STATUS "Schema ${_schema_file}") - foreach( _cf pm-pacman-1.yaml pm-pacman-2.yaml ) - set( _conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/tests/${_cf}" ) - if ( EXISTS "${_schema_file}" AND EXISTS "${_conf_file}" ) + foreach(_cf pm-pacman-1.yaml pm-pacman-2.yaml) + set(_conf_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/tests/${_cf}") + if(EXISTS "${_schema_file}" AND EXISTS "${_conf_file}") add_test( NAME validate-packages-${_cf} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + COMMAND + ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" ) else() message(FATAL_ERROR "Missing ${_conf_file}") endif() endforeach() endif() - diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index 96378d98d..8f3dfca09 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -11,41 +11,41 @@ # it will error out at runtime unless you **also** switch **off** # DEBUG_PARTITION_LAME, at which point you are welcome to shoot # yourself in the foot. -option( DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF ) -option( DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON ) +option(DEBUG_PARTITION_UNSAFE "Allow unsafe partitioning choices." OFF) +option(DEBUG_PARTITION_LAME "Unsafe partitioning will error out on exec." ON) # This is very chatty, useful mostly if you don't know what KPMCore offers. -option( DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF ) +option(DEBUG_FILESYSTEMS "Log all available Filesystems from KPMCore." OFF) -include_directories( ${CMAKE_SOURCE_DIR} ) # For 3rdparty +include_directories(${CMAKE_SOURCE_DIR}) # For 3rdparty -set( _partition_defs ) -if( DEBUG_PARTITION_UNSAFE ) - if( DEBUG_PARTITION_LAME ) - list( APPEND _partition_defs DEBUG_PARTITION_LAME ) +set(_partition_defs) +if(DEBUG_PARTITION_UNSAFE) + if(DEBUG_PARTITION_LAME) + list(APPEND _partition_defs DEBUG_PARTITION_LAME) endif() - list( APPEND _partition_defs DEBUG_PARTITION_UNSAFE ) + list(APPEND _partition_defs DEBUG_PARTITION_UNSAFE) endif() -if ( DEBUG_FILESYSTEMS ) - list( APPEND _partition_defs DEBUG_FILESYSTEMS ) +if(DEBUG_FILESYSTEMS) + list(APPEND _partition_defs DEBUG_FILESYSTEMS) endif() find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) -include( KPMcoreHelper ) +include(KPMcoreHelper) -find_package( KF5Config CONFIG ) -find_package( KF5I18n CONFIG ) -find_package( KF5WidgetsAddons CONFIG ) +find_package(KF5Config CONFIG) +find_package(KF5I18n CONFIG) +find_package(KF5WidgetsAddons CONFIG) -if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND ) - list( APPEND _partition_defs ${KPMcore_API_DEFINITIONS} ) - include_directories( ${KPMCORE_INCLUDE_DIR} ) - include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +if(KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND) + list(APPEND _partition_defs ${KPMcore_API_DEFINITIONS}) + include_directories(${KPMCORE_INCLUDE_DIR}) + include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) - add_subdirectory( tests ) + add_subdirectory(tests) - calamares_add_plugin( partition + calamares_add_plugin(partition TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -113,10 +113,9 @@ if ( KPMcore_FOUND AND Qt5DBus_FOUND AND KF5CoreAddons_FOUND AND KF5Config_FOUND SHARED_LIB ) else() - if ( NOT KPMcore_FOUND ) + if(NOT KPMcore_FOUND) calamares_skip_module( "partition (missing suitable KPMcore)" ) else() calamares_skip_module( "partition (missing dependencies for KPMcore)" ) endif() endif() - diff --git a/src/modules/partition/tests/CMakeLists.txt b/src/modules/partition/tests/CMakeLists.txt index da017d96f..26a1d83f9 100644 --- a/src/modules/partition/tests/CMakeLists.txt +++ b/src/modules/partition/tests/CMakeLists.txt @@ -3,9 +3,9 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 COMPONENTS Gui REQUIRED ) +find_package(Qt5 COMPONENTS Gui REQUIRED) -set( PartitionModule_SOURCE_DIR .. ) +set(PartitionModule_SOURCE_DIR ..) include_directories( ${Qt5Gui_INCLUDE_DIRS} @@ -25,22 +25,17 @@ calamares_add_test( ${PartitionModule_SOURCE_DIR}/jobs/DeletePartitionJob.cpp ${PartitionModule_SOURCE_DIR}/jobs/PartitionJob.cpp ${PartitionModule_SOURCE_DIR}/jobs/ResizePartitionJob.cpp - LIBRARIES - kpmcore + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) calamares_add_test( partitionclearmountsjobtest - SOURCES - ${PartitionModule_SOURCE_DIR}/jobs/ClearMountsJob.cpp - ClearMountsJobTests.cpp - LIBRARIES - kpmcore + SOURCES ${PartitionModule_SOURCE_DIR}/jobs/ClearMountsJob.cpp ClearMountsJobTests.cpp + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) - calamares_add_test( partitioncreatelayoutstest SOURCES @@ -50,26 +45,19 @@ calamares_add_test( ${PartitionModule_SOURCE_DIR}/core/PartitionLayout.cpp ${PartitionModule_SOURCE_DIR}/core/PartUtils.cpp ${PartitionModule_SOURCE_DIR}/core/DeviceModel.cpp - LIBRARIES - kpmcore - Calamares::calamaresui + LIBRARIES kpmcore Calamares::calamaresui DEFINITIONS ${_partition_defs} ) calamares_add_test( partitionautomounttest - SOURCES - ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp - AutoMountTests.cpp + SOURCES ${PartitionModule_SOURCE_DIR}/jobs/AutoMountManagementJob.cpp AutoMountTests.cpp DEFINITIONS ${_partition_defs} ) calamares_add_test( partitiondevicestest - SOURCES - DevicesTests.cpp - ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp - LIBRARIES - kpmcore + SOURCES DevicesTests.cpp ${PartitionModule_SOURCE_DIR}/core/DeviceList.cpp + LIBRARIES kpmcore DEFINITIONS ${_partition_defs} ) diff --git a/src/modules/plasmalnf/CMakeLists.txt b/src/modules/plasmalnf/CMakeLists.txt index 8ae205aed..9e87b5fec 100644 --- a/src/modules/plasmalnf/CMakeLists.txt +++ b/src/modules/plasmalnf/CMakeLists.txt @@ -7,28 +7,19 @@ find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE) # Requires a sufficiently recent Plasma framework, but also # needs a runtime support component (which we don't test for). -set( lnf_ver 5.41 ) +set(lnf_ver 5.41) -find_package( KF5Config ${lnf_ver} ) -set_package_properties( - KF5Config PROPERTIES - PURPOSE "For finding default Plasma Look-and-Feel" -) +find_package(KF5Config ${lnf_ver}) +set_package_properties(KF5Config PROPERTIES PURPOSE "For finding default Plasma Look-and-Feel") -find_package( KF5Plasma ${lnf_ver} ) -set_package_properties( - KF5Plasma PROPERTIES - PURPOSE "For Plasma Look-and-Feel selection" -) +find_package(KF5Plasma ${lnf_ver}) +set_package_properties(KF5Plasma PROPERTIES PURPOSE "For Plasma Look-and-Feel selection") -find_package( KF5Package ${lnf_ver} ) -set_package_properties( - KF5Package PROPERTIES - PURPOSE "For Plasma Look-and-Feel selection" -) +find_package(KF5Package ${lnf_ver}) +set_package_properties(KF5Package PROPERTIES PURPOSE "For Plasma Look-and-Feel selection") -if ( KF5Plasma_FOUND AND KF5Package_FOUND ) - calamares_add_plugin( plasmalnf +if(KF5Plasma_FOUND AND KF5Package_FOUND) + calamares_add_plugin(plasmalnf TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO COMPILE_DEFINITIONS @@ -48,7 +39,7 @@ if ( KF5Plasma_FOUND AND KF5Package_FOUND ) KF5::Plasma SHARED_LIB ) - if ( KF5Config_FOUND ) + if(KF5Config_FOUND) target_compile_definitions(calamares_viewmodule_plasmalnf PRIVATE WITH_KCONFIG) endif() else() diff --git a/src/modules/preservefiles/CMakeLists.txt b/src/modules/preservefiles/CMakeLists.txt index 5df637321..b11b1310c 100644 --- a/src/modules/preservefiles/CMakeLists.txt +++ b/src/modules/preservefiles/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( preservefiles +calamares_add_plugin(preservefiles TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -14,9 +14,4 @@ calamares_add_plugin( preservefiles EMERGENCY ) -calamares_add_test( - preservefilestest - SOURCES - Item.cpp - Tests.cpp -) +calamares_add_test(preservefilestest SOURCES Item.cpp Tests.cpp) diff --git a/src/modules/removeuser/CMakeLists.txt b/src/modules/removeuser/CMakeLists.txt index 7663b3472..eaaf20157 100644 --- a/src/modules/removeuser/CMakeLists.txt +++ b/src/modules/removeuser/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( removeuser +calamares_add_plugin(removeuser TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/shellprocess/CMakeLists.txt b/src/modules/shellprocess/CMakeLists.txt index ac6630c6d..8ac444fb6 100644 --- a/src/modules/shellprocess/CMakeLists.txt +++ b/src/modules/shellprocess/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( shellprocess +calamares_add_plugin(shellprocess TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -11,10 +11,4 @@ calamares_add_plugin( shellprocess SHARED_LIB ) -calamares_add_test( - shellprocesstest - SOURCES - Tests.cpp - LIBRARIES - yamlcpp::yamlcpp -) +calamares_add_test(shellprocesstest SOURCES Tests.cpp LIBRARIES yamlcpp::yamlcpp) diff --git a/src/modules/summary/CMakeLists.txt b/src/modules/summary/CMakeLists.txt index e3c1a381c..16f98ebb4 100644 --- a/src/modules/summary/CMakeLists.txt +++ b/src/modules/summary/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) -calamares_add_plugin( summary +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) +calamares_add_plugin(summary TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/summaryq/CMakeLists.txt b/src/modules/summaryq/CMakeLists.txt index 8aac1bc2f..071c344ef 100644 --- a/src/modules/summaryq/CMakeLists.txt +++ b/src/modules/summaryq/CMakeLists.txt @@ -3,15 +3,15 @@ # SPDX-FileCopyrightText: 2021 Anke Boersma # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "summaryq (QML is not supported in this build)" ) return() endif() -set( _summary ${CMAKE_CURRENT_SOURCE_DIR}/../summary ) -include_directories( ${_summary} ) +set(_summary ${CMAKE_CURRENT_SOURCE_DIR}/../summary) +include_directories(${_summary}) -calamares_add_plugin( summaryq +calamares_add_plugin(summaryq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/umount/CMakeLists.txt b/src/modules/umount/CMakeLists.txt index d72847007..09e6a085d 100644 --- a/src/modules/umount/CMakeLists.txt +++ b/src/modules/umount/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2021 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( umount +calamares_add_plugin(umount TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -12,8 +12,4 @@ calamares_add_plugin( umount EMERGENCY ) -calamares_add_test( - umounttest - SOURCES - Tests.cpp -) +calamares_add_test(umounttest SOURCES Tests.cpp) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index 8203ecf08..1ee9832c4 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -3,39 +3,33 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network ) -find_package( Crypt REQUIRED ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network) +find_package(Crypt REQUIRED) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) -find_package( LibPWQuality ) -set_package_properties( - LibPWQuality PROPERTIES - PURPOSE "Extra checks of password quality" -) +find_package(LibPWQuality) +set_package_properties(LibPWQuality PROPERTIES PURPOSE "Extra checks of password quality") -if( LibPWQuality_FOUND ) - list( APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES} ) - include_directories( ${LibPWQuality_INCLUDE_DIRS} ) - add_definitions( -DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY ) +if(LibPWQuality_FOUND) + list(APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES}) + include_directories(${LibPWQuality_INCLUDE_DIRS}) + add_definitions(-DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY) endif() -find_package( ICU COMPONENTS uc i18n ) -set_package_properties( - ICU PROPERTIES - PURPOSE "Transliteration support for full name to username conversion" -) +find_package(ICU COMPONENTS uc i18n) +set_package_properties(ICU PROPERTIES PURPOSE "Transliteration support for full name to username conversion") -if( ICU_FOUND ) - list( APPEND USER_EXTRA_LIB ICU::uc ICU::i18n ) - include_directories( ${ICU_INCLUDE_DIRS} ) - add_definitions( -DHAVE_ICU ) +if(ICU_FOUND) + list(APPEND USER_EXTRA_LIB ICU::uc ICU::i18n) + include_directories(${ICU_INCLUDE_DIRS}) + add_definitions(-DHAVE_ICU) endif() -include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) +include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) -set( _users_src +set(_users_src # Jobs CreateUserJob.cpp MiscJobs.cpp @@ -59,7 +53,7 @@ calamares_add_library( ${CRYPT_LIBRARIES} ) -calamares_add_plugin( users +calamares_add_plugin(users TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -76,42 +70,33 @@ calamares_add_plugin( users SHARED_LIB ) -calamares_add_test( - userspasswordtest - SOURCES - TestPasswordJob.cpp - SetPasswordJob.cpp - LIBRARIES - ${CRYPT_LIBRARIES} -) +calamares_add_test(userspasswordtest SOURCES TestPasswordJob.cpp SetPasswordJob.cpp LIBRARIES ${CRYPT_LIBRARIES}) calamares_add_test( usersgroupstest SOURCES TestGroupInformation.cpp - ${_users_src} # Build again with test-visibility + ${_users_src} # Build again with test-visibility LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd - ${CRYPT_LIBRARIES} # SetPassword job uses crypt() + Qt5::DBus # HostName job can use DBus to systemd + ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} ) calamares_add_test( usershostnametest - SOURCES - TestSetHostNameJob.cpp - SetHostNameJob.cpp + SOURCES TestSetHostNameJob.cpp SetHostNameJob.cpp LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd + Qt5::DBus # HostName job can use DBus to systemd ) calamares_add_test( userstest SOURCES Tests.cpp - ${_users_src} # Build again with test-visibility + ${_users_src} # Build again with test-visibility LIBRARIES - Qt5::DBus # HostName job can use DBus to systemd - ${CRYPT_LIBRARIES} # SetPassword job uses crypt() + Qt5::DBus # HostName job can use DBus to systemd + ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} ) diff --git a/src/modules/usersq/CMakeLists.txt b/src/modules/usersq/CMakeLists.txt index 8465b0246..33133f439 100644 --- a/src/modules/usersq/CMakeLists.txt +++ b/src/modules/usersq/CMakeLists.txt @@ -3,45 +3,39 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "usersq (QML is not supported in this build)" ) return() endif() -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network ) -find_package( Crypt REQUIRED ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core DBus Network) +find_package(Crypt REQUIRED) # Add optional libraries here -set( USER_EXTRA_LIB ) +set(USER_EXTRA_LIB) -include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../users ) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../users) -find_package( LibPWQuality ) -set_package_properties( - LibPWQuality PROPERTIES - PURPOSE "Extra checks of password quality" -) +find_package(LibPWQuality) +set_package_properties(LibPWQuality PROPERTIES PURPOSE "Extra checks of password quality") -if( LibPWQuality_FOUND ) - list( APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES} ) - include_directories( ${LibPWQuality_INCLUDE_DIRS} ) - add_definitions( -DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY ) +if(LibPWQuality_FOUND) + list(APPEND USER_EXTRA_LIB ${LibPWQuality_LIBRARIES}) + include_directories(${LibPWQuality_INCLUDE_DIRS}) + add_definitions(-DCHECK_PWQUALITY -DHAVE_LIBPWQUALITY) endif() #needed for ${_users}/Config.cpp -find_package( ICU COMPONENTS uc i18n ) -set_package_properties( - ICU PROPERTIES - PURPOSE "Transliteration support for full name to username conversion" -) +find_package(ICU COMPONENTS uc i18n) +set_package_properties(ICU PROPERTIES PURPOSE "Transliteration support for full name to username conversion") -if( ICU_FOUND ) - list( APPEND USER_EXTRA_LIB ICU::uc ICU::i18n ) - include_directories( ${ICU_INCLUDE_DIRS} ) - add_definitions( -DHAVE_ICU ) +if(ICU_FOUND) + list(APPEND USER_EXTRA_LIB ICU::uc ICU::i18n) + include_directories(${ICU_INCLUDE_DIRS}) + add_definitions(-DHAVE_ICU) endif() -calamares_add_plugin( usersq +calamares_add_plugin(usersq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/webview/CMakeLists.txt b/src/modules/webview/CMakeLists.txt index 54e1d18b0..b8ef5d7d4 100644 --- a/src/modules/webview/CMakeLists.txt +++ b/src/modules/webview/CMakeLists.txt @@ -3,52 +3,41 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -set( CALA_WEBVIEW_LINK_LIBRARIES "" ) +set(CALA_WEBVIEW_LINK_LIBRARIES "") -option( WEBVIEW_FORCE_WEBKIT "Always build webview with WebKit instead of WebEngine regardless of Qt version." OFF) +option(WEBVIEW_FORCE_WEBKIT "Always build webview with WebKit instead of WebEngine regardless of Qt version." OFF) -set( _reason "" ) +set(_reason "") -message( STATUS "Found Qt version ${Qt5Core_VERSION}") -if ( Qt5Core_VERSION VERSION_LESS 5.6 OR WEBVIEW_FORCE_WEBKIT ) - message( STATUS " .. using webkit") - find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS WebKit WebKitWidgets ) +message(STATUS "Found Qt version ${Qt5Core_VERSION}") +if(Qt5Core_VERSION VERSION_LESS 5.6 OR WEBVIEW_FORCE_WEBKIT) + message(STATUS " .. using webkit") + find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS WebKit WebKitWidgets) - if ( Qt5WebKit_FOUND AND Qt5WebKitWidgets_FOUND ) - list( APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES - ${QT_QTWEBKIT_INCLUDE_DIR} - ) - list( APPEND CALA_WEBVIEW_LINK_LIBRARIES - Qt5::WebKit - Qt5::WebKitWidgets - ) - set( WEBVIEW_WITH_WEBKIT 1 ) + if(Qt5WebKit_FOUND AND Qt5WebKitWidgets_FOUND) + list(APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES ${QT_QTWEBKIT_INCLUDE_DIR}) + list(APPEND CALA_WEBVIEW_LINK_LIBRARIES Qt5::WebKit Qt5::WebKitWidgets) + set(WEBVIEW_WITH_WEBKIT 1) else() - set( _reason "No suitable WebKit" ) + set(_reason "No suitable WebKit") endif() else() - message( STATUS " .. using webengine") - find_package( Qt5 ${QT_VERSION} CONFIG COMPONENTS WebEngine WebEngineWidgets ) + message(STATUS " .. using webengine") + find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS WebEngine WebEngineWidgets) - if ( Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND ) - list( APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES - ${QT_QTWEBENGINE_INCLUDE_DIR} - ) - list( APPEND CALA_WEBVIEW_LINK_LIBRARIES - Qt5::WebEngine - Qt5::WebEngineWidgets - ) - set( WEBVIEW_WITH_WEBENGINE 1 ) + if(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND) + list(APPEND CALA_WEBVIEW_INCLUDE_DIRECTORIES ${QT_QTWEBENGINE_INCLUDE_DIR}) + list(APPEND CALA_WEBVIEW_LINK_LIBRARIES Qt5::WebEngine Qt5::WebEngineWidgets) + set(WEBVIEW_WITH_WEBENGINE 1) else() - set( _reason "No suitable WebEngine" ) + set(_reason "No suitable WebEngine") endif() endif() -if ( NOT _reason ) - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/WebViewConfig.h.in - ${CMAKE_CURRENT_BINARY_DIR}/WebViewConfig.h ) +if(NOT _reason) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/WebViewConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/WebViewConfig.h) - calamares_add_plugin( webview + calamares_add_plugin(webview TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 01a89703a..c8fb13590 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -3,19 +3,19 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -find_package( LIBPARTED ) -if ( LIBPARTED_FOUND ) - set( PARTMAN_SRC checker/partman_devices.c ) - set( PARTMAN_LIB ${LIBPARTED_LIBRARY} ) +find_package(LIBPARTED) +if(LIBPARTED_FOUND) + set(PARTMAN_SRC checker/partman_devices.c) + set(PARTMAN_LIB ${LIBPARTED_LIBRARY}) else() - set( PARTMAN_SRC ) - set( PARTMAN_LIB ) - add_definitions( -DWITHOUT_LIBPARTED ) + set(PARTMAN_SRC) + set(PARTMAN_LIB) + add_definitions(-DWITHOUT_LIBPARTED) endif() -calamares_add_plugin( welcome +calamares_add_plugin(welcome TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES @@ -41,15 +41,6 @@ calamares_add_plugin( welcome calamares_add_test( welcometest - SOURCES - checker/GeneralRequirements.cpp - ${PARTMAN_SRC} - Config.cpp - Tests.cpp - LIBRARIES - ${PARTMAN_LIB} - Qt5::DBus - Qt5::Network - Qt5::Widgets - Calamares::calamaresui + SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp + LIBRARIES ${PARTMAN_LIB} Qt5::DBus Qt5::Network Qt5::Widgets Calamares::calamaresui ) diff --git a/src/modules/welcomeq/CMakeLists.txt b/src/modules/welcomeq/CMakeLists.txt index b6f950dad..7afdf638c 100644 --- a/src/modules/welcomeq/CMakeLists.txt +++ b/src/modules/welcomeq/CMakeLists.txt @@ -7,34 +7,31 @@ # This is a re-write of the welcome module using QML view steps # instead of widgets. -if( NOT WITH_QML ) +if(NOT WITH_QML) calamares_skip_module( "welcomeq (QML is not supported in this build)" ) return() endif() -set( _welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome ) +set(_welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome) -include_directories( ${_welcome} ) +include_directories(${_welcome}) # DUPLICATED WITH WELCOME MODULE -find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) -find_package( LIBPARTED ) -if ( LIBPARTED_FOUND ) - set( PARTMAN_SRC ${_welcome}/checker/partman_devices.c ) - set( CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY} ) +find_package(LIBPARTED) +if(LIBPARTED_FOUND) + set(PARTMAN_SRC ${_welcome}/checker/partman_devices.c) + set(CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY}) else() - set( PARTMAN_SRC ) - set( CHECKER_LINK_LIBRARIES ) - add_definitions( -DWITHOUT_LIBPARTED ) + set(PARTMAN_SRC) + set(CHECKER_LINK_LIBRARIES) + add_definitions(-DWITHOUT_LIBPARTED) endif() -set( CHECKER_SOURCES - ${_welcome}/checker/GeneralRequirements.cpp - ${PARTMAN_SRC} -) +set(CHECKER_SOURCES ${_welcome}/checker/GeneralRequirements.cpp ${PARTMAN_SRC}) -calamares_add_plugin( welcomeq +calamares_add_plugin(welcomeq TYPE viewmodule EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES diff --git a/src/modules/zfs/CMakeLists.txt b/src/modules/zfs/CMakeLists.txt index 2feb911d0..07764a360 100644 --- a/src/modules/zfs/CMakeLists.txt +++ b/src/modules/zfs/CMakeLists.txt @@ -3,11 +3,10 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -calamares_add_plugin( zfs +calamares_add_plugin(zfs TYPE job EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES ZfsJob.cpp SHARED_LIB ) - diff --git a/src/qml/calamares/CMakeLists.txt b/src/qml/calamares/CMakeLists.txt index d74e79ea0..07e376bfa 100644 --- a/src/qml/calamares/CMakeLists.txt +++ b/src/qml/calamares/CMakeLists.txt @@ -12,29 +12,31 @@ # Iterate over all the subdirectories which have a qmldir file, copy them over to the build dir, # and install them into share/calamares/qml/calamares -file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" ) -foreach( SUBDIRECTORY ${SUBDIRECTORIES} ) - if( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" - AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir" ) - - set( QML_DIR share/calamares/qml ) - set( QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY} ) +file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") +foreach(SUBDIRECTORY ${SUBDIRECTORIES}) + if( + IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}" + AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/qmldir" + ) + set(QML_DIR share/calamares/qml) + set(QML_MODULE_DESTINATION ${QML_DIR}/calamares/${SUBDIRECTORY}) # We glob all the files inside the subdirectory, and we make sure they are # synced with the bindir structure and installed. - file( GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*" ) - foreach( QML_MODULE_FILE ${QML_MODULE_FILES} ) - if( NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} ) - configure_file( ${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY ) + file(GLOB QML_MODULE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY} "${SUBDIRECTORY}/*") + foreach(QML_MODULE_FILE ${QML_MODULE_FILES}) + if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE}) + configure_file(${SUBDIRECTORY}/${QML_MODULE_FILE} ${SUBDIRECTORY}/${QML_MODULE_FILE} COPYONLY) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} - DESTINATION ${QML_MODULE_DESTINATION} ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${QML_MODULE_FILE} + DESTINATION ${QML_MODULE_DESTINATION} + ) endif() endforeach() - message( "-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}" ) - + message("-- ${BoldYellow}Configured QML module: ${BoldRed}calamares.${SUBDIRECTORY}${ColorReset}") endif() endforeach() -message( "" ) +message("") From 3b55c2805a268944e43f45a323ac3d205db66514 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:21:43 +0100 Subject: [PATCH 048/160] Changes: document formatting-tools --- CHANGES-3.3 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index f02f5cd81..cdc3f969f 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -18,6 +18,13 @@ large. Configuration files from previous versions of Calamares will **certainly** need to be re-validated. Take heed of the many changes in the *Modules* heading, below. +## Project ## + - The C++ code in the project is now formatted with clang-format 12 or 13, + with the coding-style as found in `.clang-format`; there are minor + differences from the tool, compared to the clang-format 9 usually applied + to Calamares 3.2. + - The CMake code in the project is now formatted with gersemi 0.7.5. + ## Core ## - CMake 3.16, Qt 5.15 are now required; the newer CMake is to support new features (also for KDE Frameworks), Qt is the current LTS version. From c7cc599a19e103089374341e583953a4475f2117 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:35:04 +0100 Subject: [PATCH 049/160] [umount] Remove/mark unused parameters --- src/modules/umount/UmountJob.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/umount/UmountJob.cpp b/src/modules/umount/UmountJob.cpp index b9d92fa87..bfa915d36 100644 --- a/src/modules/umount/UmountJob.cpp +++ b/src/modules/umount/UmountJob.cpp @@ -80,7 +80,7 @@ unmountTargetMounts( const QString& rootMountPoint ) } static Calamares::JobResult -exportZFSPools( const QString& rootMountPoint ) +exportZFSPools() { auto* gs = Calamares::JobQueue::instance()->globalStorage(); QStringList poolNames; @@ -140,7 +140,7 @@ UmountJob::exec() } // For ZFS systems, export the pools { - auto r = exportZFSPools( gs->value( "rootMountPoint" ).toString() ); + auto r = exportZFSPools(); if ( !r ) { return r; @@ -153,6 +153,7 @@ UmountJob::exec() void UmountJob::setConfigurationMap( const QVariantMap& map ) { + Q_UNUSED( map ) } CALAMARES_PLUGIN_FACTORY_DEFINITION( UmountJobFactory, registerPlugin< UmountJob >(); ) From 7f14aa6bf120a86651c4998e280153593db724c8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:35:23 +0100 Subject: [PATCH 050/160] [libcalamares] Avoid warnings about KPMCore headers --- src/libcalamares/partition/KPMHelper.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcalamares/partition/KPMHelper.h b/src/libcalamares/partition/KPMHelper.h index f6007b119..e61c31956 100644 --- a/src/libcalamares/partition/KPMHelper.h +++ b/src/libcalamares/partition/KPMHelper.h @@ -25,6 +25,8 @@ #pragma clang diagnostic ignored "-Wdocumentation" #pragma clang diagnostic ignored "-Wsuggest-destructor-override" #pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override" +// Because of __lastType +#pragma clang diagnostic ignored "-Wreserved-identifier" #endif #include From a59c45d8696d7b7270e2596d2f0b3545d25bbcbf Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:35:50 +0100 Subject: [PATCH 051/160] [users] Rename macro to avoid reserved-to-the-implementation names --- src/modules/users/CheckPWQuality.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/users/CheckPWQuality.h b/src/modules/users/CheckPWQuality.h index 6d7fb56df..db2cba0af 100644 --- a/src/modules/users/CheckPWQuality.h +++ b/src/modules/users/CheckPWQuality.h @@ -67,9 +67,9 @@ using PasswordCheckList = QVector< PasswordCheck >; * may skip adding a check, and do nothing (it should log * an error, though). */ -#define _xDEFINE_CHECK_FUNC( x ) add_check_##x( PasswordCheckList& checks, const QVariant& value ) -#define DEFINE_CHECK_FUNC( x ) void _xDEFINE_CHECK_FUNC( x ) -#define DECLARE_CHECK_FUNC( x ) void _xDEFINE_CHECK_FUNC( x ); +#define DEFINE_CHECK_FUNC_impl( x ) add_check_##x( PasswordCheckList& checks, const QVariant& value ) +#define DEFINE_CHECK_FUNC( x ) void DEFINE_CHECK_FUNC_impl( x ) +#define DECLARE_CHECK_FUNC( x ) void DEFINE_CHECK_FUNC_impl( x ); DECLARE_CHECK_FUNC( minLength ) DECLARE_CHECK_FUNC( maxLength ) From 0be88f1453454bed2f42553676e028bb388dc1a0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 16:42:31 +0100 Subject: [PATCH 052/160] [partition] Use signed sizes --- src/modules/partition/core/PartUtils.cpp | 8 ++++---- src/modules/partition/core/PartUtils.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index cb7c8a01d..a4ec7fe0b 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -479,7 +479,7 @@ isEfiFilesystemSuitableSize( const Partition* candidate ) return false; } - if ( size_t( size ) >= efiFilesystemMinimumSize() ) + if ( size >= efiFilesystemMinimumSize() ) { return true; } @@ -524,12 +524,12 @@ isEfiBootable( const Partition* candidate ) } // TODO: this is configurable via the config file **already** -size_t +qint64 efiFilesystemMinimumSize() { using CalamaresUtils::Units::operator""_MiB; - size_t uefisys_part_sizeB = 300_MiB; + qint64 uefisys_part_sizeB = 300_MiB; // The default can be overridden; the key used here comes // from the partition module Config.cpp @@ -537,7 +537,7 @@ efiFilesystemMinimumSize() if ( gs->contains( "efiSystemPartitionSize_i" ) ) { qint64 v = gs->value( "efiSystemPartitionSize_i" ).toLongLong(); - uefisys_part_sizeB = v > 0 ? static_cast< size_t >( v ) : 0; + uefisys_part_sizeB = v > 0 ? v : 0; } // There is a lower limit of what can be configured if ( uefisys_part_sizeB < 32_MiB ) diff --git a/src/modules/partition/core/PartUtils.h b/src/modules/partition/core/PartUtils.h index 31b4cde84..f3c51df45 100644 --- a/src/modules/partition/core/PartUtils.h +++ b/src/modules/partition/core/PartUtils.h @@ -107,7 +107,7 @@ bool isEfiFilesystemSuitableSize( const Partition* candidate ); * * A minimum of 32MiB (which is bonkers-small) is enforced. */ -size_t efiFilesystemMinimumSize(); +qint64 efiFilesystemMinimumSize(); /** * @brief Is the given @p partition bootable in EFI? Depending on From 03291fb726f82aa5091d01ef597f7855df819726 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 8 Feb 2022 19:01:41 +0100 Subject: [PATCH 053/160] [partition] Don't set empty labels --- src/modules/partition/core/PartitionCoreModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 989327ef0..bfa2011dd 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -553,6 +553,11 @@ PartitionCoreModule::formatPartition( Device* device, Partition* partition ) void PartitionCoreModule::setFilesystemLabel( Device* device, Partition* partition, const QString& newLabel ) { + if ( newLabel.isEmpty() ) + { + // Don't bother + return; + } auto deviceInfo = infoForDevice( device ); Q_ASSERT( deviceInfo ); From 1793c627cd0ae10438982a717647dd12fa79e758 Mon Sep 17 00:00:00 2001 From: Huang Jia Wen Date: Thu, 3 Mar 2022 14:11:32 +0800 Subject: [PATCH 054/160] [bootloader] Add loongarch64 support for bootloader --- src/modules/bootloader/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index e71823dc6..123d294fd 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -401,6 +401,8 @@ def get_grub_efi_parameters(): return ("i386-efi", "grubia32.efi", "bootia32.efi") elif efi_bitness == "64" and cpu_type == "aarch64": return ("arm64-efi", "grubaa64.efi", "bootaa64.efi") + elif efi_bitness == "64" and cpu_type == "loongarch64": + return ("loongarch64-efi", "grubloongarch64.efi", "bootloongarch64.efi") elif efi_bitness == "64": # If it's not ARM, must by AMD64 return ("x86_64-efi", "grubx64.efi", "bootx64.efi") From aedb55ea36ed85060e437014ba5ce12f876aae99 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 21 Mar 2022 23:44:20 +0100 Subject: [PATCH 055/160] [partition] Require modern KPMCore --- CMakeModules/KPMcoreHelper.cmake | 14 +---------- src/libcalamares/partition/Global.h | 7 +----- src/libcalamares/partition/KPMManager.cpp | 24 +------------------ src/libcalamares/partition/KPMTests.cpp | 8 ------- src/libcalamares/partition/PartitionQuery.cpp | 7 +----- src/modules/fsresizer/ResizeFSJob.cpp | 4 ---- src/modules/partition/PartitionViewStep.cpp | 7 +----- src/modules/partition/core/DeviceList.cpp | 4 ---- src/modules/partition/core/KPMHelpers.h | 7 +----- src/modules/partition/core/PartUtils.cpp | 24 ------------------- .../partition/core/PartitionCoreModule.cpp | 7 ------ .../partition/core/PartitionLayout.cpp | 16 ------------- src/modules/partition/gui/ChoicePage.cpp | 4 ---- .../partition/gui/DeviceInfoWidget.cpp | 2 -- src/modules/partition/gui/PartitionPage.cpp | 4 ---- .../partition/jobs/CreatePartitionJob.cpp | 4 ---- .../partition/jobs/FillGlobalStorageJob.cpp | 2 -- .../partition/tests/CreateLayoutsTests.cpp | 7 ------ src/modules/partition/tests/DevicesTests.cpp | 7 +----- 19 files changed, 7 insertions(+), 152 deletions(-) diff --git a/CMakeModules/KPMcoreHelper.cmake b/CMakeModules/KPMcoreHelper.cmake index 6aacfc95c..05dff18dd 100644 --- a/CMakeModules/KPMcoreHelper.cmake +++ b/CMakeModules/KPMcoreHelper.cmake @@ -10,7 +10,7 @@ if ( NOT KPMcore_searched_for ) set( KPMcore_searched_for TRUE ) - find_package( KPMcore 3.3 ) + find_package( KPMcore 21.12.0 ) set_package_properties( KPMcore PROPERTIES URL "https://invent.kde.org/kde/kpmcore" @@ -21,18 +21,6 @@ if ( NOT KPMcore_searched_for ) if( KPMcore_FOUND ) set( KPMcore_API_DEFINITIONS "" ) - if( KPMcore_VERSION VERSION_GREATER "3.3.70" AND KPMcore_VERSION VERSION_LESS "4.0" ) - message( FATAL_ERROR "KPMCore beta versions ${KPMcore_VERSION} not supported" ) - endif() - if ( KPMcore_VERSION VERSION_GREATER "3.3.0") - list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE331API) # kpmcore > 3.3.0 with deprecations - endif() - if ( KPMcore_VERSION VERSION_GREATER_EQUAL "4.0") - list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE4API) # kpmcore 4 with new API - endif() - if( KPMcore_VERSION VERSION_GREATER_EQUAL "4.2" ) - list( APPEND KPMcore_API_DEFINITIONS WITH_KPMCORE42API) # kpmcore 4.2 with new API - endif() else() set( KPMcore_API_DEFINITIONS WITHOUT_KPMcore ) endif() diff --git a/src/libcalamares/partition/Global.h b/src/libcalamares/partition/Global.h index 733e2f69c..b76c74c58 100644 --- a/src/libcalamares/partition/Global.h +++ b/src/libcalamares/partition/Global.h @@ -17,13 +17,10 @@ #define PARTITION_GLOBAL_H #include "DllMacro.h" +#include "FileSystem.h" #include "JobQueue.h" -#ifdef WITH_KPMCORE4API -#include "FileSystem.h" - #include -#endif namespace CalamaresUtils { @@ -78,7 +75,6 @@ isFilesystemUsedGS( const QString& filesystemType ) return isFilesystemUsedGS( Calamares::JobQueue::instanceGlobalStorage(), filesystemType ); } -#ifdef WITH_KPMCORE4API /** @brief Mark a particular filesystem type as used (or not) * * See useFilesystemGS(const QString&, bool); this method uses the filesystem type @@ -100,7 +96,6 @@ isFilesystemUsedGS( FileSystem::Type filesystem ) return isFilesystemUsedGS( untranslatedFS( filesystem ) ); } -#endif } // namespace Partition } // namespace CalamaresUtils diff --git a/src/libcalamares/partition/KPMManager.cpp b/src/libcalamares/partition/KPMManager.cpp index ff7701703..7220b6151 100644 --- a/src/libcalamares/partition/KPMManager.cpp +++ b/src/libcalamares/partition/KPMManager.cpp @@ -14,10 +14,7 @@ #include #include -#if defined( WITH_KPMCORE4API ) #include -#endif - #include @@ -30,7 +27,6 @@ class InternalManager { public: InternalManager(); - ~InternalManager(); }; static bool s_kpm_loaded = false; @@ -69,22 +65,6 @@ InternalManager::InternalManager() } } -InternalManager::~InternalManager() -{ -#if defined( WITH_KPMCORE4API ) && !defined( WITH_KPMCORE42API ) - cDebug() << "Cleaning up KPMCore backend .."; - - // From KPMcore 4.0 until KPMcore 4.2 we needed to stop - // the helper by hand. KPMcore 4.2 ported to polkit directly, - // which doesn't need a helper. - auto backend_p = CoreBackendManager::self()->backend(); - if ( backend_p ) - { - ExternalCommand::stopHelper(); - } -#endif -} - std::shared_ptr< InternalManager > getInternal() { @@ -102,9 +82,7 @@ KPMManager::KPMManager() { } -KPMManager::~KPMManager() -{ -} +KPMManager::~KPMManager() {} KPMManager::operator bool() const { diff --git a/src/libcalamares/partition/KPMTests.cpp b/src/libcalamares/partition/KPMTests.cpp index 3834b7913..2f828f772 100644 --- a/src/libcalamares/partition/KPMTests.cpp +++ b/src/libcalamares/partition/KPMTests.cpp @@ -57,18 +57,10 @@ KPMTests::testFlagNames() QCOMPARE( PartitionTable::flagName( static_cast< PartitionTable::Flag >( 1 ) ), QStringLiteral( "boot" ) ); -#ifdef WITH_KPMCORE4API // KPMCore 4 unifies the flags and handles them internally QCOMPARE( PartitionTable::flagName( PartitionTable::Flag::Boot ), QStringLiteral( "boot" ) ); QVERIFY( names.contains( QStringLiteral( "boot" ) ) ); QVERIFY( !names.contains( QStringLiteral( "esp" ) ) ); -#else - // KPMCore 3 has separate flags - QCOMPARE( PartitionTable::flagName( PartitionTable::FlagBoot ), QStringLiteral( "boot" ) ); - QCOMPARE( PartitionTable::flagName( PartitionTable::FlagEsp ), QStringLiteral( "esp" ) ); - QVERIFY( names.contains( QStringLiteral( "boot" ) ) ); - QVERIFY( names.contains( QStringLiteral( "esp" ) ) ); -#endif } void diff --git a/src/libcalamares/partition/PartitionQuery.cpp b/src/libcalamares/partition/PartitionQuery.cpp index 0356f920c..4d54215f3 100644 --- a/src/libcalamares/partition/PartitionQuery.cpp +++ b/src/libcalamares/partition/PartitionQuery.cpp @@ -50,12 +50,7 @@ isPartitionFreeSpace( const Partition* partition ) bool isPartitionNew( const Partition* partition ) { -#if defined( WITH_KPMCORE4API ) - constexpr auto NewState = Partition::State::New; -#else - constexpr auto NewState = Partition::StateNew; -#endif - return partition->state() == NewState; + return partition->state() == Partition::State::New; } diff --git a/src/modules/fsresizer/ResizeFSJob.cpp b/src/modules/fsresizer/ResizeFSJob.cpp index f972b9fa4..562644594 100644 --- a/src/modules/fsresizer/ResizeFSJob.cpp +++ b/src/modules/fsresizer/ResizeFSJob.cpp @@ -49,12 +49,8 @@ ResizeFSJob::PartitionMatch ResizeFSJob::findPartition() { using DeviceList = QList< Device* >; -#if defined( WITH_KPMCORE4API ) DeviceList devices = m_kpmcore.backend()->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); -#else - DeviceList devices = m_kpmcore.backend()->scanDevices( /* excludeReadOnly */ true ); -#endif cDebug() << "ResizeFSJob found" << devices.count() << "devices."; for ( DeviceList::iterator dev_it = devices.begin(); dev_it != devices.end(); ++dev_it ) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index a2c0bd711..fe77bee3a 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -508,11 +508,6 @@ PartitionViewStep::onLeave() { const QString espMountPoint = Calamares::JobQueue::instance()->globalStorage()->value( "efiSystemPartition" ).toString(); -#ifdef WITH_KPMCORE4API - const auto espFlag = PartitionTable::Flag::Boot; -#else - const auto espFlag = PartitionTable::FlagEsp; -#endif Partition* esp = m_core->findPartitionByMountPoint( espMountPoint ); QString message; @@ -567,7 +562,7 @@ PartitionViewStep::onLeave() cDebug() << o << "ESP missing flag"; description.append( ' ' ); description.append( tr( "The filesystem must have flag %1 set." ) - .arg( PartitionTable::flagName( espFlag ) ) ); + .arg( PartitionTable::flagName( PartitionTable::Flag::Boot ) ) ); } if ( !description.isEmpty() ) { diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index b3a10dde7..321827876 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -127,11 +127,7 @@ getDevices( DeviceType which ) cWarning() << "No KPM backend found."; return {}; } -#if defined( WITH_KPMCORE4API ) DeviceList devices = backend->scanDevices( /* not includeReadOnly, not includeLoopback */ ScanFlag( 0 ) ); -#else - DeviceList devices = backend->scanDevices( /* excludeReadOnly */ true ); -#endif /* The list of devices is cleaned up for use: * - some devices can **never** be used (e.g. floppies, nullptr) diff --git a/src/modules/partition/core/KPMHelpers.h b/src/modules/partition/core/KPMHelpers.h index 2f867bc25..5648e6171 100644 --- a/src/modules/partition/core/KPMHelpers.h +++ b/src/modules/partition/core/KPMHelpers.h @@ -27,15 +27,10 @@ class Partition; class PartitionNode; class PartitionRole; -#if defined( WITH_KPMCORE4API ) +// TODO:3.3: Remove defines, expand in-place #define KPM_PARTITION_FLAG( x ) PartitionTable::Flag::x #define KPM_PARTITION_STATE( x ) Partition::State::x #define KPM_PARTITION_FLAG_ESP PartitionTable::Flag::Boot -#else -#define KPM_PARTITION_FLAG( x ) PartitionTable::Flag##x -#define KPM_PARTITION_STATE( x ) Partition::State##x -#define KPM_PARTITION_FLAG_ESP PartitionTable::FlagEsp -#endif /** * Helper functions to manipulate partitions diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index a4ec7fe0b..3d5e1e762 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -457,9 +457,7 @@ isEfiFilesystemSuitableType( const Partition* candidate ) { case FileSystem::Type::Fat32: return true; -#ifdef WITH_KPMCORE4API case FileSystem::Type::Fat12: -#endif case FileSystem::Type::Fat16: cWarning() << "FAT12 and FAT16 are probably not supported by EFI"; return false; @@ -496,31 +494,9 @@ isEfiBootable( const Partition* candidate ) { const auto flags = PartitionInfo::flags( candidate ); -#if defined( WITH_KPMCORE4API ) // In KPMCore4, the flags are remapped, and the ESP flag is the same as Boot. static_assert( KPM_PARTITION_FLAG_ESP == KPM_PARTITION_FLAG( Boot ), "KPMCore API enum changed" ); return flags.testFlag( KPM_PARTITION_FLAG_ESP ); -#else - // In KPMCore3, bit 17 is the old-style Esp flag, and it's OK - if ( flags.testFlag( KPM_PARTITION_FLAG_ESP ) ) - { - return true; - } - - /* Otherwise, if it's a GPT table, Boot (bit 0) is the same as Esp */ - const PartitionTable* table = CalamaresUtils::Partition::getPartitionTable( candidate ); - if ( !table ) - { - cWarning() << "Root of partition table is not a PartitionTable object"; - return false; - } - if ( table->type() == PartitionTable::TableType::gpt ) - { - const auto bootFlag = KPM_PARTITION_FLAG( Boot ); - return flags.testFlag( bootFlag ); - } - return false; -#endif } // TODO: this is configurable via the config file **already** diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 2040a2658..78af2abf7 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -847,13 +847,8 @@ PartitionCoreModule::scanForLVMPVs() } } -#if defined( WITH_KPMCORE4API ) VolumeManagerDevice::scanDevices( physicalDevices ); for ( auto p : LVM::pvList::list() ) -#else - LvmDevice::scanSystemLVM( physicalDevices ); - for ( auto p : LVM::pvList ) -#endif { m_lvmPVs << p.partition().data(); @@ -890,7 +885,6 @@ PartitionCoreModule::scanForLVMPVs() m_lvmPVs << p; } } -#if defined( WITH_KPMCORE4API ) else if ( p->fileSystem().type() == FileSystem::Type::Luks2 ) { // Encrypted LVM PVs @@ -901,7 +895,6 @@ PartitionCoreModule::scanForLVMPVs() m_lvmPVs << p; } } -#endif } } } diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index 765d9fffa..a8aae61ff 100644 --- a/src/modules/partition/core/PartitionLayout.cpp +++ b/src/modules/partition/core/PartitionLayout.cpp @@ -154,11 +154,9 @@ PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType ) case FileSystem::Lvm2_PV: case FileSystem::Udf: case FileSystem::Iso9660: -#ifdef WITH_KPMCORE4API case FileSystem::Luks2: case FileSystem::LinuxRaidMember: case FileSystem::BitLocker: -#endif // bad bad cWarning() << "The selected default FS" << defaultFsType << "is not suitable." << "Using ext4 instead."; @@ -185,11 +183,9 @@ PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType ) case FileSystem::Hpfs: case FileSystem::Zfs: case FileSystem::Nilfs2: -#ifdef WITH_KPMCORE4API case FileSystem::Fat12: case FileSystem::Apfs: case FileSystem::Minix: -#endif // weird cWarning() << "The selected default FS" << defaultFsType << "is unusual, but not wrong."; break; @@ -355,30 +351,18 @@ PartitionLayout::createPartitions( Device* dev, } if ( !entry.partType.isEmpty() ) { -#if defined( WITH_KPMCORE42API ) part->setType( entry.partType ); -#else - cWarning() << "Ignoring type; requires KPMcore >= 4.2.0."; -#endif } if ( entry.partAttributes ) { -#if defined( WITH_KPMCORE42API ) part->setAttributes( entry.partAttributes ); -#else - cWarning() << "Ignoring attributes; requires KPMcore >= 4.2.0."; -#endif } if ( !entry.partFeatures.isEmpty() ) { -#if defined( WITH_KPMCORE42API ) for ( const auto& k : entry.partFeatures.keys() ) { part->fileSystem().addFeature( k, entry.partFeatures.value( k ) ); } -#else - cWarning() << "Ignoring features; requires KPMcore >= 4.2.0."; -#endif } // Some buggy (legacy) BIOSes test if the bootflag of at least one partition is set. // Otherwise they ignore the device in boot-order, so add it here. diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index c0845da7f..2d395764d 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -42,9 +42,7 @@ #include "widgets/PrettyRadioButton.h" #include -#ifdef WITH_KPMCORE4API #include -#endif #include #include @@ -1344,14 +1342,12 @@ ChoicePage::setupActions() bool isInactiveRAID = false; bool matchTableType = false; -#ifdef WITH_KPMCORE4API if ( currentDevice->type() == Device::Type::SoftwareRAID_Device && static_cast< SoftwareRAID* >( currentDevice )->status() == SoftwareRAID::Status::Inactive ) { cDebug() << Logger::SubEntry << "part of an inactive RAID device"; isInactiveRAID = true; } -#endif PartitionTable::TableType tableType = PartitionTable::unknownTableType; if ( currentDevice->partitionTable() ) diff --git a/src/modules/partition/gui/DeviceInfoWidget.cpp b/src/modules/partition/gui/DeviceInfoWidget.cpp index 39d9413e1..05a8c4b63 100644 --- a/src/modules/partition/gui/DeviceInfoWidget.cpp +++ b/src/modules/partition/gui/DeviceInfoWidget.cpp @@ -100,9 +100,7 @@ DeviceInfoWidget::retranslateUi() "that makes a file accessible as a block device. " "This kind of setup usually only contains a single filesystem." ); break; -#if defined( WITH_KPMCORE42API ) case PartitionTable::none: -#endif case PartitionTable::unknownTableType: typeString = " ? "; toolTipString = tr( "This installer cannot detect a partition table on the " diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 0b3cf2478..25e6a27ab 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -42,9 +42,7 @@ // KPMcore #include #include -#ifdef WITH_KPMCORE4API #include -#endif #include #include @@ -179,14 +177,12 @@ PartitionPage::updateButtons() { allow_create_table = true; -#ifdef WITH_KPMCORE4API if ( device->type() == Device::Type::SoftwareRAID_Device && static_cast< SoftwareRAID* >( device )->status() == SoftwareRAID::Status::Inactive ) { allow_create_table = false; allow_create = false; } -#endif } else { diff --git a/src/modules/partition/jobs/CreatePartitionJob.cpp b/src/modules/partition/jobs/CreatePartitionJob.cpp index fe7c6f350..19a04a2de 100644 --- a/src/modules/partition/jobs/CreatePartitionJob.cpp +++ b/src/modules/partition/jobs/CreatePartitionJob.cpp @@ -111,7 +111,6 @@ CreatePartitionJob::CreatePartitionJob( Device* device, Partition* partition ) static QString prettyGptType( const Partition* partition ) { -#ifdef WITH_KPMCORE42API static const QMap< QString, QString > gptTypePrettyStrings = { { "44479540-f297-41b2-9af7-d131d5f0458a", "Linux Root Partition (x86)" }, { "4f68bce3-e8cd-4db1-96e7-fbcaf984b709", "Linux Root Partition (x86-64)" }, @@ -146,9 +145,6 @@ prettyGptType( const Partition* partition ) auto type = partition->type(); return gptTypePrettyStrings.value( type.toLower(), type ); -#else - return QString(); -#endif } static QString diff --git a/src/modules/partition/jobs/FillGlobalStorageJob.cpp b/src/modules/partition/jobs/FillGlobalStorageJob.cpp index 5be353113..d734485f0 100644 --- a/src/modules/partition/jobs/FillGlobalStorageJob.cpp +++ b/src/modules/partition/jobs/FillGlobalStorageJob.cpp @@ -88,11 +88,9 @@ mapForPartition( Partition* partition, const QString& uuid ) map[ "mountPoint" ] = PartitionInfo::mountPoint( partition ); map[ "fsName" ] = userVisibleFS( partition->fileSystem() ); map[ "fs" ] = untranslatedFS( partition->fileSystem() ); -#ifdef WITH_KPMCORE42API map[ "parttype" ] = partition->type(); map[ "partattrs" ] = partition->attributes(); map[ "features" ] = partition->fileSystem().features(); -#endif if ( partition->fileSystem().type() == FileSystem::Luks && dynamic_cast< FS::luks& >( partition->fileSystem() ).innerFS() ) { diff --git a/src/modules/partition/tests/CreateLayoutsTests.cpp b/src/modules/partition/tests/CreateLayoutsTests.cpp index 68b839e08..b83f71a26 100644 --- a/src/modules/partition/tests/CreateLayoutsTests.cpp +++ b/src/modules/partition/tests/CreateLayoutsTests.cpp @@ -125,7 +125,6 @@ CreateLayoutsTests::testMixedSizePartition() QCOMPARE( partitions[ 2 ]->length(), ( ( 5_GiB - 5_MiB ) / 2 ) / LOGICAL_SIZE ); } -#ifdef WITH_KPMCORE4API // TODO: Get a clean way to instantiate a test Device from KPMCore class DevicePrivate { @@ -150,11 +149,5 @@ TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, con Device::Type::Unknown_Device ) { } -#else -TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors ) - : Device( name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device ) -{ -} -#endif TestDevice::~TestDevice() {} diff --git a/src/modules/partition/tests/DevicesTests.cpp b/src/modules/partition/tests/DevicesTests.cpp index c63d7476d..ec6bdadff 100644 --- a/src/modules/partition/tests/DevicesTests.cpp +++ b/src/modules/partition/tests/DevicesTests.cpp @@ -52,12 +52,7 @@ DevicesTests::testKPMScanDevices() cDebug() << "Getting devices via KPMCore"; CoreBackend* backend = CoreBackendManager::self()->backend(); QVERIFY( backend ); -#if defined( WITH_KPMCORE4API ) - auto flags = ScanFlag( ~0 ); -#else - auto flags = true; -#endif - auto devices = backend->scanDevices( flags ); // These flags try to get "all" + auto devices = backend->scanDevices( ScanFlag( ~0 ) ); // These flags try to get "all" cDebug() << Logger::SubEntry << "Done getting devices."; if ( !m_isRoot ) From 99b19b9539c2f132f9f22163dae4939e35eef2d1 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 12:54:54 +0100 Subject: [PATCH 056/160] [libcalamares] Always log to file, sometimes to terminal --- src/libcalamares/utils/Logger.cpp | 77 ++++++++++++++++++------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index adb082687..10f7cad8c 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -53,7 +53,14 @@ setupLogLevel( unsigned int level ) { level = LOGVERBOSE; } - s_threshold = level + 1; // Comparison is < in log() function + s_threshold = level + 1; // Comparison is < in logLevelEnabled() function +} + +unsigned int +logLevel() +{ + // Undo the +1 in setupLogLevel() + return s_threshold > 0 ? s_threshold - 1 : 0; } bool @@ -62,33 +69,40 @@ logLevelEnabled( unsigned int level ) return level < s_threshold; } -unsigned int -logLevel() +/** @brief Should we call the log_implementation() function with this level? + * + * The implementation logs everything for which logLevelEnabled() is + * true to the file **and** to stdout; it logs everything at debug-level + * or below to the file regardless. + */ +static inline bool +log_enabled( unsigned int level ) { - return s_threshold > 0 ? s_threshold - 1 : 0; + return level <= LOGDEBUG || logLevelEnabled( level ); } static void -log( const char* msg, unsigned int debugLevel, bool withTime = true ) +log_implementation( const char* msg, unsigned int debugLevel, const bool withTime ) { + QMutexLocker lock( &s_mutex ); + + const auto date = QDate::currentDate().toString( Qt::ISODate ); + const auto time = QTime::currentTime().toString(); + + // If we don't format the date as a Qt::ISODate then we get a crash when + // logging at exit as Qt tries to use QLocale to format, but QLocale is + // on its way out. + logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << msg << std::endl; + + logfile.flush(); + if ( logLevelEnabled( debugLevel ) ) { - QMutexLocker lock( &s_mutex ); - - // If we don't format the date as a Qt::ISODate then we get a crash when - // logging at exit as Qt tries to use QLocale to format, but QLocale is - // on its way out. - logfile << QDate::currentDate().toString( Qt::ISODate ).toUtf8().data() << " - " - << QTime::currentTime().toString().toUtf8().data() << " [" - << QString::number( debugLevel ).toUtf8().data() << "]: " << msg << std::endl; - - logfile.flush(); - if ( withTime ) { - std::cout << QTime::currentTime().toString().toUtf8().data() << " [" - << QString::number( debugLevel ).toUtf8().data() << "]: "; + std::cout << time.toUtf8().data() << " [" << debugLevel << "]: "; } + // The endl is desired, since it also flushes (like the logfile, above) std::cout << msg << std::endl; } } @@ -97,29 +111,30 @@ log( const char* msg, unsigned int debugLevel, bool withTime = true ) static void CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg ) { - static QMutex s_mutex; - - QByteArray ba = msg.toUtf8(); - const char* message = ba.constData(); - - QMutexLocker locker( &s_mutex ); - + unsigned int level = LOGVERBOSE; switch ( type ) { case QtInfoMsg: - log( message, LOGVERBOSE ); + level = LOGVERBOSE; break; case QtDebugMsg: - log( message, LOGDEBUG ); + level = LOGDEBUG; break; case QtWarningMsg: - log( message, LOGWARNING ); + level = LOGWARNING; break; case QtCriticalMsg: case QtFatalMsg: - log( message, LOGERROR ); + level = LOGERROR; break; } + + if ( !log_enabled( level ) ) + { + return; + } + + log_implementation( msg.toUtf8().constData(), level, true ); } @@ -188,14 +203,14 @@ CDebug::CDebug( unsigned int debugLevel, const char* func ) CDebug::~CDebug() { - if ( logLevelEnabled( m_debugLevel ) ) + if ( log_enabled( m_debugLevel ) ) { if ( m_funcinfo ) { m_msg.prepend( s_Continuation ); // Prepending, so back-to-front m_msg.prepend( m_funcinfo ); } - log( m_msg.toUtf8().data(), m_debugLevel, m_funcinfo ); + log_implementation( m_msg.toUtf8().data(), m_debugLevel, bool( m_funcinfo ) ); } } From 4545470f2d6c4fa14c1a237ef14c39ca785ea117 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 12:57:46 +0100 Subject: [PATCH 057/160] Changes: document new bits --- CHANGES-3.3 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index cdc3f969f..d8c3b2e9b 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -37,9 +37,15 @@ in the *Modules* heading, below. - Python 3.6 or later is now required, to allow for F-strings in Python code and allow other tidy-ups in the Python modules. Boost::Python now requires 1.67 or later (for CMake support). + - The log file now **always** contains a debug-log, and the `-D` flag + primarily controls what is printed to stdout. By default, stdout + only gets errors; use `-D6` to match stdout with the file. Use `-D8` + to get a verbose log file **and** verbose stdout. ## Modules ## - - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. - Please update configurations. - *bootloader* now supports more options when building the kernel command-line. (Thanks Evan) + - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. + Please update configurations. + - *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later). + From 029bb3efddbfb94fe77ab13df0624415fab4811d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 13:08:07 +0100 Subject: [PATCH 058/160] [calamares] Warnings-- The widget name is used (by moc) to inform the name of the member variable storing the widget; having a :: in the name yields a member variable with __ in it. Two _ is reserverd to the implementation. --- src/calamares/DebugWindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calamares/DebugWindow.ui b/src/calamares/DebugWindow.ui index 1b163d49d..44ecf04ab 100644 --- a/src/calamares/DebugWindow.ui +++ b/src/calamares/DebugWindow.ui @@ -5,7 +5,7 @@ SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org> SPDX-License-Identifier: GPL-3.0-or-later Calamares::DebugWindow - + 0 From a303efb1749331be6f25fdbf41668f4a1666c55f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 13:12:23 +0100 Subject: [PATCH 059/160] [users] Warnings-- Remove unreachable code. --- src/modules/users/MiscJobs.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/modules/users/MiscJobs.cpp b/src/modules/users/MiscJobs.cpp index 5cba202e0..fec546d96 100644 --- a/src/modules/users/MiscJobs.cpp +++ b/src/modules/users/MiscJobs.cpp @@ -41,13 +41,10 @@ designatorForStyle( Config::SudoStyle style ) { case Config::SudoStyle::UserOnly: return QStringLiteral( "(ALL)" ); - break; case Config::SudoStyle::UserAndGroup: return QStringLiteral( "(ALL:ALL)" ); - break; } __builtin_unreachable(); - return QString(); } Calamares::JobResult From 97031ea3e632d70da8720c1e4494452c68470059 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 15:02:43 +0100 Subject: [PATCH 060/160] [libcalamares] The amount of memory in the system cannot be negative --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 2 +- src/libcalamares/utils/CalamaresUtilsSystem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index a2ba51ded..07b473bc9 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -230,7 +230,7 @@ System::createTargetParentDirs( const QString& filePath ) const } -QPair< qint64, qreal > +QPair< quint64, qreal > System::getTotalMemoryB() const { #ifdef Q_OS_LINUX diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index f7f04079e..f4f5257c4 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -337,7 +337,7 @@ public: * * @return size, guesstimate-factor */ - DLLEXPORT QPair< qint64, qreal > getTotalMemoryB() const; + DLLEXPORT QPair< quint64, qreal > getTotalMemoryB() const; /** * @brief getCpuDescription returns a string describing the CPU. From f888cb87d1c47c2ada52fb296136d33296f24897 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 15:14:33 +0100 Subject: [PATCH 061/160] [libcalamares] Start deprecating signed sizes --- src/libcalamares/utils/Units.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libcalamares/utils/Units.h b/src/libcalamares/utils/Units.h index bb5bf4509..3b909dc02 100644 --- a/src/libcalamares/utils/Units.h +++ b/src/libcalamares/utils/Units.h @@ -17,6 +17,8 @@ namespace CalamaresUtils { +/// @brief Type for expressing units +using intunit_t = quint64; namespace Units { @@ -137,12 +139,19 @@ BytesToMiB( qint64 b ) return int( b / 1024 / 1024 ); } +// TODO: deprecate signed version constexpr int BytesToGiB( qint64 b ) { return int( b / 1024 / 1024 / 1024 ); } +constexpr intunit_t +BytesToGiB( intunit_t b ) +{ + return b / 1024 / 1024 / 1024; +} + constexpr qint64 alignBytesToBlockSize( qint64 bytes, qint64 blocksize ) { From 982f9c84583bbbc68390a4e26f2be090c6bcfa65 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 14:41:48 +0100 Subject: [PATCH 062/160] [partition] Hide implementation function --- src/modules/partition/core/PartitionActions.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index 0ce9ff4ed..5cafe5f08 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -30,10 +30,7 @@ using namespace CalamaresUtils::Units; -namespace PartitionActions -{ - -qint64 +static qint64 swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) { if ( ( swap != Config::SwapChoice::SmallSwap ) && ( swap != Config::SwapChoice::FullSwap ) ) @@ -84,6 +81,9 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) return suggestedSwapSizeB; } +namespace PartitionActions +{ + void doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionOptions o ) { From 8ce92d450cf4f98a0d9eab0e8226e51138d856f7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 14:52:12 +0100 Subject: [PATCH 063/160] [partition] Warnings-- for int / double / size_t confusions --- src/modules/partition/core/PartitionActions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index 5cafe5f08..de15712dc 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -68,7 +68,7 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) // Allow for a fudge factor - suggestedSwapSizeB = qRound64( suggestedSwapSizeB * overestimationFactor ); + suggestedSwapSizeB = qRound64( qreal( suggestedSwapSizeB ) * overestimationFactor ); // don't use more than 10% of available space if ( !ensureSuspendToDisk ) @@ -118,7 +118,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO if ( isEfi ) { - size_t uefisys_part_sizeB = PartUtils::efiFilesystemMinimumSize(); + qint64 uefisys_part_sizeB = PartUtils::efiFilesystemMinimumSize(); qint64 efiSectorCount = CalamaresUtils::bytesToSectors( uefisys_part_sizeB, dev->logicalSize() ); Q_ASSERT( efiSectorCount > 0 ); From 9b0ef5fce577633fdaed048feb868f886aa88d40 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 15:04:23 +0100 Subject: [PATCH 064/160] [partition] Use unsigned sizes Reduce warnings by using unsigned consistently; this fights the KPMCore API (which uses signed sizes for, e.g. sectorSize) a little, but states more clearly that a disk cannot have a negative size. --- .../partition/core/PartitionActions.cpp | 25 ++++++++++--------- src/modules/partition/core/PartitionActions.h | 4 +-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/modules/partition/core/PartitionActions.cpp b/src/modules/partition/core/PartitionActions.cpp index de15712dc..0ceff4324 100644 --- a/src/modules/partition/core/PartitionActions.cpp +++ b/src/modules/partition/core/PartitionActions.cpp @@ -30,8 +30,8 @@ using namespace CalamaresUtils::Units; -static qint64 -swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) +static quint64 +swapSuggestion( const quint64 availableSpaceB, Config::SwapChoice swap ) { if ( ( swap != Config::SwapChoice::SmallSwap ) && ( swap != Config::SwapChoice::FullSwap ) ) { @@ -39,10 +39,8 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) } // See partition.conf for explanation - qint64 suggestedSwapSizeB = 0; - auto memory = CalamaresUtils::System::instance()->getTotalMemoryB(); - qint64 availableRamB = memory.first; - qreal overestimationFactor = memory.second; + quint64 suggestedSwapSizeB = 0; + auto [ availableRamB, overestimationFactor ] = CalamaresUtils::System::instance()->getTotalMemoryB(); bool ensureSuspendToDisk = swap == Config::SwapChoice::FullSwap; @@ -63,12 +61,13 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) // .. top out at 8GiB if we don't care about suspend if ( !ensureSuspendToDisk ) { - suggestedSwapSizeB = qMin( 8_GiB, suggestedSwapSizeB ); + // TODO: make the _GiB operator return unsigned + suggestedSwapSizeB = qMin( quint64( 8_GiB ), suggestedSwapSizeB ); } // Allow for a fudge factor - suggestedSwapSizeB = qRound64( qreal( suggestedSwapSizeB ) * overestimationFactor ); + suggestedSwapSizeB = quint64( qRound64( qreal( suggestedSwapSizeB ) * overestimationFactor ) ); // don't use more than 10% of available space if ( !ensureSuspendToDisk ) @@ -76,6 +75,7 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap ) suggestedSwapSizeB = qMin( suggestedSwapSizeB, availableSpaceB / 10 /* 10% is 0.1 */ ); } + // TODO: make Units functions work on unsigned cDebug() << "Suggested swap size:" << CalamaresUtils::BytesToGiB( suggestedSwapSizeB ) << "GiB"; return suggestedSwapSizeB; @@ -147,16 +147,17 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO const bool mayCreateSwap = ( o.swap == Config::SwapChoice::SmallSwap ) || ( o.swap == Config::SwapChoice::FullSwap ); bool shouldCreateSwap = false; - qint64 suggestedSwapSizeB = 0; + quint64 suggestedSwapSizeB = 0; + const quint64 sectorSize = quint64( dev->logicalSize() ); if ( mayCreateSwap ) { - qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize(); + quint64 availableSpaceB = quint64( dev->totalLogical() - firstFreeSector ) * sectorSize; suggestedSwapSizeB = swapSuggestion( availableSpaceB, o.swap ); // Space required by this installation is what the distro claims is needed // (via global configuration) plus the swap size plus a fudge factor of // 0.6GiB (this was 2.1GiB up to Calamares 3.2.2). - qint64 requiredSpaceB = o.requiredSpaceB + 600_MiB + suggestedSwapSizeB; + quint64 requiredSpaceB = o.requiredSpaceB + 600_MiB + suggestedSwapSizeB; // If there is enough room for ESP + root + swap, create swap, otherwise don't. shouldCreateSwap = availableSpaceB > requiredSpaceB; @@ -165,7 +166,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO qint64 lastSectorForRoot = dev->totalLogical() - 1; //last sector of the device if ( shouldCreateSwap ) { - lastSectorForRoot -= suggestedSwapSizeB / dev->logicalSize() + 1; + lastSectorForRoot -= suggestedSwapSizeB / sectorSize + 1; } core->layoutApply( dev, firstFreeSector, lastSectorForRoot, o.luksPassphrase ); diff --git a/src/modules/partition/core/PartitionActions.h b/src/modules/partition/core/PartitionActions.h index efe8b2456..d6b86a6cd 100644 --- a/src/modules/partition/core/PartitionActions.h +++ b/src/modules/partition/core/PartitionActions.h @@ -44,7 +44,7 @@ struct ReplacePartitionOptions struct AutoPartitionOptions : ReplacePartitionOptions { QString efiPartitionMountPoint; // optional, e.g. "/boot" - qint64 requiredSpaceB; // estimated required space for root partition + quint64 requiredSpaceB; // estimated required space for root partition Config::SwapChoice swap; AutoPartitionOptions( const QString& pt, @@ -55,7 +55,7 @@ struct AutoPartitionOptions : ReplacePartitionOptions Config::SwapChoice s ) : ReplacePartitionOptions( pt, fs, luks ) , efiPartitionMountPoint( efi ) - , requiredSpaceB( requiredBytes > 0 ? requiredBytes : 0 ) + , requiredSpaceB( requiredBytes > 0 ? quint64( requiredBytes ) : 0U ) , swap( s ) { } From f64938cb3fbd706f2550d9645b744e15279e0ac8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 22 Mar 2022 16:04:17 +0100 Subject: [PATCH 065/160] [partition] Remove unnecessary methods - _find and _each Doesn't need to be part of the class API - Rename to *Transform() because that's more in-line with what it does, applying an operation to the tree. --- .../partition/gui/PartitionSplitterWidget.cpp | 150 +++++++++--------- .../partition/gui/PartitionSplitterWidget.h | 6 - 2 files changed, 76 insertions(+), 80 deletions(-) diff --git a/src/modules/partition/gui/PartitionSplitterWidget.cpp b/src/modules/partition/gui/PartitionSplitterWidget.cpp index e52afaa74..139eef168 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.cpp +++ b/src/modules/partition/gui/PartitionSplitterWidget.cpp @@ -35,6 +35,48 @@ static const int VIEW_HEIGHT static const int CORNER_RADIUS = 3; static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 ); +/** @brief Applies @p operation to each item + * + * A PartitionSplitterItem can contain a tree of items (each item has its + * own list of children) so recurse over all the children. Returns a count + * of how many items were affected. + */ +static int +countTransform( QVector< PartitionSplitterItem >& items, + const std::function< bool( PartitionSplitterItem& ) >& operation ) +{ + int opCount = 0; + for ( auto it = items.begin(); it != items.end(); ++it ) + { + if ( operation( *it ) ) + { + opCount++; + } + + opCount += countTransform( it->children, operation ); + } + return opCount; +} + +static PartitionSplitterItem +findTransform( QVector< PartitionSplitterItem >& items, std::function< bool( PartitionSplitterItem& ) > condition ) +{ + for ( auto it = items.begin(); it != items.end(); ++it ) + { + if ( condition( *it ) ) + { + return *it; + } + + PartitionSplitterItem candidate = findTransform( it->children, condition ); + if ( !candidate.isNull() ) + { + return candidate; + } + } + return PartitionSplitterItem::null(); +} + PartitionSplitterWidget::PartitionSplitterWidget( QWidget* parent ) : QWidget( parent ) , m_itemToResize( PartitionSplitterItem::null() ) @@ -159,16 +201,16 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize, m_itemToResizePath.clear(); } - PartitionSplitterItem itemToResize = _findItem( m_items, - [ path ]( PartitionSplitterItem& item ) -> bool - { - if ( path == item.itemPath ) + PartitionSplitterItem itemToResize = findTransform( m_items, + [ path ]( PartitionSplitterItem& item ) -> bool { - item.status = PartitionSplitterItem::Resizing; - return true; - } - return false; - } ); + if ( path == item.itemPath ) + { + item.status = PartitionSplitterItem::Resizing; + return true; + } + return false; + } ); if ( itemToResize.isNull() ) { @@ -186,16 +228,16 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize, qint64 newSize = m_itemToResize.size - preferredSize; m_itemToResize.size = preferredSize; - int opCount = _eachItem( m_items, - [ preferredSize ]( PartitionSplitterItem& item ) -> bool - { - if ( item.status == PartitionSplitterItem::Resizing ) - { - item.size = preferredSize; - return true; - } - return false; - } ); + int opCount = countTransform( m_items, + [ preferredSize ]( PartitionSplitterItem& item ) -> bool + { + if ( item.status == PartitionSplitterItem::Resizing ) + { + item.size = preferredSize; + return true; + } + return false; + } ); cDebug() << "each splitter item opcount:" << opCount; m_itemMinSize = minSize; m_itemMaxSize = maxSize; @@ -362,21 +404,21 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event ) m_itemToResize.size = qRound64( span * percent ); m_itemToResizeNext.size -= m_itemToResize.size - oldsize; - _eachItem( m_items, - [ this ]( PartitionSplitterItem& item ) -> bool - { - if ( item.status == PartitionSplitterItem::Resizing ) - { - item.size = m_itemToResize.size; - return true; - } - else if ( item.status == PartitionSplitterItem::ResizingNext ) - { - item.size = m_itemToResizeNext.size; - return true; - } - return false; - } ); + countTransform( m_items, + [ this ]( PartitionSplitterItem& item ) -> bool + { + if ( item.status == PartitionSplitterItem::Resizing ) + { + item.size = m_itemToResize.size; + return true; + } + else if ( item.status == PartitionSplitterItem::ResizingNext ) + { + item.size = m_itemToResizeNext.size; + return true; + } + return false; + } ); repaint(); @@ -553,46 +595,6 @@ PartitionSplitterWidget::drawPartitions( QPainter* painter, } } - -PartitionSplitterItem -PartitionSplitterWidget::_findItem( QVector< PartitionSplitterItem >& items, - std::function< bool( PartitionSplitterItem& ) > condition ) const -{ - for ( auto it = items.begin(); it != items.end(); ++it ) - { - if ( condition( *it ) ) - { - return *it; - } - - PartitionSplitterItem candidate = _findItem( it->children, condition ); - if ( !candidate.isNull() ) - { - return candidate; - } - } - return PartitionSplitterItem::null(); -} - - -int -PartitionSplitterWidget::_eachItem( QVector< PartitionSplitterItem >& items, - std::function< bool( PartitionSplitterItem& ) > operation ) const -{ - int opCount = 0; - for ( auto it = items.begin(); it != items.end(); ++it ) - { - if ( operation( *it ) ) - { - opCount++; - } - - opCount += _eachItem( it->children, operation ); - } - return opCount; -} - - QPair< QVector< PartitionSplitterItem >, qreal > PartitionSplitterWidget::computeItemsVector( const QVector< PartitionSplitterItem >& originalItems ) const { diff --git a/src/modules/partition/gui/PartitionSplitterWidget.h b/src/modules/partition/gui/PartitionSplitterWidget.h index 474ea313e..53f5b0b37 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.h +++ b/src/modules/partition/gui/PartitionSplitterWidget.h @@ -72,12 +72,6 @@ private: void drawSection( QPainter* painter, const QRect& rect_, int x, int width, const PartitionSplitterItem& item ); void drawResizeHandle( QPainter* painter, const QRect& rect_, int x ); - PartitionSplitterItem _findItem( QVector< PartitionSplitterItem >& items, - std::function< bool( PartitionSplitterItem& ) > condition ) const; - - int _eachItem( QVector< PartitionSplitterItem >& items, - std::function< bool( PartitionSplitterItem& ) > operation ) const; - QPair< QVector< PartitionSplitterItem >, qreal > computeItemsVector( const QVector< PartitionSplitterItem >& originalItems ) const; From 3bf0a93b86f36026145c9bfd886f046fc0477ec9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 12:52:19 +0200 Subject: [PATCH 066/160] CMake: fix missed merge failure - Don't format the language-lists with gersemi --- CMakeLists.txt | 84 -------------------------------------------------- 1 file changed, 84 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a99ed73f0..2b4dd5ec7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,89 +139,6 @@ set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framew # `txstats.py -e`. See also # # Total 74 languages -<<<<<<< HEAD -set(_tx_complete - az - az_AZ - ca - de - fa - fi_FI - he - hi - hr - ja - ko - lt - pt_BR - pt_PT - si - sq - sv - tr_TR - uk - zh_TW -) -set(_tx_good - as - be - ca@valencia - cs_CZ - da - fr - fur - it_IT - ml - nl - ru - sk - tg - vi - zh_CN -) -set(_tx_ok - ar - ast - bg - bn - el - en_GB - es - es_MX - et - eu - gl - hu - id - is - mr - nb - pl - ro - sl - sr - sr@latin - th -) -set(_tx_incomplete - eo - es_PR - gu - ie - kk - kn - lo - lv - mk - ne - ne_NP - ta_IN - te - ur - zh - zh_HK -) -======= set( _tx_complete az az_AZ ca es fi_FI he hi hr ja lt pt_BR pt_PT sq sv uk zh_TW ) set( _tx_good as be ca@valencia cs_CZ da de fa fr fur it_IT ko ml @@ -230,7 +147,6 @@ set( _tx_ok ar ast bg bn el en_GB es_MX et eu gl hu id is mr nb oc pl ro sl sr sr@latin th ) set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP ta_IN te ur zh zh_HK ) ->>>>>>> calamares ### Required versions # From bb278c7ba9f4fc36dbe060304cf5f73da2d9460e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 13:13:01 +0200 Subject: [PATCH 067/160] [shellprocess] Migrate towards 'standard' variable substitutions --- src/modules/shellprocess/Tests.cpp | 14 +++++++------- src/modules/shellprocess/Tests.h | 2 +- src/modules/shellprocess/shellprocess.conf | 14 ++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/modules/shellprocess/Tests.cpp b/src/modules/shellprocess/Tests.cpp index c1489c1ab..5d3a503fd 100644 --- a/src/modules/shellprocess/Tests.cpp +++ b/src/modules/shellprocess/Tests.cpp @@ -146,14 +146,14 @@ script: QVariant plainScript = CalamaresUtils::yamlMapToVariant( doc ).value( "script" ); QVariant rootScript = CalamaresUtils::yamlMapToVariant( YAML::Load( R"(--- script: - - "ls @@ROOT@@" + - "ls ${ROOT}" )" ) ) .value( "script" ); QVariant userScript = CalamaresUtils::yamlMapToVariant( YAML::Load( R"(--- script: - - mktemp -d @@ROOT@@/calatestXXXXXXXX - - "chown @@USER@@ @@ROOT@@/calatest*" - - rm -rf @@ROOT@@/calatest* + - mktemp -d ${ROOT}/calatestXXXXXXXX + - "chown ${USER} ${ROOT}/calatest*" + - rm -rf ${ROOT}/calatest* )" ) ) .value( "script" ); @@ -167,13 +167,13 @@ script: qDebug() << "Expect WARNING, ERROR, WARNING"; - // Doesn't use @@ROOT@@, so no failures + // Doesn't use ${ROOT}, so no failures QVERIFY( bool( CommandList( plainScript, false, 10s ).run() ) ); - // Doesn't use @@ROOT@@, but does chroot, so fails + // Doesn't use ${ROOT}, but does chroot, so fails QVERIFY( !bool( CommandList( plainScript, true, 10s ).run() ) ); - // Does use @@ROOT@@, which is not set, so fails + // Does use ${ROOT}, which is not set, so fails QVERIFY( !bool( CommandList( rootScript, false, 10s ).run() ) ); // .. fails for two reasons QVERIFY( !bool( CommandList( rootScript, true, 10s ).run() ) ); diff --git a/src/modules/shellprocess/Tests.h b/src/modules/shellprocess/Tests.h index cabeaada2..c44fa853b 100644 --- a/src/modules/shellprocess/Tests.h +++ b/src/modules/shellprocess/Tests.h @@ -31,7 +31,7 @@ private Q_SLOTS: void testProcessFromObject(); // Create from a complex YAML list void testProcessListFromObject(); - // Check @@ROOT@@ substitution + // Check variable substitution void testRootSubstitution(); }; diff --git a/src/modules/shellprocess/shellprocess.conf b/src/modules/shellprocess/shellprocess.conf index 07947f38f..9ff83221e 100644 --- a/src/modules/shellprocess/shellprocess.conf +++ b/src/modules/shellprocess/shellprocess.conf @@ -7,11 +7,13 @@ # If the top-level key *dontChroot* is true, then the commands # are executed in the context of the live system, otherwise # in the context of the target system. In all of the commands, -# the following substitutions will take place: -# - `@@ROOT@@` is replaced by the root mount point of the **target** -# system from the point of view of the command (for chrooted -# commands, that will be */*). -# - `@@USER@@` is replaced by the username, set on the user page. +# the following variable expansions will take place: +# - `ROOT` is replaced by the root mount point of the **target** +# system from the point of view of the command (when run in the target +# system, e.g. when *dontChroot* is false, that will be `/`). +# - `USER` is replaced by the username, set on the user page. +# +# Variables are written as `${var}`, e.g. `${ROOT}`. # # The (global) timeout for the command list can be set with # the *timeout* key. The value is a time in seconds, default @@ -72,7 +74,7 @@ dontChroot: false # ignored; the slowloris command has a different timeout from the # other commands in the list): script: - - "-touch @@ROOT@@/tmp/thingy" + - "-touch ${ROOT}/tmp/thingy" - "/usr/bin/true" - command: "/usr/local/bin/slowloris" timeout: 3600 From 2c0d9396e27783b19d8da640e0eaad4a6944f34d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 14:10:12 +0200 Subject: [PATCH 068/160] [users] Link to CoreAddons for KMacroExpander in config --- src/modules/users/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/users/CMakeLists.txt b/src/modules/users/CMakeLists.txt index 1ee9832c4..060c9b691 100644 --- a/src/modules/users/CMakeLists.txt +++ b/src/modules/users/CMakeLists.txt @@ -40,6 +40,7 @@ set(_users_src Config.cpp ) +# This part of the code is shared with the usersq module calamares_add_library( users_internal EXPORT_MACRO PLUGINDLLEXPORT_PRO @@ -49,6 +50,7 @@ calamares_add_library( SOURCES ${_users_src} LINK_LIBRARIES + KF5::CoreAddons Qt5::DBus ${CRYPT_LIBRARIES} ) @@ -78,6 +80,7 @@ calamares_add_test( TestGroupInformation.cpp ${_users_src} # Build again with test-visibility LIBRARIES + KF5::CoreAddons Qt5::DBus # HostName job can use DBus to systemd ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} @@ -96,6 +99,7 @@ calamares_add_test( Tests.cpp ${_users_src} # Build again with test-visibility LIBRARIES + KF5::CoreAddons Qt5::DBus # HostName job can use DBus to systemd ${CRYPT_LIBRARIES} # SetPassword job uses crypt() ${USER_EXTRA_LIB} From d03a8acc9d489783891ba37d47fbc0fc3de51c47 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 14:14:02 +0200 Subject: [PATCH 069/160] [libcalamares] Create namespace Calamares::String This is a step towards getting rid of CalamaresUtils and using more structured namespaces overall, e.g. Calamares::String for things related to string-handling. --- src/libcalamares/utils/String.cpp | 9 ++++++--- src/libcalamares/utils/String.h | 12 +++++++++--- src/libcalamares/utils/Tests.cpp | 12 ++++++------ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/libcalamares/utils/String.cpp b/src/libcalamares/utils/String.cpp index c88c23693..f1708d5a3 100644 --- a/src/libcalamares/utils/String.cpp +++ b/src/libcalamares/utils/String.cpp @@ -19,7 +19,9 @@ #include -namespace CalamaresUtils +namespace Calamares +{ +namespace String { QString removeDiacritics( const QString& string ) @@ -124,7 +126,7 @@ obscure( const QString& string ) QString -truncateMultiLine( const QString& string, CalamaresUtils::LinesStartEnd lines, CalamaresUtils::CharCount chars ) +truncateMultiLine( const QString& string, LinesStartEnd lines, CharCount chars ) { const char NEWLINE = '\n'; const int maxLines = lines.atStart + lines.atEnd; @@ -246,4 +248,5 @@ removeTrailing( QString& string, QChar c ) string.remove( lastIndex, string.length() ); } -} // namespace CalamaresUtils +} // namespace String +} // namespace Calamares diff --git a/src/libcalamares/utils/String.h b/src/libcalamares/utils/String.h index 1adc2336a..30fca66d2 100644 --- a/src/libcalamares/utils/String.h +++ b/src/libcalamares/utils/String.h @@ -42,10 +42,15 @@ constexpr static const auto SplitKeepEmptyParts = #endif ; +namespace Calamares +{ /** - * @brief The CalamaresUtils namespace contains utility functions. + * @brief The Calamares::String namespace + * + * This namespace contains functions related to string-handling, + * string-expansion, etc. */ -namespace CalamaresUtils +namespace String { /** * @brief removeDiacritics replaces letters with diacritics and ligatures with @@ -113,6 +118,7 @@ DLLEXPORT void removeLeading( QString& string, QChar c ); */ DLLEXPORT void removeTrailing( QString& string, QChar c ); -} // namespace CalamaresUtils +} // namespace String +} // namespace Calamares #endif diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index ce1f5d24b..b4b2251cc 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -554,7 +554,7 @@ LibCalamaresTests::testStringTruncation() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; const QString longString( R"(--- --- src/libcalamares/utils/String.h @@ -635,7 +635,7 @@ LibCalamaresTests::testStringTruncationShorter() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being displayed in various user-facing messages. These have been removed @@ -730,7 +730,7 @@ LibCalamaresTests::testStringTruncationDegenerate() { Logger::setupLogLevel( Logger::LOGDEBUG ); - using namespace CalamaresUtils; + using namespace Calamares::String; // This is quite long, 1 line only, with no newlines const QString longString( "The portscout new distfile checker has detected that one or more of your " @@ -783,7 +783,7 @@ LibCalamaresTests::testStringRemoveLeading() QFETCH( QString, result ); const QString initial = string; - CalamaresUtils::removeLeading( string, c ); + Calamares::String::removeLeading( string, c ); QCOMPARE( string, result ); } @@ -813,7 +813,7 @@ LibCalamaresTests::testStringRemoveTrailing() QFETCH( QString, result ); const QString initial = string; - CalamaresUtils::removeTrailing( string, c ); + Calamares::String::removeTrailing( string, c ); QCOMPARE( string, result ); } @@ -993,7 +993,7 @@ LibCalamaresTests::testRunnerOutput() Calamares::Utils::Runner r( { "cat" } ); r.enableOutputProcessing().setInput( QStringLiteral( "hello\nworld\n\n!\n" ) ); - QObject::connect( &r, &decltype( r )::output, [&collectedOutput]( QString s ) { collectedOutput << s; } ); + QObject::connect( &r, &decltype( r )::output, [ &collectedOutput ]( QString s ) { collectedOutput << s; } ); { auto result = r.run(); From 576f244d2dc1b7c00ea9c1b6eebded6ff9e69a64 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 14:15:52 +0200 Subject: [PATCH 070/160] *: Chase new namespace Calamares::String --- src/libcalamares/PythonJobApi.cpp | 10 +++++----- src/modules/luksopenswaphookcfg/LOSHJob.cpp | 2 +- src/modules/partition/core/KPMHelpers.cpp | 2 +- src/modules/users/Config.cpp | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index c95edfb63..753e222d1 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -211,14 +211,14 @@ _process_output( Calamares::Utils::RunLocation location, bp::extract< bp::list > x( callback ); if ( x.check() ) { - QObject::connect( &r, &decltype( r )::output, [cb = callback.attr( "append" )]( const QString& s ) { - cb( s.toStdString() ); - } ); + QObject::connect( &r, + &decltype( r )::output, + [ cb = callback.attr( "append" ) ]( const QString& s ) { cb( s.toStdString() ); } ); } else { QObject::connect( - &r, &decltype( r )::output, [&callback]( const QString& s ) { callback( s.toStdString() ); } ); + &r, &decltype( r )::output, [ &callback ]( const QString& s ) { callback( s.toStdString() ); } ); } r.enableOutputProcessing(); } @@ -262,7 +262,7 @@ host_env_process_output( const boost::python::list& args, std::string obscure( const std::string& string ) { - return CalamaresUtils::obscure( QString::fromStdString( string ) ).toStdString(); + return Calamares::String::obscure( QString::fromStdString( string ) ).toStdString(); } static QStringList diff --git a/src/modules/luksopenswaphookcfg/LOSHJob.cpp b/src/modules/luksopenswaphookcfg/LOSHJob.cpp index 42f160460..ad3b0abea 100644 --- a/src/modules/luksopenswaphookcfg/LOSHJob.cpp +++ b/src/modules/luksopenswaphookcfg/LOSHJob.cpp @@ -163,7 +163,7 @@ globalStoragePartitionInfo( Calamares::GlobalStorage* gs, LOSHInfo& info ) QString btrfsRootSubvolume = gs->value( "btrfsRootSubvolume" ).toString(); if ( !btrfsRootSubvolume.isEmpty() ) { - CalamaresUtils::removeLeading( btrfsRootSubvolume, '/' ); + Calamares::String::removeLeading( btrfsRootSubvolume, '/' ); info.keyfile_device_mount_options = QStringLiteral( "keyfile_device_mount_options=--options=subvol=" ) + btrfsRootSubvolume; } diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index d5086ef21..4a38ab4ca 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -140,7 +140,7 @@ execute( Operation& operation, const QString& failureMessage ) // Remove the === lines from the report by trimming them to empty QStringList l = report.toText().split( '\n' ); - std::for_each( l.begin(), l.end(), []( QString& s ) { CalamaresUtils::removeLeading( s, '=' ); } ); + std::for_each( l.begin(), l.end(), []( QString& s ) { Calamares::String::removeLeading( s, '=' ); } ); return Calamares::JobResult::error( failureMessage, l.join( '\n' ) ); } diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index cebe45452..eae57a868 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -450,7 +450,7 @@ Config::setFullName( const QString& name ) // Build login and hostname, if needed static QRegExp rx( "[^a-zA-Z0-9 ]", Qt::CaseInsensitive ); - const QString cleanName = CalamaresUtils::removeDiacritics( transliterate( name ) ) + const QString cleanName = Calamares::String::removeDiacritics( transliterate( name ) ) .replace( QRegExp( "[-']" ), "" ) .replace( rx, " " ) .toLower() @@ -948,7 +948,7 @@ Config::finalizeGlobalStorage() const { gs->insert( "reuseRootPassword", reuseUserPasswordForRoot() ); } - gs->insert( "password", CalamaresUtils::obscure( userPassword() ) ); + gs->insert( "password", Calamares::String::obscure( userPassword() ) ); } Calamares::JobList From f923dedc3f99a53656fbdc5126859faa94e61961 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 15:28:07 +0200 Subject: [PATCH 071/160] [libcalamares] Add a word-expander This is a variant on KMacroExpander, which allows for reporting of errors after expansion. --- src/libcalamares/CMakeLists.txt | 3 +- src/libcalamares/utils/StringExpander.cpp | 82 +++++++++++++++++++++++ src/libcalamares/utils/StringExpander.h | 66 ++++++++++++++++++ src/libcalamares/utils/Tests.cpp | 59 ++++++++++++++++ 4 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 src/libcalamares/utils/StringExpander.cpp create mode 100644 src/libcalamares/utils/StringExpander.h diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 407dc5f61..2baa3366a 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -69,6 +69,7 @@ set(libSources utils/Retranslator.cpp utils/Runner.cpp utils/String.cpp + utils/StringExpander.cpp utils/UMask.cpp utils/Variant.cpp utils/Yaml.cpp @@ -146,7 +147,7 @@ calamares_automoc( calamares ) target_link_libraries( calamares LINK_PRIVATE ${OPTIONAL_PRIVATE_LIBRARIES} - LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core ${OPTIONAL_PUBLIC_LIBRARIES} + LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons ${OPTIONAL_PUBLIC_LIBRARIES} ) add_library(Calamares::calamares ALIAS calamares) diff --git a/src/libcalamares/utils/StringExpander.cpp b/src/libcalamares/utils/StringExpander.cpp new file mode 100644 index 000000000..044e3aee1 --- /dev/null +++ b/src/libcalamares/utils/StringExpander.cpp @@ -0,0 +1,82 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + * + */ + +#include "StringExpander.h" +#include "Logger.h" + +namespace Calamares +{ +namespace String +{ + +struct DictionaryExpander::Private +{ + QHash< QString, QString > dictionary; + QStringList missing; +}; + +DictionaryExpander::DictionaryExpander() + : KWordMacroExpander( '$' ) + , d( std::make_unique< Private >() ) +{ +} + +DictionaryExpander::~DictionaryExpander() {} + + +void +DictionaryExpander::insert( const QString& key, const QString& value ) +{ + d->dictionary.insert( key, value ); +} + +void +DictionaryExpander::clearErrors() +{ + d->missing.clear(); +} + +bool +DictionaryExpander::hasErrors() const +{ + return !d->missing.isEmpty(); +} + +QStringList +DictionaryExpander::errorNames() const +{ + return d->missing; +} + +QString +DictionaryExpander::expand( QString s ) +{ + clearErrors(); + expandMacros( s ); + return s; +} + +bool +DictionaryExpander::expandMacro( const QString& str, QStringList& ret ) +{ + if ( d->dictionary.contains( str ) ) + { + ret << d->dictionary[ str ]; + return true; + } + else + { + d->missing << str; + return false; + } +} + +} // namespace String +} // namespace Calamares diff --git a/src/libcalamares/utils/StringExpander.h b/src/libcalamares/utils/StringExpander.h new file mode 100644 index 000000000..afcd03ef7 --- /dev/null +++ b/src/libcalamares/utils/StringExpander.h @@ -0,0 +1,66 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + * + */ + +#ifndef UTILS_STRINGEXPANDER_H +#define UTILS_STRINGEXPANDER_H + +#include "DllMacro.h" + +#include + +#include +#include + +namespace Calamares +{ +namespace String +{ + +/** @brief Expand variables in a string against a dictionary. + * + * This class provides a convenience API for building up a dictionary + * and using it to expand strings. Use the `expand()` method to + * do standard word-based expansion with `$` as macro-symbol. + * + * Unlike straight-up `KMacroExpander::expandMacros()`, this + * provides an API to find out which variables were missing + * from the dictionary during expansion. Use `hasErrors()` and + * `errorNames()` to find out which variables those were. + * + * Call `clearErrors()` to reset the stored errors. Calling + * `expand()` implicitly clears the errors before starting + * a new expansion, as well. + */ +class DictionaryExpander : public KWordMacroExpander +{ +public: + DictionaryExpander(); + virtual ~DictionaryExpander() override; + + void insert( const QString& key, const QString& value ); + + void clearErrors(); + bool hasErrors() const; + QStringList errorNames() const; + + QString expand( QString s ); + +protected: + virtual bool expandMacro( const QString& str, QStringList& ret ) override; + +private: + struct Private; + std::unique_ptr< Private > d; +}; + +} // namespace String +} // namespace Calamares + +#endif diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index b4b2251cc..49f1b1ed8 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -15,6 +15,7 @@ #include "RAII.h" #include "Runner.h" #include "String.h" +#include "StringExpander.h" #include "Traits.h" #include "UMask.h" #include "Variant.h" @@ -75,6 +76,10 @@ private Q_SLOTS: void testStringRemoveTrailing_data(); void testStringRemoveTrailing(); + /** @section Test String expansion. */ + void testStringMacroExpander_data(); + void testStringMacroExpander(); // The KF5::CoreAddons bits + /** @section Test Runner directory-manipulation. */ void testRunnerDirs(); void testCalculateWorkingDirectory(); @@ -817,6 +822,60 @@ LibCalamaresTests::testStringRemoveTrailing() QCOMPARE( string, result ); } +void +LibCalamaresTests::testStringMacroExpander_data() +{ + QTest::addColumn< QString >( "source" ); + QTest::addColumn< QString >( "result" ); + QTest::addColumn< QStringList >( "errors" ); + + QTest::newRow( "empty " ) << QString() << QString() << QStringList {}; + QTest::newRow( "constant" ) << QStringLiteral( "bunnies!" ) << QStringLiteral( "bunnies!" ) << QStringList {}; + QTest::newRow( "escaped " ) << QStringLiteral( "$$bun" ) << QStringLiteral( "$bun" ) + << QStringList {}; // Double $$ is an escaped $ + QTest::newRow( "whole " ) << QStringLiteral( "${ROOT}" ) << QStringLiteral( "wortel" ) << QStringList {}; + QTest::newRow( "unbraced" ) << QStringLiteral( "$ROOT" ) << QStringLiteral( "wortel" ) + << QStringList {}; // Does not need {} + QTest::newRow( "bad-var1" ) << QStringLiteral( "${ROOF}" ) << QStringLiteral( "${ROOF}" ) + << QStringList { QStringLiteral( "ROOF" ) }; // Not replaced + QTest::newRow( "twice " ) << QStringLiteral( "${ROOT}x${ROOT}" ) << QStringLiteral( "wortelxwortel" ) + << QStringList {}; + QTest::newRow( "bad-var2" ) << QStringLiteral( "${ROOT}x${ROPE}" ) << QStringLiteral( "wortelx${ROPE}" ) + << QStringList { QStringLiteral( "ROPE" ) }; // Not replaced + // This is a borked string with a "nested" variable. The variable-name- + // scanner goes from ${ to the next } and tries to match that. + QTest::newRow( "confuse1" ) << QStringLiteral( "${RO${ROOT}" ) << QStringLiteral( "${ROwortel" ) + << QStringList { "RO${ROOT" }; + // This one doesn't have a { for the first name to match with + QTest::newRow( "confuse2" ) << QStringLiteral( "$RO${ROOT}" ) << QStringLiteral( "$ROwortel" ) + << QStringList { "RO" }; + // Here we see it just doesn't nest + QTest::newRow( "confuse3" ) << QStringLiteral( "${RO${ROOT}}" ) << QStringLiteral( "${ROwortel}" ) + << QStringList { "RO${ROOT" }; +} + +void +LibCalamaresTests::testStringMacroExpander() +{ + QHash< QString, QString > dict; + dict.insert( QStringLiteral( "ROOT" ), QStringLiteral( "wortel" ) ); + + Calamares::String::DictionaryExpander d; + d.insert( QStringLiteral( "ROOT" ), QStringLiteral( "wortel" ) ); + + QFETCH( QString, source ); + QFETCH( QString, result ); + QFETCH( QStringList, errors ); + + QString km_expanded = KMacroExpander::expandMacros( source, dict, '$' ); + QCOMPARE( km_expanded, result ); + + QString de_expanded = d.expand( source ); + QCOMPARE( de_expanded, result ); + QCOMPARE( d.errorNames(), errors ); + QCOMPARE( d.hasErrors(), !errors.isEmpty() ); +} + static QString dirname( const QTemporaryDir& d ) { From 334b7fc2196661ddc295e3d48cbad4b25ede7646 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 15:30:35 +0200 Subject: [PATCH 072/160] SPDX: tag gersemi configuration --- .gersemirc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gersemirc b/.gersemirc index 11ad22911..8459e681b 100644 --- a/.gersemirc +++ b/.gersemirc @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: no +# SPDX-License-Identifier: CC0-1.0 +# +# Gersemi configuration color: false definitions: [ CMakeModules/CalamaresAddTest.cmake ] line_length: 120 From d76dd2f8e0c9436818cca30daa7572abea01308d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 12 Apr 2022 16:06:42 +0200 Subject: [PATCH 073/160] [libcalamares] Use new expander in CommandList - This switches @@ROOT@@ for ${ROOT} and uses standard macro- expansion mechanisms for the commands; undefined variables will be logged as well. --- src/libcalamares/utils/CommandList.cpp | 71 +++++++++++++------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/libcalamares/utils/CommandList.cpp b/src/libcalamares/utils/CommandList.cpp index 4652dcc5a..6046ae7da 100644 --- a/src/libcalamares/utils/CommandList.cpp +++ b/src/libcalamares/utils/CommandList.cpp @@ -16,6 +16,7 @@ // #include "utils/CalamaresUtils.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" +#include "utils/StringExpander.h" #include "utils/Variant.h" #include @@ -109,59 +110,57 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch CommandList::~CommandList() {} -static inline bool -findInCommands( const CommandList& l, const QString& needle ) -{ - for ( CommandList::const_iterator i = l.cbegin(); i != l.cend(); ++i ) - if ( i->command().contains( needle ) ) - { - return true; - } - return false; -} - Calamares::JobResult CommandList::run() { - QLatin1String rootMagic( "@@ROOT@@" ); - QLatin1String userMagic( "@@USER@@" ); - System::RunLocation location = m_doChroot ? System::RunLocation::RunInTarget : System::RunLocation::RunInHost; - - /* Figure out the replacement for @@ROOT@@ */ - QString root = QStringLiteral( "/" ); Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - bool needsRootSubstitution = findInCommands( *this, rootMagic ); - if ( needsRootSubstitution && ( location == System::RunLocation::RunInHost ) ) + Calamares::String::DictionaryExpander expander; + + // Figure out the replacement for ${ROOT} + if ( location == System::RunLocation::RunInTarget ) { - if ( !gs || !gs->contains( "rootMountPoint" ) ) - { - cError() << "No rootMountPoint defined."; - return Calamares::JobResult::error( - QCoreApplication::translate( "CommandList", "Could not run command." ), - QCoreApplication::translate( "CommandList", - "The command runs in the host environment and needs to know the root " - "path, but no rootMountPoint is defined." ) ); - } - root = gs->value( "rootMountPoint" ).toString(); + expander.insert( QStringLiteral( "ROOT" ), QStringLiteral( "/" ) ); + } + else if ( gs && gs->contains( "rootMountPoint" ) ) + { + expander.insert( QStringLiteral( "ROOT" ), gs->value( "rootMountPoint" ).toString() ); } - bool needsUserSubstitution = findInCommands( *this, userMagic ); - if ( needsUserSubstitution && ( !gs || !gs->contains( "username" ) ) ) + // Replacement for ${USER} + if ( gs && gs->contains( "username" ) ) { - cError() << "No username defined."; + expander.insert( QStringLiteral( "USER" ), gs->value( "username" ).toString() ); + } + + // Copy and expand the list, collecting missing variables (so don't call expand()) + CommandList_t expandedList; + std::transform( cbegin(), + cend(), + std::back_inserter( expandedList ), + [ &expander ]( CommandLine c ) + { + expander.expandMacros( c.first ); + return c; + } ); + + if ( expander.hasErrors() ) + { + const auto missing = expander.errorNames(); + cError() << "Missing variables:" << missing; return Calamares::JobResult::error( QCoreApplication::translate( "CommandList", "Could not run command." ), QCoreApplication::translate( "CommandList", - "The command needs to know the user's name, but no username is defined." ) ); + "The commands use variables that are not defined. " + "Missing variables are: %1." ) + .arg( missing.join( ',' ) ) ); } - QString user = gs->value( "username" ).toString(); // may be blank if unset - for ( CommandList::const_iterator i = cbegin(); i != cend(); ++i ) + + for ( CommandList::const_iterator i = expandedList.cbegin(); i != expandedList.cend(); ++i ) { QString processed_cmd = i->command(); - processed_cmd.replace( rootMagic, root ).replace( userMagic, user ); bool suppress_result = false; if ( processed_cmd.startsWith( '-' ) ) { From bbea67ecb42dd66b13c11d4f89cbfb6ab611858b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 14:08:21 +0200 Subject: [PATCH 074/160] [libcalamares] Add an expand() to command lines and lists - While this is primarily convenient for testing (e.g. checking that a command is expanded the way we expect), it simplifies some of the code because it's now clear that run() uses an expanded copy of the command-list to do the actual work. --- src/libcalamares/utils/CommandList.cpp | 97 +++++++++++++++-------- src/libcalamares/utils/CommandList.h | 33 +++++++- src/libcalamares/utils/StringExpander.cpp | 7 ++ src/libcalamares/utils/StringExpander.h | 1 + src/libcalamares/utils/Tests.cpp | 42 ++++++++++ 5 files changed, 142 insertions(+), 38 deletions(-) diff --git a/src/libcalamares/utils/CommandList.cpp b/src/libcalamares/utils/CommandList.cpp index 6046ae7da..6a743877a 100644 --- a/src/libcalamares/utils/CommandList.cpp +++ b/src/libcalamares/utils/CommandList.cpp @@ -68,6 +68,48 @@ get_variant_stringlist( const QVariantList& l ) return retl; } +static Calamares::String::DictionaryExpander +get_gs_expander( System::RunLocation location ) +{ + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + + Calamares::String::DictionaryExpander expander; + + // Figure out the replacement for ${ROOT} + if ( location == System::RunLocation::RunInTarget ) + { + expander.insert( QStringLiteral( "ROOT" ), QStringLiteral( "/" ) ); + } + else if ( gs && gs->contains( "rootMountPoint" ) ) + { + expander.insert( QStringLiteral( "ROOT" ), gs->value( "rootMountPoint" ).toString() ); + } + + // Replacement for ${USER} + if ( gs && gs->contains( "username" ) ) + { + expander.insert( QStringLiteral( "USER" ), gs->value( "username" ).toString() ); + } + + return expander; +} + +CommandLine +CommandLine::expand( KMacroExpanderBase& expander ) const +{ + QString c = first; + expander.expandMacrosShellQuote( c ); + return { c, second }; +} + +CalamaresUtils::CommandLine +CommandLine::expand() const +{ + auto expander = get_gs_expander( System::RunLocation::RunInHost ); + return expand( expander ); +} + + CommandList::CommandList( bool doChroot, std::chrono::seconds timeout ) : m_doChroot( doChroot ) , m_timeout( timeout ) @@ -91,7 +133,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch } else if ( v.type() == QVariant::String ) { - append( v.toString() ); + append( { v.toString(), m_timeout } ); } else if ( v.type() == QVariant::Map ) { @@ -114,37 +156,9 @@ Calamares::JobResult CommandList::run() { System::RunLocation location = m_doChroot ? System::RunLocation::RunInTarget : System::RunLocation::RunInHost; - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); - - Calamares::String::DictionaryExpander expander; - - // Figure out the replacement for ${ROOT} - if ( location == System::RunLocation::RunInTarget ) - { - expander.insert( QStringLiteral( "ROOT" ), QStringLiteral( "/" ) ); - } - else if ( gs && gs->contains( "rootMountPoint" ) ) - { - expander.insert( QStringLiteral( "ROOT" ), gs->value( "rootMountPoint" ).toString() ); - } - - // Replacement for ${USER} - if ( gs && gs->contains( "username" ) ) - { - expander.insert( QStringLiteral( "USER" ), gs->value( "username" ).toString() ); - } - - // Copy and expand the list, collecting missing variables (so don't call expand()) - CommandList_t expandedList; - std::transform( cbegin(), - cend(), - std::back_inserter( expandedList ), - [ &expander ]( CommandLine c ) - { - expander.expandMacros( c.first ); - return c; - } ); + auto expander = get_gs_expander( location ); + auto expandedList = expand( expander ); if ( expander.hasErrors() ) { const auto missing = expander.errorNames(); @@ -157,7 +171,6 @@ CommandList::run() .arg( missing.join( ',' ) ) ); } - for ( CommandList::const_iterator i = expandedList.cbegin(); i != expandedList.cend(); ++i ) { QString processed_cmd = i->command(); @@ -190,10 +203,24 @@ CommandList::run() return Calamares::JobResult::ok(); } -void -CommandList::append( const QString& s ) +CommandList +CommandList::expand( KMacroExpanderBase& expander ) const { - append( CommandLine( s, m_timeout ) ); + // Copy and expand the list, collecting missing variables (so don't call expand()) + CommandList expandedList( m_doChroot, m_timeout ); + std::transform( cbegin(), + cend(), + std::back_inserter( expandedList ), + [ &expander ]( const CommandLine& c ) { return c.expand( expander ); } ); + return expandedList; } +CommandList +CommandList::expand() const +{ + auto expander = get_gs_expander( System::RunLocation::RunInHost ); + return expand( expander ); +} + + } // namespace CalamaresUtils diff --git a/src/libcalamares/utils/CommandList.h b/src/libcalamares/utils/CommandList.h index 432020a96..3135b9b3c 100644 --- a/src/libcalamares/utils/CommandList.h +++ b/src/libcalamares/utils/CommandList.h @@ -18,6 +18,8 @@ #include +class KMacroExpanderBase; + namespace CalamaresUtils { @@ -50,6 +52,20 @@ struct CommandLine : public QPair< QString, std::chrono::seconds > std::chrono::seconds timeout() const { return second; } bool isValid() const { return !first.isEmpty(); } + + /** @brief Returns a copy of this one command, with variables expanded + * + * The given macro-expander is used to expand the command-line. + * This will normally be a Calamares::String::DictionaryExpander + * instance, which handles the ROOT and USER variables. + */ + CommandLine expand( KMacroExpanderBase& expander ) const; + /** @brief As above, with a default macro-expander. + * + * The default macro-expander assumes RunInHost (e.g. ROOT will + * expand to the RootMountPoint set in Global Storage). + */ + CommandLine expand() const; }; /** @brief Abbreviation, used internally. */ @@ -81,10 +97,21 @@ public: using CommandList_t::const_iterator; using CommandList_t::count; using CommandList_t::isEmpty; + using CommandList_t::push_back; + using CommandList_t::value_type; -protected: - using CommandList_t::append; - void append( const QString& ); + /** @brief Return a copy of this command-list, with variables expanded + * + * Each command-line in the list is expanded with the given @p expander. + * @see CommandLine::expand() for details. + */ + CommandList expand( KMacroExpanderBase& expander ) const; + /** @brief As above, with a default macro-expander. + * + * Each command-line in the list is expanded with that default macro-expander. + * @see CommandLine::expand() for details. + */ + CommandList expand() const; private: bool m_doChroot; diff --git a/src/libcalamares/utils/StringExpander.cpp b/src/libcalamares/utils/StringExpander.cpp index 044e3aee1..38093869d 100644 --- a/src/libcalamares/utils/StringExpander.cpp +++ b/src/libcalamares/utils/StringExpander.cpp @@ -28,6 +28,13 @@ DictionaryExpander::DictionaryExpander() { } +DictionaryExpander::DictionaryExpander( Calamares::String::DictionaryExpander&& other ) + : KWordMacroExpander( other.escapeChar() ) + , d( std::move( other.d ) ) +{ +} + + DictionaryExpander::~DictionaryExpander() {} diff --git a/src/libcalamares/utils/StringExpander.h b/src/libcalamares/utils/StringExpander.h index afcd03ef7..a7f2dab7e 100644 --- a/src/libcalamares/utils/StringExpander.h +++ b/src/libcalamares/utils/StringExpander.h @@ -42,6 +42,7 @@ class DictionaryExpander : public KWordMacroExpander { public: DictionaryExpander(); + DictionaryExpander( DictionaryExpander&& ); virtual ~DictionaryExpander() override; void insert( const QString& key, const QString& value ); diff --git a/src/libcalamares/utils/Tests.cpp b/src/libcalamares/utils/Tests.cpp index 49f1b1ed8..e94c104db 100644 --- a/src/libcalamares/utils/Tests.cpp +++ b/src/libcalamares/utils/Tests.cpp @@ -10,6 +10,7 @@ */ #include "CalamaresUtilsSystem.h" +#include "CommandList.h" #include "Entropy.h" #include "Logger.h" #include "RAII.h" @@ -46,7 +47,10 @@ private Q_SLOTS: void testLoadSaveYaml(); // Just settings.conf void testLoadSaveYamlExtended(); // Do a find() in the src dir + /** @section Test running commands and command-expansion. */ void testCommands(); + void testCommandExpansion_data(); + void testCommandExpansion(); // See also shellprocess tests /** @section Test that all the UMask objects work correctly. */ void testUmask(); @@ -99,6 +103,16 @@ LibCalamaresTests::~LibCalamaresTests() {} void LibCalamaresTests::initTestCase() { + Calamares::GlobalStorage* gs + = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + + if ( !gs ) + { + cDebug() << "Creating new JobQueue"; + (void)new Calamares::JobQueue(); + gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + } + QVERIFY( gs ); } void @@ -256,6 +270,34 @@ LibCalamaresTests::testCommands() QVERIFY( r.getOutput().contains( tfn.fileName() ) ); } +void +LibCalamaresTests::testCommandExpansion_data() +{ + QTest::addColumn< QString >( "command" ); + QTest::addColumn< QString >( "expected" ); + + QTest::newRow( "empty" ) << QString() << QString(); + QTest::newRow( "ls " ) << QStringLiteral( "ls" ) << QStringLiteral( "ls" ); + QTest::newRow( "user " ) << QStringLiteral( "chmod $USER" ) << QStringLiteral( "chmod alice" ); +} + +void +LibCalamaresTests::testCommandExpansion() +{ + Calamares::GlobalStorage* gs + = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + QVERIFY( gs ); + gs->insert( QStringLiteral( "username" ), QStringLiteral( "alice" ) ); + + QFETCH( QString, command ); + QFETCH( QString, expected ); + CalamaresUtils::CommandLine c( command, std::chrono::seconds( 0 ) ); + CalamaresUtils::CommandLine e = c.expand(); + + QCOMPARE( c.command(), command ); + QCOMPARE( e.command(), expected ); +} + void LibCalamaresTests::testUmask() { From f6b65b3b936e6fdd0a29f2b0cead50640a92591a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 14:16:57 +0200 Subject: [PATCH 075/160] [shellprocess] CommandLine now quotes properly in variable expansion --- src/modules/shellprocess/Tests.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/shellprocess/Tests.cpp b/src/modules/shellprocess/Tests.cpp index 5d3a503fd..f8727ab36 100644 --- a/src/modules/shellprocess/Tests.cpp +++ b/src/modules/shellprocess/Tests.cpp @@ -190,7 +190,14 @@ script: // But no user set yet QVERIFY( !bool( CommandList( userScript, false, 10s ).run() ) ); - // Now play dangerous games with shell expansion + // Show that shell expansion is now quoted. gs->insert( "username", "`id -u`" ); - QVERIFY( bool( CommandList( userScript, false, 10s ).run() ) ); + { + CalamaresUtils::CommandLine c { QStringLiteral( "chown ${USER}" ), std::chrono::seconds( 0 ) }; + QCOMPARE( c.expand().command(), QStringLiteral( "chown '`id -u`'" ) ); + } + // Now play dangerous games with shell expansion -- except the internal command is now + // quoted, so this fails because it's **highly** unlikely that the literal string + // "`id -u`" is a valid username. + QVERIFY( !bool( CommandList( userScript, false, 10s ).run() ) ); } From f4117881cd17b66ecad95b8c92a59f65f60a5d8f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 16:45:32 +0200 Subject: [PATCH 076/160] [welcome] Add some more development-only checks --- .../welcome/checker/GeneralRequirements.cpp | 55 +++++++++++++++---- src/modules/welcome/welcome.conf | 11 ++++ 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index ca7219ca4..b9e5db83d 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -15,6 +15,9 @@ #include "CheckerContainer.h" #include "partman_devices.h" +#include "CalamaresVersion.h" // For development-or-not +#include "GlobalStorage.h" +#include "JobQueue.h" #include "Settings.h" #include "modulesystem/Requirement.h" #include "network/Manager.h" @@ -26,9 +29,6 @@ #include "utils/Variant.h" #include "widgets/WaitingWidget.h" -#include "GlobalStorage.h" -#include "JobQueue.h" - #include #include #include @@ -152,10 +152,10 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, - [req = m_requiredStorageGiB] { return tr( "has at least %1 GiB available drive space" ).arg( req ); }, - [req = m_requiredStorageGiB] { - return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); - }, + [ req = m_requiredStorageGiB ] + { return tr( "has at least %1 GiB available drive space" ).arg( req ); }, + [ req = m_requiredStorageGiB ] + { return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); }, enoughStorage, m_entriesToRequire.contains( entry ) } ); } @@ -163,8 +163,8 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, - [req = m_requiredRamGiB] { return tr( "has at least %1 GiB working memory" ).arg( req ); }, - [req = m_requiredRamGiB] { + [ req = m_requiredRamGiB ] { return tr( "has at least %1 GiB working memory" ).arg( req ); }, + [ req = m_requiredRamGiB ] { return tr( "The system does not have enough working memory. At least %1 GiB is required." ) .arg( req ); }, @@ -191,7 +191,8 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, [] { return tr( "is running the installer as an administrator (root)" ); }, - [] { + [] + { return Calamares::Settings::instance()->isSetupMode() ? tr( "The setup program is not running with administrator rights." ) : tr( "The installer is not running with administrator rights." ); @@ -203,7 +204,8 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, [] { return tr( "has a screen large enough to show the whole installer" ); }, - [] { + [] + { return Calamares::Settings::instance()->isSetupMode() ? tr( "The screen is too small to display the setup program." ) : tr( "The screen is too small to display the installer." ); @@ -211,6 +213,37 @@ GeneralRequirements::checkRequirements() enoughScreen, false } ); } +#ifdef CALAMARES_VERSION_RC + if ( entry == "false" ) + { + checkEntries.append( { entry, + [] { return tr( "is always false" ); }, + [] { return tr( "is always false" ); }, + false, + m_entriesToRequire.contains( entry ) } ); + } + if ( entry == "true" ) + { + checkEntries.append( { entry, + [] { return tr( "is always true" ); }, + [] { return tr( "is always true" ); }, + true, + m_entriesToRequire.contains( entry ) } ); + } + if ( entry == "snark" ) + { + static unsigned int snark_count = 0; + checkEntries.append( { entry, + [] { return tr( "is checked three times." ); }, + [] + { + return tr( "The snark has not been checked three times.", + "The (some mythological beast) has not been checked three times." ); + }, + ++snark_count > 3, + m_entriesToRequire.contains( entry ) } ); + } +#endif } return checkEntries; } diff --git a/src/modules/welcome/welcome.conf b/src/modules/welcome/welcome.conf index 6e11817bf..b86231c3f 100644 --- a/src/modules/welcome/welcome.conf +++ b/src/modules/welcome/welcome.conf @@ -64,6 +64,14 @@ requirements: # the host system satisfying the condition. # # This sample file lists all the conditions that are known. + # + # Note that the last three checks are for testing-purposes only, + # and shouldn't be used in production (they are only available + # when building Calamares in development mode): + # - *false* is a check that is always false (unsatisfied) + # - *true* is a check that is always true (satisfied) + # - *snark* is a check that is only satisfied once it has been checked + # at least three times ("what I tell you three times is true"). check: - storage - ram @@ -71,6 +79,9 @@ requirements: - internet - root - screen + - false + - true + - snark # List conditions that **must** be satisfied (from the list # of conditions, above) for installation to proceed. # If any of these conditions are not met, the user cannot From cbd4bd9bbe57de0cc7a894c20947bede8146fa05 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 16:47:54 +0200 Subject: [PATCH 077/160] [welcome] Factor out is-this-check-required While here, make it possible for the "screen" (screen-size) check to be mandatory; there's no reason it shouldn't follow the same logic as all the others (although denying users an install because they have a VGA monitor seems a bit weak). --- .../welcome/checker/GeneralRequirements.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index b9e5db83d..6233eae75 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -148,6 +148,7 @@ GeneralRequirements::checkRequirements() Calamares::RequirementsList checkEntries; foreach ( const QString& entry, m_entriesToCheck ) { + const bool required = m_entriesToRequire.contains( entry ); if ( entry == "storage" ) { checkEntries.append( @@ -157,7 +158,7 @@ GeneralRequirements::checkRequirements() [ req = m_requiredStorageGiB ] { return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); }, enoughStorage, - m_entriesToRequire.contains( entry ) } ); + required } ); } else if ( entry == "ram" ) { @@ -169,7 +170,7 @@ GeneralRequirements::checkRequirements() .arg( req ); }, enoughRam, - m_entriesToRequire.contains( entry ) } ); + required } ); } else if ( entry == "power" ) { @@ -177,7 +178,7 @@ GeneralRequirements::checkRequirements() [] { return tr( "is plugged in to a power source" ); }, [] { return tr( "The system is not plugged in to a power source." ); }, hasPower, - m_entriesToRequire.contains( entry ) } ); + required } ); } else if ( entry == "internet" ) { @@ -185,7 +186,7 @@ GeneralRequirements::checkRequirements() [] { return tr( "is connected to the Internet" ); }, [] { return tr( "The system is not connected to the Internet." ); }, hasInternet, - m_entriesToRequire.contains( entry ) } ); + required } ); } else if ( entry == "root" ) { @@ -198,7 +199,7 @@ GeneralRequirements::checkRequirements() : tr( "The installer is not running with administrator rights." ); }, isRoot, - m_entriesToRequire.contains( entry ) } ); + required } ); } else if ( entry == "screen" ) { @@ -211,7 +212,7 @@ GeneralRequirements::checkRequirements() : tr( "The screen is too small to display the installer." ); }, enoughScreen, - false } ); + required } ); } #ifdef CALAMARES_VERSION_RC if ( entry == "false" ) @@ -220,7 +221,7 @@ GeneralRequirements::checkRequirements() [] { return tr( "is always false" ); }, [] { return tr( "is always false" ); }, false, - m_entriesToRequire.contains( entry ) } ); + required } ); } if ( entry == "true" ) { @@ -228,7 +229,7 @@ GeneralRequirements::checkRequirements() [] { return tr( "is always true" ); }, [] { return tr( "is always true" ); }, true, - m_entriesToRequire.contains( entry ) } ); + required } ); } if ( entry == "snark" ) { @@ -241,7 +242,7 @@ GeneralRequirements::checkRequirements() "The (some mythological beast) has not been checked three times." ); }, ++snark_count > 3, - m_entriesToRequire.contains( entry ) } ); + required } ); } #endif } From 8f5c3fa3026b3cb6ea0c68e43a1854241e0618df Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 16:51:21 +0200 Subject: [PATCH 078/160] [welcome] Improve messages a little for bogus-checks. Follow the guidelines for checker-messages, even though these should never be displayed to real users. --- src/modules/welcome/checker/GeneralRequirements.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index 6233eae75..7780b8753 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -219,7 +219,7 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, [] { return tr( "is always false" ); }, - [] { return tr( "is always false" ); }, + [] { return tr( "The computer says no." ); }, false, required } ); } @@ -227,7 +227,7 @@ GeneralRequirements::checkRequirements() { checkEntries.append( { entry, [] { return tr( "is always true" ); }, - [] { return tr( "is always true" ); }, + [] { return tr( "The computer says yes." ); }, true, required } ); } From a9e098b0b4162786ba59afbe92c61f8c2fe8b91c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 17:08:17 +0200 Subject: [PATCH 079/160] [libcalamares] Allow resetting the requirements model - When a requirements checker starts, it can reset the model to clear it of previous entries. --- .../modulesystem/RequirementsChecker.cpp | 26 +++++++++++-------- .../modulesystem/RequirementsModel.cpp | 10 +++++++ .../modulesystem/RequirementsModel.h | 4 +++ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/libcalamares/modulesystem/RequirementsChecker.cpp b/src/libcalamares/modulesystem/RequirementsChecker.cpp index 32c7254de..d0d6e74fe 100644 --- a/src/libcalamares/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamares/modulesystem/RequirementsChecker.cpp @@ -32,6 +32,7 @@ RequirementsChecker::RequirementsChecker( QVector< Module* > modules, Requiremen , m_progressTimer( nullptr ) , m_progressTimeouts( 0 ) { + m_model->clear(); m_watchers.reserve( m_modules.count() ); connect( this, &RequirementsChecker::requirementsProgress, model, &RequirementsModel::setProgressMessage ); } @@ -63,9 +64,9 @@ RequirementsChecker::finished() static QMutex finishedMutex; QMutexLocker lock( &finishedMutex ); - if ( m_progressTimer && std::all_of( m_watchers.cbegin(), m_watchers.cend(), []( const Watcher* w ) { - return w && w->isFinished(); - } ) ) + if ( m_progressTimer + && std::all_of( + m_watchers.cbegin(), m_watchers.cend(), []( const Watcher* w ) { return w && w->isFinished(); } ) ) { cDebug() << "All requirements have been checked."; if ( m_progressTimer ) @@ -100,14 +101,17 @@ RequirementsChecker::reportProgress() m_progressTimeouts++; QStringList remainingNames; - auto remaining = std::count_if( m_watchers.cbegin(), m_watchers.cend(), [&]( const Watcher* w ) { - if ( w && !w->isFinished() ) - { - remainingNames << w->objectName(); - return true; - } - return false; - } ); + auto remaining = std::count_if( m_watchers.cbegin(), + m_watchers.cend(), + [ & ]( const Watcher* w ) + { + if ( w && !w->isFinished() ) + { + remainingNames << w->objectName(); + return true; + } + return false; + } ); if ( remaining > 0 ) { cDebug() << "Remaining modules:" << remaining << Logger::DebugList( remainingNames ); diff --git a/src/libcalamares/modulesystem/RequirementsModel.cpp b/src/libcalamares/modulesystem/RequirementsModel.cpp index 6a7e0a5b4..f21f7051c 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.cpp +++ b/src/libcalamares/modulesystem/RequirementsModel.cpp @@ -15,6 +15,16 @@ namespace Calamares { +void +RequirementsModel::clear() +{ + QMutexLocker l( &m_addLock ); + emit beginResetModel(); + m_requirements.clear(); + changeRequirementsList(); + emit endResetModel(); +} + void RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements ) { diff --git a/src/libcalamares/modulesystem/RequirementsModel.h b/src/libcalamares/modulesystem/RequirementsModel.h index 5f3e13cbb..d1842760c 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.h +++ b/src/libcalamares/modulesystem/RequirementsModel.h @@ -77,6 +77,10 @@ signals: protected: QHash< int, QByteArray > roleNames() const override; + + ///@brief Clears the requirements; resets the model + void clear(); + ///@brief Append some requirements; resets the model void addRequirementsList( const Calamares::RequirementsList& requirements ); From 6348309936a1b1ffbe3247de55131925c51166ae Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 17:09:43 +0200 Subject: [PATCH 080/160] [libcalamaresui] If requirements are not satisfied, recheck in 5 seconds --- src/libcalamaresui/modulesystem/ModuleManager.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/modulesystem/ModuleManager.cpp b/src/libcalamaresui/modulesystem/ModuleManager.cpp index 1e397b340..1233b1115 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.cpp +++ b/src/libcalamaresui/modulesystem/ModuleManager.cpp @@ -349,7 +349,18 @@ ModuleManager::checkRequirements() connect( rq, &RequirementsChecker::done, this, - [ = ]() { this->requirementsComplete( m_requirementsModel->satisfiedMandatory() ); } ); + [ = ]() + { + if ( m_requirementsModel->satisfiedMandatory() ) + { + /* we're done */ this->requirementsComplete( true ); + } + else + { + this->requirementsComplete( false ); + QTimer::singleShot( std::chrono::seconds( 5 ), this, &ModuleManager::checkRequirements ); + } + } ); QTimer::singleShot( 0, rq, &RequirementsChecker::run ); } From ee925492d4dc829316c52be97bdbe941c130dd99 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 17:12:25 +0200 Subject: [PATCH 081/160] [welcome] Don't duplicate widgets --- .../welcome/checker/CheckerContainer.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/modules/welcome/checker/CheckerContainer.cpp b/src/modules/welcome/checker/CheckerContainer.cpp index 23055c2e0..dd5a6680f 100644 --- a/src/modules/welcome/checker/CheckerContainer.cpp +++ b/src/modules/welcome/checker/CheckerContainer.cpp @@ -65,13 +65,18 @@ CheckerContainer::requirementsComplete( bool ok ) } } - layout()->removeWidget( m_waitingWidget ); - m_waitingWidget->deleteLater(); - m_waitingWidget = nullptr; // Don't delete in destructor - - m_checkerWidget = new ResultsListWidget( m_config, this ); - m_checkerWidget->setObjectName( "requirementsChecker" ); - layout()->addWidget( m_checkerWidget ); + if ( m_waitingWidget ) + { + layout()->removeWidget( m_waitingWidget ); + m_waitingWidget->deleteLater(); + m_waitingWidget = nullptr; // Don't delete in destructor + } + if ( !m_checkerWidget ) + { + m_checkerWidget = new ResultsListWidget( m_config, this ); + m_checkerWidget->setObjectName( "requirementsChecker" ); + layout()->addWidget( m_checkerWidget ); + } m_verdict = ok; } From fc653adcc0f699828228eeb8faf4044d6f4402b8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 13 Apr 2022 18:15:21 +0200 Subject: [PATCH 082/160] [welcome] Don't duplicate result widgets --- .../welcome/checker/ResultsListWidget.cpp | 152 +++++++++++------- .../welcome/checker/ResultsListWidget.h | 14 ++ 2 files changed, 104 insertions(+), 62 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index acbb48e42..57e2eb4ae 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -110,10 +110,11 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, m_title = new QLabel( this ); m_title->setObjectName( "resultDialogTitle" ); - createResultWidgets( - entriesLayout, m_resultWidgets, model, []( const Calamares::RequirementsModel& m, QModelIndex i ) { - return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool(); - } ); + createResultWidgets( entriesLayout, + m_resultWidgets, + model, + []( const Calamares::RequirementsModel& m, QModelIndex i ) + { return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool(); } ); QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); buttonBox->setObjectName( "resultDialogButtons" ); @@ -154,75 +155,35 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) { setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); - QBoxLayout* mainLayout = new QVBoxLayout; - QBoxLayout* entriesLayout = new QVBoxLayout; + m_mainLayout = new QVBoxLayout; + m_entriesLayout = new QVBoxLayout; - setLayout( mainLayout ); + setLayout( m_mainLayout ); int paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 ); QHBoxLayout* spacerLayout = new QHBoxLayout; - mainLayout->addLayout( spacerLayout ); + m_mainLayout->addLayout( spacerLayout ); spacerLayout->addSpacing( paddingSize ); - spacerLayout->addLayout( entriesLayout ); + spacerLayout->addLayout( m_entriesLayout ); spacerLayout->addSpacing( paddingSize ); CalamaresUtils::unmarginLayout( spacerLayout ); - auto* explanation = new QLabel( m_config->warningMessage() ); - explanation->setWordWrap( true ); - explanation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - explanation->setOpenExternalLinks( false ); - explanation->setObjectName( "resultsExplanation" ); - entriesLayout->addWidget( explanation ); + m_explanation = new QLabel( m_config->warningMessage() ); + m_explanation->setWordWrap( true ); + m_explanation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); + m_explanation->setOpenExternalLinks( false ); + m_explanation->setObjectName( "resultsExplanation" ); + m_entriesLayout->addWidget( m_explanation ); - connect( config, &Config::warningMessageChanged, explanation, &QLabel::setText ); - connect( explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); + requirementsChanged(); - // Check that all are satisfied (gives warnings if not) and - // all *mandatory* entries are satisfied (gives errors if not). - - const bool requirementsSatisfied = config->requirementsModel()->satisfiedRequirements(); - auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) { - return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); - }; - - createResultWidgets( entriesLayout, m_resultWidgets, *( config->requirementsModel() ), isUnSatisfied ); - - if ( !requirementsSatisfied ) - { - entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); - mainLayout->addStretch(); - } - else - { - if ( !Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ).isEmpty() ) - { - QPixmap theImage - = QPixmap( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ) ); - if ( !theImage.isNull() ) - { - QLabel* imageLabel; - if ( Calamares::Branding::instance()->welcomeExpandingLogo() ) - { - FixedAspectRatioLabel* p = new FixedAspectRatioLabel; - p->setPixmap( theImage ); - imageLabel = p; - } - else - { - imageLabel = new QLabel; - imageLabel->setPixmap( theImage ); - } - - imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight() * 3 / 4, 4, 4 ); - imageLabel->setAlignment( Qt::AlignCenter ); - imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); - imageLabel->setObjectName( "welcomeLogo" ); - mainLayout->addWidget( imageLabel ); - } - } - explanation->setAlignment( Qt::AlignCenter ); - } + connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText ); + connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); + connect( config->requirementsModel(), + &Calamares::RequirementsModel::modelReset, + this, + &ResultsListWidget::requirementsChanged ); CALAMARES_RETRANSLATE_SLOT( &ResultsListWidget::retranslate ); } @@ -253,6 +214,73 @@ ResultsListWidget::retranslate() } } +void +ResultsListWidget::requirementsChanged() +{ + if ( m_config->requirementsModel()->count() < m_requirementsSeen ) + { + return; + } + m_requirementsSeen = m_config->requirementsModel()->count(); + + // Check that all are satisfied (gives warnings if not) and + // all *mandatory* entries are satisfied (gives errors if not). + + const bool requirementsSatisfied = m_config->requirementsModel()->satisfiedRequirements(); + auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) + { return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); }; + + + std::for_each( m_resultWidgets.begin(), + m_resultWidgets.end(), + []( QWidget* w ) + { + if ( w ) + { + w->deleteLater(); + } + } ); + createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); + + if ( !requirementsSatisfied ) + { + m_entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); + m_mainLayout->addStretch(); + } + else + { + if ( !Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ).isEmpty() ) + { + QPixmap theImage + = QPixmap( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ) ); + if ( !theImage.isNull() ) + { + QLabel* imageLabel; + if ( Calamares::Branding::instance()->welcomeExpandingLogo() ) + { + FixedAspectRatioLabel* p = new FixedAspectRatioLabel; + p->setPixmap( theImage ); + imageLabel = p; + } + else + { + imageLabel = new QLabel; + imageLabel->setPixmap( theImage ); + } + + imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight() * 3 / 4, 4, 4 ); + imageLabel->setAlignment( Qt::AlignCenter ); + imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + imageLabel->setObjectName( "welcomeLogo" ); + m_mainLayout->addWidget( imageLabel ); + } + } + m_explanation->setAlignment( Qt::AlignCenter ); + } + + retranslate(); +} + #include "utils/moc-warnings.h" #include "ResultsListWidget.moc" diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index 5e96b74a0..e5e64052f 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -17,6 +17,7 @@ #include +class QBoxLayout; class QLabel; class ResultsListWidget : public QWidget { @@ -27,10 +28,23 @@ public: private: /// @brief A link in the explanatory text has been clicked void linkClicked( const QString& link ); + /// @brief The model of requirements changed + void requirementsChanged(); + void retranslate(); QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry Config* m_config = nullptr; + + // UI parts, which need updating when the model changes + QLabel* m_explanation = nullptr; + QBoxLayout* m_mainLayout = nullptr; + QBoxLayout* m_entriesLayout = nullptr; + // We count how many requirements we have seen; since the model + // does not shrink, we can avoid reacting to model-is-cleared + // events because the size of the model is then (briefly) smaller + // than what we expect. + int m_requirementsSeen = 0; }; #endif // CHECKER_RESULTSLISTWIDGET_H From 11d7870d686e2778544c45ca70023742f493c946 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Apr 2022 21:48:55 +0200 Subject: [PATCH 083/160] [welcome] Factor out check for a filled requirements-model --- .../welcome/checker/ResultsListWidget.cpp | 15 ++++++++++-- .../welcome/checker/ResultsListWidget.h | 24 +++++++++++++++---- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 57e2eb4ae..6d4465f81 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -217,11 +217,10 @@ ResultsListWidget::retranslate() void ResultsListWidget::requirementsChanged() { - if ( m_config->requirementsModel()->count() < m_requirementsSeen ) + if ( !isModelFilled() ) { return; } - m_requirementsSeen = m_config->requirementsModel()->count(); // Check that all are satisfied (gives warnings if not) and // all *mandatory* entries are satisfied (gives errors if not). @@ -281,6 +280,18 @@ ResultsListWidget::requirementsChanged() retranslate(); } +bool +ResultsListWidget::isModelFilled() +{ + if ( m_config->requirementsModel()->count() < m_requirementsSeen ) + { + return false; + } + m_requirementsSeen = m_config->requirementsModel()->count(); + return true; +} + + #include "utils/moc-warnings.h" #include "ResultsListWidget.moc" diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index e5e64052f..f4f23293b 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -33,17 +33,31 @@ private: void retranslate(); - QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry + /** @brief The model can be reset and re-filled, is it full yet? + * + * We count how many requirements we have seen; since the model + * does not shrink, we can avoid reacting to model-is-cleared + * events because the size of the model is then (briefly) smaller + * than what we expect. + * + * Returns true if the model contains at least m_requirementsSeen + * elements, and updates m_requirementsSeen. (Which is why the + * method is not const) + */ + bool isModelFilled(); + + /** @brief A list of widgets, one per entry in the requirements model + * + * Unsatisfied entries have a non-null widget pointer, while requirements + * entries that **are** satisfied have no widget. + */ + QList< ResultWidget* > m_resultWidgets; Config* m_config = nullptr; // UI parts, which need updating when the model changes QLabel* m_explanation = nullptr; QBoxLayout* m_mainLayout = nullptr; QBoxLayout* m_entriesLayout = nullptr; - // We count how many requirements we have seen; since the model - // does not shrink, we can avoid reacting to model-is-cleared - // events because the size of the model is then (briefly) smaller - // than what we expect. int m_requirementsSeen = 0; }; From e79f29dc0ef3ff185439f2b148f7dabfce7454ac Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Apr 2022 21:51:43 +0200 Subject: [PATCH 084/160] [welcome] Update the explanation only when all the results are in. --- src/modules/welcome/checker/ResultsListWidget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 6d4465f81..4a3280622 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -178,7 +178,15 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) requirementsChanged(); - connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText ); + connect( config, + &Config::warningMessageChanged, + [ = ]( QString s ) + { + if ( isModelFilled() ) + { + m_explanation->setText( s ); + } + } ); connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); connect( config->requirementsModel(), &Calamares::RequirementsModel::modelReset, From fcb893cd12f4125d35bb0e0de6cdf1b5b9135993 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 14 Apr 2022 22:06:36 +0200 Subject: [PATCH 085/160] [welcome] Avoid growing more spacers Insert spacers only once; avoid crashing when all the requirements are satisfied immediately. --- src/modules/welcome/checker/ResultsListWidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 4a3280622..eb0c624c8 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -175,6 +175,8 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) m_explanation->setOpenExternalLinks( false ); m_explanation->setObjectName( "resultsExplanation" ); m_entriesLayout->addWidget( m_explanation ); + m_entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); + m_mainLayout->addStretch(); requirementsChanged(); @@ -212,7 +214,9 @@ void ResultsListWidget::retranslate() { const auto& model = *( m_config->requirementsModel() ); - for ( auto i = 0; i < model.count(); i++ ) + // Retranslate the widgets that there **are**; + // these remain in-order relative to the model. + for ( auto i = 0; i < model.count() && i < m_resultWidgets.count(); i++ ) { if ( m_resultWidgets[ i ] ) { @@ -247,12 +251,10 @@ ResultsListWidget::requirementsChanged() w->deleteLater(); } } ); - createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); if ( !requirementsSatisfied ) { - m_entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); - m_mainLayout->addStretch(); + createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); } else { From 9a3d9feb308d734b4fcbfa4438211433d42331dd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 12:13:16 +0200 Subject: [PATCH 086/160] [libcalamaresui] Add a countdown widget for limited waiting. --- src/libcalamaresui/widgets/WaitingWidget.cpp | 91 ++++++++++++++++++++ src/libcalamaresui/widgets/WaitingWidget.h | 49 ++++++++++- 2 files changed, 139 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index aef5aecf5..671f140c5 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -16,6 +16,7 @@ #include #include +#include WaitingWidget::WaitingWidget( const QString& text, QWidget* parent ) : QWidget( parent ) @@ -55,3 +56,93 @@ WaitingWidget::setText( const QString& text ) { m_waitingLabel->setText( text ); } + +struct CountdownWaitingWidget::Private +{ + std::chrono::seconds duration; + // int because we count down, need to be able to show a 0, + // and then wrap around to duration a second later. + int count = 0; + WaitingSpinnerWidget* spinner = nullptr; + QLabel* label = nullptr; + QTimer* timer = nullptr; + + Private( std::chrono::seconds seconds, QWidget* parent ) + : duration( seconds ) + , spinner( new WaitingSpinnerWidget( parent ) ) + , label( new QLabel( parent ) ) + , timer( new QTimer( parent ) ) + { + } +}; + +CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, QWidget* parent ) + : QWidget( parent ) + , d( std::make_unique< Private >( duration, this ) ) +{ + // Set up the label first for sizing + const int labelHeight = d->label->fontMetrics().height() * 3 / 2; + + // Set up the spinner + d->spinner->setFixedSize( labelHeight, labelHeight ); + + // Overall UI layout + QBoxLayout* box = new QHBoxLayout; + box->addWidget( d->spinner ); + box->addWidget( d->label ); + setLayout( box ); + + // Last because it updates the text + setInterval( duration ); + + d->timer->setInterval( std::chrono::seconds( 1 ) ); + connect( d->timer, &QTimer::timeout, this, &CountdownWaitingWidget::tick ); +} + +CountdownWaitingWidget::~CountdownWaitingWidget() +{ + d->timer->stop(); +} + +void +CountdownWaitingWidget::setInterval( std::chrono::seconds duration ) +{ + d->duration = duration; + d->count = int( duration.count() ); + tick(); +} + +void +CountdownWaitingWidget::start() +{ + // start it from the top + if ( d->count <= 0 ) + { + d->count = int( d->duration.count() ); + tick(); + } + d->timer->start(); +} + +void +CountdownWaitingWidget::stop() +{ + d->timer->stop(); +} + +void +CountdownWaitingWidget::tick() +{ + // We do want to **display** a 0 which is why we wrap around only + // after counting down from 0. + d->count--; + if ( d->count < 0 ) + { + d->count = int( d->duration.count() ); + } + d->label->setText( QString::number( d->count ) ); + if ( d->count == 0 ) + { + timeout(); + } +} diff --git a/src/libcalamaresui/widgets/WaitingWidget.h b/src/libcalamaresui/widgets/WaitingWidget.h index 850b81ca9..867529641 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.h +++ b/src/libcalamaresui/widgets/WaitingWidget.h @@ -12,18 +12,65 @@ #include -class QLabel; +#include +#include +class QLabel; +class QTimer; + +/** @brief A spinner and a label below it + * + * The spinner has a fixed size of 4* the font height, + * and the text is displayed centered below it. Use this + * to display a long-term waiting situation with a status report. + */ class WaitingWidget : public QWidget { Q_OBJECT public: + /// Create a WaitingWidget with initial @p text label. explicit WaitingWidget( const QString& text, QWidget* parent = nullptr ); + /// Update the @p text displayed in the label. void setText( const QString& text ); private: QLabel* m_waitingLabel; }; +/** @brief A spinner and a countdown next to it + * + * The spinner is sized to the text-height and displays a + * numeric countdown next to it. The countdown is updated + * every second. The signal timeout() is sent every time + * the countdown reaches 0. + */ +class CountdownWaitingWidget : public QWidget +{ + Q_OBJECT +public: + /// Create a countdown widget with a given @p duration + explicit CountdownWaitingWidget( std::chrono::seconds duration = std::chrono::seconds( 5 ), + QWidget* parent = nullptr ); + ~CountdownWaitingWidget() override; + + /// Changes the duration used and resets the countdown + void setInterval( std::chrono::seconds duration ); + + /// Start the countdown, resets to the full duration + void start(); + /// Stop the countdown + void stop(); + +Q_SIGNALS: + void timeout(); + +protected Q_SLOTS: + void tick(); + +private: + struct Private; + std::unique_ptr< Private > d; +}; + #endif // WAITINGWIDGET_H From 514b7284492fdadb13bfeb78393b405343450625 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 12:41:29 +0200 Subject: [PATCH 087/160] [libcalamaresui] Tweak widget display for countdown --- src/libcalamaresui/widgets/WaitingWidget.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index 671f140c5..0e32f4a92 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -81,10 +81,14 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q , d( std::make_unique< Private >( duration, this ) ) { // Set up the label first for sizing - const int labelHeight = d->label->fontMetrics().height() * 3 / 2; + const int labelHeight = qBound( 16, d->label->fontMetrics().height() * 3 / 2, 64 ); // Set up the spinner d->spinner->setFixedSize( labelHeight, labelHeight ); + d->spinner->setRevolutionsPerSecond( 1 ); + d->spinner->setInnerRadius( labelHeight / 2 ); + d->spinner->setLineLength( labelHeight / 2 ); + d->spinner->setLineWidth( labelHeight / 8 ); // Overall UI layout QBoxLayout* box = new QHBoxLayout; @@ -122,12 +126,14 @@ CountdownWaitingWidget::start() tick(); } d->timer->start(); + d->spinner->start(); } void CountdownWaitingWidget::stop() { d->timer->stop(); + d->spinner->stop(); } void From 075185547a067b6daaf41b8e830ed093eeeea32a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 12:47:12 +0200 Subject: [PATCH 088/160] [welcome] Display a countdown while (re)checking requirements --- src/modules/welcome/checker/ResultsListWidget.cpp | 11 ++++++++++- src/modules/welcome/checker/ResultsListWidget.h | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index eb0c624c8..4c802acfc 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -18,6 +18,7 @@ #include "utils/Logger.h" #include "utils/Retranslator.h" #include "widgets/FixedAspectRatioLabel.h" +#include "widgets/WaitingWidget.h" #include #include @@ -169,12 +170,18 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) spacerLayout->addSpacing( paddingSize ); CalamaresUtils::unmarginLayout( spacerLayout ); + QHBoxLayout* explanationLayout = new QHBoxLayout; m_explanation = new QLabel( m_config->warningMessage() ); m_explanation->setWordWrap( true ); m_explanation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); m_explanation->setOpenExternalLinks( false ); m_explanation->setObjectName( "resultsExplanation" ); - m_entriesLayout->addWidget( m_explanation ); + explanationLayout->addWidget( m_explanation ); + m_countdown = new CountdownWaitingWidget; + explanationLayout->addWidget( m_countdown ); + m_countdown->start(); + + m_entriesLayout->addLayout( explanationLayout ); m_entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); m_mainLayout->addStretch(); @@ -258,6 +265,8 @@ ResultsListWidget::requirementsChanged() } else { + m_countdown->stop(); + m_countdown->hide(); if ( !Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ).isEmpty() ) { QPixmap theImage diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index f4f23293b..ca47b3a13 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -17,8 +17,11 @@ #include +class CountdownWaitingWidget; + class QBoxLayout; class QLabel; + class ResultsListWidget : public QWidget { Q_OBJECT @@ -56,6 +59,7 @@ private: // UI parts, which need updating when the model changes QLabel* m_explanation = nullptr; + CountdownWaitingWidget* m_countdown = nullptr; QBoxLayout* m_mainLayout = nullptr; QBoxLayout* m_entriesLayout = nullptr; int m_requirementsSeen = 0; From e351b1dafa0e4cd5e136641a8655e3377e3a5bd7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 12:50:18 +0200 Subject: [PATCH 089/160] [libcalamaresui] Drop the countdown label --- src/libcalamaresui/widgets/WaitingWidget.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index 0e32f4a92..37cc4726e 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -64,13 +64,11 @@ struct CountdownWaitingWidget::Private // and then wrap around to duration a second later. int count = 0; WaitingSpinnerWidget* spinner = nullptr; - QLabel* label = nullptr; QTimer* timer = nullptr; Private( std::chrono::seconds seconds, QWidget* parent ) : duration( seconds ) , spinner( new WaitingSpinnerWidget( parent ) ) - , label( new QLabel( parent ) ) , timer( new QTimer( parent ) ) { } @@ -81,11 +79,11 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q , d( std::make_unique< Private >( duration, this ) ) { // Set up the label first for sizing - const int labelHeight = qBound( 16, d->label->fontMetrics().height() * 3 / 2, 64 ); + const int labelHeight = qBound( 16, CalamaresUtils::defaultFontHeight() * 3 / 2, 64 ); // Set up the spinner d->spinner->setFixedSize( labelHeight, labelHeight ); - d->spinner->setRevolutionsPerSecond( 1 ); + d->spinner->setRevolutionsPerSecond( 1.0 / double(duration.count()) ); d->spinner->setInnerRadius( labelHeight / 2 ); d->spinner->setLineLength( labelHeight / 2 ); d->spinner->setLineWidth( labelHeight / 8 ); @@ -93,7 +91,6 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q // Overall UI layout QBoxLayout* box = new QHBoxLayout; box->addWidget( d->spinner ); - box->addWidget( d->label ); setLayout( box ); // Last because it updates the text @@ -146,7 +143,6 @@ CountdownWaitingWidget::tick() { d->count = int( d->duration.count() ); } - d->label->setText( QString::number( d->count ) ); if ( d->count == 0 ) { timeout(); From 978661491732833eb889fb7ed3e117481a189557 Mon Sep 17 00:00:00 2001 From: huxingyi Date: Wed, 7 Feb 2018 21:06:05 +0800 Subject: [PATCH 090/160] Add text support. Implement the setText function. The text will be displayed under the spinner image. --- 3rdparty/waitingspinnerwidget.cpp | 34 ++++++++++++++++++++++++++++++- 3rdparty/waitingspinnerwidget.h | 6 ++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index 98931a6ad..a52cd17e5 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -65,6 +65,7 @@ WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, void WaitingSpinnerWidget::initialize() { _color = Qt::black; + _textColor = Qt::white; _roundness = 100.0; _minimumTrailOpacity = 3.14159265358979323846; _trailFadePercentage = 80.0; @@ -98,6 +99,7 @@ void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { painter.save(); painter.translate(_innerRadius + _lineLength, _innerRadius + _lineLength); + painter.translate((width() - _imageSize.width()) / 2, 0); qreal rotateAngle = static_cast(360 * i) / static_cast(_numberOfLines); painter.rotate(rotateAngle); @@ -114,6 +116,12 @@ void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { _roundness, Qt::RelativeSize); painter.restore(); } + + if (!_text.isEmpty()) { + painter.setPen(QPen(_textColor)); + painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), + Qt::AlignBottom | Qt::AlignHCenter, _text); + } } void WaitingSpinnerWidget::start() { @@ -166,10 +174,23 @@ void WaitingSpinnerWidget::setInnerRadius(int radius) { updateSize(); } +void WaitingSpinnerWidget::setText(QString text) { + _text = text; + updateSize(); +} + QColor WaitingSpinnerWidget::color() { return _color; } +QColor WaitingSpinnerWidget::textColor() { + return _textColor; +} + +QString WaitingSpinnerWidget::text() { + return _text; +} + qreal WaitingSpinnerWidget::roundness() { return _roundness; } @@ -214,6 +235,10 @@ void WaitingSpinnerWidget::setColor(QColor color) { _color = color; } +void WaitingSpinnerWidget::setTextColor(QColor color) { + _textColor = color; +} + void WaitingSpinnerWidget::setRevolutionsPerSecond(qreal revolutionsPerSecond) { _revolutionsPerSecond = revolutionsPerSecond; updateTimer(); @@ -237,7 +262,14 @@ void WaitingSpinnerWidget::rotate() { void WaitingSpinnerWidget::updateSize() { int size = (_innerRadius + _lineLength) * 2; - setFixedSize(size, size); + _imageSize = QSize(size, size); + if (_text.isEmpty()) { + setFixedSize(size, size); + } else { + QFontMetrics fm(font()); + QSize textSize = QSize(fm.width(_text), fm.height()); + setFixedSize(std::max(size, textSize.width()), size + size / 4 + textSize.height()); + } } void WaitingSpinnerWidget::updateTimer() { diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index d171e9beb..5bf96488c 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -59,6 +59,7 @@ public slots: public: void setColor(QColor color); + void setTextColor(QColor color); void setRoundness(qreal roundness); void setMinimumTrailOpacity(qreal minimumTrailOpacity); void setTrailFadePercentage(qreal trail); @@ -70,6 +71,8 @@ public: void setText(QString text); QColor color(); + QColor textColor(); + QString text(); qreal roundness(); qreal minimumTrailOpacity(); qreal trailFadePercentage(); @@ -109,6 +112,9 @@ private: int _lineLength; int _lineWidth; int _innerRadius; + QString _text; + QSize _imageSize; + QColor _textColor; private: WaitingSpinnerWidget(const WaitingSpinnerWidget&); From 022f04355af5a32b744ac9c54f8d105f8440e292 Mon Sep 17 00:00:00 2001 From: huxingyi Date: Wed, 7 Feb 2018 21:13:21 +0800 Subject: [PATCH 091/160] Change default text color to black. --- 3rdparty/waitingspinnerwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index a52cd17e5..8630c6c6b 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -65,7 +65,7 @@ WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, void WaitingSpinnerWidget::initialize() { _color = Qt::black; - _textColor = Qt::white; + _textColor = Qt::black; _roundness = 100.0; _minimumTrailOpacity = 3.14159265358979323846; _trailFadePercentage = 80.0; From 171a59735550a8136dd7ebe5ed1078392f6e9573 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 22:02:55 +0200 Subject: [PATCH 092/160] [3rdparty] Add SPDX tags for setText() support The setText() support was submitted upstream at https://github.com/snowwlex/QtWaitingSpinner/pull/14 by `huxingyi `, but not merged. The commits from that PR were merged into Calamares' copy of the waitingspinnerwidget files. Add relevant tags (which aren't in the PR, but Calamares does chase SPDX) --- 3rdparty/waitingspinnerwidget.cpp | 1 + 3rdparty/waitingspinnerwidget.h | 1 + 2 files changed, 2 insertions(+) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index 8630c6c6b..3f98969d5 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2012-2014 Alexander Turkin * SPDX-FileCopyrightText: 2014 William Hallatt * SPDX-FileCopyrightText: 2015 Jacob Dawid + * SPDX-FileCopyrightText: 2018 huxingyi * SPDX-License-Identifier: MIT */ diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index 5bf96488c..b600d6727 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -2,6 +2,7 @@ * SPDX-FileCopyrightText: 2012-2014 Alexander Turkin * SPDX-FileCopyrightText: 2014 William Hallatt * SPDX-FileCopyrightText: 2015 Jacob Dawid + * SPDX-FileCopyrightText: 2018 huxingyi * SPDX-License-Identifier: MIT */ From 15dc47555ad71beec827ebb7c56e4d596c42ecce Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 22:01:43 +0200 Subject: [PATCH 093/160] [3rdparty] Constness for waitingspinner The accessors can be (should be!) const. --- 3rdparty/waitingspinnerwidget.cpp | 26 +++++++++++++------------- 3rdparty/waitingspinnerwidget.h | 24 ++++++++++++------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index 3f98969d5..cd5e1b07e 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -120,7 +120,7 @@ void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { if (!_text.isEmpty()) { painter.setPen(QPen(_textColor)); - painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), + painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), Qt::AlignBottom | Qt::AlignHCenter, _text); } } @@ -175,52 +175,52 @@ void WaitingSpinnerWidget::setInnerRadius(int radius) { updateSize(); } -void WaitingSpinnerWidget::setText(QString text) { +void WaitingSpinnerWidget::setText(const QString& text) { _text = text; updateSize(); } -QColor WaitingSpinnerWidget::color() { +QColor WaitingSpinnerWidget::color() const { return _color; } -QColor WaitingSpinnerWidget::textColor() { +QColor WaitingSpinnerWidget::textColor() const { return _textColor; } -QString WaitingSpinnerWidget::text() { +QString WaitingSpinnerWidget::text() const { return _text; } -qreal WaitingSpinnerWidget::roundness() { +qreal WaitingSpinnerWidget::roundness() const { return _roundness; } -qreal WaitingSpinnerWidget::minimumTrailOpacity() { +qreal WaitingSpinnerWidget::minimumTrailOpacity() const { return _minimumTrailOpacity; } -qreal WaitingSpinnerWidget::trailFadePercentage() { +qreal WaitingSpinnerWidget::trailFadePercentage() const { return _trailFadePercentage; } -qreal WaitingSpinnerWidget::revolutionsPersSecond() { +qreal WaitingSpinnerWidget::revolutionsPersSecond() const { return _revolutionsPerSecond; } -int WaitingSpinnerWidget::numberOfLines() { +int WaitingSpinnerWidget::numberOfLines() const { return _numberOfLines; } -int WaitingSpinnerWidget::lineLength() { +int WaitingSpinnerWidget::lineLength() const { return _lineLength; } -int WaitingSpinnerWidget::lineWidth() { +int WaitingSpinnerWidget::lineWidth() const { return _lineWidth; } -int WaitingSpinnerWidget::innerRadius() { +int WaitingSpinnerWidget::innerRadius() const { return _innerRadius; } diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index b600d6727..b180e268a 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -69,19 +69,19 @@ public: void setLineLength(int length); void setLineWidth(int width); void setInnerRadius(int radius); - void setText(QString text); + void setText(const QString& text); - QColor color(); - QColor textColor(); - QString text(); - qreal roundness(); - qreal minimumTrailOpacity(); - qreal trailFadePercentage(); - qreal revolutionsPersSecond(); - int numberOfLines(); - int lineLength(); - int lineWidth(); - int innerRadius(); + QColor color() const; + QColor textColor() const; + QString text() const; + qreal roundness() const; + qreal minimumTrailOpacity() const; + qreal trailFadePercentage() const; + qreal revolutionsPersSecond() const; + int numberOfLines() const; + int lineLength() const; + int lineWidth() const; + int innerRadius() const; bool isSpinning() const; From fac8662387691f3e6ae11a3769a66d25d546e710 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 15 Apr 2022 23:08:58 +0200 Subject: [PATCH 094/160] [3rdparty] Tidy up access and API dox --- 3rdparty/waitingspinnerwidget.h | 35 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index b180e268a..7e540dd40 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -38,27 +38,30 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. class WaitingSpinnerWidget : public QWidget { Q_OBJECT public: - /*! Constructor for "standard" widget behaviour - use this - * constructor if you wish to, e.g. embed your widget in another. */ + /** @brief Constructor for "standard" widget behaviour + * + * Use this constructor if you wish to, e.g. embed your widget in another. + */ WaitingSpinnerWidget(QWidget *parent = nullptr, bool centerOnParent = true, bool disableParentWhenSpinning = true); - /*! Constructor - use this constructor to automatically create a modal - * ("blocking") spinner on top of the calling widget/window. If a valid - * parent widget is provided, "centreOnParent" will ensure that - * QtWaitingSpinner automatically centres itself on it, if not, - * "centreOnParent" is ignored. */ + /** @brief Constructor + * + * Use this constructor to automatically create a modal + * ("blocking") spinner on top of the calling widget/window. If a valid + * parent widget is provided, "centreOnParent" will ensure that + * QtWaitingSpinner automatically centres itself on it, if not, + * @p centerOnParent is ignored. + */ WaitingSpinnerWidget(Qt::WindowModality modality, QWidget *parent = nullptr, bool centerOnParent = true, bool disableParentWhenSpinning = true); -public slots: - void start(); - void stop(); + WaitingSpinnerWidget(const WaitingSpinnerWidget&) = delete; + WaitingSpinnerWidget& operator=(const WaitingSpinnerWidget&) = delete; -public: void setColor(QColor color); void setTextColor(QColor color); void setRoundness(qreal roundness); @@ -85,7 +88,11 @@ public: bool isSpinning() const; -private slots: +public Q_SLOTS: + void start(); + void stop(); + +private Q_SLOTS: void rotate(); protected: @@ -117,10 +124,6 @@ private: QSize _imageSize; QColor _textColor; -private: - WaitingSpinnerWidget(const WaitingSpinnerWidget&); - WaitingSpinnerWidget& operator=(const WaitingSpinnerWidget&); - QTimer *_timer; bool _centerOnParent; bool _disableParentWhenSpinning; From bef6b2fffd16de7d7ccbcb49eded53f9de6e550e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 00:04:32 +0200 Subject: [PATCH 095/160] [3rdparty] Introduce alignment flag for text --- 3rdparty/waitingspinnerwidget.cpp | 22 +++++++++++++++++++--- 3rdparty/waitingspinnerwidget.h | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/3rdparty/waitingspinnerwidget.cpp b/3rdparty/waitingspinnerwidget.cpp index cd5e1b07e..a55062b54 100644 --- a/3rdparty/waitingspinnerwidget.cpp +++ b/3rdparty/waitingspinnerwidget.cpp @@ -39,6 +39,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include +static bool isAlignCenter(Qt::AlignmentFlag a) +{ + return a == Qt::AlignmentFlag::AlignVCenter; +} + WaitingSpinnerWidget::WaitingSpinnerWidget(QWidget *parent, bool centerOnParent, bool disableParentWhenSpinning) @@ -120,8 +125,13 @@ void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { if (!_text.isEmpty()) { painter.setPen(QPen(_textColor)); - painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), - Qt::AlignBottom | Qt::AlignHCenter, _text); + if (isAlignCenter(alignment())) { + painter.drawText(QRect(0, 0, width(), height()), + Qt::AlignVCenter | Qt::AlignHCenter, _text); + } else { + painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), + Qt::AlignBottom | Qt::AlignHCenter, _text); + } } } @@ -180,6 +190,12 @@ void WaitingSpinnerWidget::setText(const QString& text) { updateSize(); } +void WaitingSpinnerWidget::setAlignment(Qt::AlignmentFlag align) +{ + _alignment = align; + updateSize(); +} + QColor WaitingSpinnerWidget::color() const { return _color; } @@ -264,7 +280,7 @@ void WaitingSpinnerWidget::rotate() { void WaitingSpinnerWidget::updateSize() { int size = (_innerRadius + _lineLength) * 2; _imageSize = QSize(size, size); - if (_text.isEmpty()) { + if (_text.isEmpty() || isAlignCenter(alignment())) { setFixedSize(size, size); } else { QFontMetrics fm(font()); diff --git a/3rdparty/waitingspinnerwidget.h b/3rdparty/waitingspinnerwidget.h index 7e540dd40..d5e8620d4 100644 --- a/3rdparty/waitingspinnerwidget.h +++ b/3rdparty/waitingspinnerwidget.h @@ -72,11 +72,27 @@ public: void setLineLength(int length); void setLineWidth(int width); void setInnerRadius(int radius); + + /** @brief Sets the text displayed in or below the spinner + * + * If the text is empty, no text is displayed. The text is displayed + * in or below the spinner depending on the value of alignment(). + * With AlignBottom, the text is displayed below the spinner, + * centered horizontally relative to the spinner; any other alignment + * will put the text in the middle of the spinner itself. + */ void setText(const QString& text); + /** @brief Sets the alignment of text for the spinner + * + * The only meaningful values are AlignBottom and AlignVCenter, + * for text below the spinner and text in the middle. + */ + void setAlignment(Qt::AlignmentFlag align); QColor color() const; QColor textColor() const; QString text() const; + Qt::AlignmentFlag alignment() const { return _alignment; } qreal roundness() const; qreal minimumTrailOpacity() const; qreal trailFadePercentage() const; @@ -120,6 +136,7 @@ private: int _lineLength; int _lineWidth; int _innerRadius; + Qt::AlignmentFlag _alignment = Qt::AlignmentFlag::AlignBottom; QString _text; QSize _imageSize; QColor _textColor; From 82d721f4557cc50156c07f521978d04a82f20057 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 00:05:01 +0200 Subject: [PATCH 096/160] [libcalamaresui] Display countdown --- src/libcalamaresui/widgets/WaitingWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index 37cc4726e..e8504ff94 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -143,6 +143,7 @@ CountdownWaitingWidget::tick() { d->count = int( d->duration.count() ); } + d->spinner->setText( QString::number(d->count) ); if ( d->count == 0 ) { timeout(); From 3c5ac535f156e5a73cf646eb0eac95870964031f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 11:28:10 +0200 Subject: [PATCH 097/160] [libcalamaresui] The waiting spinner now supports text, no need for extra label --- src/libcalamaresui/widgets/WaitingWidget.cpp | 50 +++++--------------- src/libcalamaresui/widgets/WaitingWidget.h | 12 ++--- 2 files changed, 15 insertions(+), 47 deletions(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index e8504ff94..13ae9fd03 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -12,50 +12,24 @@ #include "utils/CalamaresUtilsGui.h" -#include "3rdparty/waitingspinnerwidget.h" - #include #include #include WaitingWidget::WaitingWidget( const QString& text, QWidget* parent ) - : QWidget( parent ) + : WaitingSpinnerWidget( parent ) { - QBoxLayout* waitingLayout = new QVBoxLayout; - setLayout( waitingLayout ); - waitingLayout->addStretch(); - QBoxLayout* pbLayout = new QHBoxLayout; - waitingLayout->addLayout( pbLayout ); - pbLayout->addStretch(); - - WaitingSpinnerWidget* spnr = new WaitingSpinnerWidget(); - pbLayout->addWidget( spnr ); - - pbLayout->addStretch(); - - m_waitingLabel = new QLabel( text ); - - int spnrSize = m_waitingLabel->fontMetrics().height() * 4; - spnr->setFixedSize( spnrSize, spnrSize ); - spnr->setInnerRadius( spnrSize / 2 ); - spnr->setLineLength( spnrSize / 2 ); - spnr->setLineWidth( spnrSize / 8 ); - spnr->start(); - - m_waitingLabel->setAlignment( Qt::AlignCenter ); - waitingLayout->addSpacing( spnrSize / 2 ); - waitingLayout->addWidget( m_waitingLabel ); - waitingLayout->addStretch(); - - CalamaresUtils::unmarginLayout( waitingLayout ); + int spnrSize = CalamaresUtils::defaultFontHeight() * 4; + setFixedSize( spnrSize, spnrSize ); + setInnerRadius( spnrSize / 2 ); + setLineLength( spnrSize / 2 ); + setLineWidth( spnrSize / 8 ); + setAlignment( Qt::AlignmentFlag::AlignBottom ); + setText( text ); + start(); } - -void -WaitingWidget::setText( const QString& text ) -{ - m_waitingLabel->setText( text ); -} +WaitingWidget::~WaitingWidget() {} struct CountdownWaitingWidget::Private { @@ -83,7 +57,7 @@ CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, Q // Set up the spinner d->spinner->setFixedSize( labelHeight, labelHeight ); - d->spinner->setRevolutionsPerSecond( 1.0 / double(duration.count()) ); + d->spinner->setRevolutionsPerSecond( 1.0 / double( duration.count() ) ); d->spinner->setInnerRadius( labelHeight / 2 ); d->spinner->setLineLength( labelHeight / 2 ); d->spinner->setLineWidth( labelHeight / 8 ); @@ -143,7 +117,7 @@ CountdownWaitingWidget::tick() { d->count = int( d->duration.count() ); } - d->spinner->setText( QString::number(d->count) ); + d->spinner->setText( QString::number( d->count ) ); if ( d->count == 0 ) { timeout(); diff --git a/src/libcalamaresui/widgets/WaitingWidget.h b/src/libcalamaresui/widgets/WaitingWidget.h index 867529641..cb0e15545 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.h +++ b/src/libcalamaresui/widgets/WaitingWidget.h @@ -10,7 +10,7 @@ #ifndef WAITINGWIDGET_H #define WAITINGWIDGET_H -#include +#include "3rdparty/waitingspinnerwidget.h" #include #include @@ -24,18 +24,12 @@ class QTimer; * and the text is displayed centered below it. Use this * to display a long-term waiting situation with a status report. */ -class WaitingWidget : public QWidget +class WaitingWidget : public WaitingSpinnerWidget { - Q_OBJECT public: /// Create a WaitingWidget with initial @p text label. explicit WaitingWidget( const QString& text, QWidget* parent = nullptr ); - - /// Update the @p text displayed in the label. - void setText( const QString& text ); - -private: - QLabel* m_waitingLabel; + ~WaitingWidget() override; }; /** @brief A spinner and a countdown next to it From 5060a66d4e8bcd2e5c269cce54486098dfdebb6d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 11:29:49 +0200 Subject: [PATCH 098/160] [locale] Remove unused include --- src/modules/locale/LocaleViewStep.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/locale/LocaleViewStep.cpp b/src/modules/locale/LocaleViewStep.cpp index 2145ad201..03d1d4f5e 100644 --- a/src/modules/locale/LocaleViewStep.cpp +++ b/src/modules/locale/LocaleViewStep.cpp @@ -11,7 +11,6 @@ #include "LocaleViewStep.h" #include "LocalePage.h" -#include "widgets/WaitingWidget.h" #include "GlobalStorage.h" #include "JobQueue.h" From 3bd610a8388deb4157d849685daf922c1c30c5ed Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 11:53:03 +0200 Subject: [PATCH 099/160] [libcalamaresui] Port Countdown to spinner widget alone --- src/libcalamaresui/widgets/WaitingWidget.cpp | 26 ++++++++------------ src/libcalamaresui/widgets/WaitingWidget.h | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index 13ae9fd03..118d219e4 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -37,35 +37,29 @@ struct CountdownWaitingWidget::Private // int because we count down, need to be able to show a 0, // and then wrap around to duration a second later. int count = 0; - WaitingSpinnerWidget* spinner = nullptr; QTimer* timer = nullptr; Private( std::chrono::seconds seconds, QWidget* parent ) : duration( seconds ) - , spinner( new WaitingSpinnerWidget( parent ) ) , timer( new QTimer( parent ) ) { } }; CountdownWaitingWidget::CountdownWaitingWidget( std::chrono::seconds duration, QWidget* parent ) - : QWidget( parent ) + : WaitingSpinnerWidget( parent, false, false ) , d( std::make_unique< Private >( duration, this ) ) { // Set up the label first for sizing const int labelHeight = qBound( 16, CalamaresUtils::defaultFontHeight() * 3 / 2, 64 ); // Set up the spinner - d->spinner->setFixedSize( labelHeight, labelHeight ); - d->spinner->setRevolutionsPerSecond( 1.0 / double( duration.count() ) ); - d->spinner->setInnerRadius( labelHeight / 2 ); - d->spinner->setLineLength( labelHeight / 2 ); - d->spinner->setLineWidth( labelHeight / 8 ); - - // Overall UI layout - QBoxLayout* box = new QHBoxLayout; - box->addWidget( d->spinner ); - setLayout( box ); + setFixedSize( labelHeight, labelHeight ); + setRevolutionsPerSecond( 1.0 / double( duration.count() ) ); + setInnerRadius( labelHeight / 2 ); + setLineLength( labelHeight / 2 ); + setLineWidth( labelHeight / 8 ); + setAlignment( Qt::AlignmentFlag::AlignVCenter ); // Last because it updates the text setInterval( duration ); @@ -97,14 +91,14 @@ CountdownWaitingWidget::start() tick(); } d->timer->start(); - d->spinner->start(); + WaitingSpinnerWidget::start(); } void CountdownWaitingWidget::stop() { d->timer->stop(); - d->spinner->stop(); + WaitingSpinnerWidget::stop(); } void @@ -117,7 +111,7 @@ CountdownWaitingWidget::tick() { d->count = int( d->duration.count() ); } - d->spinner->setText( QString::number( d->count ) ); + setText( QString::number( d->count ) ); if ( d->count == 0 ) { timeout(); diff --git a/src/libcalamaresui/widgets/WaitingWidget.h b/src/libcalamaresui/widgets/WaitingWidget.h index cb0e15545..009f17f49 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.h +++ b/src/libcalamaresui/widgets/WaitingWidget.h @@ -39,7 +39,7 @@ public: * every second. The signal timeout() is sent every time * the countdown reaches 0. */ -class CountdownWaitingWidget : public QWidget +class CountdownWaitingWidget : public WaitingSpinnerWidget { Q_OBJECT public: From 2ccd59e90b9eecc042f064ab430e5862288c3af7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 11:59:31 +0200 Subject: [PATCH 100/160] [libcalamaresui] Move waitingspinnerwidget.* into calamaresui Although this is 3rd-party code, it now diverges -- by merging the stale PR from upstream, and from adding features of our own -- enough that we should not pretend that it is the original 3rdparty code. Chase a couple of include paths that called this from 3rdparty/ --- src/libcalamaresui/CMakeLists.txt | 7 +------ src/libcalamaresui/widgets/WaitingWidget.h | 2 +- .../libcalamaresui/widgets}/waitingspinnerwidget.cpp | 0 .../libcalamaresui/widgets}/waitingspinnerwidget.h | 0 src/modules/partition/gui/ScanningDialog.cpp | 2 +- 5 files changed, 3 insertions(+), 8 deletions(-) rename {3rdparty => src/libcalamaresui/widgets}/waitingspinnerwidget.cpp (100%) rename {3rdparty => src/libcalamaresui/widgets}/waitingspinnerwidget.h (100%) diff --git a/src/libcalamaresui/CMakeLists.txt b/src/libcalamaresui/CMakeLists.txt index 48e4c4b4d..48ac201d3 100644 --- a/src/libcalamaresui/CMakeLists.txt +++ b/src/libcalamaresui/CMakeLists.txt @@ -33,17 +33,12 @@ set( calamaresui_SOURCES widgets/LogWidget.cpp widgets/TranslationFix.cpp widgets/WaitingWidget.cpp - ${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp + widgets/waitingspinnerwidget.cpp Branding.cpp ViewManager.cpp ) -# Don't warn about third-party sources -mark_thirdparty_code( - ${CMAKE_SOURCE_DIR}/3rdparty/waitingspinnerwidget.cpp -) - if( WITH_PYTHON ) list( APPEND calamaresui_SOURCES modulesystem/PythonJobModule.cpp diff --git a/src/libcalamaresui/widgets/WaitingWidget.h b/src/libcalamaresui/widgets/WaitingWidget.h index 009f17f49..1b78809de 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.h +++ b/src/libcalamaresui/widgets/WaitingWidget.h @@ -10,7 +10,7 @@ #ifndef WAITINGWIDGET_H #define WAITINGWIDGET_H -#include "3rdparty/waitingspinnerwidget.h" +#include "widgets/waitingspinnerwidget.h" #include #include diff --git a/3rdparty/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp similarity index 100% rename from 3rdparty/waitingspinnerwidget.cpp rename to src/libcalamaresui/widgets/waitingspinnerwidget.cpp diff --git a/3rdparty/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h similarity index 100% rename from 3rdparty/waitingspinnerwidget.h rename to src/libcalamaresui/widgets/waitingspinnerwidget.h diff --git a/src/modules/partition/gui/ScanningDialog.cpp b/src/modules/partition/gui/ScanningDialog.cpp index 56133e21f..7dd85ff86 100644 --- a/src/modules/partition/gui/ScanningDialog.cpp +++ b/src/modules/partition/gui/ScanningDialog.cpp @@ -10,7 +10,7 @@ #include "ScanningDialog.h" -#include "3rdparty/waitingspinnerwidget.h" +#include "widgets/waitingspinnerwidget.h" #include #include From 1f7dd2fcd59f40b527d6bb8a13f481efce4e0f2d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:02:56 +0200 Subject: [PATCH 101/160] [libcalamaresui] Convenience API --- src/libcalamaresui/widgets/waitingspinnerwidget.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index d5e8620d4..531d19273 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -88,6 +88,8 @@ public: * for text below the spinner and text in the middle. */ void setAlignment(Qt::AlignmentFlag align); + /// Convenience to set text-in-the-middle (@c true) or text-at-bottom (@c false) + void setCenteredText(bool centered) { setAlignment(centered ? Qt::AlignmentFlag::AlignVCenter : Qt::AlignmentFlag::AlignBottom ); } QColor color() const; QColor textColor() const; From 78a8993f388836d72589aa997252188956a8fcda Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:11:52 +0200 Subject: [PATCH 102/160] [libcalamaresui] Move to more modern-style initializations --- .../widgets/waitingspinnerwidget.cpp | 13 ------- .../widgets/waitingspinnerwidget.h | 37 ++++++++++++------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index a55062b54..a41a8a3f7 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -70,19 +70,6 @@ WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, } void WaitingSpinnerWidget::initialize() { - _color = Qt::black; - _textColor = Qt::black; - _roundness = 100.0; - _minimumTrailOpacity = 3.14159265358979323846; - _trailFadePercentage = 80.0; - _revolutionsPerSecond = 1.57079632679489661923; - _numberOfLines = 20; - _lineLength = 10; - _lineWidth = 2; - _innerRadius = 10; - _currentCounter = 0; - _isSpinning = false; - _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(rotate())); updateSize(); diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index 531d19273..d223dcf27 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -129,23 +129,32 @@ private: void updatePosition(); private: - QColor _color; - qreal _roundness; // 0..100 - qreal _minimumTrailOpacity; - qreal _trailFadePercentage; - qreal _revolutionsPerSecond; - int _numberOfLines; - int _lineLength; - int _lineWidth; - int _innerRadius; + // PI, leading to a full fade in one whole revolution + static constexpr const auto radian = 3.14159265358979323846; + + // Spinner-wheel related settings + QColor _color = Qt::black; + qreal _roundness = 100.0; // 0..100 + qreal _minimumTrailOpacity = radian; + qreal _trailFadePercentage = 80.0; + qreal _revolutionsPerSecond = radian / 2; + int _numberOfLines = 20; + int _lineLength = 10; + int _lineWidth = 2; + int _innerRadius = 10; + QSize _imageSize; + + // Text-related settings Qt::AlignmentFlag _alignment = Qt::AlignmentFlag::AlignBottom; QString _text; - QSize _imageSize; - QColor _textColor; + QColor _textColor = Qt::black; - QTimer *_timer; + // Environment settings bool _centerOnParent; bool _disableParentWhenSpinning; - int _currentCounter; - bool _isSpinning; + + // Internal bits + QTimer *_timer = nullptr; + int _currentCounter = 0; + bool _isSpinning = false; }; From 497422e72c2b766aacb6457e10517c0d8204b0cc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:18:49 +0200 Subject: [PATCH 103/160] [libcalamaresui] Don't disable parent while waiting --- src/libcalamaresui/widgets/WaitingWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamaresui/widgets/WaitingWidget.cpp b/src/libcalamaresui/widgets/WaitingWidget.cpp index 118d219e4..18acc11b7 100644 --- a/src/libcalamaresui/widgets/WaitingWidget.cpp +++ b/src/libcalamaresui/widgets/WaitingWidget.cpp @@ -17,7 +17,7 @@ #include WaitingWidget::WaitingWidget( const QString& text, QWidget* parent ) - : WaitingSpinnerWidget( parent ) + : WaitingSpinnerWidget( parent, false, false ) { int spnrSize = CalamaresUtils::defaultFontHeight() * 4; setFixedSize( spnrSize, spnrSize ); From 18f8633dd93646723ca189fab5506a6a9e611557 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:20:02 +0200 Subject: [PATCH 104/160] [libcalamaresui] Also modern-style initialize center and disable flags - All constructors explicitly initialize these, so there's no real change here. --- src/libcalamaresui/widgets/waitingspinnerwidget.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index d223dcf27..d66a2cea0 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -150,8 +150,8 @@ private: QColor _textColor = Qt::black; // Environment settings - bool _centerOnParent; - bool _disableParentWhenSpinning; + bool _centerOnParent = true; + bool _disableParentWhenSpinning = true; // Internal bits QTimer *_timer = nullptr; From e11a0ee44885f45e7907b7508b8b8eac3e7c014b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:25:28 +0200 Subject: [PATCH 105/160] [libcalamaresui] Use delegating-constructor, drop initialize() --- .../widgets/waitingspinnerwidget.cpp | 33 +++++++++---------- .../widgets/waitingspinnerwidget.h | 1 - 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index a41a8a3f7..a4bb9b79c 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -47,34 +47,33 @@ static bool isAlignCenter(Qt::AlignmentFlag a) WaitingSpinnerWidget::WaitingSpinnerWidget(QWidget *parent, bool centerOnParent, bool disableParentWhenSpinning) - : QWidget(parent), - _centerOnParent(centerOnParent), - _disableParentWhenSpinning(disableParentWhenSpinning) { - initialize(); -} + : WaitingSpinnerWidget(Qt::WindowModality::NonModal, parent, centerOnParent, disableParentWhenSpinning) +{} WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, QWidget *parent, bool centerOnParent, bool disableParentWhenSpinning) - : QWidget(parent, Qt::Dialog | Qt::FramelessWindowHint), + : QWidget(parent, modality == Qt::WindowModality::NonModal ? Qt::WindowFlags() : Qt::Dialog | Qt::FramelessWindowHint), _centerOnParent(centerOnParent), - _disableParentWhenSpinning(disableParentWhenSpinning){ - initialize(); - - // We need to set the window modality AFTER we've hidden the - // widget for the first time since changing this property while - // the widget is visible has no effect. - setWindowModality(modality); - setAttribute(Qt::WA_TranslucentBackground); -} - -void WaitingSpinnerWidget::initialize() { + _disableParentWhenSpinning(disableParentWhenSpinning) +{ _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(rotate())); updateSize(); updateTimer(); hide(); + + // We need to set the window modality AFTER we've hidden the + // widget for the first time since changing this property while + // the widget is visible has no effect. + // + // Non-modal windows don't need any work + if ( modality != Qt::WindowModality::NonModal ) + { + setWindowModality(modality); + setAttribute(Qt::WA_TranslucentBackground); + } } void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index d66a2cea0..1ecc33a87 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -123,7 +123,6 @@ private: qreal trailFadePerc, qreal minOpacity, QColor color); - void initialize(); void updateSize(); void updateTimer(); void updatePosition(); From 18fef8dfe5d926ec0bc979562553adf4db8db2e9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:39:21 +0200 Subject: [PATCH 106/160] [libcalamaresui] Apply coding style --- .../widgets/waitingspinnerwidget.cpp | 307 +++++++++++------- .../widgets/waitingspinnerwidget.h | 98 +++--- 2 files changed, 243 insertions(+), 162 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index a4bb9b79c..0186fa983 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -32,34 +32,35 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "waitingspinnerwidget.h" // Standard includes -#include #include +#include // Qt includes #include #include -static bool isAlignCenter(Qt::AlignmentFlag a) +static bool +isAlignCenter( Qt::AlignmentFlag a ) { return a == Qt::AlignmentFlag::AlignVCenter; } -WaitingSpinnerWidget::WaitingSpinnerWidget(QWidget *parent, - bool centerOnParent, - bool disableParentWhenSpinning) - : WaitingSpinnerWidget(Qt::WindowModality::NonModal, parent, centerOnParent, disableParentWhenSpinning) -{} - -WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, - QWidget *parent, - bool centerOnParent, - bool disableParentWhenSpinning) - : QWidget(parent, modality == Qt::WindowModality::NonModal ? Qt::WindowFlags() : Qt::Dialog | Qt::FramelessWindowHint), - _centerOnParent(centerOnParent), - _disableParentWhenSpinning(disableParentWhenSpinning) +WaitingSpinnerWidget::WaitingSpinnerWidget( QWidget* parent, bool centerOnParent, bool disableParentWhenSpinning ) + : WaitingSpinnerWidget( Qt::WindowModality::NonModal, parent, centerOnParent, disableParentWhenSpinning ) { - _timer = new QTimer(this); - connect(_timer, SIGNAL(timeout()), this, SLOT(rotate())); +} + +WaitingSpinnerWidget::WaitingSpinnerWidget( Qt::WindowModality modality, + QWidget* parent, + bool centerOnParent, + bool disableParentWhenSpinning ) + : QWidget( parent, + modality == Qt::WindowModality::NonModal ? Qt::WindowFlags() : Qt::Dialog | Qt::FramelessWindowHint ) + , _centerOnParent( centerOnParent ) + , _disableParentWhenSpinning( disableParentWhenSpinning ) +{ + _timer = new QTimer( this ); + connect( _timer, SIGNAL( timeout() ), this, SLOT( rotate() ) ); updateSize(); updateTimer(); hide(); @@ -71,249 +72,327 @@ WaitingSpinnerWidget::WaitingSpinnerWidget(Qt::WindowModality modality, // Non-modal windows don't need any work if ( modality != Qt::WindowModality::NonModal ) { - setWindowModality(modality); - setAttribute(Qt::WA_TranslucentBackground); + setWindowModality( modality ); + setAttribute( Qt::WA_TranslucentBackground ); } } -void WaitingSpinnerWidget::paintEvent(QPaintEvent *) { +void +WaitingSpinnerWidget::paintEvent( QPaintEvent* ) +{ updatePosition(); - QPainter painter(this); - painter.fillRect(this->rect(), Qt::transparent); - painter.setRenderHint(QPainter::Antialiasing, true); + QPainter painter( this ); + painter.fillRect( this->rect(), Qt::transparent ); + painter.setRenderHint( QPainter::Antialiasing, true ); - if (_currentCounter >= _numberOfLines) { + if ( _currentCounter >= _numberOfLines ) + { _currentCounter = 0; } - painter.setPen(Qt::NoPen); - for (int i = 0; i < _numberOfLines; ++i) { + painter.setPen( Qt::NoPen ); + for ( int i = 0; i < _numberOfLines; ++i ) + { painter.save(); - painter.translate(_innerRadius + _lineLength, - _innerRadius + _lineLength); - painter.translate((width() - _imageSize.width()) / 2, 0); - qreal rotateAngle = - static_cast(360 * i) / static_cast(_numberOfLines); - painter.rotate(rotateAngle); - painter.translate(_innerRadius, 0); - int distance = - lineCountDistanceFromPrimary(i, _currentCounter, _numberOfLines); - QColor color = - currentLineColor(distance, _numberOfLines, _trailFadePercentage, - _minimumTrailOpacity, _color); - painter.setBrush(color); + painter.translate( _innerRadius + _lineLength, _innerRadius + _lineLength ); + painter.translate( ( width() - _imageSize.width() ) / 2, 0 ); + qreal rotateAngle = static_cast< qreal >( 360 * i ) / static_cast< qreal >( _numberOfLines ); + painter.rotate( rotateAngle ); + painter.translate( _innerRadius, 0 ); + int distance = lineCountDistanceFromPrimary( i, _currentCounter, _numberOfLines ); + QColor color = currentLineColor( distance, _numberOfLines, _trailFadePercentage, _minimumTrailOpacity, _color ); + painter.setBrush( color ); // TODO improve the way rounded rect is painted painter.drawRoundedRect( - QRect(0, -_lineWidth / 2, _lineLength, _lineWidth), _roundness, - _roundness, Qt::RelativeSize); + QRect( 0, -_lineWidth / 2, _lineLength, _lineWidth ), _roundness, _roundness, Qt::RelativeSize ); painter.restore(); } - if (!_text.isEmpty()) { - painter.setPen(QPen(_textColor)); - if (isAlignCenter(alignment())) { - painter.drawText(QRect(0, 0, width(), height()), - Qt::AlignVCenter | Qt::AlignHCenter, _text); - } else { - painter.drawText(QRect(0, _imageSize.height(), width(), height() - _imageSize.height()), - Qt::AlignBottom | Qt::AlignHCenter, _text); + if ( !_text.isEmpty() ) + { + painter.setPen( QPen( _textColor ) ); + if ( isAlignCenter( alignment() ) ) + { + painter.drawText( QRect( 0, 0, width(), height() ), Qt::AlignVCenter | Qt::AlignHCenter, _text ); + } + else + { + painter.drawText( QRect( 0, _imageSize.height(), width(), height() - _imageSize.height() ), + Qt::AlignBottom | Qt::AlignHCenter, + _text ); } } } -void WaitingSpinnerWidget::start() { +void +WaitingSpinnerWidget::start() +{ updatePosition(); _isSpinning = true; show(); - if(parentWidget() && _disableParentWhenSpinning) { - parentWidget()->setEnabled(false); + if ( parentWidget() && _disableParentWhenSpinning ) + { + parentWidget()->setEnabled( false ); } - if (!_timer->isActive()) { + if ( !_timer->isActive() ) + { _timer->start(); _currentCounter = 0; } } -void WaitingSpinnerWidget::stop() { +void +WaitingSpinnerWidget::stop() +{ _isSpinning = false; hide(); - if(parentWidget() && _disableParentWhenSpinning) { - parentWidget()->setEnabled(true); + if ( parentWidget() && _disableParentWhenSpinning ) + { + parentWidget()->setEnabled( true ); } - if (_timer->isActive()) { + if ( _timer->isActive() ) + { _timer->stop(); _currentCounter = 0; } } -void WaitingSpinnerWidget::setNumberOfLines(int lines) { +void +WaitingSpinnerWidget::setNumberOfLines( int lines ) +{ _numberOfLines = lines; _currentCounter = 0; updateTimer(); } -void WaitingSpinnerWidget::setLineLength(int length) { +void +WaitingSpinnerWidget::setLineLength( int length ) +{ _lineLength = length; updateSize(); } -void WaitingSpinnerWidget::setLineWidth(int width) { +void +WaitingSpinnerWidget::setLineWidth( int width ) +{ _lineWidth = width; updateSize(); } -void WaitingSpinnerWidget::setInnerRadius(int radius) { +void +WaitingSpinnerWidget::setInnerRadius( int radius ) +{ _innerRadius = radius; updateSize(); } -void WaitingSpinnerWidget::setText(const QString& text) { +void +WaitingSpinnerWidget::setText( const QString& text ) +{ _text = text; updateSize(); } -void WaitingSpinnerWidget::setAlignment(Qt::AlignmentFlag align) +void +WaitingSpinnerWidget::setAlignment( Qt::AlignmentFlag align ) { _alignment = align; updateSize(); } -QColor WaitingSpinnerWidget::color() const { +QColor +WaitingSpinnerWidget::color() const +{ return _color; } -QColor WaitingSpinnerWidget::textColor() const { +QColor +WaitingSpinnerWidget::textColor() const +{ return _textColor; } -QString WaitingSpinnerWidget::text() const { +QString +WaitingSpinnerWidget::text() const +{ return _text; } -qreal WaitingSpinnerWidget::roundness() const { +qreal +WaitingSpinnerWidget::roundness() const +{ return _roundness; } -qreal WaitingSpinnerWidget::minimumTrailOpacity() const { +qreal +WaitingSpinnerWidget::minimumTrailOpacity() const +{ return _minimumTrailOpacity; } -qreal WaitingSpinnerWidget::trailFadePercentage() const { +qreal +WaitingSpinnerWidget::trailFadePercentage() const +{ return _trailFadePercentage; } -qreal WaitingSpinnerWidget::revolutionsPersSecond() const { +qreal +WaitingSpinnerWidget::revolutionsPersSecond() const +{ return _revolutionsPerSecond; } -int WaitingSpinnerWidget::numberOfLines() const { +int +WaitingSpinnerWidget::numberOfLines() const +{ return _numberOfLines; } -int WaitingSpinnerWidget::lineLength() const { +int +WaitingSpinnerWidget::lineLength() const +{ return _lineLength; } -int WaitingSpinnerWidget::lineWidth() const { +int +WaitingSpinnerWidget::lineWidth() const +{ return _lineWidth; } -int WaitingSpinnerWidget::innerRadius() const { +int +WaitingSpinnerWidget::innerRadius() const +{ return _innerRadius; } -bool WaitingSpinnerWidget::isSpinning() const { +bool +WaitingSpinnerWidget::isSpinning() const +{ return _isSpinning; } -void WaitingSpinnerWidget::setRoundness(qreal roundness) { - _roundness = std::max(0.0, std::min(100.0, roundness)); +void +WaitingSpinnerWidget::setRoundness( qreal roundness ) +{ + _roundness = std::max( 0.0, std::min( 100.0, roundness ) ); } -void WaitingSpinnerWidget::setColor(QColor color) { +void +WaitingSpinnerWidget::setColor( QColor color ) +{ _color = color; } -void WaitingSpinnerWidget::setTextColor(QColor color) { +void +WaitingSpinnerWidget::setTextColor( QColor color ) +{ _textColor = color; } -void WaitingSpinnerWidget::setRevolutionsPerSecond(qreal revolutionsPerSecond) { +void +WaitingSpinnerWidget::setRevolutionsPerSecond( qreal revolutionsPerSecond ) +{ _revolutionsPerSecond = revolutionsPerSecond; updateTimer(); } -void WaitingSpinnerWidget::setTrailFadePercentage(qreal trail) { +void +WaitingSpinnerWidget::setTrailFadePercentage( qreal trail ) +{ _trailFadePercentage = trail; } -void WaitingSpinnerWidget::setMinimumTrailOpacity(qreal minimumTrailOpacity) { +void +WaitingSpinnerWidget::setMinimumTrailOpacity( qreal minimumTrailOpacity ) +{ _minimumTrailOpacity = minimumTrailOpacity; } -void WaitingSpinnerWidget::rotate() { +void +WaitingSpinnerWidget::rotate() +{ ++_currentCounter; - if (_currentCounter >= _numberOfLines) { + if ( _currentCounter >= _numberOfLines ) + { _currentCounter = 0; } update(); } -void WaitingSpinnerWidget::updateSize() { - int size = (_innerRadius + _lineLength) * 2; - _imageSize = QSize(size, size); - if (_text.isEmpty() || isAlignCenter(alignment())) { - setFixedSize(size, size); - } else { - QFontMetrics fm(font()); - QSize textSize = QSize(fm.width(_text), fm.height()); - setFixedSize(std::max(size, textSize.width()), size + size / 4 + textSize.height()); +void +WaitingSpinnerWidget::updateSize() +{ + int size = ( _innerRadius + _lineLength ) * 2; + _imageSize = QSize( size, size ); + if ( _text.isEmpty() || isAlignCenter( alignment() ) ) + { + setFixedSize( size, size ); + } + else + { + QFontMetrics fm( font() ); + QSize textSize = QSize( fm.width( _text ), fm.height() ); + setFixedSize( std::max( size, textSize.width() ), size + size / 4 + textSize.height() ); } } -void WaitingSpinnerWidget::updateTimer() { - _timer->setInterval(1000 / (_numberOfLines * _revolutionsPerSecond)); +void +WaitingSpinnerWidget::updateTimer() +{ + _timer->setInterval( 1000 / ( _numberOfLines * _revolutionsPerSecond ) ); } -void WaitingSpinnerWidget::updatePosition() { - if (parentWidget() && _centerOnParent) { - move(parentWidget()->width() / 2 - width() / 2, - parentWidget()->height() / 2 - height() / 2); +void +WaitingSpinnerWidget::updatePosition() +{ + if ( parentWidget() && _centerOnParent ) + { + move( parentWidget()->width() / 2 - width() / 2, parentWidget()->height() / 2 - height() / 2 ); } } -int WaitingSpinnerWidget::lineCountDistanceFromPrimary(int current, int primary, - int totalNrOfLines) { +int +WaitingSpinnerWidget::lineCountDistanceFromPrimary( int current, int primary, int totalNrOfLines ) +{ int distance = primary - current; - if (distance < 0) { + if ( distance < 0 ) + { distance += totalNrOfLines; } return distance; } -QColor WaitingSpinnerWidget::currentLineColor(int countDistance, int totalNrOfLines, - qreal trailFadePerc, qreal minOpacity, - QColor color) { - if (countDistance == 0) { +QColor +WaitingSpinnerWidget::currentLineColor( int countDistance, + int totalNrOfLines, + qreal trailFadePerc, + qreal minOpacity, + QColor color ) +{ + if ( countDistance == 0 ) + { return color; } const qreal minAlphaF = minOpacity / 100.0; - int distanceThreshold = - static_cast(ceil((totalNrOfLines - 1) * trailFadePerc / 100.0)); - if (countDistance > distanceThreshold) { - color.setAlphaF(minAlphaF); - } else { + int distanceThreshold = static_cast< int >( ceil( ( totalNrOfLines - 1 ) * trailFadePerc / 100.0 ) ); + if ( countDistance > distanceThreshold ) + { + color.setAlphaF( minAlphaF ); + } + else + { qreal alphaDiff = color.alphaF() - minAlphaF; - qreal gradient = alphaDiff / static_cast(distanceThreshold + 1); + qreal gradient = alphaDiff / static_cast< qreal >( distanceThreshold + 1 ); qreal resultAlpha = color.alphaF() - gradient * countDistance; // If alpha is out of bounds, clip it. - resultAlpha = std::min(1.0, std::max(0.0, resultAlpha)); - color.setAlphaF(resultAlpha); + resultAlpha = std::min( 1.0, std::max( 0.0, resultAlpha ) ); + color.setAlphaF( resultAlpha ); } return color; } diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index 1ecc33a87..2fe76b5b1 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -31,20 +31,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #pragma once // Qt includes -#include -#include #include +#include +#include -class WaitingSpinnerWidget : public QWidget { +class WaitingSpinnerWidget : public QWidget +{ Q_OBJECT public: /** @brief Constructor for "standard" widget behaviour * * Use this constructor if you wish to, e.g. embed your widget in another. */ - WaitingSpinnerWidget(QWidget *parent = nullptr, - bool centerOnParent = true, - bool disableParentWhenSpinning = true); + WaitingSpinnerWidget( QWidget* parent = nullptr, + bool centerOnParent = true, + bool disableParentWhenSpinning = true ); /** @brief Constructor * @@ -54,24 +55,24 @@ public: * QtWaitingSpinner automatically centres itself on it, if not, * @p centerOnParent is ignored. */ - WaitingSpinnerWidget(Qt::WindowModality modality, - QWidget *parent = nullptr, - bool centerOnParent = true, - bool disableParentWhenSpinning = true); + WaitingSpinnerWidget( Qt::WindowModality modality, + QWidget* parent = nullptr, + bool centerOnParent = true, + bool disableParentWhenSpinning = true ); - WaitingSpinnerWidget(const WaitingSpinnerWidget&) = delete; - WaitingSpinnerWidget& operator=(const WaitingSpinnerWidget&) = delete; + WaitingSpinnerWidget( const WaitingSpinnerWidget& ) = delete; + WaitingSpinnerWidget& operator=( const WaitingSpinnerWidget& ) = delete; - void setColor(QColor color); - void setTextColor(QColor color); - void setRoundness(qreal roundness); - void setMinimumTrailOpacity(qreal minimumTrailOpacity); - void setTrailFadePercentage(qreal trail); - void setRevolutionsPerSecond(qreal revolutionsPerSecond); - void setNumberOfLines(int lines); - void setLineLength(int length); - void setLineWidth(int width); - void setInnerRadius(int radius); + void setColor( QColor color ); + void setTextColor( QColor color ); + void setRoundness( qreal roundness ); + void setMinimumTrailOpacity( qreal minimumTrailOpacity ); + void setTrailFadePercentage( qreal trail ); + void setRevolutionsPerSecond( qreal revolutionsPerSecond ); + void setNumberOfLines( int lines ); + void setLineLength( int length ); + void setLineWidth( int width ); + void setInnerRadius( int radius ); /** @brief Sets the text displayed in or below the spinner * @@ -81,21 +82,24 @@ public: * centered horizontally relative to the spinner; any other alignment * will put the text in the middle of the spinner itself. */ - void setText(const QString& text); + void setText( const QString& text ); /** @brief Sets the alignment of text for the spinner * * The only meaningful values are AlignBottom and AlignVCenter, * for text below the spinner and text in the middle. */ - void setAlignment(Qt::AlignmentFlag align); + void setAlignment( Qt::AlignmentFlag align ); /// Convenience to set text-in-the-middle (@c true) or text-at-bottom (@c false) - void setCenteredText(bool centered) { setAlignment(centered ? Qt::AlignmentFlag::AlignVCenter : Qt::AlignmentFlag::AlignBottom ); } + void setCenteredText( bool centered ) + { + setAlignment( centered ? Qt::AlignmentFlag::AlignVCenter : Qt::AlignmentFlag::AlignBottom ); + } QColor color() const; QColor textColor() const; QString text() const; Qt::AlignmentFlag alignment() const { return _alignment; } - qreal roundness() const; + qreal roundness() const; qreal minimumTrailOpacity() const; qreal trailFadePercentage() const; qreal revolutionsPersSecond() const; @@ -114,14 +118,12 @@ private Q_SLOTS: void rotate(); protected: - void paintEvent(QPaintEvent *paintEvent) override; + void paintEvent( QPaintEvent* paintEvent ) override; private: - static int lineCountDistanceFromPrimary(int current, int primary, - int totalNrOfLines); - static QColor currentLineColor(int distance, int totalNrOfLines, - qreal trailFadePerc, qreal minOpacity, - QColor color); + static int lineCountDistanceFromPrimary( int current, int primary, int totalNrOfLines ); + static QColor + currentLineColor( int distance, int totalNrOfLines, qreal trailFadePerc, qreal minOpacity, QColor color ); void updateSize(); void updateTimer(); @@ -132,28 +134,28 @@ private: static constexpr const auto radian = 3.14159265358979323846; // Spinner-wheel related settings - QColor _color = Qt::black; - qreal _roundness = 100.0; // 0..100 - qreal _minimumTrailOpacity = radian; - qreal _trailFadePercentage = 80.0; - qreal _revolutionsPerSecond = radian / 2; - int _numberOfLines = 20; - int _lineLength = 10; - int _lineWidth = 2; - int _innerRadius = 10; - QSize _imageSize; + QColor _color = Qt::black; + qreal _roundness = 100.0; // 0..100 + qreal _minimumTrailOpacity = radian; + qreal _trailFadePercentage = 80.0; + qreal _revolutionsPerSecond = radian / 2; + int _numberOfLines = 20; + int _lineLength = 10; + int _lineWidth = 2; + int _innerRadius = 10; + QSize _imageSize; // Text-related settings Qt::AlignmentFlag _alignment = Qt::AlignmentFlag::AlignBottom; QString _text; - QColor _textColor = Qt::black; + QColor _textColor = Qt::black; // Environment settings - bool _centerOnParent = true; - bool _disableParentWhenSpinning = true; + bool _centerOnParent = true; + bool _disableParentWhenSpinning = true; // Internal bits - QTimer *_timer = nullptr; - int _currentCounter = 0; - bool _isSpinning = false; + QTimer* _timer = nullptr; + int _currentCounter = 0; + bool _isSpinning = false; }; From 9084d746aff0eb72de04866617bbc0ea85307c0e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:42:29 +0200 Subject: [PATCH 107/160] Git: add a blame-ignore file for large-scale reformatting --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..cbf236645 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +18fef8dfe5d926ec0bc979562553adf4db8db2e9 From 56c27c425567cf75ace2fe15c9c10bc1a2689cb6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:45:58 +0200 Subject: [PATCH 108/160] [libcalamaresui] Warnings-- --- src/libcalamaresui/widgets/waitingspinnerwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index 0186fa983..542d01a38 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -336,7 +336,7 @@ WaitingSpinnerWidget::updateSize() else { QFontMetrics fm( font() ); - QSize textSize = QSize( fm.width( _text ), fm.height() ); + QSize textSize = QSize( fm.horizontalAdvance( _text ), fm.height() ); setFixedSize( std::max( size, textSize.width() ), size + size / 4 + textSize.height() ); } } @@ -344,7 +344,8 @@ WaitingSpinnerWidget::updateSize() void WaitingSpinnerWidget::updateTimer() { - _timer->setInterval( 1000 / ( _numberOfLines * _revolutionsPerSecond ) ); + // Old-style interval in milliseconds; force to int to suppress warning + _timer->setInterval( int( 1000 / ( _numberOfLines * _revolutionsPerSecond ) ) ); } void From 58306de28a78e6cf6c863558db21d0d9403467e9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:48:12 +0200 Subject: [PATCH 109/160] [libcalamaresui] Private static methods can be hidden --- .../widgets/waitingspinnerwidget.cpp | 78 +++++++++---------- .../widgets/waitingspinnerwidget.h | 4 - 2 files changed, 37 insertions(+), 45 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index 542d01a38..9d3577e78 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -45,6 +45,43 @@ isAlignCenter( Qt::AlignmentFlag a ) return a == Qt::AlignmentFlag::AlignVCenter; } +static int +lineCountDistanceFromPrimary( int current, int primary, int totalNrOfLines ) +{ + int distance = primary - current; + if ( distance < 0 ) + { + distance += totalNrOfLines; + } + return distance; +} + +static QColor +currentLineColor( int countDistance, int totalNrOfLines, qreal trailFadePerc, qreal minOpacity, QColor color ) +{ + if ( countDistance == 0 ) + { + return color; + } + const qreal minAlphaF = minOpacity / 100.0; + int distanceThreshold = static_cast< int >( ceil( ( totalNrOfLines - 1 ) * trailFadePerc / 100.0 ) ); + if ( countDistance > distanceThreshold ) + { + color.setAlphaF( minAlphaF ); + } + else + { + qreal alphaDiff = color.alphaF() - minAlphaF; + qreal gradient = alphaDiff / static_cast< qreal >( distanceThreshold + 1 ); + qreal resultAlpha = color.alphaF() - gradient * countDistance; + + // If alpha is out of bounds, clip it. + resultAlpha = std::min( 1.0, std::max( 0.0, resultAlpha ) ); + color.setAlphaF( resultAlpha ); + } + return color; +} + WaitingSpinnerWidget::WaitingSpinnerWidget( QWidget* parent, bool centerOnParent, bool disableParentWhenSpinning ) : WaitingSpinnerWidget( Qt::WindowModality::NonModal, parent, centerOnParent, disableParentWhenSpinning ) { @@ -356,44 +393,3 @@ WaitingSpinnerWidget::updatePosition() move( parentWidget()->width() / 2 - width() / 2, parentWidget()->height() / 2 - height() / 2 ); } } - -int -WaitingSpinnerWidget::lineCountDistanceFromPrimary( int current, int primary, int totalNrOfLines ) -{ - int distance = primary - current; - if ( distance < 0 ) - { - distance += totalNrOfLines; - } - return distance; -} - -QColor -WaitingSpinnerWidget::currentLineColor( int countDistance, - int totalNrOfLines, - qreal trailFadePerc, - qreal minOpacity, - QColor color ) -{ - if ( countDistance == 0 ) - { - return color; - } - const qreal minAlphaF = minOpacity / 100.0; - int distanceThreshold = static_cast< int >( ceil( ( totalNrOfLines - 1 ) * trailFadePerc / 100.0 ) ); - if ( countDistance > distanceThreshold ) - { - color.setAlphaF( minAlphaF ); - } - else - { - qreal alphaDiff = color.alphaF() - minAlphaF; - qreal gradient = alphaDiff / static_cast< qreal >( distanceThreshold + 1 ); - qreal resultAlpha = color.alphaF() - gradient * countDistance; - - // If alpha is out of bounds, clip it. - resultAlpha = std::min( 1.0, std::max( 0.0, resultAlpha ) ); - color.setAlphaF( resultAlpha ); - } - return color; -} diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.h b/src/libcalamaresui/widgets/waitingspinnerwidget.h index 2fe76b5b1..ce4a4cbff 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.h +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.h @@ -121,10 +121,6 @@ protected: void paintEvent( QPaintEvent* paintEvent ) override; private: - static int lineCountDistanceFromPrimary( int current, int primary, int totalNrOfLines ); - static QColor - currentLineColor( int distance, int totalNrOfLines, qreal trailFadePerc, qreal minOpacity, QColor color ); - void updateSize(); void updateTimer(); void updatePosition(); From 87ff7ae0da984a56ce37ae000c13c0b0056fddb3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 16 Apr 2022 12:51:11 +0200 Subject: [PATCH 110/160] [libcalamaresui] Use Qt max, min, bound --- src/libcalamaresui/widgets/waitingspinnerwidget.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index 9d3577e78..90d279dae 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -28,14 +28,8 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -// Own includes #include "waitingspinnerwidget.h" -// Standard includes -#include -#include - -// Qt includes #include #include @@ -76,7 +70,7 @@ currentLineColor( int countDistance, int totalNrOfLines, qreal trailFadePerc, qr qreal resultAlpha = color.alphaF() - gradient * countDistance; // If alpha is out of bounds, clip it. - resultAlpha = std::min( 1.0, std::max( 0.0, resultAlpha ) ); + resultAlpha = qBound( 0.0, resultAlpha, 1.0 ); color.setAlphaF( resultAlpha ); } return color; @@ -316,7 +310,7 @@ WaitingSpinnerWidget::isSpinning() const void WaitingSpinnerWidget::setRoundness( qreal roundness ) { - _roundness = std::max( 0.0, std::min( 100.0, roundness ) ); + _roundness = qBound( 0.0, roundness, 100.0 ); } void @@ -374,7 +368,7 @@ WaitingSpinnerWidget::updateSize() { QFontMetrics fm( font() ); QSize textSize = QSize( fm.horizontalAdvance( _text ), fm.height() ); - setFixedSize( std::max( size, textSize.width() ), size + size / 4 + textSize.height() ); + setFixedSize( qMax( size, textSize.width() ), size + size / 4 + textSize.height() ); } } From 7db14cb5cf5780828b1f310db476175cb9a78fd4 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 10:07:56 +0200 Subject: [PATCH 111/160] [libcalamaresui] Fix build for ::ceil --- src/libcalamaresui/widgets/waitingspinnerwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp index 90d279dae..3073e9b97 100644 --- a/src/libcalamaresui/widgets/waitingspinnerwidget.cpp +++ b/src/libcalamaresui/widgets/waitingspinnerwidget.cpp @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "waitingspinnerwidget.h" +#include #include #include @@ -58,7 +59,7 @@ currentLineColor( int countDistance, int totalNrOfLines, qreal trailFadePerc, qr return color; } const qreal minAlphaF = minOpacity / 100.0; - int distanceThreshold = static_cast< int >( ceil( ( totalNrOfLines - 1 ) * trailFadePerc / 100.0 ) ); + int distanceThreshold = static_cast< int >( qCeil( ( totalNrOfLines - 1 ) * trailFadePerc / 100.0 ) ); if ( countDistance > distanceThreshold ) { color.setAlphaF( minAlphaF ); From 7b22546b140d903e347fcea5ffdc2137d6716d10 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 09:53:05 +0200 Subject: [PATCH 112/160] [calamares] Don't need a method for painting, reduce API --- .../progresstree/ProgressTreeDelegate.cpp | 85 +++++++++---------- .../progresstree/ProgressTreeDelegate.h | 3 - 2 files changed, 41 insertions(+), 47 deletions(-) diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index 48b5b4328..388f4508c 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -25,50 +25,8 @@ item_fontsize() return CalamaresUtils::defaultFontSize() + 4; } -QSize -ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const -{ - if ( !index.isValid() ) - { - return option.rect.size(); - } - - QFont font = qApp->font(); - - font.setPointSize( item_fontsize() ); - QFontMetrics fm( font ); - int height = fm.height(); - - height += 2 * item_margin; - - return QSize( option.rect.width(), height ); -} - - -void -ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const -{ - QStyleOptionViewItem opt = option; - - painter->save(); - - initStyleOption( &opt, index ); - opt.text.clear(); - - painter->setBrush( - QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ) ); - painter->setPen( QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarText ) ) ); - - paintViewStep( painter, opt, index ); - - painter->restore(); -} - - -void -ProgressTreeDelegate::paintViewStep( QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const +static void +paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) { QRect textRect = option.rect.adjusted( item_margin, item_margin, -item_margin, -item_margin ); QFont font = qApp->font(); @@ -122,3 +80,42 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter, } } while ( shrinkSteps <= maximumShrink ); } + +QSize +ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const +{ + if ( !index.isValid() ) + { + return option.rect.size(); + } + + QFont font = qApp->font(); + + font.setPointSize( item_fontsize() ); + QFontMetrics fm( font ); + int height = fm.height(); + + height += 2 * item_margin; + + return QSize( option.rect.width(), height ); +} + + +void +ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const +{ + QStyleOptionViewItem opt = option; + + painter->save(); + + initStyleOption( &opt, index ); + opt.text.clear(); + + painter->setBrush( + QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ) ); + painter->setPen( QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarText ) ) ); + + paintViewStep( painter, opt, index ); + + painter->restore(); +} diff --git a/src/calamares/progresstree/ProgressTreeDelegate.h b/src/calamares/progresstree/ProgressTreeDelegate.h index 55dcf7ac4..d5a5abcbc 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.h +++ b/src/calamares/progresstree/ProgressTreeDelegate.h @@ -26,9 +26,6 @@ public: protected: QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override; void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; - -private: - void paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; }; #endif // PROGRESSTREEDELEGATE_H From e757639669376d2eb26fbf2725e1e171fe000b1d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 11:15:43 +0200 Subject: [PATCH 113/160] [calamares] A progresstree isn't a tree --- src/calamares/progresstree/ProgressTreeView.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calamares/progresstree/ProgressTreeView.h b/src/calamares/progresstree/ProgressTreeView.h index 5c416dfd6..00decb6c3 100644 --- a/src/calamares/progresstree/ProgressTreeView.h +++ b/src/calamares/progresstree/ProgressTreeView.h @@ -14,8 +14,11 @@ #include /** - * @brief The ProgressTreeView class is a modified QTreeView which displays the + * @brief Displays progress through the list of (visible) steps + * + * The ProgressTreeView class is a modified QListView which displays the * available view steps and the user's progress through them. + * Since Calamares doesn't support "sub steps", it isn't really a tree. */ class ProgressTreeView : public QListView { From 7686b89cd6926a7d8820913fcff3f8ec755dee33 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 11:35:52 +0200 Subject: [PATCH 114/160] [welcome] Very basic model delegate for results / requirements --- src/modules/welcome/CMakeLists.txt | 1 + .../welcome/checker/ResultDelegate.cpp | 88 +++++++++++++++++++ src/modules/welcome/checker/ResultDelegate.h | 28 ++++++ 3 files changed, 117 insertions(+) create mode 100644 src/modules/welcome/checker/ResultDelegate.cpp create mode 100644 src/modules/welcome/checker/ResultDelegate.h diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index c8fb13590..05f769224 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -21,6 +21,7 @@ calamares_add_plugin(welcome SOURCES checker/CheckerContainer.cpp checker/GeneralRequirements.cpp + checker/ResultDelegate.cpp checker/ResultWidget.cpp checker/ResultsListWidget.cpp ${PARTMAN_SRC} diff --git a/src/modules/welcome/checker/ResultDelegate.cpp b/src/modules/welcome/checker/ResultDelegate.cpp new file mode 100644 index 000000000..f3984ed87 --- /dev/null +++ b/src/modules/welcome/checker/ResultDelegate.cpp @@ -0,0 +1,88 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#include "ResultDelegate.h" + +#include "modulesystem/RequirementsModel.h" +#include "utils/CalamaresUtilsGui.h" + +#include +#include + +static constexpr int const item_margin = 8; +static inline int +item_fontsize() +{ + return CalamaresUtils::defaultFontSize() + 4; +} + +static void +paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) +{ + QRect textRect = option.rect.adjusted( item_margin, item_margin, -item_margin, -item_margin ); + QFont font = qApp->font(); + font.setPointSize( item_fontsize() ); + font.setBold( false ); + painter->setFont( font ); + + if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() ) + { + painter->setBrush( QColorConstants::Green ); + painter->setPen( QColorConstants::Black ); + } + else + { + if ( index.data( Calamares::RequirementsModel::Mandatory ).toBool() ) + { + painter->setPen( QColorConstants::Red ); + } + else + { + painter->setPen( QColorConstants::Blue ); + } + } + + + painter->drawText( textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, index.data().toString() ); +} + +QSize +ResultDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const +{ + if ( !index.isValid() ) + { + return option.rect.size(); + } + + QFont font = qApp->font(); + + font.setPointSize( item_fontsize() ); + QFontMetrics fm( font ); + int height = fm.height(); + + height += 2 * item_margin; + + return QSize( option.rect.width(), height ); +} + + +void +ResultDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const +{ + QStyleOptionViewItem opt = option; + + painter->save(); + + initStyleOption( &opt, index ); + opt.text.clear(); + + paintRequirement( painter, opt, index ); + + painter->restore(); +} diff --git a/src/modules/welcome/checker/ResultDelegate.h b/src/modules/welcome/checker/ResultDelegate.h new file mode 100644 index 000000000..9d0fc6349 --- /dev/null +++ b/src/modules/welcome/checker/ResultDelegate.h @@ -0,0 +1,28 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2022 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ + +#ifndef WELCOME_CHECKER_RESULTDELEGATE_HH +#define WELCOME_CHECKER_RESULTDELEGATE_HH + +#include + +/** + * @brief Class for drawing (un)satisfied requirements + */ +class ResultDelegate : public QStyledItemDelegate +{ +public: + using QStyledItemDelegate::QStyledItemDelegate; + +protected: + QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override; + void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; +}; + +#endif // PROGRESSTREEDELEGATE_H From e457d099d83730b9b4eede679e160ca05a22e168 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 12:00:02 +0200 Subject: [PATCH 115/160] [welcome] Replace manual widgets-creation by a listview with model --- .../welcome/checker/ResultsListWidget.cpp | 46 ++++++++++--------- .../welcome/checker/ResultsListWidget.h | 9 +++- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 4c802acfc..71f16e8bf 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -10,7 +10,7 @@ #include "ResultsListWidget.h" -#include "ResultWidget.h" +#include "ResultDelegate.h" #include "Branding.h" #include "Settings.h" @@ -24,6 +24,7 @@ #include #include #include +#include #include /** @brief Add widgets to @p layout for the list @p checkEntries @@ -156,20 +157,11 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) { setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); - m_mainLayout = new QVBoxLayout; - m_entriesLayout = new QVBoxLayout; - - setLayout( m_mainLayout ); + auto mainLayout = new QVBoxLayout; + setLayout( mainLayout ); int paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 ); - QHBoxLayout* spacerLayout = new QHBoxLayout; - m_mainLayout->addLayout( spacerLayout ); - spacerLayout->addSpacing( paddingSize ); - spacerLayout->addLayout( m_entriesLayout ); - spacerLayout->addSpacing( paddingSize ); - CalamaresUtils::unmarginLayout( spacerLayout ); - QHBoxLayout* explanationLayout = new QHBoxLayout; m_explanation = new QLabel( m_config->warningMessage() ); m_explanation->setWordWrap( true ); @@ -181,11 +173,20 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) explanationLayout->addWidget( m_countdown ); m_countdown->start(); - m_entriesLayout->addLayout( explanationLayout ); - m_entriesLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() / 2 ); - m_mainLayout->addStretch(); + mainLayout->addLayout( explanationLayout ); + mainLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 ); - requirementsChanged(); + auto* listview = new QListView( this ); + listview->setSelectionMode( QAbstractItemView::NoSelection ); + listview->setDragDropMode( QAbstractItemView::NoDragDrop ); + listview->setAcceptDrops( false ); + listview->setItemDelegate( new ResultDelegate( this ) ); + listview->setModel( config->unsatisfiedRequirements() ); + m_centralWidget = listview; + m_centralLayout = mainLayout; + + mainLayout->addWidget( listview ); + mainLayout->addStretch(); connect( config, &Config::warningMessageChanged, @@ -197,10 +198,6 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) } } ); connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); - connect( config->requirementsModel(), - &Calamares::RequirementsModel::modelReset, - this, - &ResultsListWidget::requirementsChanged ); CALAMARES_RETRANSLATE_SLOT( &ResultsListWidget::retranslate ); } @@ -261,12 +258,16 @@ ResultsListWidget::requirementsChanged() if ( !requirementsSatisfied ) { - createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); + // createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); } else { m_countdown->stop(); m_countdown->hide(); + + delete m_centralWidget; + m_centralWidget = nullptr; + if ( !Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductWelcome ).isEmpty() ) { QPixmap theImage @@ -290,7 +291,8 @@ ResultsListWidget::requirementsChanged() imageLabel->setAlignment( Qt::AlignCenter ); imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); imageLabel->setObjectName( "welcomeLogo" ); - m_mainLayout->addWidget( imageLabel ); + // This specifically isn't assigned to m_centralWidget + m_centralLayout->addWidget( imageLabel ); } } m_explanation->setAlignment( Qt::AlignCenter ); diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index ca47b3a13..08dfe3f8b 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -60,8 +60,13 @@ private: // UI parts, which need updating when the model changes QLabel* m_explanation = nullptr; CountdownWaitingWidget* m_countdown = nullptr; - QBoxLayout* m_mainLayout = nullptr; - QBoxLayout* m_entriesLayout = nullptr; + // There is a central widget, which can be: + // - a list widget showing failed requirements + // - nullptr (when displaying a pretty label for language / splash purposes) + // it is placed in the central layout. + QWidget* m_centralWidget = nullptr; + QBoxLayout* m_centralLayout = nullptr; + int m_requirementsSeen = 0; }; From 15b4660d3e60393e06b186e19e22634e9d3c1d03 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 12:51:12 +0200 Subject: [PATCH 116/160] [welcome] Rip out rest of ResultWidget - this breaks the dialog showing details, but we'll switch that to the delegate as well. --- src/modules/welcome/CMakeLists.txt | 1 - src/modules/welcome/checker/ResultWidget.cpp | 60 ----------- src/modules/welcome/checker/ResultWidget.h | 42 -------- .../welcome/checker/ResultsListWidget.cpp | 101 +----------------- .../welcome/checker/ResultsListWidget.h | 10 -- 5 files changed, 1 insertion(+), 213 deletions(-) delete mode 100644 src/modules/welcome/checker/ResultWidget.cpp delete mode 100644 src/modules/welcome/checker/ResultWidget.h diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 05f769224..0a8353084 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -22,7 +22,6 @@ calamares_add_plugin(welcome checker/CheckerContainer.cpp checker/GeneralRequirements.cpp checker/ResultDelegate.cpp - checker/ResultWidget.cpp checker/ResultsListWidget.cpp ${PARTMAN_SRC} WelcomeViewStep.cpp diff --git a/src/modules/welcome/checker/ResultWidget.cpp b/src/modules/welcome/checker/ResultWidget.cpp deleted file mode 100644 index 6e34a6c36..000000000 --- a/src/modules/welcome/checker/ResultWidget.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac - * SPDX-FileCopyrightText: 2017 Adriaan de Groot - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#include "ResultWidget.h" - -#include "utils/CalamaresUtilsGui.h" -#include "utils/Logger.h" - -#include - -static inline void -setCondition( QLabel* label, CalamaresUtils::ImageType t ) -{ - label->setPixmap( - CalamaresUtils::defaultPixmap( t, CalamaresUtils::Original, QSize( label->height(), label->height() ) ) ); -} - -ResultWidget::ResultWidget( bool satisfied, bool required, QWidget* parent ) - : QWidget( parent ) -{ - QBoxLayout* mainLayout = new QHBoxLayout; - setLayout( mainLayout ); - - m_iconLabel = new QLabel( this ); - m_iconLabel->setFixedSize( CalamaresUtils::defaultIconSize() ); - m_iconLabel->setObjectName( "resultIcon" ); - mainLayout->addWidget( m_iconLabel ); - - m_textLabel = new QLabel( this ); - m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - m_textLabel->setObjectName( "resultText" ); - mainLayout->addWidget( m_textLabel ); - - if ( satisfied ) - { - setCondition( m_iconLabel, CalamaresUtils::StatusOk ); - } - else if ( required ) - { - setCondition( m_iconLabel, CalamaresUtils::StatusError ); - } - else - { - setCondition( m_iconLabel, CalamaresUtils::StatusWarning ); - } -} - - -void -ResultWidget::setText( const QString& text ) -{ - m_textLabel->setText( text ); -} diff --git a/src/modules/welcome/checker/ResultWidget.h b/src/modules/welcome/checker/ResultWidget.h deleted file mode 100644 index d77c0d9bb..000000000 --- a/src/modules/welcome/checker/ResultWidget.h +++ /dev/null @@ -1,42 +0,0 @@ -/* === This file is part of Calamares - === - * - * SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac - * SPDX-FileCopyrightText: 2017 Adriaan de Groot - * SPDX-License-Identifier: GPL-3.0-or-later - * - * Calamares is Free Software: see the License-Identifier above. - * - */ - -#ifndef CHECKER_RESULTWIDGET_H -#define CHECKER_RESULTWIDGET_H - -#include - -/** - * @brief Displays the results of a single check. - * - * Widget to insert into a ResultListWidget to display an iconic status - * (warning or failure when the check is not satisfied) along with - * descriptive test. - */ -class ResultWidget : public QWidget -{ - Q_OBJECT -public: - /** - * @brief Create widget with results of a check. - * - * Use setText() to set up the text of the widget. - */ - explicit ResultWidget( bool satisfied, bool required, QWidget* parent = nullptr ); - - /// @brief Set the displayed description of the check. - void setText( const QString& text ); - -private: - QLabel* m_textLabel; - QLabel* m_iconLabel; -}; - -#endif // CHECKER_RESULTWIDGET_H diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 71f16e8bf..e1989e21d 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -27,54 +27,6 @@ #include #include -/** @brief Add widgets to @p layout for the list @p checkEntries - * - * The @p resultWidgets is filled with pointers to the widgets; - * for each entry in @p checkEntries that satisfies @p predicate, - * a widget is created, otherwise a nullptr is added instead. - * - * Adds all the widgets to the given @p layout. - * - * Afterwards, @p resultWidgets has a length equal to @p checkEntries. - */ -static void -createResultWidgets( QLayout* layout, - QList< ResultWidget* >& resultWidgets, - const Calamares::RequirementsModel& model, - std::function< bool( const Calamares::RequirementsModel&, QModelIndex ) > predicate ) -{ - resultWidgets.clear(); - resultWidgets.reserve( model.count() ); - for ( auto i = 0; i < model.count(); i++ ) - { - const auto& index = model.index( i ); - if ( !predicate( model, index ) ) - { - resultWidgets.append( nullptr ); - continue; - } - - const QString checkName = model.data( index, Calamares::RequirementsModel::Name ).toString(); - const bool is_satisfied = model.data( index, Calamares::RequirementsModel::Satisfied ).toBool(); - const bool is_mandatory = model.data( index, Calamares::RequirementsModel::Mandatory ).toBool(); - ResultWidget* ciw = new ResultWidget( is_satisfied, is_mandatory ); - ciw->setObjectName( checkName ); - - layout->addWidget( ciw ); - ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - - ciw->setAutoFillBackground( true ); - QPalette pal( ciw->palette() ); - QColor bgColor = pal.window().color(); - int bgHue = ( is_satisfied ) ? bgColor.hue() : ( is_mandatory ) ? 0 : 60; - bgColor.setHsv( bgHue, 64, bgColor.value() ); - pal.setColor( QPalette::Window, bgColor ); - ciw->setPalette( pal ); - - resultWidgets.append( ciw ); - } -} - /** @brief A "details" dialog for the results-list * * This displays the same RequirementsList as ResultsListWidget, @@ -96,7 +48,6 @@ public: private: QLabel* m_title; - QList< ResultWidget* > m_resultWidgets; ///< One widget for each entry with details available const Calamares::RequirementsModel& m_model; void retranslate(); @@ -112,12 +63,6 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, m_title = new QLabel( this ); m_title->setObjectName( "resultDialogTitle" ); - createResultWidgets( entriesLayout, - m_resultWidgets, - model, - []( const Calamares::RequirementsModel& m, QModelIndex i ) - { return m.data( i, Calamares::RequirementsModel::HasDetails ).toBool(); } ); - QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); buttonBox->setObjectName( "resultDialogButtons" ); @@ -139,15 +84,6 @@ ResultsListDialog::retranslate() { m_title->setText( tr( "For best results, please ensure that this computer:" ) ); setWindowTitle( tr( "System requirements" ) ); - - for ( auto i = 0; i < m_model.count(); i++ ) - { - if ( m_resultWidgets[ i ] ) - { - m_resultWidgets[ i ]->setText( - m_model.data( m_model.index( i ), Calamares::RequirementsModel::Details ).toString() ); - } - } } @@ -198,8 +134,6 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) } } ); connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); - - CALAMARES_RETRANSLATE_SLOT( &ResultsListWidget::retranslate ); } @@ -214,22 +148,6 @@ ResultsListWidget::linkClicked( const QString& link ) } } -void -ResultsListWidget::retranslate() -{ - const auto& model = *( m_config->requirementsModel() ); - // Retranslate the widgets that there **are**; - // these remain in-order relative to the model. - for ( auto i = 0; i < model.count() && i < m_resultWidgets.count(); i++ ) - { - if ( m_resultWidgets[ i ] ) - { - m_resultWidgets[ i ]->setText( - model.data( model.index( i ), Calamares::RequirementsModel::NegatedText ).toString() ); - } - } -} - void ResultsListWidget::requirementsChanged() { @@ -245,22 +163,7 @@ ResultsListWidget::requirementsChanged() auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) { return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); }; - - std::for_each( m_resultWidgets.begin(), - m_resultWidgets.end(), - []( QWidget* w ) - { - if ( w ) - { - w->deleteLater(); - } - } ); - - if ( !requirementsSatisfied ) - { - // createResultWidgets( m_entriesLayout, m_resultWidgets, *( m_config->requirementsModel() ), isUnSatisfied ); - } - else + if ( requirementsSatisfied ) { m_countdown->stop(); m_countdown->hide(); @@ -297,8 +200,6 @@ ResultsListWidget::requirementsChanged() } m_explanation->setAlignment( Qt::AlignCenter ); } - - retranslate(); } bool diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index 08dfe3f8b..a75748e3f 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -11,8 +11,6 @@ #ifndef CHECKER_RESULTSLISTWIDGET_H #define CHECKER_RESULTSLISTWIDGET_H -#include "ResultWidget.h" - #include "Config.h" #include @@ -34,8 +32,6 @@ private: /// @brief The model of requirements changed void requirementsChanged(); - void retranslate(); - /** @brief The model can be reset and re-filled, is it full yet? * * We count how many requirements we have seen; since the model @@ -49,12 +45,6 @@ private: */ bool isModelFilled(); - /** @brief A list of widgets, one per entry in the requirements model - * - * Unsatisfied entries have a non-null widget pointer, while requirements - * entries that **are** satisfied have no widget. - */ - QList< ResultWidget* > m_resultWidgets; Config* m_config = nullptr; // UI parts, which need updating when the model changes From 1101b0dc82df7b67feb4f1e6bf6d31b82b824b01 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 13:01:39 +0200 Subject: [PATCH 117/160] CMake: hand off RC-or-not to the version header again (for welcome-checks) --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b4dd5ec7..8f43d4d0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -530,10 +530,10 @@ if(NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/") extend_version( "${CALAMARES_VERSION}" OFF CALAMARES_VERSION_SHORT CALAMARES_VERSION ) endif() -# Special target for not-RC (e.g. might-be-release) builds. -# This is used by the release script to get the version. -if(CALAMARES_VERSION_RC EQUAL 0) - add_custom_target(show-version ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} USES_TERMINAL) +# Special define for RC (e.g. not-a-release) builds. +# This is consumed via the CalamaresConfig.h header. +if(NOT CALAMARES_RELEASE_MODE) + set(CALAMARES_VERSION_RC 1) endif() # enforce using constBegin, constEnd for const-iterators From 3679bb45f0d3821e190fc25dee45f8ffc7786318 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 13:16:10 +0200 Subject: [PATCH 118/160] [welcome] Give the countdown a tooltip --- src/modules/welcome/checker/ResultsListWidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index e1989e21d..a512bdd36 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -106,8 +106,9 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) m_explanation->setObjectName( "resultsExplanation" ); explanationLayout->addWidget( m_explanation ); m_countdown = new CountdownWaitingWidget; - explanationLayout->addWidget( m_countdown ); + m_countdown->setToolTip( tr("Checking requirements again in a few seconds ...") ); m_countdown->start(); + explanationLayout->addWidget( m_countdown ); mainLayout->addLayout( explanationLayout ); mainLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 ); From ab1c78ca239306cf29dcc93cb4ffcdcd807acc29 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 13:29:19 +0200 Subject: [PATCH 119/160] [welcome] Allow delegate to pick the text role to display --- src/modules/welcome/checker/ResultDelegate.cpp | 7 +++---- src/modules/welcome/checker/ResultDelegate.h | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/modules/welcome/checker/ResultDelegate.cpp b/src/modules/welcome/checker/ResultDelegate.cpp index f3984ed87..f9fa372f9 100644 --- a/src/modules/welcome/checker/ResultDelegate.cpp +++ b/src/modules/welcome/checker/ResultDelegate.cpp @@ -23,7 +23,7 @@ item_fontsize() } static void -paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) +paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index, int role ) { QRect textRect = option.rect.adjusted( item_margin, item_margin, -item_margin, -item_margin ); QFont font = qApp->font(); @@ -48,8 +48,7 @@ paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const Q } } - - painter->drawText( textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, index.data().toString() ); + painter->drawText( textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, index.data( role ).toString() ); } QSize @@ -82,7 +81,7 @@ ResultDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co initStyleOption( &opt, index ); opt.text.clear(); - paintRequirement( painter, opt, index ); + paintRequirement( painter, opt, index, m_textRole ); painter->restore(); } diff --git a/src/modules/welcome/checker/ResultDelegate.h b/src/modules/welcome/checker/ResultDelegate.h index 9d0fc6349..db770502e 100644 --- a/src/modules/welcome/checker/ResultDelegate.h +++ b/src/modules/welcome/checker/ResultDelegate.h @@ -12,6 +12,8 @@ #include +#include "modulesystem/RequirementsModel.h" + /** * @brief Class for drawing (un)satisfied requirements */ @@ -19,10 +21,17 @@ class ResultDelegate : public QStyledItemDelegate { public: using QStyledItemDelegate::QStyledItemDelegate; + ResultDelegate( QObject* parent, Calamares::RequirementsModel::Roles text ) + : QStyledItemDelegate( parent ) + , m_textRole( text ) + { + } protected: QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override; void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; + + int m_textRole = Calamares::RequirementsModel::Name; }; #endif // PROGRESSTREEDELEGATE_H From 8b917ace4de5724c40679d3aef04ef26b80225e8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 15:09:54 +0200 Subject: [PATCH 120/160] [welcome] Replace widgets in dialog with model+listview While here, remove unused vars and functions, tidy code. --- .../welcome/checker/ResultsListWidget.cpp | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index a512bdd36..36286fe86 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -43,22 +43,19 @@ public: * The list must continue to exist for the lifetime of the dialog, * or UB happens. */ - ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent ); + ResultsListDialog( QAbstractItemModel* model, QWidget* parent ); ~ResultsListDialog() override; private: QLabel* m_title; - const Calamares::RequirementsModel& m_model; void retranslate(); }; -ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent ) +ResultsListDialog::ResultsListDialog( QAbstractItemModel* model, QWidget* parent ) : QDialog( parent ) - , m_model( model ) { auto* mainLayout = new QVBoxLayout; - auto* entriesLayout = new QVBoxLayout; m_title = new QLabel( this ); m_title->setObjectName( "resultDialogTitle" ); @@ -67,7 +64,15 @@ ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, buttonBox->setObjectName( "resultDialogButtons" ); mainLayout->addWidget( m_title ); - mainLayout->addLayout( entriesLayout ); + + auto* listview = new QListView( this ); + listview->setSelectionMode( QAbstractItemView::NoSelection ); + listview->setDragDropMode( QAbstractItemView::NoDragDrop ); + listview->setAcceptDrops( false ); + listview->setItemDelegate( new ResultDelegate( this, Calamares::RequirementsModel::Details ) ); + listview->setModel( model ); + + mainLayout->addWidget( listview ); mainLayout->addWidget( buttonBox ); setLayout( mainLayout ); @@ -96,8 +101,6 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) auto mainLayout = new QVBoxLayout; setLayout( mainLayout ); - int paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 ); - QHBoxLayout* explanationLayout = new QHBoxLayout; m_explanation = new QLabel( m_config->warningMessage() ); m_explanation->setWordWrap( true ); @@ -106,7 +109,7 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) m_explanation->setObjectName( "resultsExplanation" ); explanationLayout->addWidget( m_explanation ); m_countdown = new CountdownWaitingWidget; - m_countdown->setToolTip( tr("Checking requirements again in a few seconds ...") ); + m_countdown->setToolTip( tr( "Checking requirements again in a few seconds ..." ) ); m_countdown->start(); explanationLayout->addWidget( m_countdown ); @@ -117,7 +120,7 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) listview->setSelectionMode( QAbstractItemView::NoSelection ); listview->setDragDropMode( QAbstractItemView::NoDragDrop ); listview->setAcceptDrops( false ); - listview->setItemDelegate( new ResultDelegate( this ) ); + listview->setItemDelegate( new ResultDelegate( this, Calamares::RequirementsModel::NegatedText ) ); listview->setModel( config->unsatisfiedRequirements() ); m_centralWidget = listview; m_centralLayout = mainLayout; @@ -143,7 +146,7 @@ ResultsListWidget::linkClicked( const QString& link ) { if ( link == "#details" ) { - auto* dialog = new ResultsListDialog( *( m_config->requirementsModel() ), this ); + auto* dialog = new ResultsListDialog( m_config->requirementsModel(), this ); dialog->exec(); dialog->deleteLater(); } @@ -161,8 +164,6 @@ ResultsListWidget::requirementsChanged() // all *mandatory* entries are satisfied (gives errors if not). const bool requirementsSatisfied = m_config->requirementsModel()->satisfiedRequirements(); - auto isUnSatisfied = []( const Calamares::RequirementsModel& m, QModelIndex i ) - { return !m.data( i, Calamares::RequirementsModel::Satisfied ).toBool(); }; if ( requirementsSatisfied ) { From 0b2af86ec98a4b5c04d7165e8e636369f8e83b7c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 15:15:06 +0200 Subject: [PATCH 121/160] [welcome] Remove compensating-for-model-reset code The model was emptied-and-refilled when re-checked, which meant we needed to have some special handling when messages changed to avoid re-creating widgets. Since we use a model view now, we don't need the extra machinery. --- .../welcome/checker/ResultsListWidget.cpp | 27 +------------------ .../welcome/checker/ResultsListWidget.h | 15 ----------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 36286fe86..e97d7833d 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -128,15 +128,7 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) mainLayout->addWidget( listview ); mainLayout->addStretch(); - connect( config, - &Config::warningMessageChanged, - [ = ]( QString s ) - { - if ( isModelFilled() ) - { - m_explanation->setText( s ); - } - } ); + connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText ); connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); } @@ -155,11 +147,6 @@ ResultsListWidget::linkClicked( const QString& link ) void ResultsListWidget::requirementsChanged() { - if ( !isModelFilled() ) - { - return; - } - // Check that all are satisfied (gives warnings if not) and // all *mandatory* entries are satisfied (gives errors if not). @@ -204,18 +191,6 @@ ResultsListWidget::requirementsChanged() } } -bool -ResultsListWidget::isModelFilled() -{ - if ( m_config->requirementsModel()->count() < m_requirementsSeen ) - { - return false; - } - m_requirementsSeen = m_config->requirementsModel()->count(); - return true; -} - - #include "utils/moc-warnings.h" #include "ResultsListWidget.moc" diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index a75748e3f..d83a4bd96 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -32,19 +32,6 @@ private: /// @brief The model of requirements changed void requirementsChanged(); - /** @brief The model can be reset and re-filled, is it full yet? - * - * We count how many requirements we have seen; since the model - * does not shrink, we can avoid reacting to model-is-cleared - * events because the size of the model is then (briefly) smaller - * than what we expect. - * - * Returns true if the model contains at least m_requirementsSeen - * elements, and updates m_requirementsSeen. (Which is why the - * method is not const) - */ - bool isModelFilled(); - Config* m_config = nullptr; // UI parts, which need updating when the model changes @@ -56,8 +43,6 @@ private: // it is placed in the central layout. QWidget* m_centralWidget = nullptr; QBoxLayout* m_centralLayout = nullptr; - - int m_requirementsSeen = 0; }; #endif // CHECKER_RESULTSLISTWIDGET_H From 07f4ec529b6cc3aa302cd02d10e16710898d4768 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 15:39:53 +0200 Subject: [PATCH 122/160] [libcalamares] Clean up requirements model API - don't need friends - made modify-the-model API public where it makes sense - improve naming --- .../modulesystem/RequirementsChecker.cpp | 3 +- .../modulesystem/RequirementsModel.cpp | 36 +++++++++++++------ .../modulesystem/RequirementsModel.h | 21 +++++------ 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/src/libcalamares/modulesystem/RequirementsChecker.cpp b/src/libcalamares/modulesystem/RequirementsChecker.cpp index d0d6e74fe..bdc564519 100644 --- a/src/libcalamares/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamares/modulesystem/RequirementsChecker.cpp @@ -32,7 +32,6 @@ RequirementsChecker::RequirementsChecker( QVector< Module* > modules, Requiremen , m_progressTimer( nullptr ) , m_progressTimeouts( 0 ) { - m_model->clear(); m_watchers.reserve( m_modules.count() ); connect( this, &RequirementsChecker::requirementsProgress, model, &RequirementsModel::setProgressMessage ); } @@ -77,7 +76,7 @@ RequirementsChecker::finished() } m_model->describe(); - m_model->changeRequirementsList(); + m_model->reCheckList(); QTimer::singleShot( 0, this, &RequirementsChecker::done ); } } diff --git a/src/libcalamares/modulesystem/RequirementsModel.cpp b/src/libcalamares/modulesystem/RequirementsModel.cpp index f21f7051c..b9a091014 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.cpp +++ b/src/libcalamares/modulesystem/RequirementsModel.cpp @@ -19,24 +19,38 @@ void RequirementsModel::clear() { QMutexLocker l( &m_addLock ); - emit beginResetModel(); + beginResetModel(); m_requirements.clear(); - changeRequirementsList(); - emit endResetModel(); + endResetModel(); + reCheckList(); } void RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements ) { QMutexLocker l( &m_addLock ); - emit beginResetModel(); - m_requirements.append( requirements ); - changeRequirementsList(); - emit endResetModel(); + + beginResetModel(); + for ( const auto& r : requirements ) + { + auto it = std::find_if( m_requirements.begin(), + m_requirements.end(), + [ &r ]( const Calamares::RequirementEntry& re ) { return r.name == re.name; } ); + if ( it != m_requirements.end() ) + { + *it = r; + } + else + { + m_requirements.append( r ); + } + } + endResetModel(); + reCheckList(); } void -RequirementsModel::changeRequirementsList() +RequirementsModel::reCheckList() { auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; }; auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; }; @@ -44,8 +58,8 @@ RequirementsModel::changeRequirementsList() m_satisfiedRequirements = std::none_of( m_requirements.begin(), m_requirements.end(), isUnSatisfied ); m_satisfiedMandatory = std::none_of( m_requirements.begin(), m_requirements.end(), isMandatoryAndUnSatisfied ); - emit satisfiedRequirementsChanged( m_satisfiedRequirements ); - emit satisfiedMandatoryChanged( m_satisfiedMandatory ); + Q_EMIT satisfiedRequirementsChanged( m_satisfiedRequirements ); + Q_EMIT satisfiedMandatoryChanged( m_satisfiedMandatory ); } int @@ -108,7 +122,7 @@ void RequirementsModel::setProgressMessage( const QString& m ) { m_progressMessage = m; - emit progressMessageChanged( m_progressMessage ); + Q_EMIT progressMessageChanged( m_progressMessage ); } } // namespace Calamares diff --git a/src/libcalamares/modulesystem/RequirementsModel.h b/src/libcalamares/modulesystem/RequirementsModel.h index d1842760c..6ddbe72d0 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.h +++ b/src/libcalamares/modulesystem/RequirementsModel.h @@ -33,8 +33,6 @@ class RequirementsChecker; */ class DLLEXPORT RequirementsModel : public QAbstractListModel { - friend class RequirementsChecker; - Q_OBJECT Q_PROPERTY( bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL ) Q_PROPERTY( bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL ) @@ -69,6 +67,15 @@ public: ///@brief Debugging tool, describe the checking-state void describe() const; + ///@brief Update progress message (called by the checker) + void setProgressMessage( const QString& m ); + + ///@brief Append some requirements; resets the model + void addRequirementsList( const Calamares::RequirementsList& requirements ); + + ///@brief Check the whole list, emit signals satisfied...() + void reCheckList(); + signals: void satisfiedRequirementsChanged( bool value ); void satisfiedMandatoryChanged( bool value ); @@ -77,20 +84,10 @@ signals: protected: QHash< int, QByteArray > roleNames() const override; - ///@brief Clears the requirements; resets the model void clear(); - ///@brief Append some requirements; resets the model - void addRequirementsList( const Calamares::RequirementsList& requirements ); - - ///@brief Update progress message (called by the checker) - void setProgressMessage( const QString& m ); - private: - ///@brief Implementation for {set,add}RequirementsList - void changeRequirementsList(); - QString m_progressMessage; QMutex m_addLock; RequirementsList m_requirements; From e5036da084e92085bdbf8f207ff7f2d7f5902433 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:03:42 +0200 Subject: [PATCH 123/160] [welcome] Draw an icon for requirement-status --- .../welcome/checker/ResultDelegate.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/modules/welcome/checker/ResultDelegate.cpp b/src/modules/welcome/checker/ResultDelegate.cpp index f9fa372f9..9de7ac68a 100644 --- a/src/modules/welcome/checker/ResultDelegate.cpp +++ b/src/modules/welcome/checker/ResultDelegate.cpp @@ -25,29 +25,37 @@ item_fontsize() static void paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index, int role ) { + const auto fontsize = item_fontsize(); + QRect textRect = option.rect.adjusted( item_margin, item_margin, -item_margin, -item_margin ); QFont font = qApp->font(); - font.setPointSize( item_fontsize() ); + font.setPointSize( fontsize ); font.setBold( false ); painter->setFont( font ); - if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() ) - { - painter->setBrush( QColorConstants::Green ); - painter->setPen( QColorConstants::Black ); - } + CalamaresUtils::ImageType statusImage = CalamaresUtils::StatusOk; + + painter->setPen( QColorConstants::Black ); + if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() ) {} else { if ( index.data( Calamares::RequirementsModel::Mandatory ).toBool() ) { - painter->setPen( QColorConstants::Red ); + statusImage = CalamaresUtils::StatusError; } else { - painter->setPen( QColorConstants::Blue ); + statusImage = CalamaresUtils::StatusWarning; } } + auto image + = CalamaresUtils::defaultPixmap( statusImage, CalamaresUtils::Original, QSize( 2 * fontsize, 2 * fontsize ) ) + .toImage(); + painter->drawImage( textRect.topLeft(), image ); + + // Leave space for that image (already drawn) + textRect.moveLeft( 2 * fontsize + 2 * item_margin ); painter->drawText( textRect, Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, index.data( role ).toString() ); } From 7650795f486f28999f4954d831366300575eb5f7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:16:20 +0200 Subject: [PATCH 124/160] [welcome] Give the result-display somre more space --- src/modules/welcome/checker/ResultDelegate.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/welcome/checker/ResultDelegate.cpp b/src/modules/welcome/checker/ResultDelegate.cpp index 9de7ac68a..60f67849a 100644 --- a/src/modules/welcome/checker/ResultDelegate.cpp +++ b/src/modules/welcome/checker/ResultDelegate.cpp @@ -71,11 +71,11 @@ ResultDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& font.setPointSize( item_fontsize() ); QFontMetrics fm( font ); - int height = fm.height(); - height += 2 * item_margin; + const int height = fm.height() + 2 * item_margin; + int textwidth = fm.boundingRect( index.data( Calamares::RequirementsModel::NegatedText ).toString() ).width(); - return QSize( option.rect.width(), height ); + return QSize( qMax( option.rect.width(), textwidth ), height ); } From e102e2630ec03c1fe6dea6b9c75b5c3d79598474 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:19:34 +0200 Subject: [PATCH 125/160] [welcome] Rip out the "details" dialog for requirements - The dialog gave very little extra information - The text descriptions from the dialog are already available as tooltips in the existing list view. --- src/modules/welcome/Config.cpp | 34 ++++---- .../welcome/checker/ResultsListWidget.cpp | 78 ------------------- .../welcome/checker/ResultsListWidget.h | 2 - 3 files changed, 18 insertions(+), 96 deletions(-) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index 94f2192c2..c1b13fc69 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -54,12 +54,10 @@ Config::retranslate() { message = setup ? tr( "This computer does not satisfy the minimum " "requirements for setting up %1.
" - "Setup cannot continue. " - "Details..." ) + "Setup cannot continue." ) : tr( "This computer does not satisfy the minimum " "requirements for installing %1.
" - "Installation cannot continue. " - "Details..." ); + "Installation cannot continue." ); } else { @@ -124,16 +122,16 @@ Config::initLanguages() QLocale defaultLocale = QLocale( QLocale::system().name() ); cDebug() << "Matching locale" << defaultLocale; - int matchedLocaleIndex = m_languages->find( [&]( const QLocale& x ) { - return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); - } ); + int matchedLocaleIndex = m_languages->find( + [ & ]( const QLocale& x ) + { return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); } ); if ( matchedLocaleIndex < 0 ) { cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language(); matchedLocaleIndex - = m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } ); + = m_languages->find( [ & ]( const QLocale& x ) { return x.language() == defaultLocale.language(); } ); } if ( matchedLocaleIndex < 0 ) @@ -191,7 +189,8 @@ Config::setLocaleIndex( int index ) QLocale::setDefault( selectedTranslation.locale() ); const auto* branding = Calamares::Branding::instance(); - CalamaresUtils::installTranslator( selectedTranslation.id(), branding ? branding->translationsDirectory() : QString() ); + CalamaresUtils::installTranslator( selectedTranslation.id(), + branding ? branding->translationsDirectory() : QString() ); if ( Calamares::JobQueue::instance() && Calamares::JobQueue::instance()->globalStorage() ) { CalamaresUtils::Locale::insertGS( *Calamares::JobQueue::instance()->globalStorage(), @@ -367,13 +366,16 @@ setGeoIP( Config* config, const QVariantMap& configurationMap ) if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) { auto* future = new FWString(); - QObject::connect( future, &FWString::finished, [config, future, handler]() { - QString countryResult = future->future().result(); - cDebug() << "GeoIP result for welcome=" << countryResult; - ::setCountry( config, countryResult, handler ); - future->deleteLater(); - delete handler; - } ); + QObject::connect( future, + &FWString::finished, + [ config, future, handler ]() + { + QString countryResult = future->future().result(); + cDebug() << "GeoIP result for welcome=" << countryResult; + ::setCountry( config, countryResult, handler ); + future->deleteLater(); + delete handler; + } ); future->setFuture( handler->queryRaw() ); } else diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index e97d7833d..e26859135 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -27,71 +27,6 @@ #include #include -/** @brief A "details" dialog for the results-list - * - * This displays the same RequirementsList as ResultsListWidget, - * but the *details* part rather than the show description. - * - * This is an internal-to-the-widget class. - */ -class ResultsListDialog : public QDialog -{ - Q_OBJECT -public: - /** @brief Create a dialog for the given @p checkEntries list of requirements. - * - * The list must continue to exist for the lifetime of the dialog, - * or UB happens. - */ - ResultsListDialog( QAbstractItemModel* model, QWidget* parent ); - ~ResultsListDialog() override; - -private: - QLabel* m_title; - - void retranslate(); -}; - -ResultsListDialog::ResultsListDialog( QAbstractItemModel* model, QWidget* parent ) - : QDialog( parent ) -{ - auto* mainLayout = new QVBoxLayout; - - m_title = new QLabel( this ); - m_title->setObjectName( "resultDialogTitle" ); - - QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); - buttonBox->setObjectName( "resultDialogButtons" ); - - mainLayout->addWidget( m_title ); - - auto* listview = new QListView( this ); - listview->setSelectionMode( QAbstractItemView::NoSelection ); - listview->setDragDropMode( QAbstractItemView::NoDragDrop ); - listview->setAcceptDrops( false ); - listview->setItemDelegate( new ResultDelegate( this, Calamares::RequirementsModel::Details ) ); - listview->setModel( model ); - - mainLayout->addWidget( listview ); - mainLayout->addWidget( buttonBox ); - - setLayout( mainLayout ); - - connect( buttonBox, &QDialogButtonBox::clicked, this, &QDialog::close ); - - CALAMARES_RETRANSLATE_SLOT( &ResultsListDialog::retranslate ); -} - -ResultsListDialog::~ResultsListDialog() {} - -void -ResultsListDialog::retranslate() -{ - m_title->setText( tr( "For best results, please ensure that this computer:" ) ); - setWindowTitle( tr( "System requirements" ) ); -} - - ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) : QWidget( parent ) , m_config( config ) @@ -129,19 +64,6 @@ ResultsListWidget::ResultsListWidget( Config* config, QWidget* parent ) mainLayout->addStretch(); connect( config, &Config::warningMessageChanged, m_explanation, &QLabel::setText ); - connect( m_explanation, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked ); -} - - -void -ResultsListWidget::linkClicked( const QString& link ) -{ - if ( link == "#details" ) - { - auto* dialog = new ResultsListDialog( m_config->requirementsModel(), this ); - dialog->exec(); - dialog->deleteLater(); - } } void diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index d83a4bd96..3bbed1090 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -27,8 +27,6 @@ public: explicit ResultsListWidget( Config* config, QWidget* parent ); private: - /// @brief A link in the explanatory text has been clicked - void linkClicked( const QString& link ); /// @brief The model of requirements changed void requirementsChanged(); From b129cb078673e8d7fc0861f366bd372f054ad1fc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:25:28 +0200 Subject: [PATCH 126/160] [libcalamares] Match roles from model to Qt standard roles --- src/libcalamares/modulesystem/RequirementsModel.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/modulesystem/RequirementsModel.h b/src/libcalamares/modulesystem/RequirementsModel.h index 6ddbe72d0..bd71ce81f 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.h +++ b/src/libcalamares/modulesystem/RequirementsModel.h @@ -43,11 +43,11 @@ public: enum Roles : short { - Name, + NegatedText = Qt::DisplayRole, + Details = Qt::ToolTipRole, + Name = Qt::UserRole, Satisfied, Mandatory, - Details, - NegatedText, HasDetails }; // No Q_ENUM because these are exposed through roleNames() From 217e4ab4f7ec21c4acf71d6700f87984fe10cbab Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 16:36:18 +0200 Subject: [PATCH 127/160] [welcome] Start improving the tooltips for missing requirements --- src/modules/welcome/checker/GeneralRequirements.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index 7780b8753..5f0124ef6 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -145,6 +145,7 @@ GeneralRequirements::checkRequirements() << TR( "hasInternet", hasInternet ) << TR( "isRoot", isRoot ); // clang-format on + Calamares::RequirementsList checkEntries; foreach ( const QString& entry, m_entriesToCheck ) { @@ -154,7 +155,11 @@ GeneralRequirements::checkRequirements() checkEntries.append( { entry, [ req = m_requiredStorageGiB ] - { return tr( "has at least %1 GiB available drive space" ).arg( req ); }, + { + return tr( "Please ensure the system has at least %1 GiB available drive space." ).arg( req ) + + QStringLiteral( "

" ) + + tr( "Available drive space is all of the hard disks and SSDs connected to the system." ); + }, [ req = m_requiredStorageGiB ] { return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); }, enoughStorage, From 47016765b3d63afac80b2220cb78b2ff0a42db8c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 20 Apr 2022 17:01:25 +0200 Subject: [PATCH 128/160] [welcome] Fill backgrounds of failed requirements --- src/modules/welcome/checker/ResultDelegate.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/welcome/checker/ResultDelegate.cpp b/src/modules/welcome/checker/ResultDelegate.cpp index 60f67849a..420ece812 100644 --- a/src/modules/welcome/checker/ResultDelegate.cpp +++ b/src/modules/welcome/checker/ResultDelegate.cpp @@ -36,15 +36,24 @@ paintRequirement( QPainter* painter, const QStyleOptionViewItem& option, const Q CalamaresUtils::ImageType statusImage = CalamaresUtils::StatusOk; painter->setPen( QColorConstants::Black ); - if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() ) {} + if ( index.data( Calamares::RequirementsModel::Satisfied ).toBool() ) + { + painter->fillRect( textRect, option.palette.window().color() ); + } else { if ( index.data( Calamares::RequirementsModel::Mandatory ).toBool() ) { + QColor bgColor = option.palette.window().color(); + bgColor.setHsv( 0, 64, bgColor.value() ); + painter->fillRect( option.rect, bgColor ); statusImage = CalamaresUtils::StatusError; } else { + QColor bgColor = option.palette.window().color(); + bgColor.setHsv( 60, 64, bgColor.value() ); + painter->fillRect( option.rect, bgColor ); statusImage = CalamaresUtils::StatusWarning; } } From a3bd0d809128d9247fad2416a84da365f6f854a0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 22 Apr 2022 12:46:19 +0200 Subject: [PATCH 129/160] Docs: update GS key overviews --- src/branding/README.md | 19 +++++++++++++++++++ src/modules/README.md | 40 +++++++++++++++++++++++++++------------- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/branding/README.md b/src/branding/README.md index 234b2a9b1..318e2b6d9 100644 --- a/src/branding/README.md +++ b/src/branding/README.md @@ -204,3 +204,22 @@ Adding the subdirectory can be done as follows: to `.qm` files before being installed. The CMake macro's do this automatically. For manual packaging, use `lrelease` to compile the files. + +## Global Storage keys + +The following keys from the `branding.desc` file are copied into +Global Storage under a *branding* parent key: + "productName", + "version", + "shortVersion", + "versionedName", + "shortVersionedName", + "shortProductName", + "bootloaderEntryName", + "productUrl", + "supportUrl", + "knownIssuesUrl", + "releaseNotesUrl", + "donateUrl" + + diff --git a/src/modules/README.md b/src/modules/README.md index e5bd2e7b6..e654177c7 100644 --- a/src/modules/README.md +++ b/src/modules/README.md @@ -180,26 +180,40 @@ it is possible to take the whole installation-process into account for determining the relative weights there. -## Global storage keys +## Global Storage keys -Some modules place values in global storage so that they can be referenced later by other modules or even other parts of the same module. The following table represents a partial list of the values available as well as where they originate from and which module consume them. +Some modules place values in Global Storage so that they can be referenced later by other modules or even other parts of the same module. The following table represents a partial list of the values available as well as where they originate from and which module consume them. +Keys whose name is followed by a `+` are **structured** data, and have +entries (which start with `+`) below the parent key describing subkeys. +Some structured keys refer to other documentation sources. -Key |Source |Consumers|Description -------------------|----------------|---|--- -btrfsSubvolumes |mount |fstab|List of maps containing the mountpoint and btrtfs subvolume +Key |Source |Consumers |Description +------------------|----------------|---------------|--- +bootloader + |partition | |Bootloader location +\+ installPath | | |Device (e.g. `/dev/sda`) where the bootloader is installed +branding + | | |See `src/branding/README.md` +btrfsSubvolumes |mount |fstab |List of maps containing the mountpoint and btrtfs subvolume btrfsRootSubvolume|mount |bootloader, luksopenswaphook|String containing the subvolume mounted at root efiSystemPartition|partition |bootloader, fstab|String containing the path to the ESP relative to the installed system extraMounts |mount |unpackfs|List of maps holding metadata for the temporary mountpoints used by the installer -fullname |users ||The full username (e.g. "Jane Q. Public") -hostname |users ||A string containing the hostname of the new system -netinstallAdd |packagechooser |netinstall|Data to add to netinstall tree. Same format as netinstall.yaml -netinstallSelect |packagechooser |netinstall|List of group names to select in the netinstall tree -partitions |partition, rawfs|numerous modules|List of maps of metadata about each partition -rootMountPoint |mount |numerous modules|A string with the absolute path to the root mountpoint +fullname |users | |The full username (e.g. "Jane Q. Public") +hostname |users | |A string containing the hostname of the new system +netinstallAdd |packagechooser |netinstall |Data to add to netinstall tree. Same format as netinstall.yaml +netinstallSelect |packagechooser |netinstall |List of group names to select in the netinstall tree +packageOperations +|packagechooser, netinstall|packages|Operations to perform +\+ (list data) | | |See `packages.conf` +partitions + |partition, rawfs|(many) |List of maps of metadata about each partition +\+ device | | |path to the partition device +\+ fs | | |the name of the file system +\+ mountPoint | | |where the device should be mounted +\+ uuid | | |the UUID of the partition device +rootMountPoint |mount |(many) |A string with the absolute path to the root mountpoint username |users |networkcfg, plasmainf, preservefiles|A string containing the username of the new user zfsDatasets |zfs |bootloader, grubcfg, mount|List of maps of zfs datasets including the name and mount information -zfsInfo |partition |mount, zfs|List of encrypted zfs partitions and the encription info -zfsPoolInfo |zfs |mount, umount|List of maps of zfs pool info including the name and mountpoint +zfsInfo |partition |mount, zfs |List of encrypted zfs partitions and the encription info +zfsPoolInfo |zfs |mount, umount |List of maps of zfs pool info including the name and mountpoint + + ## C++ modules From eb5be9cd34dd9605404cb6cb0cff990356af3cbe Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 11:11:40 +0200 Subject: [PATCH 130/160] [bootloader] Allow skipping an EFI bootloader, too - while here, remove C-style if() --- src/modules/bootloader/main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/bootloader/main.py b/src/modules/bootloader/main.py index fb8e19ac2..814da37f3 100644 --- a/src/modules/bootloader/main.py +++ b/src/modules/bootloader/main.py @@ -761,8 +761,12 @@ def run(): fw_type = libcalamares.globalstorage.value("firmwareType") - if (libcalamares.globalstorage.value("bootLoader") is None and fw_type != "efi"): - libcalamares.utils.warning( "Non-EFI system, and no bootloader is set." ) + if libcalamares.globalstorage.value("bootLoader") is None: + # Don't want a bootloader, but do log that this has an effect: + if fw_type != "efi": + libcalamares.utils.warning( "Non-EFI system, and no bootloader is set." ) + else: + libcalamares.utils.warning( "EFI system, and no bootloader is set." ) return None partitions = libcalamares.globalstorage.value("partitions") From d70d1ebfcd5f46c48a6f41c938755d2453a3927a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 11:23:04 +0200 Subject: [PATCH 131/160] [partition] Always offer a 'no bootloader' item - this branch is importing parts of a PR from Anubhav, so add relevant SPDX tag as well. --- src/modules/partition/core/BootLoaderModel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/partition/core/BootLoaderModel.cpp b/src/modules/partition/core/BootLoaderModel.cpp index fd66c8514..f659fc593 100644 --- a/src/modules/partition/core/BootLoaderModel.cpp +++ b/src/modules/partition/core/BootLoaderModel.cpp @@ -3,6 +3,7 @@ * SPDX-FileCopyrightText: 2014 Aurélien Gâteau * SPDX-FileCopyrightText: 2015 Teo Mrnjavac * SPDX-FileCopyrightText: 2019 Adriaan de Groot + * SPDX-FileCopyrightText: 2021 Anubhav Choudhary * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -79,7 +80,7 @@ BootLoaderModel::updateInternal() clear(); createMbrItems(); - // An empty model is possible if you don't havee permissions: don't crash though. + // An empty model is possible if you don't have permissions: don't crash though. if ( rowCount() < 1 ) { return; @@ -124,10 +125,10 @@ BootLoaderModel::updateInternal() { appendRow( createBootLoaderItem( partitionText, PartitionInfo::mountPoint( partition ), true ) ); } - - // Create "don't install bootloader" item - appendRow( createBootLoaderItem( tr( "Do not install a boot loader" ), QString(), false ) ); } + // Create "don't install bootloader" item. This is always available, + // also if there was no /boot or / partition found. + appendRow( createBootLoaderItem( tr( "Do not install a boot loader" ), QString(), false ) ); } From d02afa20b8a66f5879818974e2d29792f149a68c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 12:14:00 +0200 Subject: [PATCH 132/160] [partition] Factor out creating-bootloader-panel - this makes createBootloaderComboBox obsolete, since that was an implementation detail for creating the panel. - add the panel also when doing an alongside install. - credits to Anubhav, whose PR started this code. --- src/modules/partition/gui/ChoicePage.cpp | 151 ++++++++++++----------- src/modules/partition/gui/ChoicePage.h | 7 +- 2 files changed, 83 insertions(+), 75 deletions(-) diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index c0845da7f..a7299e715 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -3,6 +3,7 @@ * SPDX-FileCopyrightText: 2014-2017 Teo Mrnjavac * SPDX-FileCopyrightText: 2017-2019 Adriaan de Groot * SPDX-FileCopyrightText: 2019 Collabora Ltd + * SPDX-FileCopyrightText: 2021 Anubhav Choudhary * SPDX-License-Identifier: GPL-3.0-or-later * * Calamares is Free Software: see the License-Identifier above. @@ -1023,6 +1024,12 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice ) QLabel* sizeLabel = new QLabel( m_previewAfterFrame ); layout->addWidget( sizeLabel ); sizeLabel->setWordWrap( true ); + + if ( !m_isEfi ) + { + layout->addWidget( createBootloaderPanel() ); + } + connect( m_afterPartitionSplitterWidget, &PartitionSplitterWidget::partitionResized, this, @@ -1081,51 +1088,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice ) if ( !m_isEfi ) { - QWidget* eraseWidget = new QWidget; - - QHBoxLayout* eraseLayout = new QHBoxLayout; - eraseWidget->setLayout( eraseLayout ); - eraseLayout->setContentsMargins( 0, 0, 0, 0 ); - QLabel* eraseBootloaderLabel = new QLabel( eraseWidget ); - eraseLayout->addWidget( eraseBootloaderLabel ); - eraseBootloaderLabel->setText( tr( "Boot loader location:" ) ); - - m_bootloaderComboBox = createBootloaderComboBox( eraseWidget ); - connect( m_core->bootLoaderModel(), - &QAbstractItemModel::modelReset, - [ this ]() - { - if ( !m_bootloaderComboBox.isNull() ) - { - Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, - m_core->bootLoaderInstallPath() ); - } - } ); - connect( - m_core, - &PartitionCoreModule::deviceReverted, - this, - [ this ]( Device* dev ) - { - Q_UNUSED( dev ) - if ( !m_bootloaderComboBox.isNull() ) - { - if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() ) - { - m_bootloaderComboBox->setModel( m_core->bootLoaderModel() ); - } - - m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); - } - }, - Qt::QueuedConnection ); - // ^ Must be Queued so it's sure to run when the widget is already visible. - - eraseLayout->addWidget( m_bootloaderComboBox ); - eraseBootloaderLabel->setBuddy( m_bootloaderComboBox ); - eraseLayout->addStretch(); - - layout->addWidget( eraseWidget ); + layout->addWidget( createBootloaderPanel() ); } m_previewAfterFrame->show(); @@ -1237,35 +1200,6 @@ ChoicePage::setupEfiSystemPartitionSelector() } } - -QComboBox* -ChoicePage::createBootloaderComboBox( QWidget* parent ) -{ - QComboBox* comboForBootloader = new QComboBox( parent ); - comboForBootloader->setModel( m_core->bootLoaderModel() ); - - // When the chosen bootloader device changes, we update the choice in the PCM - connect( comboForBootloader, - QOverload< int >::of( &QComboBox::currentIndexChanged ), - this, - [ this ]( int newIndex ) - { - QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() ); - if ( bootloaderCombo ) - { - QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole ); - if ( !var.isValid() ) - { - return; - } - m_core->setBootLoaderInstallPath( var.toString() ); - } - } ); - - return comboForBootloader; -} - - static inline void force_uncheck( QButtonGroup* grp, PrettyRadioButton* button ) { @@ -1737,3 +1671,72 @@ ChoicePage::setLastSelectedDeviceIndex( int index ) m_lastSelectedDeviceIndex = index; m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex ); } + +QWidget* +ChoicePage::createBootloaderPanel() +{ + QWidget* panelWidget = new QWidget; + + QHBoxLayout* mainLayout = new QHBoxLayout; + panelWidget->setLayout( mainLayout ); + mainLayout->setContentsMargins( 0, 0, 0, 0 ); + QLabel* widgetLabel = new QLabel( panelWidget ); + mainLayout->addWidget( widgetLabel ); + widgetLabel->setText( tr( "Boot loader location:" ) ); + + QComboBox* comboForBootloader = new QComboBox( panelWidget ); + comboForBootloader->setModel( m_core->bootLoaderModel() ); + + // When the chosen bootloader device changes, we update the choice in the PCM + connect( comboForBootloader, + QOverload< int >::of( &QComboBox::currentIndexChanged ), + this, + [ this ]( int newIndex ) + { + QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() ); + if ( bootloaderCombo ) + { + QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole ); + if ( !var.isValid() ) + { + return; + } + m_core->setBootLoaderInstallPath( var.toString() ); + } + } ); + m_bootloaderComboBox = comboForBootloader; + + connect( m_core->bootLoaderModel(), + &QAbstractItemModel::modelReset, + [ this ]() + { + if ( !m_bootloaderComboBox.isNull() ) + { + Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() ); + } + } ); + connect( + m_core, + &PartitionCoreModule::deviceReverted, + this, + [ this ]( Device* ) + { + if ( !m_bootloaderComboBox.isNull() ) + { + if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() ) + { + m_bootloaderComboBox->setModel( m_core->bootLoaderModel() ); + } + + m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); + } + }, + Qt::QueuedConnection ); + // ^ Must be Queued so it's sure to run when the widget is already visible. + + mainLayout->addWidget( m_bootloaderComboBox ); + widgetLabel->setBuddy( m_bootloaderComboBox ); + mainLayout->addStretch(); + + return panelWidget; +} diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index 12222ac63..d1699200a 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -108,7 +108,12 @@ private: void updateNextEnabled(); void setupChoices(); void checkInstallChoiceRadioButton( Config::InstallChoice choice ); ///< Sets the chosen button to "on" - QComboBox* createBootloaderComboBox( QWidget* parentButton ); + /** @brief Create a panel with "boot loader location:" + * + * Panel + dropdown and handling for model updates. Returns a pointer + * to the panel's widget. + */ + QWidget* createBootloaderPanel(); Device* selectedDevice(); /* Change the UI depending on the device selected. */ From ab0a33ceae89e6f541c3f544dea1032e3c77e50f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 14:01:02 +0200 Subject: [PATCH 133/160] Changes: credits for faux-merged PR --- CHANGES-3.3 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index d8c3b2e9b..0cc89c4b4 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -10,6 +10,7 @@ the history of the 3.2 series (2018-05 - 2021-12). # 3.3.0 (unreleased) # This release contains contributions from (alphabetically by first name): + - Anubhav Choudhary - Evan James - Vitor Lopes @@ -48,4 +49,6 @@ in the *Modules* heading, below. - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. Please update configurations. - *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later). + - *partition* can now skip installing the bootloader in more scenarios. + #1632 (Thanks Anubhav) From 62de4eb8bfd0c68b9f7aea1f6ab51409d613de4f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 14:36:16 +0200 Subject: [PATCH 134/160] CMake: use modern FindPython and FindBoost --- CMakeLists.txt | 36 ++++-------- CMakeModules/BoostPython3.cmake | 97 --------------------------------- 2 files changed, 10 insertions(+), 123 deletions(-) delete mode 100644 CMakeModules/BoostPython3.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f43d4d0a..e4ebcc00b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,7 +155,7 @@ set(QT_VERSION 5.15.0) set(YAMLCPP_VERSION 0.5.1) set(ECM_VERSION 5.18) set(PYTHONLIBS_VERSION 3.6) -set(BOOSTPYTHON_VERSION 1.67.0) +set(BOOSTPYTHON_VERSION 1.72.0) ### CMAKE SETUP # @@ -343,18 +343,17 @@ if(NOT KF5Crash_FOUND) set(BUILD_KF5Crash OFF) endif() -# TODO:3.3: Use FindPython3 instead -find_package(PythonInterp ${PYTHONLIBS_VERSION}) +find_package(Python ${PYTHONLIBS_VERSION} COMPONENTS Interpreter Development) set_package_properties( - PythonInterp + Python PROPERTIES - DESCRIPTION "Python 3 interpreter." + DESCRIPTION "Python3 interpreter." URL "https://python.org" - PURPOSE "Python 3 interpreter for certain tests." + PURPOSE "Python3 interpreter for certain tests." ) set(_schema_explanation "") -if(PYTHONINTERP_FOUND) +if(Python_Interpreter_FOUND) if(BUILD_SCHEMA_TESTING) # The configuration validator script has some dependencies, # and if they are not installed, don't run. If errors out @@ -363,7 +362,7 @@ if(PYTHONINTERP_FOUND) set(_validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT}) else() exec_program( - ${PYTHON_EXECUTABLE} + Python::Interpreter ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x @@ -388,27 +387,12 @@ else() endif() add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") -find_package(PythonLibs ${PYTHONLIBS_VERSION}) -set_package_properties( - PythonLibs - PROPERTIES - DESCRIPTION "C interface libraries for the Python 3 interpreter." - URL "https://python.org" - PURPOSE "Python 3 is used for Python job modules." -) - -if(PYTHONLIBS_FOUND) - # TODO:3.3: Require Boost + CMake; sort out Boost::Python - # Since Boost provides CMake config files (starting with Boost 1.70. - # or so) the mess that is the Calamares find code picks the wrong - # bits. Suppress those CMake config files, as suggested by @jmrcpn - set(Boost_NO_BOOST_CMAKE ON) - include(BoostPython3) - find_boost_python3( ${BOOSTPYTHON_VERSION} ${PYTHONLIBS_VERSION_STRING} CALAMARES_BOOST_PYTHON3_FOUND ) +if(Python_Development_FOUND) + find_package( Boost ${BOOSTPYTHON_VERSION} COMPONENTS python ) set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") endif() -if(NOT PYTHONLIBS_FOUND OR NOT CALAMARES_BOOST_PYTHON3_FOUND) +if(NOT Python_Development_FOUND OR NOT Boost_FOUND) message(STATUS "Disabling Boost::Python modules") set(WITH_PYTHON OFF) endif() diff --git a/CMakeModules/BoostPython3.cmake b/CMakeModules/BoostPython3.cmake deleted file mode 100644 index bd1d24e0e..000000000 --- a/CMakeModules/BoostPython3.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# === This file is part of Calamares - === -# -# SPDX-FileCopyrightText: 2014 Aurélien Gâteau -# SPDX-FileCopyrightText: 2017 Adriaan de Groot -# SPDX-FileCopyrightText: 2019 Kevin Kofler -# SPDX-License-Identifier: BSD-2-Clause -# -### -# -# Handles the mess that Boost::Python is before CMake 3.16 and -# Boost 1.70 or so. -# -### -# -# On Ubuntu 14.04, the libboost-python1.54-dev package comes with one library -# for each Python version: -# libboost_python-py27.so -# libboost_python-py33.so -# libboost_python-py34.so -# -# Boost upstream however installs Boost.Python3 libboost_python3.so, which is -# what FindBoost.cmake is looking for. It looks for a library named -# "libboost_${component}.so". -# -# On Gentoo instead, the >=dev-libs/boost-1.54 package provides boost library -# with a name like: -# libboost_python-2.7.so -# libboost_python-3.3.so -# libboost_python-3.4.so -# depending on what python's targets you selected during install -# -# On Fedora >= 30 instead, the boost-python3-devel provides boost library with a -# name like: -# libboost_python37.so -# depending on what python's targets you selected during install -# -# find_boost_python3() tries to find the package with different component -# names. By default it tries "python3", "python-py$suffix" and -# "python-$dotsuffix", where suffix is based on the `python_version` argument. -# One can supply a custom component name by setting the -# `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time. -set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING - "Name of the Boost.Python component. If Boost.Python is installed as - libboost_python-foo.so then this variable should be set to 'python-foo'." -) - -include(FindPackageHandleStandardArgs) - -macro( _find_boost_python3_int boost_version componentname found_var ) - foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} ${componentname} ) - find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} ) - string( TOUPPER ${_fbp_name} _fbp_uc_name ) - if( Boost_${_fbp_uc_name}_FOUND ) - if( CMAKE_SYSTEM_NAME MATCHES "FreeBSD" ) - # No upcasing - set( ${found_var} ${_fbp_name} ) - else() - set( ${found_var} ${_fbp_uc_name} ) - endif() - break() - endif() - endforeach() -endmacro() - -macro( find_boost_python3 boost_version python_version found_var ) - set( ${found_var} OFF ) - set( _fbp_found OFF ) - - # turns "3.4.123abc" into "34" - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1\\2" _fbp_python_short_version ${python_version} ) - _find_boost_python3_int( ${boost_version} python-py${_fbp_python_short_version} _fbp_found ) - - if (NOT _fbp_found) - _find_boost_python3_int( ${boost_version} python${_fbp_python_short_version} _fbp_found ) - endif() - - if (NOT _fbp_found) - # The following loop changes the searched name for Gentoo based distributions - # turns "3.4.123abc" into "3.4" - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} ) - _find_boost_python3_int( ${boost_version} python-${_fbp_python_short_version} _fbp_found ) - endif() - - set( ${found_var} ${_fbp_found} ) - - # This is superfluous, but allows proper reporting in the features list - if ( _fbp_found ) - find_package( Boost ${boost_version} COMPONENTS ${_fbp_found} ) - else() - find_package( Boost ${boost_version} COMPONENTS Python ) - endif() - set_package_properties( - Boost PROPERTIES - DESCRIPTION "A C++ library which enables seamless interoperability between C++ and Python 3." - URL "http://www.boost.org" - ) -endmacro() From 585d06494ec41ad503f18c2b225bd03bedafe6dc Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 14:47:18 +0200 Subject: [PATCH 135/160] CMake: fix linking with modern Python and Boost --- src/libcalamares/CMakeLists.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 2baa3366a..dbc8816ee 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -88,14 +88,7 @@ endif() # if(WITH_PYTHON) list(APPEND libSources PythonHelper.cpp PythonJob.cpp PythonJobApi.cpp) - - include_directories(${PYTHON_INCLUDE_DIRS}) - link_directories(${PYTHON_LIBRARIES}) - - include_directories(${Boost_INCLUDE_DIRS}) - link_directories(${Boost_LIBRARY_DIRS}) - - list(APPEND OPTIONAL_PRIVATE_LIBRARIES ${PYTHON_LIBRARIES} ${Boost_LIBRARIES}) + list(APPEND OPTIONAL_PRIVATE_LIBRARIES Python::Python Boost::python) endif() ### OPTIONAL GeoIP XML support From 5e80dddc82741116c30915c334665ba6f3322ed8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 14:53:26 +0200 Subject: [PATCH 136/160] CMake: resolve another TODO - update translations - apply gersemi formatting - move HOMEPAGE_URL --- CMakeLists.txt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ebcc00b..e5133415d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if(CMAKE_SCRIPT_MODE_FILE) return() endif() -project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX) +project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX HOMEPAGE_URL "https://calamares.io/") if(CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "Do not build development versions in the source-directory.") @@ -139,10 +139,10 @@ set(CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framew # `txstats.py -e`. See also # # Total 74 languages -set( _tx_complete az az_AZ ca es fi_FI he hi hr ja lt pt_BR pt_PT - sq sv uk zh_TW ) -set( _tx_good as be ca@valencia cs_CZ da de fa fr fur it_IT ko ml - nl ru si sk tg tr_TR vi zh_CN ) +set( _tx_complete az az_AZ ca es fi_FI he hi hr ja ko lt pt_BR + pt_PT sq sv tr_TR uk zh_TW ) +set( _tx_good as be ca@valencia cs_CZ da de fa fr fur it_IT ml nl + ru si sk tg vi zh_CN ) set( _tx_ok ar ast bg bn el en_GB es_MX et eu gl hu id is mr nb oc pl ro sl sr sr@latin th ) set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP @@ -388,7 +388,7 @@ endif() add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") if(Python_Development_FOUND) - find_package( Boost ${BOOSTPYTHON_VERSION} COMPONENTS python ) + find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python) set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") endif() @@ -644,13 +644,11 @@ feature_summary( # # Note: most distro's will do distro-specific packaging rather than # using CPack, and this duplicates information in the AppStream, too. -# TODO:3.3 With newer CMake, move HOMEPAGE_URL to the project()call set(CPACK_PACKAGE_VENDOR calamares) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A Linux system installer") set(CPACK_PACKAGE_DESCRIPTION "Calamares is a Linux system installer, intended for Linux distributions to use on their ISOs and other bootable media to install the distribution to the end-user's computer. Calamares can also be used as an OEM configuration tool. It is modular, extensible and highly-configurable for Linux distributions from all five major Linux families." ) -set(CPACK_PACKAGE_HOMEPAGE_URL "https://calamares.io") set(CPACK_PACKAGE_ICON "data/images/squid.png") include(CPack) From 53926b8bbec10cb229fb229e4ff4d6a129102d70 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 15:00:52 +0200 Subject: [PATCH 137/160] i18n: make language-updater more resilient --- CMakeLists.txt | 1 + ci/txstats.py | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5133415d..3ecdb0b66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,6 +147,7 @@ set( _tx_ok ar ast bg bn el en_GB es_MX et eu gl hu id is mr nb oc pl ro sl sr sr@latin th ) set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP ta_IN te ur zh zh_HK ) +# Total 74 languages ### Required versions # diff --git a/ci/txstats.py b/ci/txstats.py index 69a34f89e..696a4b828 100755 --- a/ci/txstats.py +++ b/ci/txstats.py @@ -97,10 +97,12 @@ class EditingOutputter(object): lines = f.readlines() mark = None + mark_text = None for l in lines: # Note that we didn't strip the lines, so need the \n here if l.startswith("# Total ") and l.endswith(" languages\n"): mark = lines.index(l) + mark_text = l break if mark is None: raise TXError("No CMakeLists.txt lines for TX stats found") @@ -108,18 +110,17 @@ class EditingOutputter(object): nextmark = mark + 1 for l in lines[mark+1:]: - if l.startswith("set( _tx_"): - nextmark += 1 - continue - if l.startswith(" "): - nextmark += 1 - continue - break - if nextmark > mark + 12 or nextmark > len(lines) - 4: + nextmark += 1 + if l.startswith(mark_text): + break + if nextmark > mark + 100 or nextmark > len(lines) - 4: # Try to catch runaway nextmarks: we know there should # be four set-lines, which are unlikely to be 3 lines each; # similarly the CMakeLists.txt is supposed to end with # some boilerplate. + # + # However, gersemi will reformat to one-language-per-line, + # so we can get really long sections, that's why we use 100 as a limit. raise TXError("Could not find end of TX settings in CMakeLists.txt") self.post_lines = lines[nextmark:] @@ -185,7 +186,8 @@ def get_tx_stats(languages, outputter, verbose): ) all_langs = [] - outputter.print("# Total %d languages" % len(languages)) + mark_text = "# Total %d languages" % len(languages) + outputter.print(mark_text) for lang_name in languages: stats = languages[lang_name]["translated"]["percentage"] # Make the by-definition-incomplete languages have a percentage @@ -202,6 +204,7 @@ def get_tx_stats(languages, outputter, verbose): output_langs(all_langs, outputter, "good", lambda s : 1.0 > s >= 0.75) output_langs(all_langs, outputter, "ok", lambda s : 0.75 > s >= 0.05) output_langs(all_langs, outputter, "incomplete", lambda s : 0.05 > s) + outputter.print(mark_text) # Audit the languages that are in TX, mapped to git for lang_name in languages: From d7459e2bfeba7fa0b88823b532d815fb7af04be8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 15:23:27 +0200 Subject: [PATCH 138/160] CMake: modernize optional parts of libcalamares --- src/libcalamares/CMakeLists.txt | 88 ++++++++++++++------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index dbc8816ee..70996c331 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -17,10 +17,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h) -set(OPTIONAL_PRIVATE_LIBRARIES "") -set(OPTIONAL_PUBLIC_LIBRARIES "") - -set(libSources +add_library( + calamares + SHARED CppJob.cpp GlobalStorage.cpp Job.cpp @@ -75,20 +74,29 @@ set(libSources utils/Yaml.cpp ) +set_target_properties( + calamares + PROPERTIES + VERSION ${CALAMARES_VERSION_SHORT} + SOVERSION ${CALAMARES_VERSION_SHORT} + INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares +) +target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons) + ### OPTIONAL Automount support (requires dbus) # # if(Qt5DBus_FOUND) - list(APPEND libSources partition/AutoMount.cpp) - list(APPEND OPTIONAL_PRIVATE_LIBRARIES Qt5::DBus) + target_sources(calamares PRIVATE partition/AutoMount.cpp) + target_link_libraries(calamares PRIVATE Qt5::DBus) endif() ### OPTIONAL Python support # # if(WITH_PYTHON) - list(APPEND libSources PythonHelper.cpp PythonJob.cpp PythonJobApi.cpp) - list(APPEND OPTIONAL_PRIVATE_LIBRARIES Python::Python Boost::python) + target_sources(calamares PRIVATE PythonHelper.cpp PythonJob.cpp PythonJobApi.cpp) + target_link_libraries(calamares PRIVATE Python::Python Boost::python) endif() ### OPTIONAL GeoIP XML support @@ -96,8 +104,8 @@ endif() # find_package(Qt5 COMPONENTS Xml) if(Qt5Xml_FOUND) - list(APPEND libSources geoip/GeoIPXML.cpp) - list(APPEND OPTIONAL_PUBLIC_LIBRARIES Qt5::Network Qt5::Xml) + target_sources(calamares PRIVATE geoip/GeoIPXML.cpp) + target_link_libraries(calamares PRIVATE Qt5::Network Qt5::Xml) endif() ### OPTIONAL KPMcore support @@ -113,36 +121,21 @@ if(KPMcore_FOUND) add_definitions(-D${d}) endforeach() include_directories(${KPMCORE_INCLUDE_DIR}) - list( - APPEND - libSources - partition/FileSystem.cpp - partition/KPMManager.cpp - partition/PartitionIterator.cpp - partition/PartitionQuery.cpp + target_sources( + calamares + PRIVATE + partition/FileSystem.cpp + partition/KPMManager.cpp + partition/PartitionIterator.cpp + partition/PartitionQuery.cpp ) - list(APPEND OPTIONAL_PRIVATE_LIBRARIES kpmcore) + target_link_libraries(calamares PRIVATE kpmcore) endif() ### LIBRARY # # -add_library(calamares SHARED ${libSources}) -set_target_properties( - calamares - PROPERTIES - VERSION ${CALAMARES_VERSION_SHORT} - SOVERSION ${CALAMARES_VERSION_SHORT} - INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares -) calamares_automoc( calamares ) - -target_link_libraries( - calamares - LINK_PRIVATE ${OPTIONAL_PRIVATE_LIBRARIES} - LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons ${OPTIONAL_PUBLIC_LIBRARIES} -) - add_library(Calamares::calamares ALIAS calamares) ### Installation @@ -181,13 +174,9 @@ foreach(subdir geoip locale modulesystem network partition utils) install(FILES ${subdir_headers} DESTINATION include/libcalamares/${subdir}) endforeach() -### TESTING +### TRANSLATION TESTING # -# -calamares_add_test(libcalamarestest SOURCES Tests.cpp) - -calamares_add_test(libcalamaresgeoiptest SOURCES geoip/GeoIPTests.cpp ${geoip_src}) - +# This is a support function, used just once, to help out the localetest function(calamares_qrc_translations basename) set(NAME ${ARGV0}) set(options "") @@ -238,6 +227,14 @@ function(calamares_qrc_translations basename) endfunction() calamares_qrc_translations( localetest OUTPUT_VARIABLE localetest_qrc SUBDIRECTORY testdata LANGUAGES nl ) + +### TESTING +# +# +calamares_add_test(libcalamarestest SOURCES Tests.cpp) + +calamares_add_test(libcalamaresgeoiptest SOURCES geoip/GeoIPTests.cpp ${geoip_src}) + calamares_add_test(libcalamareslocaletest SOURCES locale/Tests.cpp ${localetest_qrc}) calamares_add_test(libcalamaresmodulesystemtest SOURCES modulesystem/Tests.cpp) @@ -246,18 +243,9 @@ calamares_add_test(libcalamaresnetworktest SOURCES network/Tests.cpp) calamares_add_test(libcalamarespackagestest SOURCES packages/Tests.cpp) -calamares_add_test( - libcalamarespartitiontest - SOURCES partition/Global.cpp partition/Tests.cpp - LIBRARIES ${OPTIONAL_PRIVATE_LIBRARIES} -) - if(KPMcore_FOUND) - calamares_add_test( - libcalamarespartitionkpmtest - SOURCES partition/KPMTests.cpp - LIBRARIES ${OPTIONAL_PRIVATE_LIBRARIES} - ) + calamares_add_test(libcalamarespartitiontest SOURCES partition/Global.cpp partition/Tests.cpp LIBRARIES kpmcore) + calamares_add_test(libcalamarespartitionkpmtest SOURCES partition/KPMTests.cpp LIBRARIES kpmcore) endif() calamares_add_test(libcalamaresutilstest SOURCES utils/Tests.cpp utils/Runner.cpp) From eefe65ad0e7eeefae1fcffa90b82737b55e7f35d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 25 Apr 2022 15:34:39 +0200 Subject: [PATCH 139/160] CMake: chase changed linking in libcalamares --- src/modules/netinstall/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/netinstall/CMakeLists.txt b/src/modules/netinstall/CMakeLists.txt index d50eab7b2..cfbd854c2 100644 --- a/src/modules/netinstall/CMakeLists.txt +++ b/src/modules/netinstall/CMakeLists.txt @@ -24,6 +24,6 @@ if(KF5CoreAddons_FOUND) calamares_add_test( netinstalltest SOURCES Tests.cpp Config.cpp LoaderQueue.cpp PackageTreeItem.cpp PackageModel.cpp - LIBRARIES Qt5::Gui KF5::CoreAddons + LIBRARIES Qt5::Gui Qt5::Network KF5::CoreAddons ) endif() From 992d2d3be0624be17025cab7b96d1d636da1b28e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 00:23:24 +0200 Subject: [PATCH 140/160] [displaymanager] kdm is no longer relevant --- CHANGES-3.3 | 1 + .../displaymanager/displaymanager.conf | 1 - .../displaymanager/displaymanager.schema.yaml | 2 +- src/modules/displaymanager/main.py | 78 ------------------- 4 files changed, 2 insertions(+), 80 deletions(-) diff --git a/CHANGES-3.3 b/CHANGES-3.3 index 0cc89c4b4..9debfc8d8 100644 --- a/CHANGES-3.3 +++ b/CHANGES-3.3 @@ -46,6 +46,7 @@ in the *Modules* heading, below. ## Modules ## - *bootloader* now supports more options when building the kernel command-line. (Thanks Evan) + - *displaymanager* no longer supports the discontinued *kdm* display manager. - *grubcfg* changed the key *keepDistributor* to *keep_distributor*. Please update configurations. - *partition* requires KPMCore 21.12 (e.g. KPMCore 4.2 API, or later). diff --git a/src/modules/displaymanager/displaymanager.conf b/src/modules/displaymanager/displaymanager.conf index 0fd2af163..c5c0e0b78 100644 --- a/src/modules/displaymanager/displaymanager.conf +++ b/src/modules/displaymanager/displaymanager.conf @@ -22,7 +22,6 @@ displaymanagers: - gdm - mdm - lxdm - - kdm - greetd # Enable the following settings to force a desktop environment diff --git a/src/modules/displaymanager/displaymanager.schema.yaml b/src/modules/displaymanager/displaymanager.schema.yaml index 89d657a3b..7e4c5f54c 100644 --- a/src/modules/displaymanager/displaymanager.schema.yaml +++ b/src/modules/displaymanager/displaymanager.schema.yaml @@ -10,7 +10,7 @@ properties: type: array items: type: string - enum: [slim, sddm, lightdm, gdm, mdm, lxdm, kdm, greetd] + enum: [slim, sddm, lightdm, gdm, mdm, lxdm, greetd] minItems: 1 # Must be non-empty, if present at all defaultDesktopEnvironment: type: object diff --git a/src/modules/displaymanager/main.py b/src/modules/displaymanager/main.py index d77c0ab6c..969dc90c6 100644 --- a/src/modules/displaymanager/main.py +++ b/src/modules/displaymanager/main.py @@ -481,84 +481,6 @@ class DMgdm(DisplayManager): pass -class DMkdm(DisplayManager): - name = "kdm" - executable = "kdm" - - def set_autologin(self, username, do_autologin, default_desktop_environment): - # Systems with KDM as Desktop Manager - kdm_conf_path = os.path.join( - self.root_mount_point, "usr/share/config/kdm/kdmrc" - ) - # Check which path is in use: SUSE does something else. - # Also double-check the default setting. Pick the first - # one that exists in the target. - for candidate_kdmrc in ( - "usr/share/config/kdm/kdmrc", - "usr/share/kde4/config/kdm/kdmrc", - ): - p = os.path.join(self.root_mount_point, candidate_kdmrc) - if os.path.exists(p): - kdm_conf_path = p - break - text = [] - - if os.path.exists(kdm_conf_path): - with open(kdm_conf_path, 'r') as kdm_conf: - text = kdm_conf.readlines() - - with open(kdm_conf_path, 'w') as kdm_conf: - for line in text: - if 'AutoLoginEnable=' in line: - if do_autologin: - line = 'AutoLoginEnable=true\n' - else: - line = 'AutoLoginEnable=false\n' - - if do_autologin and 'AutoLoginUser=' in line: - line = "AutoLoginUser={!s}\n".format(username) - - kdm_conf.write(line) - else: - return ( - _("Cannot write KDM configuration file"), - _("KDM config file {!s} does not exist").format(kdm_conf_path) - ) - - def basic_setup(self): - if libcalamares.utils.target_env_call( - ['getent', 'group', 'kdm'] - ) != 0: - libcalamares.utils.target_env_call( - ['groupadd', '-g', '135', 'kdm'] - ) - - if libcalamares.utils.target_env_call( - ['getent', 'passwd', 'kdm'] - ) != 0: - libcalamares.utils.target_env_call( - ['useradd', - '-u', '135', - '-g', 'kdm', - '-d', '/var/lib/kdm', - '-s', '/bin/false', - '-r', - '-M', - 'kdm' - ] - ) - - libcalamares.utils.target_env_call( - ['chown', '-R', '135:135', 'var/lib/kdm'] - ) - - def desktop_environment_setup(self, desktop_environment): - pass - - def greeter_setup(self): - pass - - class DMlxdm(DisplayManager): name = "lxdm" executable = "lxdm" From a7d3630e42b7c001fc6a209a56e3baa7e25f575d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 00:51:50 +0200 Subject: [PATCH 141/160] [libcalamaresui] Improve naming, resolve TODO --- src/calamares/calamares-sidebar.qml | 6 +++--- src/calamares/progresstree/ProgressTreeDelegate.cpp | 4 ++-- src/libcalamaresui/Branding.h | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/calamares/calamares-sidebar.qml b/src/calamares/calamares-sidebar.qml index 5c94fb6b2..f57174553 100644 --- a/src/calamares/calamares-sidebar.qml +++ b/src/calamares/calamares-sidebar.qml @@ -46,12 +46,12 @@ Rectangle { Layout.fillWidth: true; height: 35; radius: 6; - color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarBackgroundSelected : Branding.SidebarBackground ); + color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarBackgroundCurrent : Branding.SidebarBackground ); Text { anchors.verticalCenter: parent.verticalCenter; anchors.horizontalCenter: parent.horizontalCenter; - color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarTextSelected : Branding.SidebarText ); + color: Branding.styleString( index == ViewManager.currentStepIndex ? Branding.SidebarTextCurrent : Branding.SidebarText ); text: display; } } @@ -77,7 +77,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter; x: parent.x + 4; text: qsTr("Show debug information") - color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextSelect : Branding.SidebarBackground ); + color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextCurrent : Branding.SidebarBackground ); font.pointSize : 9 } diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index 388f4508c..2117a28ae 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -36,9 +36,9 @@ paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QMod if ( index.row() == index.data( Calamares::ViewManager::ProgressTreeItemCurrentIndex ).toInt() ) { - painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextSelect ) ); + painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextCurrent ) ); QString textHighlight - = Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextHighlight ); + = Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackgroundCurrent ); if ( textHighlight.isEmpty() ) { painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().window() ); diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 1654b4d56..556f2fcff 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -76,10 +76,8 @@ public: { SidebarBackground, SidebarText, - SidebarTextSelect, - SidebarTextSelected = SidebarTextSelect, // TODO:3.3:Remove SidebarTextSelect - SidebarTextHighlight, - SidebarBackgroundSelected = SidebarTextHighlight // TODO:3.3:Remove SidebarTextHighlight + SidebarTextCurrent, + SidebarBackgroundCurrent, }; Q_ENUM( StyleEntry ) From 1c3817ad6565d2bfe806e0c5b6a0745c527dcdf8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 00:54:01 +0200 Subject: [PATCH 142/160] [welcome] Fix displayed (user-visible) copyright years --- src/modules/welcome/WelcomePage.cpp | 2 +- src/modules/welcomeq/about.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 3dfeb2d8e..9f991a53a 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -239,7 +239,7 @@ WelcomePage::showAboutBox() "%2
" "for %3


" "Copyright 2014-2017 Teo Mrnjavac <teo@kde.org>
" - "Copyright 2017-2020 Adriaan de Groot <groot@kde.org>
" + "Copyright 2017-2022 Adriaan de Groot <groot@kde.org>
" "Thanks to the Calamares team " "and the Calamares " "translators team.

" diff --git a/src/modules/welcomeq/about.qml b/src/modules/welcomeq/about.qml index 21050c4ea..0b5fef2fc 100644 --- a/src/modules/welcomeq/about.qml +++ b/src/modules/welcomeq/about.qml @@ -48,7 +48,7 @@ Item { %2
for %3


Copyright 2014-2017 Teo Mrnjavac <teo@kde.org>
- Copyright 2017-2020 Adriaan de Groot <groot@kde.org>
+ Copyright 2017-2022 Adriaan de Groot <groot@kde.org>
Thanks to the Calamares team and the Calamares translators team.

From f26ff07046968ad626c48b3b5b5b56a475733a4c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 11:24:56 +0200 Subject: [PATCH 143/160] [webview] Fix build Some QPainter enum values were deprecated in 5.14, and since we require 5.15 now, we hit some old code paths with now-deprecated values; this only shows up when actually enforcing deprecations. --- src/modules/webview/WebViewStep.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/webview/WebViewStep.cpp b/src/modules/webview/WebViewStep.cpp index 8e7c48f1a..d66c87f36 100644 --- a/src/modules/webview/WebViewStep.cpp +++ b/src/modules/webview/WebViewStep.cpp @@ -32,8 +32,7 @@ WebViewStep::WebViewStep( QObject* parent ) #ifdef WEBVIEW_WITH_WEBKIT m_view->settings()->setFontFamily( QWebSettings::StandardFont, m_view->settings()->fontFamily( QWebSettings::SansSerifFont ) ); - m_view->setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing - | QPainter::SmoothPixmapTransform | QPainter::NonCosmeticDefaultPen ); + m_view->setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform ); #endif } From a7cf1b18cedefa652822b828334feacb2316b162 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 11:31:25 +0200 Subject: [PATCH 144/160] [webview] reduce #defines --- src/modules/webview/WebViewStep.cpp | 2 +- src/modules/webview/WebViewStep.h | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/modules/webview/WebViewStep.cpp b/src/modules/webview/WebViewStep.cpp index d66c87f36..d787b8ec6 100644 --- a/src/modules/webview/WebViewStep.cpp +++ b/src/modules/webview/WebViewStep.cpp @@ -28,7 +28,7 @@ WebViewStep::WebViewStep( QObject* parent ) #ifdef WEBVIEW_WITH_WEBENGINE QtWebEngine::initialize(); #endif - m_view = new C_QWEBVIEW(); + m_view = new WebViewWidget(); #ifdef WEBVIEW_WITH_WEBKIT m_view->settings()->setFontFamily( QWebSettings::StandardFont, m_view->settings()->fontFamily( QWebSettings::SansSerifFont ) ); diff --git a/src/modules/webview/WebViewStep.h b/src/modules/webview/WebViewStep.h index 6fd71222e..700da2856 100644 --- a/src/modules/webview/WebViewStep.h +++ b/src/modules/webview/WebViewStep.h @@ -20,20 +20,21 @@ #include -#ifdef WEBVIEW_WITH_WEBKIT -#define C_QWEBVIEW QWebView -#endif -#ifdef WEBVIEW_WITH_WEBENGINE -#ifdef C_QWEBVIEW +#if defined( WEBVIEW_WITH_WEBKIT ) && defined( WEBVIEW_WITH_WEBENGINE ) #error Both WEBENGINE and WEBKIT enabled #endif -#define C_QWEBVIEW QWebEngineView -#endif -#ifndef C_QWEBVIEW +#if !defined( WEBVIEW_WITH_WEBKIT ) && !defined( WEBVIEW_WITH_WEBENGINE ) #error Neither WEBENGINE nor WEBKIT enabled #endif -class C_QWEBVIEW; +#ifdef WEBVIEW_WITH_WEBKIT +class QWebView; +using WebViewWidget = QWebView; +#endif +#ifdef WEBVIEW_WITH_WEBENGINE +class QWebEngineView; +using WebViewWidget = QWebEngineView; +#endif class PLUGINDLLEXPORT WebViewStep : public Calamares::ViewStep { @@ -60,7 +61,7 @@ public: void setConfigurationMap( const QVariantMap& configurationMap ) override; private: - C_QWEBVIEW* m_view; + WebViewWidget* m_view; QString m_url; QString m_prettyName; }; From 1f7b2a3d2d56cf9d462d69000d6f6bcead514711 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 11:38:42 +0200 Subject: [PATCH 145/160] [libcalamares] Remove CommandList destructor The destructor was just the default one, but declaring it blocks the default copy constructor. --- src/libcalamares/utils/CommandList.cpp | 2 -- src/libcalamares/utils/CommandList.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/libcalamares/utils/CommandList.cpp b/src/libcalamares/utils/CommandList.cpp index 6a743877a..7e1f42d22 100644 --- a/src/libcalamares/utils/CommandList.cpp +++ b/src/libcalamares/utils/CommandList.cpp @@ -150,8 +150,6 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch } } -CommandList::~CommandList() {} - Calamares::JobResult CommandList::run() { diff --git a/src/libcalamares/utils/CommandList.h b/src/libcalamares/utils/CommandList.h index 3135b9b3c..586b04ed3 100644 --- a/src/libcalamares/utils/CommandList.h +++ b/src/libcalamares/utils/CommandList.h @@ -85,7 +85,6 @@ public: /** @brief empty command-list with timeout to apply to entries. */ CommandList( bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) ); CommandList( const QVariant& v, bool doChroot = true, std::chrono::seconds timeout = std::chrono::seconds( 10 ) ); - ~CommandList(); bool doChroot() const { return m_doChroot; } From 8407d391097fda5e0ab6a1c4d9235568eb6274e9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 11:39:58 +0200 Subject: [PATCH 146/160] [welcome] Remove superfluous moc include (automoc handles this) --- src/modules/welcome/checker/ResultsListWidget.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index e26859135..f07725484 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -112,7 +112,3 @@ ResultsListWidget::requirementsChanged() m_explanation->setAlignment( Qt::AlignCenter ); } } - -#include "utils/moc-warnings.h" - -#include "ResultsListWidget.moc" From ed9155bfd8e94e5e0cd2b458b81377e601ba6c71 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 4 May 2022 12:01:36 +0200 Subject: [PATCH 147/160] CMake: fix reversed logic RC (in the 3.2 branch) and RELEASE_MODE are inverted, logically, but the change to the CMake check wasn't properly inverted. This only matters if you try to build Calamares in the src-dir, which is something I never do anyway. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e52c3fa1..e4953b564 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ endif() project(CALAMARES VERSION ${CALAMARES_VERSION} LANGUAGES C CXX HOMEPAGE_URL "https://calamares.io/") -if(CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) +if(NOT CALAMARES_RELEASE_MODE AND CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR) message(FATAL_ERROR "Do not build development versions in the source-directory.") endif() From 85c67113b772517c78f7b83677243424b368da2b Mon Sep 17 00:00:00 2001 From: dalto Date: Mon, 9 May 2022 06:50:33 -0500 Subject: [PATCH 148/160] [mount] Update schema to use arrays --- src/modules/mount/mount.schema.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/mount/mount.schema.yaml b/src/modules/mount/mount.schema.yaml index 0392c1120..a083ed75a 100644 --- a/src/modules/mount/mount.schema.yaml +++ b/src/modules/mount/mount.schema.yaml @@ -15,7 +15,7 @@ properties: device: { type: string } fs: { type: string } mountPoint: { type: string } - options: { type: string } + options: { type: array, items: { type: string } } efi: { type: boolean, default: false } required: [ device, mountPoint ] btrfsSubvolumes: @@ -35,9 +35,9 @@ properties: additionalProperties: false properties: filesystem: { type: string } - options: { type: array } - ssdOptions: { type: array } - hddOptions: { type: array } + options: { type: array, items: { type: string } } + ssdOptions: { type: array, items: { type: string } } + hddOptions: { type: array, items: { type: string } } required: [ filesystem ] From f4e9b3689de77698e90aeb68094c9b7686df7307 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 May 2022 15:05:54 +0200 Subject: [PATCH 149/160] [users] Remove legacy settings --- src/modules/users/Config.cpp | 25 ------------------------- src/modules/users/users.conf | 15 --------------- src/modules/users/users.schema.yaml | 8 ++------ 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index 5d10793ca..007bf705e 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -858,25 +858,6 @@ either( T ( *f )( const QVariantMap&, const QString&, U ), } } -// TODO:3.3: Remove -static void -copyLegacy( const QVariantMap& source, const QString& sourceKey, QVariantMap& target, const QString& targetKey ) -{ - if ( source.contains( sourceKey ) ) - { - if ( target.contains( targetKey ) ) - { - cWarning() << "Legacy *users* key" << sourceKey << "ignored."; - } - else - { - const QVariant legacyValue = source.value( sourceKey ); - cWarning() << "Legacy *users* key" << sourceKey << "overrides hostname-settings."; - target.insert( targetKey, legacyValue ); - } - } -} - /** @brief Tidy up a list of names * * Remove duplicates, apply lowercase, sort. @@ -897,9 +878,6 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) bool ok = false; // Ignored QVariantMap userSettings = CalamaresUtils::getSubMap( configurationMap, "user", ok ); - // TODO:3.3: Remove calls to copyLegacy - copyLegacy( configurationMap, "userShell", userSettings, "shell" ); - QString shell( QLatin1String( "/bin/bash" ) ); // as if it's not set at all if ( userSettings.contains( "shell" ) ) { @@ -925,9 +903,6 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) bool ok = false; // Ignored QVariantMap hostnameSettings = CalamaresUtils::getSubMap( configurationMap, "hostname", ok ); - // TODO:3.3: Remove calls to copyLegacy - copyLegacy( configurationMap, "setHostname", hostnameSettings, "location" ); - copyLegacy( configurationMap, "writeHostsFile", hostnameSettings, "writeHostsFile" ); m_hostnameAction = getHostNameAction( hostnameSettings ); m_writeEtcHosts = CalamaresUtils::getBool( hostnameSettings, "writeHostsFile", true ); m_hostnameTemplate diff --git a/src/modules/users/users.conf b/src/modules/users/users.conf index 779d1afdf..00a98ee7f 100644 --- a/src/modules/users/users.conf +++ b/src/modules/users/users.conf @@ -161,10 +161,6 @@ allowWeakPasswordsDefault: false user: shell: /bin/bash forbidden_names: [ root ] -# TODO:3.3: Remove this setting -# -# This is the legacy setting for user.shell -userShell: /bin/bash # Hostname settings # @@ -212,17 +208,6 @@ hostname: template: "derp-${cpu}" forbidden_names: [ localhost ] -# TODO:3.3: Remove this setting -# -# This is a legacy setting for hostname.location; if it is set -# at all, and there is no setting for hostname.location, it is used. -setHostname: EtcFile - -# TODO:3.3: Remove this setting -# -# This is a legacy setting for hostname.writeHostsFile -writeHostsFile: true - presets: fullName: # value: "OEM User" diff --git a/src/modules/users/users.schema.yaml b/src/modules/users/users.schema.yaml index 025f8a3d2..972306b80 100644 --- a/src/modules/users/users.schema.yaml +++ b/src/modules/users/users.schema.yaml @@ -6,13 +6,12 @@ $id: https://calamares.io/schemas/users additionalProperties: false type: object properties: - # User shell, should be path to /bin/sh or so - userShell: { type: string } user: additionalProperties: false type: object properties: - shell: { type: string } # Overrides userShell + # User shell, should be path to /bin/sh or so + shell: { type: string } forbidden_names: { type: array, items: { type: string } } # Group settings defaultGroups: @@ -54,9 +53,6 @@ properties: writeHostsFile: { type: boolean, default: true } template: { type: string, default: "${first}-${product}" } forbidden_names: { type: array, items: { type: string } } - # Legacy Hostname setting - setHostname: { type: string, enum: [ None, EtcFile, Hostnamed ] } - writeHostsFile: { type: boolean, default: true } # Presets # From 824d706a20404930584d8a5108256daf361e3573 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 May 2022 15:13:42 +0200 Subject: [PATCH 150/160] [users] Fix tests - in 3.3, the legacy values are ignored, so all the old-style tests behave as if nothing is set at all. - Some tests used old-style settings, adapt to newer ones. --- src/modules/users/Tests.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/modules/users/Tests.cpp b/src/modules/users/Tests.cpp index b6badbe91..2ce0c0a7b 100644 --- a/src/modules/users/Tests.cpp +++ b/src/modules/users/Tests.cpp @@ -279,8 +279,10 @@ UserTests::testHostActions2() QCOMPARE( c.hostnameAction(), HostNameAction::EtcHostname ); QCOMPARE( c.writeEtcHosts(), true ); - legacy.insert( "writeHostsFile", false ); - legacy.insert( "setHostname", "Hostnamed" ); + QVariantMap hostSettings; + hostSettings.insert( "writeHostsFile", false ); + hostSettings.insert( "location", "Hostnamed" ); + legacy.insert( "hostname", hostSettings ); c.setConfigurationMap( legacy ); QCOMPARE( c.hostnameAction(), HostNameAction::SystemdHostname ); QCOMPARE( c.writeEtcHosts(), false ); @@ -464,16 +466,14 @@ UserTests::testUserYAML_data() QTest::addColumn< QString >( "filename" ); QTest::addColumn< QString >( "shell" ); - QTest::newRow( "old, unset " ) << "tests/7ao-shell.conf" - << "/bin/bash"; - QTest::newRow( "old, empty " ) << "tests/7bo-shell.conf" - << ""; - QTest::newRow( "old, relative" ) << "tests/7co-shell.conf" - << "/bin/ls"; // Setting is ignored - QTest::newRow( "old, invalid " ) << "tests/7do-shell.conf" - << ""; - QTest::newRow( "old, absolute" ) << "tests/7eo-shell.conf" - << "/usr/bin/dash"; + const QString bash = QStringLiteral( "/bin/bash" ); + + // All the old settings are ignored + QTest::newRow( "old, unset " ) << "tests/7ao-shell.conf" << bash; + QTest::newRow( "old, empty " ) << "tests/7bo-shell.conf" << bash; + QTest::newRow( "old, relative" ) << "tests/7co-shell.conf" << bash; + QTest::newRow( "old, invalid " ) << "tests/7do-shell.conf" << bash; + QTest::newRow( "old, absolute" ) << "tests/7eo-shell.conf" << bash; QTest::newRow( "new, unset " ) << "tests/7an-shell.conf" << "/bin/bash"; From 9196f696ea915bb88d002cd66a11711de1fa9fee Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 May 2022 15:24:11 +0200 Subject: [PATCH 151/160] [users] Ensure the basic forbidden-names are always forbidden by the constructor --- src/modules/users/Config.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index 007bf705e..8f36862ce 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -96,8 +96,22 @@ hostnameActionNames() return names; } +static QStringList +alwaysForbiddenLoginNames() +{ + return { "root", "nobody" }; +} + +static QStringList +alwaysForbiddenHostNames() +{ + return { "localhost" }; +} + Config::Config( QObject* parent ) : Calamares::ModuleSystem::Config( parent ) + , m_forbiddenHostNames( alwaysForbiddenHostNames() ) + , m_forbiddenLoginNames( alwaysForbiddenLoginNames() ) { emit readyChanged( m_isReady ); // false @@ -887,7 +901,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) setUserShell( shell ); m_forbiddenLoginNames = CalamaresUtils::getStringList( userSettings, "forbidden_names" ); - m_forbiddenLoginNames << QStringLiteral( "root" ) << QStringLiteral( "nobody" ); + m_forbiddenLoginNames << alwaysForbiddenLoginNames(); tidy( m_forbiddenLoginNames ); } @@ -909,7 +923,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) = CalamaresUtils::getString( hostnameSettings, "template", QStringLiteral( "${first}-${product}" ) ); m_forbiddenHostNames = CalamaresUtils::getStringList( hostnameSettings, "forbidden_names" ); - m_forbiddenHostNames << QStringLiteral( "localhost" ); + m_forbiddenHostNames << alwaysForbiddenHostNames(); tidy( m_forbiddenHostNames ); } From f42924a9ca925be4c8e1cde4b226446aad1d3a88 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 12:31:53 +0200 Subject: [PATCH 152/160] CI: accept clang-format 12-14 --- ci/calamaresstyle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/calamaresstyle b/ci/calamaresstyle index 52fe30737..d3d2aa099 100755 --- a/ci/calamaresstyle +++ b/ci/calamaresstyle @@ -45,11 +45,11 @@ test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; } format_version=`"$CF" --version | tr -dc '[^.0-9]' | cut -d . -f 1` case "$format_version" in - 12|13 ) + 12|13|14 ) : ;; * ) - echo "! Clang-format version '$format_version' unsupported, version 12 required." + echo "! Clang-format version '$format_version' unsupported, version 12-14 required." exit 1 ;; esac From 928b46f18ebaa9d9840632bbe9f529fa17dcafaa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 12:39:45 +0200 Subject: [PATCH 153/160] [libcalamaresui] Use namespace Calamares::Widgets --- src/libcalamaresui/widgets/ClickableLabel.cpp | 5 +++-- src/libcalamaresui/widgets/ClickableLabel.h | 11 ++++++----- src/libcalamaresui/widgets/PrettyRadioButton.cpp | 4 +++- src/libcalamaresui/widgets/PrettyRadioButton.h | 10 ++++++---- src/modules/partition/gui/ChoicePage.cpp | 2 +- src/modules/partition/gui/ChoicePage.h | 11 +++++++---- 6 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/libcalamaresui/widgets/ClickableLabel.cpp b/src/libcalamaresui/widgets/ClickableLabel.cpp index be7b142f1..8475a5aea 100644 --- a/src/libcalamaresui/widgets/ClickableLabel.cpp +++ b/src/libcalamaresui/widgets/ClickableLabel.cpp @@ -13,7 +13,8 @@ namespace Calamares { - +namespace Widgets +{ ClickableLabel::ClickableLabel( QWidget* parent ) : QLabel( parent ) @@ -47,5 +48,5 @@ ClickableLabel::mouseReleaseEvent( QMouseEvent* event ) emit clicked(); } } - +} // namespace Widgets } // namespace Calamares diff --git a/src/libcalamaresui/widgets/ClickableLabel.h b/src/libcalamaresui/widgets/ClickableLabel.h index 8c5561677..259f4a71f 100644 --- a/src/libcalamaresui/widgets/ClickableLabel.h +++ b/src/libcalamaresui/widgets/ClickableLabel.h @@ -8,8 +8,8 @@ * */ -#ifndef LIBCALAMARESUI_CLICKABLELABEL_H -#define LIBCALAMARESUI_CLICKABLELABEL_H +#ifndef LIBCALAMARESUI_WIDGETS_CLICKABLELABEL_H +#define LIBCALAMARESUI_WIDGETS_CLICKABLELABEL_H #include #include @@ -18,7 +18,8 @@ namespace Calamares { - +namespace Widgets +{ /** @brief A Label where the whole label area is clickable * * When clicking anywhere on the Label (text, background, whatever) @@ -44,7 +45,7 @@ protected: private: QElapsedTimer m_time; }; - +} // namespace Widgets } // namespace Calamares -#endif // LIBCALAMARESUI_CLICKABLELABEL_H +#endif // LIBCALAMARESUI_WIDGETS_CLICKABLELABEL_H diff --git a/src/libcalamaresui/widgets/PrettyRadioButton.cpp b/src/libcalamaresui/widgets/PrettyRadioButton.cpp index b79f93a25..62e462a58 100644 --- a/src/libcalamaresui/widgets/PrettyRadioButton.cpp +++ b/src/libcalamaresui/widgets/PrettyRadioButton.cpp @@ -20,6 +20,8 @@ namespace Calamares { +namespace Widgets +{ PrettyRadioButton::PrettyRadioButton( QWidget* parent ) : QWidget( parent ) @@ -124,5 +126,5 @@ PrettyRadioButton::toggleOptions( bool toggle ) m_optionsLayout->parentWidget()->setVisible( toggle ); } } - +} // namespace Widgets } // namespace Calamares diff --git a/src/libcalamaresui/widgets/PrettyRadioButton.h b/src/libcalamaresui/widgets/PrettyRadioButton.h index 1874457a8..fd00911e1 100644 --- a/src/libcalamaresui/widgets/PrettyRadioButton.h +++ b/src/libcalamaresui/widgets/PrettyRadioButton.h @@ -7,8 +7,8 @@ * */ -#ifndef LIBCALAMARESUI_PRETTYRADIOBUTTON_H -#define LIBCALAMARESUI_PRETTYRADIOBUTTON_H +#ifndef LIBCALAMARESUI_WIDGETS_PRETTYRADIOBUTTON_H +#define LIBCALAMARESUI_WIDGETS_PRETTYRADIOBUTTON_H #include "DllMacro.h" @@ -21,6 +21,8 @@ class QHBoxLayout; namespace Calamares { +namespace Widgets +{ class ClickableLabel; /** @brief A radio button with fancy label next to it. @@ -72,6 +74,6 @@ protected: QGridLayout* m_mainLayout; QHBoxLayout* m_optionsLayout; }; - +} // namespace Widgets } // namespace Calamares -#endif // LIBCALAMARESUI_PRETTYRADIOBUTTON_H +#endif // LIBCALAMARESUI_WIDGETS_PRETTYRADIOBUTTON_H diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index dd15fee7e..bf7c6e02c 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -54,7 +54,7 @@ #include #include -using Calamares::PrettyRadioButton; +using Calamares::Widgets::PrettyRadioButton; using CalamaresUtils::Partition::findPartitionByPath; using CalamaresUtils::Partition::isPartitionFreeSpace; using CalamaresUtils::Partition::PartitionIterator; diff --git a/src/modules/partition/gui/ChoicePage.h b/src/modules/partition/gui/ChoicePage.h index d1699200a..ea346f5ad 100644 --- a/src/modules/partition/gui/ChoicePage.h +++ b/src/modules/partition/gui/ChoicePage.h @@ -30,8 +30,11 @@ class QListView; namespace Calamares { +namespace Widgets +{ class PrettyRadioButton; } +} // namespace Calamares class Config; class DeviceInfoWidget; @@ -142,10 +145,10 @@ private: QComboBox* m_drivesCombo; QButtonGroup* m_grp; - Calamares::PrettyRadioButton* m_alongsideButton; - Calamares::PrettyRadioButton* m_eraseButton; - Calamares::PrettyRadioButton* m_replaceButton; - Calamares::PrettyRadioButton* m_somethingElseButton; + Calamares::Widgets::PrettyRadioButton* m_alongsideButton; + Calamares::Widgets::PrettyRadioButton* m_eraseButton; + Calamares::Widgets::PrettyRadioButton* m_replaceButton; + Calamares::Widgets::PrettyRadioButton* m_somethingElseButton; QComboBox* m_eraseSwapChoiceComboBox = nullptr; // UI, see also Config's swap choice QComboBox* m_eraseFsTypesChoiceComboBox = nullptr; // UI, see also Config's erase-mode FS From 704e2506649dc1359a1ae9a07877dc4ed9c81ca9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 14:37:24 +0200 Subject: [PATCH 154/160] [libcalamaresui] Remove under-used function - there was one consumer of this function, and it was over-engineered for what was needed (removing a list of widgets). Just drop it. --- .../utils/CalamaresUtilsGui.cpp | 20 ------------------- src/libcalamaresui/utils/CalamaresUtilsGui.h | 8 -------- src/modules/license/LicensePage.cpp | 7 +++++-- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp index e21c532ac..2a8b380c5 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp @@ -256,24 +256,4 @@ defaultIconSize() return QSize( w, w ); } - -void -clearLayout( QLayout* layout ) -{ - while ( QLayoutItem* item = layout->takeAt( 0 ) ) - { - if ( QWidget* widget = item->widget() ) - { - widget->deleteLater(); - } - - if ( QLayout* childLayout = item->layout() ) - { - clearLayout( childLayout ); - } - - delete item; - } -} - } // namespace CalamaresUtils diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index aa7aff79b..6f98db501 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -95,14 +95,6 @@ UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size */ UIDLLEXPORT void unmarginLayout( QLayout* layout ); -// TODO:3.3:This has only one consumer, move to LicensePage, make static -/** - * @brief clearLayout recursively walks the QLayout tree and deletes all the child - * widgets and layouts. - * @param layout the layout to clear. - */ -UIDLLEXPORT void clearLayout( QLayout* layout ); - UIDLLEXPORT void setDefaultFontSize( int points ); UIDLLEXPORT int defaultFontSize(); // in points UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific diff --git a/src/modules/license/LicensePage.cpp b/src/modules/license/LicensePage.cpp index bafc9f463..eb609b2da 100644 --- a/src/modules/license/LicensePage.cpp +++ b/src/modules/license/LicensePage.cpp @@ -115,7 +115,11 @@ LicensePage::LicensePage( QWidget* parent ) void LicensePage::setEntries( const QList< LicenseEntry >& entriesList ) { - CalamaresUtils::clearLayout( ui->licenseEntriesLayout ); + for ( QWidget* w : m_entries ) + { + ui->licenseEntriesLayout->removeWidget( w ); + w->deleteLater(); + } m_allLicensesOptional = true; @@ -128,7 +132,6 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList ) m_entries.append( w ); m_allLicensesOptional &= !entry.isRequired(); } - ui->licenseEntriesLayout->addSpacerItem( new QSpacerItem( 10, 10, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); ui->acceptCheckBox->setChecked( false ); checkAcceptance( false ); From 880c367d646be9e286072f25f721584e6fea7559 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 14:42:41 +0200 Subject: [PATCH 155/160] [libcalamaresui] Remove under-used function --- src/libcalamaresui/utils/CalamaresUtilsGui.cpp | 9 --------- src/libcalamaresui/utils/CalamaresUtilsGui.h | 1 - src/modules/partition/gui/PartitionLabelsView.cpp | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp index 2a8b380c5..55aa8f3ae 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp @@ -223,15 +223,6 @@ defaultFontHeight() } -QFont -defaultFont() -{ - QFont f; - f.setPointSize( defaultFontSize() ); - return f; -} - - QFont largeFont() { diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index 6f98db501..e4395b93f 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -98,7 +98,6 @@ UIDLLEXPORT void unmarginLayout( QLayout* layout ); UIDLLEXPORT void setDefaultFontSize( int points ); UIDLLEXPORT int defaultFontSize(); // in points UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific -UIDLLEXPORT QFont defaultFont(); // TODO:3.3:This has one consumer, move to BlankViewStep UIDLLEXPORT QFont largeFont(); UIDLLEXPORT QSize defaultIconSize(); diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index e3a50c576..66b1ba62a 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -29,7 +29,7 @@ using namespace CalamaresUtils::Units; static const int LAYOUT_MARGIN = 4; -static const int LABEL_PARTITION_SQUARE_MARGIN = qMax( QFontMetrics( CalamaresUtils::defaultFont() ).ascent() - 2, 18 ); +static const int LABEL_PARTITION_SQUARE_MARGIN = qMax( CalamaresUtils::defaultFontHeight() - 2, 18 ); static const int LABELS_MARGIN = LABEL_PARTITION_SQUARE_MARGIN; static const int CORNER_RADIUS = 2; From 7096ee760e1215ffb0ca7b65f2ddbfccdec227b9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 14:45:59 +0200 Subject: [PATCH 156/160] [libcalamaresui] Remove unused image-transformation function --- .../utils/CalamaresUtilsGui.cpp | 49 ------------------- src/libcalamaresui/utils/CalamaresUtilsGui.h | 12 ----- src/libcalamaresui/utils/ImageRegistry.cpp | 5 -- 3 files changed, 66 deletions(-) diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp index 55aa8f3ae..a1030d03e 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.cpp +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.cpp @@ -128,55 +128,6 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size ) } -QPixmap -createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPct ) -{ - int height; - int width; - - if ( !size.isEmpty() ) - { - height = size.height(); - width = size.width(); - } - else - { - height = pixmap.height(); - width = pixmap.width(); - } - - if ( !height || !width ) - { - return QPixmap(); - } - - QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ); - if ( frameWidthPct == 0.00f ) - { - return scaledAvatar; - } - - QPixmap frame( width, height ); - frame.fill( Qt::transparent ); - - QPainter painter( &frame ); - painter.setRenderHint( QPainter::Antialiasing ); - - QRect outerRect( 0, 0, width, height ); - QBrush brush( scaledAvatar ); - QPen pen; - pen.setColor( Qt::transparent ); - pen.setJoinStyle( Qt::RoundJoin ); - - painter.setBrush( brush ); - painter.setPen( pen ); - painter.drawRoundedRect( - outerRect, qreal( frameWidthPct ) * 100.0, qreal( frameWidthPct ) * 100.0, Qt::RelativeSize ); - - return frame; -} - - void unmarginLayout( QLayout* layout ) { diff --git a/src/libcalamaresui/utils/CalamaresUtilsGui.h b/src/libcalamaresui/utils/CalamaresUtilsGui.h index e4395b93f..5a0ee336f 100644 --- a/src/libcalamaresui/utils/CalamaresUtilsGui.h +++ b/src/libcalamaresui/utils/CalamaresUtilsGui.h @@ -63,7 +63,6 @@ enum ImageMode CoverInCase, Grid, DropShadow, - RoundedCorners }; /** @@ -78,17 +77,6 @@ UIDLLEXPORT QPixmap defaultPixmap( ImageType type, ImageMode mode = CalamaresUtils::Original, const QSize& size = QSize( 0, 0 ) ); -// TODO:3.3:This has only one consumer, move to ImageRegistry, make static -/** - * @brief createRoundedImage returns a rounded version of a pixmap. - * @param avatar the input pixmap. - * @param size the new size. - * @param frameWidthPct the frame size, as percentage of width. - * @return the transformed pixmap. - * This one is currently unused. - */ -UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.20f ); - /** * @brief unmarginLayout recursively walks the QLayout tree and removes all margins. * @param layout the layout to unmargin. diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index 647893d64..96dd79e78 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -90,11 +90,6 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils:: if ( !pixmap.isNull() ) { - if ( mode == CalamaresUtils::RoundedCorners ) - { - pixmap = CalamaresUtils::createRoundedImage( pixmap, size ); - } - if ( !size.isNull() && pixmap.size() != size ) { if ( size.width() == 0 ) From a9df84177099bf03e6754fe64baf2daf83e18557 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Apr 2022 16:57:18 +0200 Subject: [PATCH 157/160] CMake: fix Python3-executable uses --- CMakeLists.txt | 2 +- src/modules/CMakeLists.txt | 5 ++--- src/modules/packages/tests/CMakeTests.txt | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4953b564..d495ae439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,7 +364,7 @@ if(Python_Interpreter_FOUND) set(_validator_deps ${CALAMARES_CONFIGVALIDATOR_RESULT}) else() exec_program( - Python::Interpreter + ${Python_EXECUTABLE} ARGS "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" -x diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 07f415f75..bb7335316 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -25,8 +25,7 @@ foreach(SUBDIRECTORY ${SUBDIRECTORIES}) calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES ) endforeach() -# TODO:3.3: Use FindPython3 -if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND Python_Interpreter_FOUND) # The tests for each config file are independent of whether the # module is enabled or not: the config file should match its schema # regardless. @@ -52,7 +51,7 @@ if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXEC add_test( NAME validate-${SUBDIRECTORY}-${_conf_base} COMMAND - ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" + ${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" ) endif() diff --git a/src/modules/packages/tests/CMakeTests.txt b/src/modules/packages/tests/CMakeTests.txt index a131735ce..66da86b5a 100644 --- a/src/modules/packages/tests/CMakeTests.txt +++ b/src/modules/packages/tests/CMakeTests.txt @@ -27,7 +27,7 @@ add_test( WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXECUTABLE) +if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND Python_Interpreter_FOUND) set(_module packages) set(_schema_file "${CMAKE_CURRENT_SOURCE_DIR}/${_module}/${_module}.schema.yaml") message(STATUS "Schema ${_schema_file}") @@ -37,7 +37,7 @@ if(BUILD_TESTING AND BUILD_SCHEMA_TESTING AND PYTHONINTERP_FOUND AND PYTHON_EXEC add_test( NAME validate-packages-${_cf} COMMAND - ${PYTHON_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" + ${Python_EXECUTABLE} "${CMAKE_SOURCE_DIR}/ci/configvalidator.py" "${_schema_file}" "${_conf_file}" ) else() message(FATAL_ERROR "Missing ${_conf_file}") From 52e2c8c262949f4f6f1250b74caca15702736974 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 9 May 2022 15:42:01 +0200 Subject: [PATCH 158/160] [libcalamares] Use stronger type, rather than comment --- src/libcalamares/modulesystem/RequirementsChecker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/modulesystem/RequirementsChecker.cpp b/src/libcalamares/modulesystem/RequirementsChecker.cpp index bdc564519..b5bd91b36 100644 --- a/src/libcalamares/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamares/modulesystem/RequirementsChecker.cpp @@ -43,7 +43,7 @@ RequirementsChecker::run() { m_progressTimer = new QTimer( this ); connect( m_progressTimer, &QTimer::timeout, this, &RequirementsChecker::reportProgress ); - m_progressTimer->start( 1200 ); // msec + m_progressTimer->start( std::chrono::milliseconds( 1200 ) ); for ( const auto& module : m_modules ) { From 0d3e5e1c26ad166327897b3fe044b4b3b3e3f2a9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 10 May 2022 11:16:24 +0200 Subject: [PATCH 159/160] CMake: find boost_python as well On FreeBSD, at least, `find_package(Boost COMPONENTS python)` doesn't work well, while `find_package(boost_python)` does the job. Be somewhat more flexible: look for boost_python first, assuming it pulls in the rest of the Boost bits it needs. --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d495ae439..817e7e0c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -390,8 +390,14 @@ endif() add_feature_info(yaml-schema BUILD_SCHEMA_TESTING "Validate YAML (config files) with schema.${_schema_explanation}") if(Python_Development_FOUND) - find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python) - set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") + find_package(boost_python) + if(NOT TARGET Boost::python) + find_package(Boost ${BOOSTPYTHON_VERSION} COMPONENTS python) + set_package_properties(Boost PROPERTIES PURPOSE "Boost.Python is used for Python job modules.") + else() + message(STATUS "Found boost_python with target Boost::python") + set(Boost_FOUND ON) + endif() endif() if(NOT Python_Development_FOUND OR NOT Boost_FOUND) From 2a42084af41b4becd0d9364f5124defc949b9f5b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 18 May 2022 15:16:30 +0200 Subject: [PATCH 160/160] [partition, users] Fix merge artifacts --- src/modules/partition/core/KPMHelpers.cpp | 40 +---------------------- src/modules/users/Config.cpp | 12 ------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index de2a6bd4f..7a44d3eed 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -129,44 +129,6 @@ clonePartition( Device* device, Partition* partition ) partition->activeFlags() ); } -#ifndef WITH_KPMCORE4API -// This function was added in KPMCore 4, implementation copied from src/fs/luks.cpp -/* - SPDX-FileCopyrightText: 2010 Volker Lanz - SPDX-FileCopyrightText: 2012-2019 Andrius Štikonas - SPDX-FileCopyrightText: 2015-2016 Teo Mrnjavac - SPDX-FileCopyrightText: 2016 Chantara Tith - SPDX-FileCopyrightText: 2017 Christian Morlok - SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho - SPDX-FileCopyrightText: 2020 Arnaud Ferraris - SPDX-FileCopyrightText: 2020 Gaël PORTAY - - SPDX-License-Identifier: GPL-3.0-or-later -*/ -static bool -testPassphrase( FS::luks* fs, const QString& deviceNode, const QString& passphrase ) -{ - ExternalCommand cmd( QStringLiteral( "cryptsetup" ), - { QStringLiteral( "open" ), - QStringLiteral( "--tries" ), - QStringLiteral( "1" ), - QStringLiteral( "--test-passphrase" ), - deviceNode } ); - if ( cmd.write( passphrase.toLocal8Bit() + '\n' ) && cmd.start( -1 ) && cmd.exitCode() == 0 ) - { - return true; - } - - return false; -} -#else -static bool -testPassphrase( FS::luks* fs, const QString& deviceNode, const QString& passphrase ) -{ - return fs->testPassphrase( deviceNode, passphrase ); -} -#endif - // Adapted from luks cryptOpen which always opens a dialog to ask for a passphrase int updateLuksDevice( Partition* partition, const QString& passphrase ) @@ -191,7 +153,7 @@ updateLuksDevice( Partition* partition, const QString& passphrase ) FS::luks* luksFs = dynamic_cast< FS::luks* >( &partition->fileSystem() ); // Test the given passphrase - if ( !testPassphrase( luksFs, deviceNode, passphrase ) ) + if ( !luksFs->testPassphrase( deviceNode, passphrase ) ) { cWarning() << Logger::SubEntry << "#3: Passphrase incorrect"; return 3; diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index b0bd94d7e..f55c4fd99 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -110,18 +110,6 @@ hostnameActionNames() return names; } -static QStringList -alwaysForbiddenLoginNames() -{ - return { "root", "nobody" }; -} - -static QStringList -alwaysForbiddenHostNames() -{ - return { "localhost" }; -} - Config::Config( QObject* parent ) : Calamares::ModuleSystem::Config( parent ) , m_forbiddenHostNames( alwaysForbiddenHostNames() )