From 8f553c0b618f278918d108fd996c43997dda30f7 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Mon, 3 Jun 2019 10:45:31 +0200 Subject: [PATCH 01/44] i18n: [calamares] Automatic merge of Transifex translations --- lang/calamares_fi_FI.ts | 212 ++++++++++++++++++++-------------------- 1 file changed, 107 insertions(+), 105 deletions(-) diff --git a/lang/calamares_fi_FI.ts b/lang/calamares_fi_FI.ts index 21af2c84c..e85ee3b06 100644 --- a/lang/calamares_fi_FI.ts +++ b/lang/calamares_fi_FI.ts @@ -894,32 +894,32 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The type of <strong>partition table</strong> on the selected storage device.<br><br>The only way to change the partition table type is to erase and recreate the partition table from scratch, which destroys all data on the storage device.<br>This installer will keep the current partition table unless you explicitly choose otherwise.<br>If unsure, on modern systems GPT is preferred. - + Valitun tallennuslaitteen <strong>osion taulukon</strong> tyyppi.<br><br>Ainoa tapa muuttaa osion taulukon tyyppiä on poistaa ja luoda uudelleen osiot tyhjästä, mikä tuhoaa kaikki tallennuslaitteen tiedot. <br>Tämä asennusohjelma säilyttää nykyisen osion taulukon, ellet nimenomaisesti valitse muuta.<br>Jos olet epävarma, niin nykyaikaisissa järjestelmissä GPT on suositus. This device has a <strong>%1</strong> partition table. - + Tässälaitteessa on <strong>%1</strong> osion taulukko. This is a <strong>loop</strong> device.<br><br>It is a pseudo-device with no partition table that makes a file accessible as a block device. This kind of setup usually only contains a single filesystem. - + Tämä <strong>loop</strong> -laite.<br><br>Se on pseudo-laite, jossa ei ole osio-taulukkoa ja joka tekee tiedostosta lohkotun aseman. Tällainen asennus sisältää yleensä vain yhden tiedostojärjestelmän. This installer <strong>cannot detect a partition table</strong> on the selected storage device.<br><br>The device either has no partition table, or the partition table is corrupted or of an unknown type.<br>This installer can create a new partition table for you, either automatically, or through the manual partitioning page. - + Tämä asennusohjelma <strong>ei tunnista osion taulukkoa</strong> valitussa tallennuslaitteessa.<br><br>Laitteessa ei ole osio-taulukkoa, tai taulukko on vioittunut tai tuntematon.<br>Tämä asennusohjelma voi luoda uuden osiontaulukon sinulle, joko automaattisesti tai manuaalisesti. <br><br>This is the recommended partition table type for modern systems which start from an <strong>EFI</strong> boot environment. - + <br><br>Tämä on suositeltava osion taulun tyyppi nykyaikaisille järjestelmille, jotka käyttävät <strong>EFI</strong> -käynnistysympäristöä. <br><br>This partition table type is only advisable on older systems which start from a <strong>BIOS</strong> boot environment. GPT is recommended in most other cases.<br><br><strong>Warning:</strong> the MBR partition table is an obsolete MS-DOS era standard.<br>Only 4 <em>primary</em> partitions may be created, and of those 4, one can be an <em>extended</em> partition, which may in turn contain many <em>logical</em> partitions. - + <br><br>Tämä osiotaulukon tyyppi on suositeltava vain vanhemmissa järjestelmissä, jotka käyttävät <strong>BIOS</strong> -käynnistysympäristöä. GPT:tä suositellaan useimmissa muissa tapauksissa.<br><br><strong>Varoitus:</strong>MBR-taulukko on vanhentunut MS-DOS-standardi.<br>Vain 4 <em>ensisijaisia</em> Vain ensisijaisia osioita voidaan luoda, ja 4, niistä yksi voi olla <em>laajennettu</em> osio, joka voi puolestaan sisältää monia osioita <em>loogisia</em> osioita. @@ -934,7 +934,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. %1 - (%2) device[name] - (device-node[name]) - + %1 - (%2) @@ -942,17 +942,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Write LUKS configuration for Dracut to %1 - + Kirjoita LUKS-kokoonpano Dracutille %1 Skip writing LUKS configuration for Dracut: "/" partition is not encrypted - + Ohita LUKS-määrityksen kirjoittaminen Dracutille: "/" -osio ei ole salattu Failed to open %1 - + Ei voi avata %1 @@ -960,7 +960,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Dummy C++ Job - + Dummy C++ -työ @@ -978,7 +978,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. &Keep - + &Säilytä @@ -1031,22 +1031,22 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. En&crypt system - + Sa&laa järjestelmä Passphrase - + Salasana Confirm passphrase - + Vahvista salasana Please enter the same passphrase in both boxes. - + Anna sama salasana molemmissa ruuduissa. @@ -1059,32 +1059,32 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Install %1 on <strong>new</strong> %2 system partition. - + Asenna %1 <strong>uusi</strong> %2 järjestelmä osio. Set up <strong>new</strong> %2 partition with mount point <strong>%1</strong>. - + Määritä <strong>uusi</strong> %2 -osio liitepisteellä<strong>%1</strong>. Install %2 on %3 system partition <strong>%1</strong>. - + Asenna %2 - %3 -järjestelmän osioon <strong>%1</strong>. Set up %3 partition <strong>%1</strong> with mount point <strong>%2</strong>. - + Määritä %3 osio <strong>%1</strong> jossa on liitäntäpiste <strong>%2</strong>. Install boot loader on <strong>%1</strong>. - + Asenna käynnistyslatain <strong>%1</strong>. Setting up mount points. - + Liitosten määrittäminen. @@ -1097,7 +1097,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. <Restart checkbox tooltip> - + <Restart checkbox tooltip> @@ -1107,12 +1107,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. <h1>All done.</h1><br/>%1 has been set up on your computer.<br/>You may now start using your new system. - + <h1>Valmista.</h1><br/>%1 on määritetty tietokoneellesi.<br/>Voit nyt alkaa käyttää uutta järjestelmääsi. <html><head/><body><p>When this box is checked, your system will restart immediately when you click on <span style="font-style:italic;">Done</span> or close the setup program.</p></body></html> - + <html><head/><body><p>Kun tämä valintaruutu on valittu, järjestelmä käynnistyy heti, kun napsautat <span style="font-style:italic;">Valmis</span> -painiketta tai suljet asennusohjelman.</p></body></html> @@ -1122,17 +1122,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. <html><head/><body><p>When this box is checked, your system will restart immediately when you click on <span style="font-style:italic;">Done</span> or close the installer.</p></body></html> - + <html><head/><body><p>Kun tämä valintaruutu on valittuna, järjestelmä käynnistyy heti, kun napsautat <span style="font-style:italic;">Valmis</span> tai suljet asentimen.</p></body></html> <h1>Setup Failed</h1><br/>%1 has not been set up on your computer.<br/>The error message was: %2. - + <h1>Asennus epäonnistui</h1><br/>%1 ei ole määritetty tietokoneellesi.<br/> Virhesanoma oli: %2. <h1>Installation Failed</h1><br/>%1 has not been installed on your computer.<br/>The error message was: %2. - + <h1>Asennus epäonnistui </h1><br/>%1 ei ole asennettu tietokoneeseesi.<br/>Virhesanoma oli: %2. @@ -1145,22 +1145,22 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Setup Complete - + Asennus valmis Installation Complete - + Asennus valmis The setup of %1 is complete. - + Asennus %1 on valmis. The installation of %1 is complete. - + Asennus %1 on valmis. @@ -1168,17 +1168,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Format partition %1 (file system: %2, size: %3 MiB) on %4. - + Alustaa osiota %1 (tiedostojärjestelmä: %2, koko: %3 MiB) - %4. Format <strong>%3MiB</strong> partition <strong>%1</strong> with file system <strong>%2</strong>. - + Alustus <strong>%3MiB</strong> osio <strong>%1</strong> tiedostojärjestelmällä <strong>%2</strong>. Formatting partition %1 with file system %2. - + Alustaa osiota %1 tiedostojärjestelmällä %2. @@ -1191,22 +1191,22 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. has at least %1 GiB available drive space - + vähintään %1 GiB vapaata levytilaa There is not enough drive space. At least %1 GiB is required. - + Levytilaa ei ole riittävästi. Vähintään %1 GiB tarvitaan. has at least %1 GiB working memory - + vähintään %1 GiB työmuistia The system does not have enough working memory. At least %1 GiB is required. - + Järjestelmässä ei ole tarpeeksi työmuistia. Vähintään %1 GiB vaaditaan. @@ -1216,7 +1216,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The system is not plugged in to a power source. - + Järjestelmä ei ole kytketty virtalähteeseen. @@ -1226,27 +1226,27 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The system is not connected to the Internet. - + Järjestelmä ei ole yhteydessä internetiin. The setup program is not running with administrator rights. - + Asennus -ohjelma ei ole käynnissä järjestelmänvalvojan oikeuksin. The installer is not running with administrator rights. - + Asennus -ohjelma ei ole käynnissä järjestelmänvalvojan oikeuksin. The screen is too small to display the setup program. - + Näyttö on liian pieni, jotta asennus -ohjelma voidaan näyttää. The screen is too small to display the installer. - + Näyttö on liian pieni asentajan näyttämiseksi. @@ -1257,22 +1257,22 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. OEM Batch Identifier - + OEM-erän tunniste Could not create directories <code>%1</code>. - + Hakemistoja ei voitu luoda <code>%1</code>. Could not open file <code>%1</code>. - + Tiedostoa ei voitu avata <code>%1</code>. Could not write to file <code>%1</code>. - + Tiedostoon ei voitu kirjoittaa <code>%1</code>. @@ -1280,17 +1280,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Konsole not installed - + Pääte ei asennettuna Please install KDE Konsole and try again! - + Asenna KDE konsole ja yritä uudelleen! Executing script: &nbsp;<code>%1</code> - + Suoritetaan skripti: &nbsp;<code>%1</code> @@ -1298,7 +1298,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Script - + Skripti @@ -1332,7 +1332,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The system locale setting affects the language and character set for some command line user interface elements.<br/>The current setting is <strong>%1</strong>. - + Järjestelmän kieli asetus vaikuttaa joidenkin komentorivin käyttöliittymän kieleen ja merkistön käyttöön.<br/>Nykyinen asetus on <strong>%1</strong>. @@ -1342,7 +1342,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. &OK - + &OK @@ -1355,27 +1355,27 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. I accept the terms and conditions above. - + Hyväksyn yllä olevat ehdot ja edellytykset. <h1>License Agreement</h1>This setup procedure will install proprietary software that is subject to licensing terms. - + <h1>Lisenssisopimus</h1>Tämä asennustoiminto asentaa ohjelmistoja, joihin sovelletaan lisenssiehtoja. Please review the End User License Agreements (EULAs) above.<br/>If you do not agree with the terms, the setup procedure cannot continue. - + Katso yllä olevat käyttöoikeussopimukset (EULA).<br/>Jos et hyväksy ehtoja, asennus ei voi jatkua. <h1>License Agreement</h1>This setup procedure can install proprietary software that is subject to licensing terms in order to provide additional features and enhance the user experience. - + <h1>Lisenssisopimus</h1>Tämä asennustoiminto voi asentaa tekijänoikeuksin rajattua ohjelmistoja, joihin sovelletaan lisenssiehtoja, jotta voidaan tarjota lisäominaisuuksia ja parantaa käyttäjäkokemusta. Please review the End User License Agreements (EULAs) above.<br/>If you do not agree with the terms, proprietary software will not be installed, and open source alternatives will be used instead. - + Katso yllä olevat käyttöoikeussopimukset (EULA).<br/>Jos et hyväksy ehtoja, tekijänoikeuksin rajattua ohjelmistoa ei asenneta, ja avoimen lähdekoodin vaihtoehtoja käytetään sen sijaan. @@ -1383,7 +1383,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. License - + Lisenssi @@ -1508,7 +1508,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Description - + Kuvaus @@ -1526,7 +1526,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Package selection - + Paketin valinta @@ -1552,7 +1552,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. OEM Configuration - + OEM-kokoonpano @@ -1565,17 +1565,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Password is too short - + Salasana on liian lyhyt Password is too long - + Salasana on liian pitkä Password is too weak - + Salasana on liian heikko @@ -1670,7 +1670,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The password is too short - + Salasana on liian lyhyt @@ -1720,7 +1720,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. No password supplied - + Salasanaa ei annettu @@ -1795,12 +1795,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Fatal failure - + Vakava virhe Unknown error - + Tuntematon virhe @@ -1884,32 +1884,32 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Root - + Root Home - + Home Boot - + Boot EFI system - + EFI-järjestelmä Swap - + Swap New partition for %1 - + Uusi osio %1 @@ -1920,7 +1920,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. %1 %2 size[number] filesystem[name] - + %1 %2 @@ -2106,7 +2106,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. No EFI system partition configured - + EFI-järjestelmäosiota ei ole määritetty @@ -2116,7 +2116,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. EFI system partition flag not set - + EFI-järjestelmäosion lippua ei ole asetettu @@ -2126,7 +2126,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Boot partition not encrypted - + Käynnistysosiota ei ole salattu @@ -2136,7 +2136,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. has at least one disk device available. - + on vähintään yksi levy käytettävissä. @@ -2189,7 +2189,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Saving files for later ... - + Tiedostojen tallentaminen myöhemmin ... @@ -2215,7 +2215,9 @@ There was no output from the command. Output: - + +Ulostulo: + @@ -2284,22 +2286,22 @@ Output: unknown - + tuntematon extended - + laajennettu unformatted - + formatoimaton swap - + swap @@ -2309,7 +2311,7 @@ Output: (no mount point) - + (ei liitoskohtaa) @@ -2427,7 +2429,7 @@ Output: Invalid configuration - + Virheellinen konfiguraatio @@ -2438,7 +2440,7 @@ Output: KPMCore not Available - + KPMCore ei saatavilla @@ -2453,7 +2455,7 @@ Output: Resize Failed - + Kokomuutos epäonnistui @@ -2573,7 +2575,7 @@ Output: System requirements - + Järjestelmävaatimukset @@ -2581,12 +2583,12 @@ Output: Scanning storage devices... - + Skannataan tallennuslaitteita... Partitioning - + Osiointi @@ -2757,7 +2759,7 @@ Output: Cannot disable root account. - + Root-tiliä ei voi poistaa. @@ -2805,7 +2807,7 @@ Output: Cannot set timezone, - + Aikavyöhykettä ei voi määrittää, @@ -2856,7 +2858,7 @@ Output: Installation feedback - + Asennuksen palaute @@ -2951,7 +2953,7 @@ Output: Feedback - + Palautetta @@ -3031,7 +3033,7 @@ Output: Physical Extent Size: - + Fyysinen koko: @@ -3041,17 +3043,17 @@ Output: Total Size: - + Yhteensä koko: Used Size: - + Käytetty tila: Total Sectors: - + Sektorit yhteensä: @@ -3080,7 +3082,7 @@ Output: Select language - + Valitse kieli @@ -3130,7 +3132,7 @@ Output: %1 support - + %1 tuki From bdac6d1e30111f56589b05e0d1e479a6c67c57eb Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Mon, 3 Jun 2019 10:45:31 +0200 Subject: [PATCH 02/44] i18n: [python] Automatic merge of Transifex translations --- lang/python/ast/LC_MESSAGES/python.mo | Bin 5065 -> 5167 bytes lang/python/ast/LC_MESSAGES/python.po | 2 +- lang/python/fi_FI/LC_MESSAGES/python.mo | Bin 776 -> 1309 bytes lang/python/fi_FI/LC_MESSAGES/python.po | 10 ++++++---- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lang/python/ast/LC_MESSAGES/python.mo b/lang/python/ast/LC_MESSAGES/python.mo index 5c04defa8e6c0dd8ade3f5c91b37980aa6622ac3..c3c75acd64f9405139893e93b993fa4ed2657a59 100644 GIT binary patch delta 1081 zcmY+@Pi#z46vy#XGwn=O(NS7|Mh9hPYFbVG>1c_hB_Rl{g;bPGW@gbSs*F@ZCKU^@ zX#}&j5V4b(APte&ArTv^O8nW@1S_#2zQ6mPCT?=)bI+T1-@Wgg`(DQ%CW;>;!8=B4 zr>~-4t1{b(m3jQoJ_pR!;ult!>8N#ZF~hNf{h zzQbN@oNpFmeLKuxg0!E*UBt6>W}C2Wf!Q8BhNQ~wq85IR`)~&Jrmgj6TX6_gf+;_K zg-PN+s0<_)dK)>2DqR+fJq#{0Q0U(L=o;mpYjH+w+O>o)*>#^_9g-MV3QFtF z1h^WjjBRwiEeGE?YwplmUnX~}7>boEfuX9VLu2_fgZ;7G>FoHWu?w;D`SFV**?dPi aU0n)CqCk;2>^xwto_qx`ZyT=N%vS7{gk delta 992 zcmXxjPe@cz6vy#nGn1NWGt*?LX^t~Cju{T+pC+wHauEfoV5Cn-4JdXz+s(9UNyl zo|T#P;m;$Sh_3;&7F@%6+`-FO9yB|HeRv8-@d{330v9ofUoeF`rFkr5*1$ZAF|&f* zXK}i2=cQd%bg{3O9PTa*oY&z~&Jc;__S-g$&sFiMGH#S!L(&td~H>d@yq7wLx zYSkfL#o8L*>R~LXq>mXqz}I*lw@|&VJYiOcNmQw?qk2Dtm+(bt{tgi~FeeWFpi*&R~+a>xP%8`3hdc?>K?csISBm)C%8X20x>Ey@z+O;iNC| z6t*&7L<;Oe6+BlOb9*W1ze=SlD096m$U%bc1xiZ6-gAl7x|!b(&5Y@QtCTLYU95^j zC8wjVVk!I|?F`t1MsZ!x4U667q|c7Zxkz(ne;A3o&<13Gxi;vFR38;>9`|W#sI~=) SzXG#m#pj_{6~(TagU~-_7f|c~ diff --git a/lang/python/ast/LC_MESSAGES/python.po b/lang/python/ast/LC_MESSAGES/python.po index f8c44901b..9fe45fc13 100644 --- a/lang/python/ast/LC_MESSAGES/python.po +++ b/lang/python/ast/LC_MESSAGES/python.po @@ -347,7 +347,7 @@ msgstr "" #: src/modules/openrcdmcryptcfg/main.py:34 msgid "Configuring OpenRC dmcrypt service." -msgstr "" +msgstr "Configurando'l serviciu dmcrypt d'OpenRC." #: src/modules/luksbootkeyfile/main.py:35 msgid "Configuring LUKS key file." diff --git a/lang/python/fi_FI/LC_MESSAGES/python.mo b/lang/python/fi_FI/LC_MESSAGES/python.mo index afb4b8f3a5f49c6f861798da482d813320b3fdbb..cc21c37d47137a9ff7e2c90b27323aaa09535ba3 100644 GIT binary patch delta 749 zcmZvYy^9n<5XF1f^VBo&)(;dFDHcJHb8<2EKn_6;6buZSo!*c{sZB_z-S^tLsP-X$iU3d*S9NjXu;#xRKKd~>gTI(*5+T&uDnu+)6i8&pb_*5 zO0hmr>H;_d&w)3f^CR z!*Ad^3_rotXt<)(Bk&qH1|xVKd<~`td;o8PpO^VxAo{9RD8)$#DTQ{2v9{zXFfEJu z>UcVxSYD`?Z=cLJwXIA};%I6)r^w-H)S;M$4XSl%C`50lb&(1^Gb9BvOT#U3t_sxX zNvU@XSq`Er^iqFYMozb6>tq=3?T^)_tt!hq6dTN|OxSLNm^x(YzKbmBrqN!kSjR{{ ztRhZfI}+-DvQAFu!Z5>JM6Jxs@YZ&9tvAp1MIs zr0*zLj#Z_}@xPmuuvpT;FyjQBwyJI4W$JN}qXzR`uud{{4=afNpS|yd%D!u*KS%|cTI_#h@XY$cl+NY& KUX4G<2I@Dk@Xam& delta 213 zcmbQs)xlPOPl#nI0}!wQu?!IV05LZZ*8njHtN>zBAYKW?!a%$qi1~r|G7w7v@naws z0pfo^+|LM91H|G$_F^W8y4^rp0LVWLq@{uM9jN#ZAPrQi#J~&`WC3Di0F(ne2qeZj ynUgVA*f+m4uOu@sU7;Ycs3fx_Ge56*vpLgqMuEtTl+5Ci!%GzMi!<{}^cVmo6d$Dk diff --git a/lang/python/fi_FI/LC_MESSAGES/python.po b/lang/python/fi_FI/LC_MESSAGES/python.po index 848fe1162..3905c909a 100644 --- a/lang/python/fi_FI/LC_MESSAGES/python.po +++ b/lang/python/fi_FI/LC_MESSAGES/python.po @@ -88,25 +88,27 @@ msgstr "" #: src/modules/umount/main.py:40 msgid "Unmount file systems." -msgstr "" +msgstr "Irrota tiedostojärjestelmät käytöstä." #: src/modules/unpackfs/main.py:41 msgid "Filling up filesystems." -msgstr "" +msgstr "Paikannetaan tiedostojärjestelmiä." #: src/modules/unpackfs/main.py:159 msgid "rsync failed with error code {}." -msgstr "" +msgstr "rsync epäonnistui virhekoodilla {}." #: src/modules/unpackfs/main.py:220 src/modules/unpackfs/main.py:238 msgid "Failed to unpack image \"{}\"" -msgstr "" +msgstr "Kuvan purkaminen epäonnistui \"{}\"" #: src/modules/unpackfs/main.py:221 msgid "" "Failed to find unsquashfs, make sure you have the squashfs-tools package " "installed" msgstr "" +"Ei löytynyt unsquashfs, varmista, että sinulla on squashfs-tools paketti " +"asennettuna" #: src/modules/unpackfs/main.py:320 msgid "No mount point for root partition" From de34cacadddd6413a0a6f92c5ca28b2df940b9a3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jun 2019 10:49:51 +0200 Subject: [PATCH 03/44] Document (hoped-for) speedups in slideshow loading. --- CHANGES | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index b5707cd45..853bcdf4b 100644 --- a/CHANGES +++ b/CHANGES @@ -11,7 +11,9 @@ This release contains contributions from (alphabetically by first name): ## Core ## No user- or deployer-visible changes. Bugfixing as usual, see the -milestone for details. +milestone for details. The slideshow used during installation is now +loaded asynchronously, which may improve the transition speed to the +installation slideshow (#1152). ## Modules ## From 6dc83d692c808fa0b5cc99240cccce5bb6b4270f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jun 2019 10:57:26 +0200 Subject: [PATCH 04/44] CMake: pre-release housekeeping --- CHANGES | 2 +- CMakeLists.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 853bcdf4b..2f911b681 100644 --- a/CHANGES +++ b/CHANGES @@ -3,7 +3,7 @@ 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.9 (unreleased) # +# 3.2.9 (2019-06-03) # This release contains contributions from (alphabetically by first name): - Kevin Kofler diff --git a/CMakeLists.txt b/CMakeLists.txt index c18c11658..11e613710 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ project( CALAMARES VERSION 3.2.9 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # @@ -104,12 +104,12 @@ set( CALAMARES_DESCRIPTION_SUMMARY # checks for new languages and misspelled ones are done (that is, # copy these four lines to four backup lines, add "p", and then update # the original four lines with the current translations). -set( _tx_complete ast ca cs_CZ da de fr hr ja lt pl pt_BR pt_PT - tr_TR zh_TW ) -set( _tx_good bg en_GB es es_MX et gl he hi hu id it_IT ro ru sk sq - zh_CN ) -set( _tx_ok ar el es_PR eu fi_FI is ko mr nb nl sl sr - sr@latin sv th uk ) +set( _tx_complete ca cs_CZ da de fr he hr hu ko lt pt_BR sq tr_TR + zh_TW ) +set( _tx_good ast en_GB es es_MX et gl id it_IT ja nl pl pt_PT ro + ru sk zh_CN ) +set( _tx_ok ar bg el es_PR eu fi_FI hi is mr nb sl sr sr@latin sv + th uk ) set( _tx_bad be eo fa fr_CH gu kk kn lo mk ne_NP ur uz ) From 3335c2003e3c7ed3f24b5984914f647be12fb904 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jun 2019 11:09:51 +0200 Subject: [PATCH 05/44] [fsresizer] Fix tests - Again? The checks on the job name (using filesystem or device name) all looked very bogus, unless it was previously not setting them at all. --- src/modules/fsresizer/Tests.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/modules/fsresizer/Tests.cpp b/src/modules/fsresizer/Tests.cpp index b825beb6e..cee390b6b 100644 --- a/src/modules/fsresizer/Tests.cpp +++ b/src/modules/fsresizer/Tests.cpp @@ -83,13 +83,14 @@ size: 100% atleast: 600MiB )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ).toMap() ); - QVERIFY( j.name().isEmpty() ); + QVERIFY( !j.name().isEmpty() ); + QCOMPARE( j.name(), QString("/") ); QCOMPARE( j.size().unit(), SizeUnit::Percent ); QCOMPARE( j.minimumSize().unit(), SizeUnit::MiB ); QCOMPARE( j.size().value(), 100 ); QCOMPARE( j.minimumSize().value(), 600 ); - // Silly config + // Silly config has bad atleast value doc0 = YAML::Load( R"(--- fs: / dev: /dev/m00 @@ -98,12 +99,27 @@ atleast: 127 % )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ).toMap() ); QVERIFY( !j.name().isEmpty() ); + QCOMPARE( j.name(), QString("/") ); QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.size().value(), 72 ); QCOMPARE( j.minimumSize().value(), 0 ); - // Silly config + // Silly config has bad atleast value + doc0 = YAML::Load( R"(--- +dev: /dev/m00 +size: 72 MiB +atleast: 127 % +)" ); + j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ).toMap() ); + QVERIFY( !j.name().isEmpty() ); + QCOMPARE( j.name(), QString("/dev/m00") ); + QCOMPARE( j.size().unit(), SizeUnit::MiB ); + QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); + QCOMPARE( j.size().value(), 72 ); + QCOMPARE( j.minimumSize().value(), 0 ); + + // Normal config doc0 = YAML::Load( R"(--- fs: / # dev: /dev/m00 @@ -111,7 +127,8 @@ size: 71MiB # atleast: 127% )" ); j.setConfigurationMap( CalamaresUtils::yamlMapToVariant( doc0 ).toMap() ); - QVERIFY( j.name().isEmpty() ); + QVERIFY( !j.name().isEmpty() ); + QCOMPARE( j.name(), QString("/") ); QCOMPARE( j.size().unit(), SizeUnit::MiB ); QCOMPARE( j.minimumSize().unit(), SizeUnit::None ); QCOMPARE( j.size().value(), 71 ); From 40d1856bb1b910720fd36977abcef5207f31e40f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 3 Jun 2019 15:04:41 +0200 Subject: [PATCH 06/44] Changes: remove reference to QML loading, add some issue numbers --- CHANGES | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 2f911b681..cf963361c 100644 --- a/CHANGES +++ b/CHANGES @@ -11,9 +11,7 @@ This release contains contributions from (alphabetically by first name): ## Core ## No user- or deployer-visible changes. Bugfixing as usual, see the -milestone for details. The slideshow used during installation is now -loaded asynchronously, which may improve the transition speed to the -installation slideshow (#1152). +milestone for details. ## Modules ## @@ -23,7 +21,9 @@ installation slideshow (#1152). - *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. + 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). From 21f6ff0e60371074f1fe99c34506b5269a37ee02 Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Fri, 7 Jun 2019 10:44:01 +0200 Subject: [PATCH 07/44] i18n: [calamares] Automatic merge of Transifex translations --- lang/calamares_es_MX.ts | 12 ++-- lang/calamares_fi_FI.ts | 148 ++++++++++++++++++++-------------------- 2 files changed, 80 insertions(+), 80 deletions(-) diff --git a/lang/calamares_es_MX.ts b/lang/calamares_es_MX.ts index 5b1556a12..f3411597f 100644 --- a/lang/calamares_es_MX.ts +++ b/lang/calamares_es_MX.ts @@ -854,17 +854,17 @@ El instalador terminará y se perderán todos los cambios. Deactivate volume group named %1. - + Desactivar el grupo de volúmenes llamado%1. Deactivate volume group named <strong>%1</strong>. - + Desactivar el grupo de volúmenes llamado<strong>% 1</strong>. The installer failed to deactivate a volume group named %1. - + El instalador no pudo desactivar un grupo de volúmenes llamado%1. @@ -1098,7 +1098,7 @@ El instalador terminará y se perderán todos los cambios. <Restart checkbox tooltip> - + <Restart checkbox tooltip> @@ -1108,12 +1108,12 @@ El instalador terminará y se perderán todos los cambios. <h1>All done.</h1><br/>%1 has been set up on your computer.<br/>You may now start using your new system. - + <h1>Todo listo.</h1><br/>% 1 se ha configurado en su computadora. <br/>Ahora puede comenzar a usar su nuevo sistema. <html><head/><body><p>When this box is checked, your system will restart immediately when you click on <span style="font-style:italic;">Done</span> or close the setup program.</p></body></html> - + <html><head/><body><p>Cuando esta casilla está marcada, su sistema se reiniciará inmediatamente cuando haga clic en <span style="font-style:italic;">Listo</span> o cierre el programa de instalación.</p></body></html> diff --git a/lang/calamares_fi_FI.ts b/lang/calamares_fi_FI.ts index e85ee3b06..c2868130d 100644 --- a/lang/calamares_fi_FI.ts +++ b/lang/calamares_fi_FI.ts @@ -63,7 +63,7 @@ GlobalStorage - + Globaali-tallennus @@ -1392,63 +1392,63 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. <strong>%1 driver</strong><br/>by %2 %1 is an untranslatable product name, example: Creative Audigy driver - + <strong>%1 ajuri</strong><br/>- %2 <strong>%1 graphics driver</strong><br/><font color="Grey">by %2</font> %1 is usually a vendor name, example: Nvidia graphics driver - + <strong>%1 näytönohjaimet</strong><br/><font color="Grey">- %2</font> <strong>%1 browser plugin</strong><br/><font color="Grey">by %2</font> - + <strong>%1 selaimen laajennus</strong><br/><font color="Grey">- %2</font> <strong>%1 codec</strong><br/><font color="Grey">by %2</font> - + <strong>%1 kodekki</strong><br/><font color="Grey">- %2</font> <strong>%1 package</strong><br/><font color="Grey">by %2</font> - + <strong>%1 paketti</strong><br/><font color="Grey">- %2</font> <strong>%1</strong><br/><font color="Grey">by %2</font> - + <strong>%1</strong><br/><font color="Grey">- %2</font> Shows the complete license text - + Näyttää täydellisen lisenssin tekstin Hide license text - + Piilota lisenssin teksti Show license agreement - + Näytä lisenssisopimus Hide license agreement - + Piilota lisenssisopimus Opens the license agreement in a browser window. - + Avaa lisenssisopimus selaimessa. <a href="%1">View license agreement</a> - + <a href="%1">Näytä lisenssisopimus</a> @@ -1456,12 +1456,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The system language will be set to %1. - + Järjestelmän kielen asetuksena on %1. The numbers and dates locale will be set to %1. - + Numerot ja päivämäärät, paikallinen asetus on %1. @@ -1513,12 +1513,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Network Installation. (Disabled: Unable to fetch package lists, check your network connection) - + Verkkoasennus. (Ei käytössä: Pakettiluetteloita ei voi hakea, tarkista verkkoyhteys) Network Installation. (Disabled: Received invalid groups data) - + Verkkoasennus. (Ei käytössä: Vastaanotettiin virheellisiä ryhmän tietoja) @@ -1534,17 +1534,17 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Ba&tch: - + Ba&tch: <html><head/><body><p>Enter a batch-identifier here. This will be stored in the target system.</p></body></html> - + <html><head/><body><p>Syötä erän tunniste tähän. Tämä tallennetaan kohdejärjestelmään.</p></body></html> <html><head/><body><h1>OEM Configuration</h1><p>Calamares will use OEM settings while configuring the target system.</p></body></html> - + <html><head/><body><h1>OEM asetukset</h1><p>Calamares käyttää OEM-asetuksia määritettäessä kohdejärjestelmää.</p></body></html> @@ -1557,7 +1557,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Set the OEM Batch Identifier to <code>%1</code>. - + Aseta OEM valmistajan erän tunnus <code>%1</code>. @@ -1580,92 +1580,92 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Memory allocation error when setting '%1' - + Muistin varausvirhe asetettaessa '%1' Memory allocation error - + Muistin varausvirhe The password is the same as the old one - + Salasana on sama kuin vanha The password is a palindrome - + Salasana on palindromi The password differs with case changes only - + Salasana eroaa vain vähäisin muutoksin The password is too similar to the old one - + Salasana on liian samanlainen kuin vanha The password contains the user name in some form - + Salasana sisältää jonkin käyttäjänimen The password contains words from the real name of the user in some form - + Salasana sisältää sanoja käyttäjän todellisesta nimestä jossain muodossa The password contains forbidden words in some form - + Salasana sisältää kiellettyjä sanoja The password contains less than %1 digits - + Salasana sisältää vähemmän kuin %1 numeroa The password contains too few digits - + Salasana sisältää liian vähän numeroita The password contains less than %1 uppercase letters - + Salasana sisältää vähemmän kuin %1 isoja kirjaimia The password contains too few uppercase letters - + Salasana sisältää liian vähän isoja kirjaimia The password contains less than %1 lowercase letters - + Salasana sisältää vähemmän kuin %1 pieniä kirjaimia The password contains too few lowercase letters - + Salasana sisältää liian vähän pieniä kirjaimia The password contains less than %1 non-alphanumeric characters - + Salasanassa on vähemmän kuin %1 erikoismerkkiä The password contains too few non-alphanumeric characters - + Salasana sisältää liian vähän erikoismerkkejä The password is shorter than %1 characters - + Salasana on lyhyempi kuin %1 merkkiä @@ -1675,47 +1675,47 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. The password is just rotated old one - + Salasana on vain vanhan pyöritystä The password contains less than %1 character classes - + Salasana sisältää vähemmän kuin %1 merkkiluokkaa The password does not contain enough character classes - + Salasana ei sisällä tarpeeksi merkkiluokkia The password contains more than %1 same characters consecutively - + Salasana sisältää enemmän kuin %1 samaa merkkiä peräkkäin The password contains too many same characters consecutively - + Salasana sisältää liian monta samaa merkkiä peräkkäin The password contains more than %1 characters of the same class consecutively - + Salasana sisältää enemmän kuin %1 merkkiä samasta luokasta peräkkäin The password contains too many characters of the same class consecutively - + Salasana sisältää liian monta saman luokan merkkiä peräkkäin The password contains monotonic sequence longer than %1 characters - + Salasana sisältää monotonisen merkkijonon, joka on pidempi kuin %1 merkkiä The password contains too long of a monotonic character sequence - + Salasanassa on liian pitkä monotoninen merkkijono @@ -1725,72 +1725,72 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Cannot obtain random numbers from the RNG device - + Satunnaislukuja ei voi saada RNG-laitteesta Password generation failed - required entropy too low for settings - + Salasanojen luonti epäonnistui - pakollinen vähimmäistaso liian alhainen asetuksia varten The password fails the dictionary check - %1 - + Salasana epäonnistui sanaston tarkistuksessa -%1 The password fails the dictionary check - + Salasana epäonnistui sanaston tarkistuksessa Unknown setting - %1 - + Tuntematon asetus - %1 Unknown setting - + Tuntematon asetus Bad integer value of setting - %1 - + Asetuksen virheellinen kokonaisluku - %1 Bad integer value - + Virheellinen kokonaisluku Setting %1 is not of integer type - + Asetus %1 ei ole kokonaisluku Setting is not of integer type - + Asetus ei ole kokonaisluku Setting %1 is not of string type - + Asetus %1 ei ole merkkijono Setting is not of string type - + Asetus ei ole merkkijono Opening the configuration file failed - + Määritystiedoston avaaminen epäonnistui The configuration file is malformed - + Määritystiedosto on väärin muotoiltu @@ -1861,12 +1861,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Log in automatically without asking for the password. - + Kirjaudu automaattisesti ilman salasanaa. Use the same password for the administrator account. - + Käytä pääkäyttäjän tilillä samaa salasanaa. @@ -1968,7 +1968,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Storage de&vice: - + Tallennus&laite: @@ -1983,7 +1983,7 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Cre&ate - + Luo& @@ -1998,27 +1998,27 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. New Volume Group - + Uusi aseman ryhmä Resize Volume Group - + Muuta kokoa aseman-ryhmässä Deactivate Volume Group - + Poista asemaryhmä käytöstä Remove Volume Group - + Poista asemaryhmä I&nstall boot loader on: - + A&senna käynnistyslatain: @@ -2028,12 +2028,12 @@ Asennusohjelma sulkeutuu ja kaikki muutoksesi katoavat. Can not create new partition - + Ei voi luoda uutta osiota The partition table on %1 already has %2 primary partitions, and no more can be added. Please remove one primary partition and add an extended partition, instead. - + %1 osio-taulukossa on jo %2 ensisijaista osiota, eikä sitä voi lisätä. Poista yksi ensisijainen osio ja lisää laajennettu osio. @@ -2518,7 +2518,7 @@ Ulostulo: Resize Volume Group - + Muuta kokoa aseman-ryhmässä From bbc0edecd3b65b05d26090609d901a6f915c1d7b Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Fri, 7 Jun 2019 10:44:01 +0200 Subject: [PATCH 08/44] i18n: [dummypythonqt] Automatic merge of Transifex translations --- .../lang/be/LC_MESSAGES/dummypythonqt.mo | Bin 1118 -> 1118 bytes .../lang/be/LC_MESSAGES/dummypythonqt.po | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.mo b/src/modules/dummypythonqt/lang/be/LC_MESSAGES/dummypythonqt.mo index 42cb16abd89b83fccdabd2a929ca6310f2605303..2a7ecc372f48d28bb36e268d93b0a2eb66209172 100644 GIT binary patch delta 24 fcmcb|agSreBS!AL#Nv#SoYLIH, YEAR. # # Translators: -# Zmicer Turok , 2018 +# Zmicer Turok , 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" +"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" +"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" From a7e5488f77aa2672963489d7a8ed1053f330137a Mon Sep 17 00:00:00 2001 From: Calamares CI Date: Fri, 7 Jun 2019 10:44:02 +0200 Subject: [PATCH 09/44] i18n: [python] Automatic merge of Transifex translations --- lang/python/fi_FI/LC_MESSAGES/python.mo | Bin 1309 -> 2126 bytes lang/python/fi_FI/LC_MESSAGES/python.po | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lang/python/fi_FI/LC_MESSAGES/python.mo b/lang/python/fi_FI/LC_MESSAGES/python.mo index cc21c37d47137a9ff7e2c90b27323aaa09535ba3..02ef2d1f4f60884793171cc5ed03c87c770811f1 100644 GIT binary patch literal 2126 zcmZ{k%WoS+9LEO;FH>Fx#9RCtaY#zmc0vWIOAu}26q7oQ(xiwJ8oXnByt^~Y%&c9j zlq*LN65`6iXAT^CK;nWqaiV_!75oz*aX@@$*WM%rMw@O%Q9+-jF6b8*y_F*Y65Kuu$`Ddz-T+B>*V zJuqHXHRoHS#svaegRMK@)sjF;L+BD{4O1R=ZVeZmA;+CZ9=p>DW6Kspal8~H+ zNh+kd_g%Y!^N}E%89`&6QJ)V5xjts{@N{k9w2m#J*NLD8GOgn=WE~NiDZffG@f#Lz z++1W^GLF5yS(=BS@X1zLt2phKLhg8#wSA`iu*?p2?dW;fsb>VtH-~DgY}e?Hu$Bs! z*paB`y6DC!dy_&fEcr}|>(V-Qpo%Nu^FgIG#*S5oxT<4b+pQ5Ze6f%xUw;K+B9feCW)r)Y=EgOqqhhiz@GUVme?)|DS_wQ9?icB|by^m(;fuizFtpfEcQsr;sm@WS z&y5vs<6wU)SU=q7wRMFFnz)4_Qrw{RkEAPYZXjFGRoRVEdvUO(O=26Q(tKz)*3MD! zyRoF`)CR3CpR2HUGp#g5();PgHbrVhUfh93pi$Yy29ZuDY1R)>0+Eg|pK_(ytdc32 zPNowS?AQ*a=?k{Y&TjqzJWjy4)8@GtkmG&RP2|k@N9% zGAr*R6Z85`3$?C1ES#63j@9_ibTW3+TdI$egVS6cafoy*Da|tHgz&3Ev8JSWdTZ>) zYV3~H_>h|f!Qv|<9Mq7NDvM)ITK&7uBW#hxtxyVonc{3a8$xrMnTRJ|5BUIVf7e_l zi-O2YPB>Y zFGh>Hm&dgKf0puRU?v5U5^gPLE!4N;|7GBG;wUPj?aisO;&C|UX?|aDpF+HDJbxhm E0S(24^Z)<= delta 349 zcmX}nu}eZx6vy%7eflgLe43J!#3KU1!9AiO8k-ah8Y7e5ppSabz{%0k;Uct%OaFnB zLz6=Y)#hl>AJEWJEkWN~j}H9!z`6IHd+)O|O7&i{@u5&_q)0-NA&(YSj89Sj3z;i6F||Ty3FCe%6}gJ$v)nHUDTySbg@2CD+HF5{TYkf9cHQ9O`o=rg sSL#rIs=gjr`N@a%5Yt(^pzHR5UfSdI>1D$U!r7hc2c92R^mnrQ0~l8>cK`qY diff --git a/lang/python/fi_FI/LC_MESSAGES/python.po b/lang/python/fi_FI/LC_MESSAGES/python.po index 3905c909a..4348bb437 100644 --- a/lang/python/fi_FI/LC_MESSAGES/python.po +++ b/lang/python/fi_FI/LC_MESSAGES/python.po @@ -120,7 +120,7 @@ msgstr "" #: src/modules/unpackfs/main.py:326 msgid "Bad mount point for root partition" -msgstr "" +msgstr "Huono kiinnityspiste root-osioon" #: src/modules/unpackfs/main.py:327 msgid "rootMountPoint is \"{}\", which does not exist, doing nothing" @@ -129,7 +129,7 @@ msgstr "" #: src/modules/unpackfs/main.py:340 src/modules/unpackfs/main.py:347 #: src/modules/unpackfs/main.py:352 msgid "Bad unsquash configuration" -msgstr "" +msgstr "Huono epäpuhdas kokoonpano" #: src/modules/unpackfs/main.py:341 msgid "The filesystem for \"{}\" ({}) is not supported" @@ -169,19 +169,19 @@ msgstr "" #: src/modules/displaymanager/main.py:602 msgid "Cannot configure LightDM" -msgstr "" +msgstr "LightDM määritysvirhe" #: src/modules/displaymanager/main.py:603 msgid "No LightDM greeter installed." -msgstr "" +msgstr "LightDM ei ole asennettu." #: src/modules/displaymanager/main.py:634 msgid "Cannot write SLIM configuration file" -msgstr "" +msgstr "SLIM-määritystiedostoa ei voi kirjoittaa" #: src/modules/displaymanager/main.py:635 msgid "SLIM config file {!s} does not exist" -msgstr "" +msgstr "SLIM-määritystiedostoa {!s} ei ole olemassa" #: src/modules/displaymanager/main.py:750 msgid "No display managers selected for the displaymanager module." @@ -195,11 +195,11 @@ msgstr "" #: src/modules/displaymanager/main.py:831 msgid "Display manager configuration was incomplete" -msgstr "" +msgstr "Näytönhallinnan kokoonpano oli puutteellinen" #: src/modules/initcpiocfg/main.py:36 msgid "Configuring mkinitcpio." -msgstr "" +msgstr "Määritetään mkinitcpio." #: src/modules/initcpiocfg/main.py:192 #: src/modules/luksopenswaphookcfg/main.py:100 @@ -215,7 +215,7 @@ msgstr "" #: src/modules/initcpio/main.py:47 msgid "Process Failed" -msgstr "" +msgstr "Prosessi epäonnistui" #: src/modules/initcpio/main.py:48 msgid "" @@ -229,7 +229,7 @@ msgstr "" #: src/modules/rawfs/main.py:35 msgid "Installing data." -msgstr "" +msgstr "Asennetaan tietoja." #: src/modules/services-openrc/main.py:38 msgid "Configure OpenRC services" From 0619f1953645e90e3ae3c38506efb22e146adb2c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 10:45:53 +0200 Subject: [PATCH 10/44] CMake: post-release housekeeping --- CHANGES | 10 ++++++++++ CMakeLists.txt | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index cf963361c..d1a43c258 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,16 @@ 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.10 (unreleased) # + +This release contains contributions from (alphabetically by first name): + +## Core ## + +## Modules ## + + + # 3.2.9 (2019-06-03) # This release contains contributions from (alphabetically by first name): diff --git a/CMakeLists.txt b/CMakeLists.txt index 11e613710..b1b762172 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,10 +37,10 @@ cmake_minimum_required( VERSION 3.2 FATAL_ERROR ) project( CALAMARES - VERSION 3.2.9 + VERSION 3.2.10 LANGUAGES C CXX ) -set( CALAMARES_VERSION_RC 0 ) # Set to 0 during release cycle, 1 during development +set( CALAMARES_VERSION_RC 1 ) # Set to 0 during release cycle, 1 during development ### OPTIONS # From e49beaea91ac2c2842626654f9051fba9dab3cd0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 10:55:03 +0200 Subject: [PATCH 11/44] CMake: switch WITH_PYTHONQT default to OFF --- CHANGES | 6 ++++++ CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d1a43c258..1ba7ab907 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,12 @@ This release contains contributions from (alphabetically by first name): ## 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. + ## Modules ## diff --git a/CMakeLists.txt b/CMakeLists.txt index b1b762172..882aafe6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,7 @@ option( INSTALL_CONFIG "Install configuration files" OFF ) option( INSTALL_POLKIT "Install Polkit configuration" ON ) option( BUILD_TESTING "Build the testing tree." ON ) option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) -option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." ON ) +option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) From 61b78d88953f01ec0933c50f21a6fb92df16446a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 11:46:08 +0200 Subject: [PATCH 12/44] [libcalamares] Stop job threads before exit - This solves a crash where the thread is destroyed while still running (e.g. cancelling during install). - The thread might not cooperate in being terminated, but then we have a bigger problem anyway (and Calamares will still crash on exit). FIXES #1164 --- src/libcalamares/JobQueue.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp index 6ef055ffc..3a76aa099 100644 --- a/src/libcalamares/JobQueue.cpp +++ b/src/libcalamares/JobQueue.cpp @@ -44,7 +44,7 @@ public: } virtual ~JobThread() override; - + void setJobs( const JobList& jobs ) { m_jobs = jobs; @@ -157,6 +157,14 @@ JobQueue::JobQueue( QObject* parent ) JobQueue::~JobQueue() { + if ( m_thread->isRunning() ) + { + m_thread->terminate(); + if ( !m_thread->wait(300) ) + cError() << "Could not terminate job thread (expect a crash now)."; + delete m_thread; + } + delete m_storage; } From 92d03c2cf7af34487c3a46f83671dbcc54506f95 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 12:10:22 +0200 Subject: [PATCH 13/44] [libcalamares] Introduce enum class for special process exit values - Replace magic numbers like -3 with named enum values (NoWorkingDirectory, for -3). - Downside is big-ugly static_casts, but that's what you get for having an int as return value for processes. --- .../utils/CalamaresUtilsSystem.cpp | 26 +++++++++---------- src/libcalamares/utils/CalamaresUtilsSystem.h | 24 +++++++++++------ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 1b603a7e7..0d227c88f 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -114,14 +114,14 @@ System::mount( const QString& devicePath, const QString& options ) { if ( devicePath.isEmpty() || mountPoint.isEmpty() ) - return -3; + return static_cast(ProcessResult::Code::NoWorkingDirectory); QDir mountPointDir( mountPoint ); if ( !mountPointDir.exists() ) { bool ok = mountPointDir.mkpath( mountPoint ); if ( !ok ) - return -3; + return static_cast(ProcessResult::Code::NoWorkingDirectory); } QString program( "mount" ); @@ -147,14 +147,14 @@ System::runCommand( QString output; if ( !Calamares::JobQueue::instance() ) - return -3; + return ProcessResult::Code::NoWorkingDirectory; Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); if ( ( location == System::RunLocation::RunInTarget ) && ( !gs || !gs->contains( "rootMountPoint" ) ) ) { cWarning() << "No rootMountPoint in global storage"; - return -3; + return ProcessResult::Code::NoWorkingDirectory; } QProcess process; @@ -167,7 +167,7 @@ System::runCommand( if ( !QDir( destDir ).exists() ) { cWarning() << "rootMountPoint points to a dir which does not exist"; - return -3; + return ProcessResult::Code::NoWorkingDirectory; } program = "chroot"; @@ -190,7 +190,7 @@ System::runCommand( process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); else cWarning() << "Invalid working directory:" << workingPath; - return -3; + return ProcessResult::Code::NoWorkingDirectory; } cDebug() << "Running" << program << RedactedList( arguments ); @@ -198,7 +198,7 @@ System::runCommand( if ( !process.waitForStarted() ) { cWarning() << "Process failed to start" << process.error(); - return -2; + return ProcessResult::Code::FailedToStart; } if ( !stdInput.isEmpty() ) @@ -211,7 +211,7 @@ System::runCommand( { cWarning().noquote().nospace() << "Timed out. Output so far:\n" << process.readAllStandardOutput(); - return -4; + return ProcessResult::Code::TimedOut; } output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() ); @@ -219,7 +219,7 @@ System::runCommand( if ( process.exitStatus() == QProcess::CrashExit ) { cWarning().noquote().nospace() << "Process crashed. Output so far:\n" << output; - return -1; + return ProcessResult::Code::Crashed; } auto r = process.exitCode(); @@ -306,22 +306,22 @@ ProcessResult::explainProcess( int ec, const QString& command, const QString& ou ? QCoreApplication::translate( "ProcessResult", "\nThere was no output from the command.") : (QCoreApplication::translate( "ProcessResult", "\nOutput:\n") + output); - if ( ec == -1 ) //Crash! + if ( ec == static_cast(ProcessResult::Code::Crashed) ) //Crash! return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command crashed." ), QCoreApplication::translate( "ProcessResult", "Command %1 crashed." ) .arg( command ) + outputMessage ); - if ( ec == -2 ) + if ( ec == static_cast(ProcessResult::Code::FailedToStart) ) return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command failed to start." ), QCoreApplication::translate( "ProcessResult", "Command %1 failed to start." ) .arg( command ) ); - if ( ec == -3 ) + if ( ec == static_cast(ProcessResult::Code::NoWorkingDirectory) ) return JobResult::error( QCoreApplication::translate( "ProcessResult", "Internal error when starting command." ), QCoreApplication::translate( "ProcessResult", "Bad parameters for process job call." ) ); - if ( ec == -4 ) + if ( ec == static_cast(ProcessResult::Code::TimedOut) ) return JobResult::error( QCoreApplication::translate( "ProcessResult", "External command failed to finish." ), QCoreApplication::translate( "ProcessResult", "Command %1 failed to finish in %2 seconds." ) .arg( command ) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.h b/src/libcalamares/utils/CalamaresUtilsSystem.h index 6809859ee..c17d52e93 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.h +++ b/src/libcalamares/utils/CalamaresUtilsSystem.h @@ -32,8 +32,16 @@ namespace CalamaresUtils class ProcessResult : public QPair< int, QString > { public: + enum class Code : int + { + Crashed = -1, // Must match special return values from QProcess + FailedToStart = -2, // Must match special return values from QProcess + NoWorkingDirectory = -3, + TimedOut = -4 + } ; + /** @brief Implicit one-argument constructor has no output, only a return code */ - ProcessResult( int r ) : QPair< int, QString >( r, QString() ) {} + ProcessResult( Code r ) : QPair< int, QString >( static_cast(r), QString() ) {} ProcessResult( int r, QString s ) : QPair< int, QString >( r, s ) {} int getExitCode() const { return first; } @@ -93,9 +101,9 @@ public: * @param filesystemName the name of the filesystem (optional). * @param options any additional options as passed to mount -o (optional). * @returns the program's exit code, or: - * -1 = QProcess crash - * -2 = QProcess cannot start - * -3 = bad arguments + * Crashed = QProcess crash + * FailedToStart = QProcess cannot start + * NoWorkingDirectory = bad arguments */ DLLEXPORT int mount( const QString& devicePath, const QString& mountPoint, @@ -120,10 +128,10 @@ public: * * @returns the program's exit code and its output (if any). Special * exit codes (which will never have any output) are: - * -1 = QProcess crash - * -2 = QProcess cannot start - * -3 = bad arguments - * -4 = QProcess timeout + * Crashed = QProcess crash + * FailedToStart = QProcess cannot start + * NoWorkingDirectory = bad arguments + * TimedOut = QProcess timeout */ static DLLEXPORT ProcessResult runCommand( RunLocation location, From 6055f08affb3e17085044fd14e7d157e558c0637 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 12:30:38 +0200 Subject: [PATCH 14/44] [libcalamares] Refactor ProcessJob - Use the system runCommand() instead of a 90% copy of it. This **does** change the overall command to `env /bin/sh -c` rather than running only `/bin/sh -c`, though. --- src/libcalamares/ProcessJob.cpp | 86 +++++---------------------------- src/libcalamares/ProcessJob.h | 7 +-- 2 files changed, 14 insertions(+), 79 deletions(-) diff --git a/src/libcalamares/ProcessJob.cpp b/src/libcalamares/ProcessJob.cpp index 3cf4eec49..bfdf19860 100644 --- a/src/libcalamares/ProcessJob.cpp +++ b/src/libcalamares/ProcessJob.cpp @@ -67,83 +67,23 @@ ProcessJob::prettyStatusMessage() const JobResult ProcessJob::exec() { - int ec = 0; - QString output; + using CalamaresUtils::System; + if ( m_runInChroot ) - ec = CalamaresUtils::System::instance()-> - targetEnvOutput( m_command, - output, + return CalamaresUtils::System::instance()-> + targetEnvCommand( { m_command }, m_workingPath, QString(), - m_timeoutSec ); + m_timeoutSec ) + .explainProcess( m_command, m_timeoutSec ); else - ec = callOutput( m_command, - output, - m_workingPath, - QString(), - m_timeoutSec ); - - return CalamaresUtils::ProcessResult::explainProcess( ec, m_command, output, m_timeoutSec ); -} - - -int -ProcessJob::callOutput( const QString& command, - QString& output, - const QString& workingPath, - const QString& stdInput, - int timeoutSec ) -{ - output.clear(); - - QProcess process; - process.setProgram( "/bin/sh" ); - process.setArguments( { "-c", command } ); - process.setProcessChannelMode( QProcess::MergedChannels ); - - if ( !workingPath.isEmpty() ) - { - if ( QDir( workingPath ).exists() ) - process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); - else - { - cWarning() << "Invalid working directory:" << workingPath; - return -3; - } - } - - cDebug() << "Running" << command; - process.start(); - if ( !process.waitForStarted() ) - { - cWarning() << "Process failed to start" << process.error(); - return -2; - } - - if ( !stdInput.isEmpty() ) - { - process.write( stdInput.toLocal8Bit() ); - process.closeWriteChannel(); - } - - if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) ) - { - cWarning() << "Timed out. output so far:"; - output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() ); - cWarning() << output; - return -4; - } - - output.append( QString::fromLocal8Bit( process.readAllStandardOutput() ).trimmed() ); - - if ( process.exitStatus() == QProcess::CrashExit ) - { - cWarning() << "Process crashed"; - return -1; - } - - cDebug() << "Finished. Exit code:" << process.exitCode(); - return process.exitCode(); + return + System::runCommand( System::RunLocation::RunInHost, + { "/bin/sh", "-c", m_command }, + m_workingPath, + QString(), + m_timeoutSec ) + .explainProcess( m_command, m_timeoutSec ); } } // namespace Calamares diff --git a/src/libcalamares/ProcessJob.h b/src/libcalamares/ProcessJob.h index d01dbb676..224ebdaf0 100644 --- a/src/libcalamares/ProcessJob.h +++ b/src/libcalamares/ProcessJob.h @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac - * Copyright 2017-2018, Adriaan de Groot + * Copyright 2017-2019, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,11 +40,6 @@ public: JobResult exec() override; private: - int callOutput( const QString& command, - QString& output, - const QString& workingPath = QString(), - const QString& stdInput = QString(), - int timeoutSec = 0 ); QString m_command; QString m_workingPath; bool m_runInChroot; From b587d77e31a7e95589918cbcef6654176216eb92 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 12:33:31 +0200 Subject: [PATCH 15/44] [libcalamares] Fix untranslatable string. - This would substitue an untranslated "in chroot" into the translated string, which is weird. --- src/libcalamares/ProcessJob.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/ProcessJob.cpp b/src/libcalamares/ProcessJob.cpp index bfdf19860..47fcee05d 100644 --- a/src/libcalamares/ProcessJob.cpp +++ b/src/libcalamares/ProcessJob.cpp @@ -48,10 +48,8 @@ ProcessJob::~ProcessJob() QString ProcessJob::prettyName() const { - //TODO: show something more meaningful - return tr( "Run command %1 %2" ) - .arg( m_command ) - .arg( m_runInChroot ? "in chroot." : " ." ); + return ( m_runInChroot ? tr( "Run command '%1' in target system." ) : tr( " Run command '%1'." ) ) + .arg( m_command ); } From d7f513412168a8fc614c2c93609fb54e131b34e2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 13:32:31 +0200 Subject: [PATCH 16/44] [libcalamares] Be more verbose in error situations - runCommand can return NoWorkingDirectory in multiple places, make sure the log contains a more specific reason. --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 0d227c88f..c74243ecc 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -114,14 +114,24 @@ System::mount( const QString& devicePath, const QString& options ) { if ( devicePath.isEmpty() || mountPoint.isEmpty() ) + { + if ( devicePath.isEmpty() ) + cWarning() << "Can't mount an empty device."; + if ( mountPoint.isEmpty() ) + cWarning() << "Can't mount on an empty mountpoint."; + return static_cast(ProcessResult::Code::NoWorkingDirectory); + } QDir mountPointDir( mountPoint ); if ( !mountPointDir.exists() ) { bool ok = mountPointDir.mkpath( mountPoint ); if ( !ok ) + { + cWarning() << "Could not create mountpoint" << mountPoint; return static_cast(ProcessResult::Code::NoWorkingDirectory); + } } QString program( "mount" ); @@ -147,7 +157,10 @@ System::runCommand( QString output; if ( !Calamares::JobQueue::instance() ) + { + cError() << "No JobQueue"; return ProcessResult::Code::NoWorkingDirectory; + } Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); if ( ( location == System::RunLocation::RunInTarget ) && From 07a59bd09cb3ec5c4737164d62f8a51cfcd4ec6e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 13:37:46 +0200 Subject: [PATCH 17/44] [libcalamares] All commands with workingDirectory failed - This is the same as EFAIL: a block is indented as if it's a multi- line else block. This isn't Python though, and the return always applies. - Add the necessary braces. - Apparently noone uses this code path (until ProcessJob was re- factored to do so). --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index c74243ecc..739249cd0 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -202,8 +202,10 @@ System::runCommand( if ( QDir( workingPath ).exists() ) process.setWorkingDirectory( QDir( workingPath ).absolutePath() ); else + { cWarning() << "Invalid working directory:" << workingPath; return ProcessResult::Code::NoWorkingDirectory; + } } cDebug() << "Running" << program << RedactedList( arguments ); From 5a835f32b8e9190dafc72b904f76ec7a474200dd Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 13:56:16 +0200 Subject: [PATCH 18/44] [libcalamares] Start extending tests to runCommand() --- src/libcalamares/Tests.cpp | 21 +++++++++++++++++++++ src/libcalamares/Tests.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/libcalamares/Tests.cpp b/src/libcalamares/Tests.cpp index 615cb51a7..40cb480e9 100644 --- a/src/libcalamares/Tests.cpp +++ b/src/libcalamares/Tests.cpp @@ -18,9 +18,12 @@ #include "Tests.h" +#include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" #include "utils/Yaml.h" +#include + #include QTEST_GUILESS_MAIN( LibCalamaresTests ) @@ -113,3 +116,21 @@ LibCalamaresTests::testLoadSaveYamlExtended() } QFile::remove( "out.yaml" ); } + +void +LibCalamaresTests::testCommands() +{ + using CalamaresUtils::System; + auto r = System::runCommand( + System::RunLocation::RunInHost, + { "/bin/ls", "/tmp" } + ); + + QVERIFY( r.getExitCode() == 0 ); + + QTemporaryFile tf( "/tmp/calamares-test-XXXXXX" ); + QVERIFY( tf.open() ); + QVERIFY( !tf.fileName().isEmpty() ); + + QVERIFY( r.getOutput().contains( tf.fileName() ) ); +} diff --git a/src/libcalamares/Tests.h b/src/libcalamares/Tests.h index 8d0aee1ff..5cdb3912b 100644 --- a/src/libcalamares/Tests.h +++ b/src/libcalamares/Tests.h @@ -34,6 +34,8 @@ private Q_SLOTS: void testLoadSaveYaml(); // Just settings.conf void testLoadSaveYamlExtended(); // Do a find() in the src dir + + void testCommands(); }; #endif From 7be33b8196758c72c023a77f30ce335e4d96b5d2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 15:53:27 +0200 Subject: [PATCH 19/44] [libcalamares] runCommand doesn't need queue or settings - JobQueue is only needed to get global settings, which are needed when running in the target; for host commands, allow running without a queue. - Settings is needed for the value of debugsettings; assume if there's no settings object, that we're in a test and should print debugging information. --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index 739249cd0..e2c6e9dec 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -156,13 +156,8 @@ System::runCommand( { QString output; - if ( !Calamares::JobQueue::instance() ) - { - cError() << "No JobQueue"; - return ProcessResult::Code::NoWorkingDirectory; - } + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); if ( ( location == System::RunLocation::RunInTarget ) && ( !gs || !gs->contains( "rootMountPoint" ) ) ) { @@ -239,7 +234,8 @@ System::runCommand( auto r = process.exitCode(); cDebug() << "Finished. Exit code:" << r; - if ( ( r != 0 ) || Calamares::Settings::instance()->debugMode() ) + bool showDebug = ( !Calamares::Settings::instance() ) || ( Calamares::Settings::instance()->debugMode() ); + if ( ( r != 0 ) || showDebug ) { cDebug() << "Target cmd:" << RedactedList( args ); cDebug().noquote().nospace() << "Target output:\n" << output; From 4e13f780f188440c83d7b0c095aec05c93ea636c Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 16:00:37 +0200 Subject: [PATCH 20/44] [libcalamares] Expand tests for runCommand - try both with and without a working-directory set, this would have shown up the problem with bad indentation much earlier. --- src/libcalamares/Tests.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libcalamares/Tests.cpp b/src/libcalamares/Tests.cpp index 40cb480e9..3b7624537 100644 --- a/src/libcalamares/Tests.cpp +++ b/src/libcalamares/Tests.cpp @@ -132,5 +132,29 @@ LibCalamaresTests::testCommands() QVERIFY( tf.open() ); QVERIFY( !tf.fileName().isEmpty() ); - QVERIFY( r.getOutput().contains( tf.fileName() ) ); + QFileInfo tfn( tf.fileName() ); + QVERIFY( !r.getOutput().contains( tfn.fileName() ) ); + + // Run ls again, now that the file exists + r = System::runCommand( + System::RunLocation::RunInHost, + { "/bin/ls", "/tmp" } + ); + QVERIFY( r.getOutput().contains( tfn.fileName() ) ); + + // .. and without a working directory set, assume builddir != /tmp + r = System::runCommand( + System::RunLocation::RunInHost, + { "/bin/ls" } + ); + QVERIFY( !r.getOutput().contains( tfn.fileName() ) ); + + r = System::runCommand( + System::RunLocation::RunInHost, + { "/bin/ls" }, + "/tmp" + ); + QVERIFY( r.getOutput().contains( tfn.fileName() ) ); + + } From 4f221b41d196cc3527cedeabb77a9d1cc0fd1167 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 16:11:54 +0200 Subject: [PATCH 21/44] [libcalamares] Close stdin on process jobs - This avoids processes that wait on stdin, and e.g. improves reaction to having just "cat" (no file) in a command, or a package manager that asks for input. --- src/libcalamares/utils/CalamaresUtilsSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/utils/CalamaresUtilsSystem.cpp b/src/libcalamares/utils/CalamaresUtilsSystem.cpp index e2c6e9dec..5990fbc42 100644 --- a/src/libcalamares/utils/CalamaresUtilsSystem.cpp +++ b/src/libcalamares/utils/CalamaresUtilsSystem.cpp @@ -214,8 +214,8 @@ System::runCommand( if ( !stdInput.isEmpty() ) { process.write( stdInput.toLocal8Bit() ); - process.closeWriteChannel(); } + process.closeWriteChannel(); if ( !process.waitForFinished( timeoutSec ? ( timeoutSec * 1000 ) : -1 ) ) { From c233bbb23df6464634e9a5ecf307b9729995f158 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 21:54:07 +0200 Subject: [PATCH 22/44] [libcalamaresui] Handle no-finished-page scenarios - From an exec section, next() is called automatically when all the jobs in that section are done. - If there **is** no next section (e.g. there's no finished page to show after the exec), then m_steps.at() would assert on an out-of-range index. - Introdcuce a helper predicate isAtVeryEnd() which handles both out-of-range and normal at-the-end scenarios. - If there's no page following the exec section, stay with the slideshow but update buttons to match the normal last-page behavior, and don't ask about cancel (since we're done). --- src/libcalamaresui/ViewManager.cpp | 33 ++++++++++++++++++++++-------- src/libcalamaresui/ViewManager.h | 7 ++++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 508581b4e..3a5d24feb 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -283,18 +283,35 @@ ViewManager::next() } m_currentStep++; - m_stack->setCurrentIndex( m_currentStep ); + + m_stack->setCurrentIndex( m_currentStep ); // Does nothing if out of range step->onLeave(); - m_steps.at( m_currentStep )->onActivate(); - executing = qobject_cast< ExecutionViewStep* >( m_steps.at( m_currentStep ) ) != nullptr; - emit currentStepChanged(); + + if ( m_currentStep < m_steps.count() ) + { + m_steps.at( m_currentStep )->onActivate(); + executing = qobject_cast< ExecutionViewStep* >( m_steps.at( m_currentStep ) ) != nullptr; + emit currentStepChanged(); + } + else + { + // Reached the end in a weird state (e.g. no finished step after an exec) + executing = false; + m_next->setEnabled( false ); + m_back->setEnabled( false ); + } updateCancelEnabled( !settings->disableCancel() && !(executing && settings->disableCancelDuringExec() ) ); } else + { step->next(); + } - m_next->setEnabled( !executing && m_steps.at( m_currentStep )->isNextEnabled() ); - m_back->setEnabled( !executing && m_steps.at( m_currentStep )->isBackEnabled() ); + if ( m_currentStep < m_steps.count() ) + { + m_next->setEnabled( !executing && m_steps.at( m_currentStep )->isNextEnabled() ); + m_back->setEnabled( !executing && m_steps.at( m_currentStep )->isBackEnabled() ); + } updateButtonLabels(); } @@ -320,7 +337,7 @@ ViewManager::updateButtonLabels() else m_next->setText( tr( "&Next" ) ); - if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() ) + if ( isAtVeryEnd() ) { m_quit->setText( tr( "&Done" ) ); m_quit->setToolTip( complete ); @@ -368,7 +385,7 @@ bool ViewManager::confirmCancelInstallation() const auto* const settings = Calamares::Settings::instance(); // When we're at the very end, then it's always OK to exit. - if ( m_currentStep == m_steps.count() -1 && m_steps.last()->isAtEnd() ) + if ( isAtVeryEnd() ) return true; // Not at the very end, cancel/quit might be disabled diff --git a/src/libcalamaresui/ViewManager.h b/src/libcalamaresui/ViewManager.h index 50e8d1dc4..c9f554ee8 100644 --- a/src/libcalamaresui/ViewManager.h +++ b/src/libcalamaresui/ViewManager.h @@ -130,7 +130,12 @@ private: void insertViewStep( int before, ViewStep* step ); void updateButtonLabels(); void updateCancelEnabled( bool enabled ); - + + bool isAtVeryEnd() const + { + return ( m_currentStep >= m_steps.count() ) || ( m_currentStep == m_steps.count() - 1 && m_steps.last()->isAtEnd() ); + } + static ViewManager* s_instance; ViewStepList m_steps; From 64ef331562001455bcc51d0d1a3e076d2cf9b2b0 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 21:58:35 +0200 Subject: [PATCH 23/44] Changes: document bugfix --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 1ba7ab907..5fdba303f 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,10 @@ This release contains contributions from (alphabetically by first name): 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). ## Modules ## From 3548792d1b04db46a97a66f6d5734b4986333880 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 22:51:33 +0200 Subject: [PATCH 24/44] [partition] Improve check canBeResized - Report the globalSettings name properly (with "GiB") - Bail out on bad conversion early. --- src/modules/partition/core/PartUtils.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 7b44d3d64..f54cca499 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -148,20 +148,23 @@ canBeResized( Partition* candidate ) ->globalStorage() ->value( "requiredStorageGiB" ) .toDouble( &ok ); + if ( !ok ) + { + cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly."; + return false; + } + // We require a little more for partitioning overhead and swap file double advisedStorageGB = requiredStorageGB + 0.5 + 2.0; qint64 availableStorageB = candidate->available(); - qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGB ); - if ( ok && - availableStorageB > advisedStorageB ) + if ( availableStorageB > advisedStorageB ) { cDebug() << "Partition" << convenienceName( candidate ) << "authorized for resize + autopartition install."; - return true; } - else if ( ok ) + else { Logger::CDebug deb; deb << Logger::SubEntry << "NO, insufficient storage"; @@ -173,11 +176,6 @@ canBeResized( Partition* candidate ) << "sectorsUsed:" << candidate->sectorsUsed() << "fsType:" << candidate->fileSystem().name(); return false; } - else - { - cDebug() << Logger::SubEntry << "NO, requiredStorageGB is not set correctly."; - return false; - } } From acf3dbcdcbae1cbf63f7ccb3b828cc867a52577f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 22:55:50 +0200 Subject: [PATCH 25/44] [partition] Refactor getting the globalStorage value --- src/modules/partition/core/PartUtils.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index f54cca499..49a54cc6e 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -62,6 +62,13 @@ convenienceName( const Partition* const candidate ) return p; } +/** @brief Get the globalStorage setting for required space. */ +static double +getRequiredStorageGiB( bool& ok ) +{ + return Calamares::JobQueue::instance()->globalStorage()->value( "requiredStorageGiB" ).toDouble( &ok ); +} + bool canBeReplaced( Partition* candidate ) { @@ -72,10 +79,7 @@ canBeReplaced( Partition* candidate ) return false; bool ok = false; - double requiredStorageGB = Calamares::JobQueue::instance() - ->globalStorage() - ->value( "requiredStorageGiB" ) - .toDouble( &ok ); + double requiredStorageGB = getRequiredStorageGiB( ok ); qint64 availableStorageB = candidate->capacity(); qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024; @@ -144,10 +148,7 @@ canBeResized( Partition* candidate ) } bool ok = false; - double requiredStorageGB = Calamares::JobQueue::instance() - ->globalStorage() - ->value( "requiredStorageGiB" ) - .toDouble( &ok ); + double requiredStorageGB = getRequiredStorageGiB( ok ); if ( !ok ) { cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly."; From 962776804c504d7e0cdb08b6088dbb410c5c9124 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 23:01:18 +0200 Subject: [PATCH 26/44] [libcalamares] Add BytesToGiB (extends BytesToMiB) --- src/libcalamares/utils/Units.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libcalamares/utils/Units.h b/src/libcalamares/utils/Units.h index e6d46aaed..8fb34c3e0 100644 --- a/src/libcalamares/utils/Units.h +++ b/src/libcalamares/utils/Units.h @@ -78,6 +78,11 @@ constexpr int BytesToMiB( qint64 b ) return int( b / 1024 / 1024 ); } +constexpr int BytesToGiB( qint64 b ) +{ + return int( b / 1024 / 1024 / 1024 ); +} + constexpr qint64 alignBytesToBlockSize( qint64 bytes, qint64 blocksize ) { qint64 blocks = bytes / blocksize; From 79934aa51304e288d95ae614929a0a37685046ef Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 23:04:24 +0200 Subject: [PATCH 27/44] [partition] Use GiB consistently in code --- src/modules/partition/core/PartUtils.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 49a54cc6e..22139b8e4 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -148,7 +148,7 @@ canBeResized( Partition* candidate ) } bool ok = false; - double requiredStorageGB = getRequiredStorageGiB( ok ); + double requiredStorageGiB = getRequiredStorageGiB( ok ); if ( !ok ) { cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly."; @@ -156,9 +156,9 @@ canBeResized( Partition* candidate ) } // We require a little more for partitioning overhead and swap file - double advisedStorageGB = requiredStorageGB + 0.5 + 2.0; + double advisedStorageGiB = requiredStorageGiB + 0.5 + 2.0; qint64 availableStorageB = candidate->available(); - qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGB ); + qint64 advisedStorageB = CalamaresUtils::GiBtoBytes( advisedStorageGiB ); if ( availableStorageB > advisedStorageB ) { @@ -170,9 +170,9 @@ canBeResized( Partition* candidate ) Logger::CDebug deb; deb << Logger::SubEntry << "NO, insufficient storage"; deb << Logger::Continuation << "Required storage B:" << advisedStorageB - << QString( "(%1GB)" ).arg( advisedStorageGB ); + << QString( "(%1GiB)" ).arg( advisedStorageGiB ); deb << Logger::Continuation << "Available storage B:" << availableStorageB - << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ) + << QString( "(%1GiB)" ).arg( CalamaresUtils::BytesToGiB( availableStorageB ) ) << "for" << convenienceName( candidate ) << "length:" << candidate->length() << "sectorsUsed:" << candidate->sectorsUsed() << "fsType:" << candidate->fileSystem().name(); return false; From b5c50c8d049010b271175ab23cdedf92d10c3a49 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 7 Jun 2019 23:19:24 +0200 Subject: [PATCH 28/44] [partition] Update canBeReplaced - Use GiB consistently - Provide same kind of debugging information as canBeResized() --- src/modules/partition/core/PartUtils.cpp | 36 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/modules/partition/core/PartUtils.cpp b/src/modules/partition/core/PartUtils.cpp index 22139b8e4..562474865 100644 --- a/src/modules/partition/core/PartUtils.cpp +++ b/src/modules/partition/core/PartUtils.cpp @@ -73,30 +73,44 @@ bool canBeReplaced( Partition* candidate ) { if ( !candidate ) + { + cDebug() << "Partition* is NULL"; return false; + } + cDebug() << "Checking if" << convenienceName( candidate ) << "can be replaced."; if ( candidate->isMounted() ) + { + cDebug() << Logger::SubEntry << "NO, it is mounted."; return false; + } bool ok = false; - double requiredStorageGB = getRequiredStorageGiB( ok ); + double requiredStorageGiB = getRequiredStorageGiB( ok ); + if ( !ok ) + { + cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly."; + return false; + } qint64 availableStorageB = candidate->capacity(); - qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024; - cDebug() << "Required storage B:" << requiredStorageB - << QString( "(%1GB)" ).arg( requiredStorageB / 1024 / 1024 / 1024 ); - cDebug() << "Storage capacity B:" << availableStorageB - << QString( "(%1GB)" ).arg( availableStorageB / 1024 / 1024 / 1024 ) - << "for" << convenienceName( candidate ) << " length:" << candidate->length(); + qint64 requiredStorageB = CalamaresUtils::GiBtoBytes( requiredStorageGiB + 0.5 ); - if ( ok && - availableStorageB > requiredStorageB ) + if ( availableStorageB > requiredStorageB ) { cDebug() << "Partition" << convenienceName( candidate ) << "authorized for replace install."; - return true; } - return false; + else + { + Logger::CDebug deb; + deb << Logger::SubEntry << "NO, insufficient storage"; + deb << Logger::Continuation << "Required storage B:" << requiredStorageB + << QString( "(%1GiB)" ).arg( requiredStorageGiB ); + deb << Logger::Continuation << "Available storage B:" << availableStorageB + << QString( "(%1GiB)" ).arg( CalamaresUtils::BytesToGiB( availableStorageB ) ); + return false; + } } From e6a2cb607f56054dc3f8e9024267da82b8f92093 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 07:48:47 -0400 Subject: [PATCH 29/44] [partition] Add setting for requiredstorage - If the welcome module isn't used, can set a required amount of storage for the installation here. --- src/modules/partition/gui/PartitionViewStep.cpp | 4 ++++ src/modules/partition/gui/PartitionViewStep.h | 2 ++ src/modules/partition/partition.conf | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index 58fa17674..f94a48829 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -69,6 +69,7 @@ PartitionViewStep::PartitionViewStep( QObject* parent ) , m_widget( new QStackedWidget() ) , m_choicePage( nullptr ) , m_manualPartitionPage( nullptr ) + , m_requiredStorageGiB( 0.0 ) { m_widget->setContentsMargins( 0, 0, 0, 0 ); @@ -564,6 +565,9 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap ) m_swapChoices = choices; + // Settings that overlap with the Welcome module + m_requiredStorageGiB = CalamaresUtils::getDouble( configurationMap, "requiredStorage", -1.0 ); + // These gs settings seem to be unused (in upstream Calamares) outside of // the partition module itself. gs->insert( "ensureSuspendToDisk", ensureSuspendToDisk ); diff --git a/src/modules/partition/gui/PartitionViewStep.h b/src/modules/partition/gui/PartitionViewStep.h index e3d058e67..0a62b3aa3 100644 --- a/src/modules/partition/gui/PartitionViewStep.h +++ b/src/modules/partition/gui/PartitionViewStep.h @@ -86,6 +86,8 @@ private: QFutureWatcher* m_future; QSet< PartitionActions::Choices::SwapChoice > m_swapChoices; + + qreal m_requiredStorageGiB; // May duplicate setting in the welcome module }; CALAMARES_PLUGIN_FACTORY_DECLARATION( PartitionViewStepFactory ) diff --git a/src/modules/partition/partition.conf b/src/modules/partition/partition.conf index 42d1f2ce2..385269fc7 100644 --- a/src/modules/partition/partition.conf +++ b/src/modules/partition/partition.conf @@ -120,3 +120,15 @@ defaultFileSystemType: "ext4" # % of the available drive space if a '%' is appended to the value # - minSize: minimum partition size (optional parameter) # - maxSize: maximum partition size (optional parameter) + +# Checking for available storage +# +# This overlaps with the setting of the same name in the welcome module's +# requirements section. If nothing is set by the welcome module, this +# value is used instead. It is still a problem if there is no required +# size set at all, and the replace and resize options will not be offered +# if no required size is set. +# +# The value is in Gibibytes (GiB). +# +# requiredStorage: 3.5 From 20c0256932ccf738227f210c05ae41ba9c670ef7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 08:19:08 -0400 Subject: [PATCH 30/44] CI: update AppImage configs - Use GiB terminology like the example configs already do, to match commit 599b34c7 --- data/config-appimage/modules/welcome.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/config-appimage/modules/welcome.conf b/data/config-appimage/modules/welcome.conf index 8dae3e957..0cfb59546 100644 --- a/data/config-appimage/modules/welcome.conf +++ b/data/config-appimage/modules/welcome.conf @@ -15,12 +15,12 @@ showReleaseNotesUrl: true # that are checked. They may not match with the actual requirements # imposed by other modules in the system. requirements: - # Amount of available disk, in GB. Floating-point is allowed here. + # Amount of available disk, in GiB. Floating-point is allowed here. # Note that this does not account for *usable* disk, so it is possible # to pass this requirement, yet have no space to install to. requiredStorage: 5.5 - # Amount of available RAM, in GB. Floating-point is allowed here. + # Amount of available RAM, in GiB. Floating-point is allowed here. requiredRam: 1.0 # To check for internet connectivity, Calamares does a HTTP GET From 74432f698f9765ae779ac2829572d6d1e715b696 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 08:12:28 -0400 Subject: [PATCH 31/44] [partition] Allow the requiredStorage setting to propagate - store into globalStorage if the welcome module hasn't already done so. - this ends up used in PartUtils (via globalStorage). --- src/modules/partition/gui/PartitionViewStep.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index f94a48829..8a190b68a 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -372,6 +372,14 @@ PartitionViewStep::isAtEnd() const void PartitionViewStep::onActivate() { + // If there's no setting (e.g. from the welcome page) for required storage + // then use ours, if it was set. + auto* gs = Calamares::JobQueue::instance() ? Calamares::JobQueue::instance()->globalStorage() : nullptr; + if ( m_requiredStorageGiB >= 0.0 && gs && !gs->contains( "requiredStorageGiB" ) ) + { + gs->insert( "requiredStorageGiB", m_requiredStorageGiB ); + } + // if we're coming back to PVS from the next VS if ( m_widget->currentWidget() == m_choicePage && m_choicePage->currentChoice() == ChoicePage::Alongside ) From 1a29555ce0b44ca52a8970225d0dec2bf4153ab6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 14:39:17 +0200 Subject: [PATCH 32/44] Changes: document new partition setting --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 5fdba303f..395e9312e 100644 --- a/CHANGES +++ b/CHANGES @@ -21,6 +21,10 @@ This release contains contributions from (alphabetically by first name): ## Modules ## + - *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) # From 7bda89dac4d5591c570cd8f1dd398e91b96813db Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 14:39:38 +0200 Subject: [PATCH 33/44] Changes: mention issue number in the notes --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 5fdba303f..6747ba626 100644 --- a/CHANGES +++ b/CHANGES @@ -17,7 +17,7 @@ This release contains contributions from (alphabetically by first name): - 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). + the restart-now functionality). #1168 ## Modules ## From 0d507ec2651fcfa98ea4834ed6590350e08a1920 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 8 Jun 2019 17:20:13 +0200 Subject: [PATCH 34/44] [calamares] Tidy up application code - remove commented code, fix logging around it - misplaced include --- src/calamares/CalamaresApplication.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 704cde71c..2593518fa 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with Calamares. If not, see . */ -#include #include "CalamaresApplication.h" #include "CalamaresConfig.h" @@ -37,6 +36,7 @@ #include "viewpages/ViewStep.h" #include "ViewManager.h" +#include #include #include @@ -90,16 +90,8 @@ CalamaresApplication::init() CalamaresApplication::~CalamaresApplication() { - cDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares..."; - -// if ( JobQueue::instance() ) -// JobQueue::instance()->stop(); - -// delete m_mainwindow; - -// delete JobQueue::instance(); - - cDebug( Logger::LOGVERBOSE ) << "Finished shutdown."; + cLog( Logger::LOGVERBOSE ) << "Shutting down Calamares..."; + cLog( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown."; } From 39675655a0f52f38e27381aabf689d916bb4bd00 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 10:30:19 +0200 Subject: [PATCH 35/44] [calamares] Tidy up include-guard comments --- src/calamares/CalamaresApplication.h | 2 +- src/calamares/CalamaresWindow.h | 2 +- src/calamares/progresstree/ProgressTreeDelegate.h | 2 +- src/calamares/progresstree/ProgressTreeItem.h | 2 +- src/calamares/progresstree/ProgressTreeModel.h | 2 +- src/calamares/progresstree/ProgressTreeView.h | 2 +- src/calamares/progresstree/ViewStepItem.h | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/calamares/CalamaresApplication.h b/src/calamares/CalamaresApplication.h index 9f53726ae..f337c54e5 100644 --- a/src/calamares/CalamaresApplication.h +++ b/src/calamares/CalamaresApplication.h @@ -82,4 +82,4 @@ private: bool m_debugMode; }; -#endif //CALAMARESAPPLICATION_H +#endif // CALAMARESAPPLICATION_H diff --git a/src/calamares/CalamaresWindow.h b/src/calamares/CalamaresWindow.h index faca8974a..310aa3eab 100644 --- a/src/calamares/CalamaresWindow.h +++ b/src/calamares/CalamaresWindow.h @@ -55,4 +55,4 @@ private: Calamares::ViewManager* m_viewManager; }; -#endif //CALAMARESWINDOW_H +#endif // CALAMARESWINDOW_H diff --git a/src/calamares/progresstree/ProgressTreeDelegate.h b/src/calamares/progresstree/ProgressTreeDelegate.h index 83b281696..554824e06 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.h +++ b/src/calamares/progresstree/ProgressTreeDelegate.h @@ -45,4 +45,4 @@ private: const QModelIndex& index ) const; }; -#endif // PROGRESSTREEDELEGATE_H +#endif // PROGRESSTREEDELEGATE_H diff --git a/src/calamares/progresstree/ProgressTreeItem.h b/src/calamares/progresstree/ProgressTreeItem.h index c7d7fcf05..fd93ab0ef 100644 --- a/src/calamares/progresstree/ProgressTreeItem.h +++ b/src/calamares/progresstree/ProgressTreeItem.h @@ -57,4 +57,4 @@ public: virtual QVariant data( int role ) const; }; -#endif // PROGRESSTREEITEM_H +#endif // PROGRESSTREEITEM_H diff --git a/src/calamares/progresstree/ProgressTreeModel.h b/src/calamares/progresstree/ProgressTreeModel.h index 0e9574516..e424f9d8d 100644 --- a/src/calamares/progresstree/ProgressTreeModel.h +++ b/src/calamares/progresstree/ProgressTreeModel.h @@ -57,4 +57,4 @@ private: ProgressTreeRoot* m_rootItem; }; -#endif // PROGRESSTREEMODEL_H +#endif // PROGRESSTREEMODEL_H diff --git a/src/calamares/progresstree/ProgressTreeView.h b/src/calamares/progresstree/ProgressTreeView.h index 68787984a..0b48a5f2a 100644 --- a/src/calamares/progresstree/ProgressTreeView.h +++ b/src/calamares/progresstree/ProgressTreeView.h @@ -48,4 +48,4 @@ private: ProgressTreeDelegate* m_delegate; }; -#endif // PROGRESSTREEVIEW_H +#endif // PROGRESSTREEVIEW_H diff --git a/src/calamares/progresstree/ViewStepItem.h b/src/calamares/progresstree/ViewStepItem.h index ea473fe5e..5a7c79b4a 100644 --- a/src/calamares/progresstree/ViewStepItem.h +++ b/src/calamares/progresstree/ViewStepItem.h @@ -51,4 +51,4 @@ private: }; -#endif // VIEWSTEPITEM_H +#endif // VIEWSTEPITEM_H From 0a1b27fcfa912ec117dc69c9c72facb5d183022f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 11:18:48 +0200 Subject: [PATCH 36/44] CI: add clang-format as a tool - update the style guide to require braces around blocks - add a clang-format file that is pretty close to the astyle configuration --- .clang-format | 33 +++++++++++++++++++++++++++++++++ ci/HACKING.md | 12 ++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..1eb0867e1 --- /dev/null +++ b/.clang-format @@ -0,0 +1,33 @@ +--- +BasedOnStyle: WebKit + +AlignAfterOpenBracket: Align +AllowAllParametersOfDeclarationOnNextLine: 'false' +AllowShortFunctionsOnASingleLine: Inline +AllowShortIfStatementsOnASingleLine: 'false' +AllowShortLoopsOnASingleLine: 'false' +AlwaysBreakAfterDefinitionReturnType: All +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: 'false' +BinPackParameters: 'false' +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: 'true' +BreakConstructorInitializers: BeforeComma +ColumnLimit: 120 +Cpp11BracedListStyle: 'false' +FixNamespaceComments: 'true' +IncludeBlocks: Preserve +IndentWidth: '4' +MaxEmptyLinesToKeep: '2' +NamespaceIndentation: Inner +PointerAlignment: Left +ReflowComments: 'false' +SortIncludes: 'true' +SpaceAfterCStyleCast: 'false' +SpacesBeforeTrailingComments: '2' +SpacesInAngles: 'true' +SpacesInParentheses: 'true' +SpacesInSquareBrackets: 'true' +Standard: Cpp11 + +... diff --git a/ci/HACKING.md b/ci/HACKING.md index f2e6308d1..10d1ac46b 100644 --- a/ci/HACKING.md +++ b/ci/HACKING.md @@ -56,7 +56,7 @@ some PEP8 guidelines. * For pointer and reference variable declarations, put a space before the variable name and no space between the type and the `*` or `&`, e.g. `int* p`. * `for`, `if`, `else`, `while` and similar statements put the braces on the next line, - if the following block is more than one statement. Use no braces for single statements. + if the following block is more than one statement. Always use braces. * Function and class definitions have their braces on separate lines. * A function implementation's return type is on its own line. * `CamelCase.{cpp,h}` style file names. @@ -86,9 +86,13 @@ MyClass::myMethod( QStringList list, const QString& name ) } ``` -You can use the `ci/calamaresstyle` script to run -[astyle](http://astyle.sf.net) on your code and have it formatted the right -way. +You can use `clang-format` (version 7) to have Calamares sources formatted +the right way. There is a `.clang-format` file that specifies the details. +In general: +``` + $ clang-format-7 -i -style=file +``` +` **NOTE:** An .editorconfig file is included to assist with formatting. In order to take advantage of this functionality you will need to acquire the From 94bea9baaf40cd99f4207d2492f6833ee970260b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 10:45:31 +0200 Subject: [PATCH 37/44] CI: update documentation of debug-levels --- ci/HACKING.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ci/HACKING.md b/ci/HACKING.md index 10d1ac46b..1ffa4db8d 100644 --- a/ci/HACKING.md +++ b/ci/HACKING.md @@ -184,14 +184,18 @@ connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this] Debugging --------- Use `cDebug()` and `cLog()` from `utils/Logger.h`. You can pass a debug-level to -either macro (1 is debugging, higher is less important). Use `cLog()` for warning -messages. It is recommended to add *WARNING* as the first part of a warning -message. +either macro (6 is debugging, higher is less important). Use `cWarning()` for warning +messages (equivalent to level 2) and `cError()` for errors (level 1). Warnings +and errors will add relevant text automatically. See `libcalamares/utils/Logger.h` +for details. For log messages that are continued across multiple calls to `cDebug()`, in particular listing things, conventional formatting is as follows: * End the first debug message with ` ..` -* Indent following lines with ` ..` +* Start the next debug message by outputting `Logger::SubEntry` + +For single-outputs that need to be split across multiplt lines, +output `Logger::Continuation`. Commit Messages From 54c3adb466844d8ad81f5bdddaf532369bd00469 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 11:50:36 +0200 Subject: [PATCH 38/44] CI: add brackets to one-line blocks - since we mix Python (indentation is important) with C++ (it isn't), having indented one-line blocks which suddenly need {} when a statment is added is confusing and error-prone. Instead, make the blocks explicit, always, in C++. --- ci/astylerc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/astylerc b/ci/astylerc index 043e81f0f..7fb769a9d 100644 --- a/ci/astylerc +++ b/ci/astylerc @@ -5,7 +5,7 @@ indent=spaces=4 # Brackets style=break -remove-brackets # Remove brackets on single-line `if` and `for` (requires astyle 2.04) +add-brackets # Spaces pad-paren-in From 8053bf6f3a2df7f8f710d163bc26df00f52e1668 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 12:51:33 +0200 Subject: [PATCH 39/44] CI: use both tools for code-formatting - astyle can do some things that clang-format doesn't (e.g. adding brackets; you need clang-tidy for that), - clang-format does a much nicer job with lambdas and certain other constructions, - allow passing in directories at a time for formatting. --- ci/calamaresstyle | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/ci/calamaresstyle b/ci/calamaresstyle index 2bb9b2578..11c587ada 100755 --- a/ci/calamaresstyle +++ b/ci/calamaresstyle @@ -1,6 +1,42 @@ #!/bin/sh +# # Calls astyle with settings matching Calamares coding style -# Requires astyle >= 2.04 +# Requires astyle >= 2.04 and clang-format-7 +# +# You can pass in directory names, in which case the files +# in that directory (NOT below it) are processed. +# set -e -astyle --options=$(dirname $0)/astylerc "$@" +AS=$( which astyle ) +CF=$( which clang-format-7 ) + +test -n "$AS" || { echo "! No astyle found in PATH"; exit 1 ; } +test -n "$CF" || { echo "! No clang-format-7 found in PATH"; exit 1 ; } +test -x "$AS" || { echo "! $AS is not executable."; exit 1 ; } +test -x "$CF" || { echo "! $CF is not executable."; exit 1 ; } + +any_dirs=no +for d in "$@" +do + test -d "$d" && any_dirs=yes +done + +style_some() +{ + $AS --options=$(dirname $0)/astylerc --quiet "$@" + $CF -i -style=file "$@" +} + +if test "x$any_dirs" = "xyes" ; then + for d in "$@" + do + if test -d "$@" ; then + style_some $( find "$d" -maxdepth 1 -type f -name '*.cpp' -o -name '*.h' ) + else + style_some "$d" + fi + done +else + style_some "$@" +fi From 9235499f7f0c688c379fa0307f8a3a912b278359 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 13:19:53 +0200 Subject: [PATCH 40/44] [calamares] Reformat the progresstree - add { } to single-line blocks - group some includes better - lines broken at a different length, some shuffling around of parameter lists. --- .../progresstree/ProgressTreeDelegate.cpp | 45 +++++++++++-------- .../progresstree/ProgressTreeDelegate.h | 11 ++--- .../progresstree/ProgressTreeItem.cpp | 8 ++-- .../progresstree/ProgressTreeModel.cpp | 44 +++++++++++++++--- .../progresstree/ProgressTreeView.cpp | 25 +++++------ src/calamares/progresstree/ViewStepItem.cpp | 18 ++++---- src/calamares/progresstree/ViewStepItem.h | 3 +- 7 files changed, 94 insertions(+), 60 deletions(-) diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index 67dfeebda..5fb9dbf8b 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -20,23 +20,28 @@ #include "ProgressTreeDelegate.h" #include "ProgressTreeModel.h" -#include "Branding.h" #include "CalamaresApplication.h" #include "CalamaresWindow.h" +#include "Branding.h" #include "utils/CalamaresUtilsGui.h" #include static constexpr int const item_margin = 8; -static inline int item_fontsize() { return CalamaresUtils::defaultFontSize() + 4; } +static inline int +item_fontsize() +{ + return CalamaresUtils::defaultFontSize() + 4; +} QSize -ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, - const QModelIndex& index ) const +ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const { if ( !index.isValid() ) + { return option.rect.size(); + } QFont font = qApp->font(); @@ -51,9 +56,7 @@ ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, void -ProgressTreeDelegate::paint( QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index) const +ProgressTreeDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { QStyleOptionViewItem opt = option; @@ -62,10 +65,9 @@ ProgressTreeDelegate::paint( QPainter* painter, 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 ) ) ); + painter->setBrush( + QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ) ); + painter->setPen( QColor( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarText ) ) ); paintViewStep( painter, opt, index ); @@ -89,14 +91,17 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter, if ( isCurrent ) { - painter->setPen( Calamares::Branding::instance()-> - styleString( Calamares::Branding::SidebarTextSelect ) ); - QString textHighlight = Calamares::Branding::instance()-> - styleString( Calamares::Branding::SidebarTextHighlight ); + painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextSelect ) ); + QString textHighlight + = Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextHighlight ); if ( textHighlight.isEmpty() ) + { painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().background() ); + } else + { painter->setBrush( QColor( textHighlight ) ); + } } @@ -114,17 +119,19 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter, shrinkSteps++; QRectF boundingBox; - painter->drawText( textRect, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, index.data().toString(), &boundingBox ); + painter->drawText( + textRect, Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingleLine, index.data().toString(), &boundingBox ); // The extra check here is to avoid the changing-font-size if we're not going to use // it in the next iteration of the loop anyway. - if ( ( shrinkSteps <= maximumShrink ) && (boundingBox.width() > textRect.width() ) ) + if ( ( shrinkSteps <= maximumShrink ) && ( boundingBox.width() > textRect.width() ) ) { font.setPointSize( item_fontsize() - shrinkSteps ); painter->setFont( font ); } else + { break; // It fits - } - while ( shrinkSteps <= maximumShrink ); + } + } while ( shrinkSteps <= maximumShrink ); } diff --git a/src/calamares/progresstree/ProgressTreeDelegate.h b/src/calamares/progresstree/ProgressTreeDelegate.h index 554824e06..d36bd4d14 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.h +++ b/src/calamares/progresstree/ProgressTreeDelegate.h @@ -33,16 +33,11 @@ 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; + 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; + void paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; }; #endif // PROGRESSTREEDELEGATE_H diff --git a/src/calamares/progresstree/ProgressTreeItem.cpp b/src/calamares/progresstree/ProgressTreeItem.cpp index 0445962ab..4c5b5b0c3 100644 --- a/src/calamares/progresstree/ProgressTreeItem.cpp +++ b/src/calamares/progresstree/ProgressTreeItem.cpp @@ -65,8 +65,9 @@ int ProgressTreeItem::row() const { if ( m_parentItem ) - return m_parentItem->m_childItems.indexOf( - const_cast< ProgressTreeItem* >( this ) ); + { + return m_parentItem->m_childItems.indexOf( const_cast< ProgressTreeItem* >( this ) ); + } return 0; } @@ -80,7 +81,8 @@ ProgressTreeItem::parent() ProgressTreeRoot::ProgressTreeRoot() : ProgressTreeItem() -{} +{ +} QVariant diff --git a/src/calamares/progresstree/ProgressTreeModel.cpp b/src/calamares/progresstree/ProgressTreeModel.cpp index e3b4fa030..d4b5a0321 100644 --- a/src/calamares/progresstree/ProgressTreeModel.cpp +++ b/src/calamares/progresstree/ProgressTreeModel.cpp @@ -19,7 +19,8 @@ #include "ProgressTreeModel.h" -#include "progresstree/ViewStepItem.h" +#include "ViewStepItem.h" + #include "ViewManager.h" ProgressTreeModel::ProgressTreeModel( QObject* parent ) @@ -40,7 +41,9 @@ Qt::ItemFlags ProgressTreeModel::flags( const QModelIndex& index ) const { if ( !index.isValid() ) + { return Qt::ItemFlags(); + } return Qt::ItemIsEnabled; } @@ -50,20 +53,30 @@ QModelIndex ProgressTreeModel::index( int row, int column, const QModelIndex& parent ) const { if ( !hasIndex( row, column, parent ) ) + { return QModelIndex(); + } ProgressTreeItem* parentItem; if ( !parent.isValid() ) + { parentItem = m_rootItem; + } else + { parentItem = static_cast< ProgressTreeItem* >( parent.internalPointer() ); + } ProgressTreeItem* childItem = parentItem->child( row ); if ( childItem ) + { return createIndex( row, column, childItem ); + } else + { return QModelIndex(); + } } @@ -71,13 +84,17 @@ QModelIndex ProgressTreeModel::parent( const QModelIndex& index ) const { if ( !index.isValid() ) + { return QModelIndex(); + } ProgressTreeItem* childItem = static_cast< ProgressTreeItem* >( index.internalPointer() ); ProgressTreeItem* parentItem = childItem->parent(); if ( parentItem == m_rootItem ) + { return QModelIndex(); + } return createIndex( parentItem->row(), 0, parentItem ); } @@ -87,7 +104,9 @@ QVariant ProgressTreeModel::data( const QModelIndex& index, int role ) const { if ( !index.isValid() ) + { return QVariant(); + } ProgressTreeItem* item = static_cast< ProgressTreeItem* >( index.internalPointer() ); @@ -111,12 +130,18 @@ ProgressTreeModel::rowCount( const QModelIndex& parent ) const { ProgressTreeItem* parentItem; if ( parent.column() > 0 ) + { return 0; + } if ( !parent.isValid() ) + { parentItem = m_rootItem; + } else + { parentItem = static_cast< ProgressTreeItem* >( parent.internalPointer() ); + } return parentItem->childCount(); } @@ -126,9 +151,13 @@ int ProgressTreeModel::columnCount( const QModelIndex& parent ) const { if ( parent.isValid() ) + { return static_cast< ProgressTreeItem* >( parent.internalPointer() )->columnCount(); + } else + { return m_rootItem->columnCount(); + } } @@ -152,7 +181,9 @@ QModelIndex ProgressTreeModel::indexFromItem( ProgressTreeItem* item ) { if ( !item || !item->parent() ) + { return QModelIndex(); + } // Reconstructs a QModelIndex from a ProgressTreeItem that is somewhere in the tree. // Traverses the item to the root node, then rebuilds the qmodelindices from there @@ -172,10 +203,13 @@ ProgressTreeModel::indexFromItem( ProgressTreeItem* item ) **/ QList< int > childIndexList; ProgressTreeItem* curItem = item; - while ( curItem != m_rootItem ) { - int row = curItem->row(); //relative to its parent - if ( row < 0 ) // something went wrong, bail + while ( curItem != m_rootItem ) + { + int row = curItem->row(); //relative to its parent + if ( row < 0 ) // something went wrong, bail + { return QModelIndex(); + } childIndexList << row; @@ -184,7 +218,7 @@ ProgressTreeModel::indexFromItem( ProgressTreeItem* item ) // Now we rebuild the QModelIndex we need QModelIndex idx; - for ( int i = childIndexList.size() - 1; i >= 0 ; i-- ) + for ( int i = childIndexList.size() - 1; i >= 0; i-- ) { idx = index( childIndexList[ i ], 0, idx ); } diff --git a/src/calamares/progresstree/ProgressTreeView.cpp b/src/calamares/progresstree/ProgressTreeView.cpp index 079592848..5c81e3851 100644 --- a/src/calamares/progresstree/ProgressTreeView.cpp +++ b/src/calamares/progresstree/ProgressTreeView.cpp @@ -19,8 +19,9 @@ #include "ProgressTreeView.h" #include "ProgressTreeDelegate.h" -#include "ViewManager.h" + #include "Branding.h" +#include "ViewManager.h" ProgressTreeView* ProgressTreeView::s_instance = nullptr; @@ -33,9 +34,9 @@ ProgressTreeView::instance() ProgressTreeView::ProgressTreeView( QWidget* parent ) : QTreeView( parent ) { - s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr + s_instance = this; //FIXME: should assert when s_instance gets written and it wasn't nullptr - this->setObjectName("sidebarMenuApp"); + this->setObjectName( "sidebarMenuApp" ); setFrameShape( QFrame::NoFrame ); setContentsMargins( 0, 0, 0, 0 ); @@ -55,31 +56,29 @@ ProgressTreeView::ProgressTreeView( QWidget* parent ) setItemDelegate( m_delegate ); QPalette plt = palette(); - plt.setColor( QPalette::Base, Calamares::Branding::instance()-> - styleString( Calamares::Branding::SidebarBackground ) ); + plt.setColor( QPalette::Base, + Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarBackground ) ); setPalette( plt ); } -ProgressTreeView::~ProgressTreeView() -{ -} +ProgressTreeView::~ProgressTreeView() {} void ProgressTreeView::setModel( QAbstractItemModel* model ) { if ( ProgressTreeView::model() ) + { return; + } QTreeView::setModel( model ); expandAll(); connect( Calamares::ViewManager::instance(), &Calamares::ViewManager::currentStepChanged, - this, [this]() - { - viewport()->update(); - }, - Qt::UniqueConnection ); + this, + [this]() { viewport()->update(); }, + Qt::UniqueConnection ); } diff --git a/src/calamares/progresstree/ViewStepItem.cpp b/src/calamares/progresstree/ViewStepItem.cpp index fe2fe6034..5af73fcfd 100644 --- a/src/calamares/progresstree/ViewStepItem.cpp +++ b/src/calamares/progresstree/ViewStepItem.cpp @@ -19,6 +19,7 @@ #include "ViewStepItem.h" #include "ProgressTreeModel.h" + #include "Settings.h" #include "ViewManager.h" #include "viewpages/ViewStep.h" @@ -35,8 +36,7 @@ ViewStepItem::ViewStepItem( std::function< QString() > prettyName, } -ViewStepItem::ViewStepItem( const Calamares::ViewStep* step, - ProgressTreeItem* parent ) +ViewStepItem::ViewStepItem( const Calamares::ViewStep* step, ProgressTreeItem* parent ) : ProgressTreeItem( parent ) { m_step = step; @@ -55,8 +55,7 @@ ViewStepItem::data( int role ) const { if ( role == Qt::DisplayRole ) { - return m_step ? m_step->prettyName() - : m_prettyName(); + return m_step ? m_step->prettyName() : m_prettyName(); } if ( Calamares::Settings::instance()->debugMode() && role == Qt::ToolTipRole ) { @@ -66,9 +65,9 @@ ViewStepItem::data( int role ) const toolTip.append( "
Type:\tViewStep" ); toolTip.append( QString( "
Pretty:\t%1" ).arg( m_step->prettyName() ) ); toolTip.append( QString( "
Status:\t%1" ).arg( m_step->prettyStatus() ) ); - toolTip.append( QString( "
Source:\t%1" ).arg( - m_step->moduleInstanceKey().isEmpty() ? "built-in" - : m_step->moduleInstanceKey() ) ); + toolTip.append( + QString( "
Source:\t%1" ) + .arg( m_step->moduleInstanceKey().isEmpty() ? "built-in" : m_step->moduleInstanceKey() ) ); } else { @@ -78,8 +77,7 @@ ViewStepItem::data( int role ) const return toolTip; } if ( role == ProgressTreeModel::ProgressTreeItemCurrentRole ) - return m_step ? - ( Calamares::ViewManager::instance()->currentStep() == m_step ) : - ( Calamares::ViewManager::instance()->currentStep() == m_accessor() ); + return m_step ? ( Calamares::ViewManager::instance()->currentStep() == m_step ) + : ( Calamares::ViewManager::instance()->currentStep() == m_accessor() ); return QVariant(); } diff --git a/src/calamares/progresstree/ViewStepItem.h b/src/calamares/progresstree/ViewStepItem.h index 5a7c79b4a..3095ef43b 100644 --- a/src/calamares/progresstree/ViewStepItem.h +++ b/src/calamares/progresstree/ViewStepItem.h @@ -37,8 +37,7 @@ public: std::function< const Calamares::ViewStep*() > accessor, ProgressTreeItem* parent = nullptr ); - explicit ViewStepItem( const Calamares::ViewStep* step, - ProgressTreeItem* parent = nullptr ); + explicit ViewStepItem( const Calamares::ViewStep* step, ProgressTreeItem* parent = nullptr ); void appendChild( ProgressTreeItem* item ) override; From a6d7fcdadf914579edde145f7cbcfefb99f88ef5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 11 Jun 2019 13:33:42 +0200 Subject: [PATCH 41/44] [calamares] Reformat the rest of the application --- src/calamares/CalamaresApplication.cpp | 83 +++++++++++++-------- src/calamares/CalamaresApplication.h | 2 +- src/calamares/CalamaresWindow.cpp | 58 ++++++++------- src/calamares/CalamaresWindow.h | 4 +- src/calamares/main.cpp | 32 ++++++--- src/calamares/testmain.cpp | 99 +++++++++++++++++--------- 6 files changed, 179 insertions(+), 99 deletions(-) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 2593518fa..0f9a8a208 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -19,22 +19,22 @@ #include "CalamaresApplication.h" #include "CalamaresConfig.h" -#include "CalamaresWindow.h" #include "CalamaresVersion.h" -#include "progresstree/ProgressTreeView.h" +#include "CalamaresWindow.h" #include "progresstree/ProgressTreeModel.h" +#include "progresstree/ProgressTreeView.h" +#include "Branding.h" +#include "JobQueue.h" +#include "Settings.h" +#include "ViewManager.h" #include "modulesystem/ModuleManager.h" #include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Dirs.h" #include "utils/Logger.h" #include "utils/Retranslator.h" -#include "JobQueue.h" -#include "Branding.h" -#include "Settings.h" #include "viewpages/ViewStep.h" -#include "ViewManager.h" #include #include @@ -77,12 +77,11 @@ CalamaresApplication::init() initSettings(); initBranding(); - setWindowIcon( QIcon( Calamares::Branding::instance()-> - imagePath( Calamares::Branding::ProductIcon ) ) ); + setWindowIcon( QIcon( Calamares::Branding::instance()->imagePath( Calamares::Branding::ProductIcon ) ) ); cDebug() << "STARTUP: initQmlPath, initSettings, initBranding done"; - initModuleManager(); //also shows main window + initModuleManager(); //also shows main window cDebug() << "STARTUP: initModuleManager: module init started"; } @@ -130,14 +129,20 @@ qmlDirCandidates( bool assumeBuilddir ) QStringList qmlDirs; if ( CalamaresUtils::isAppDataDirOverridden() ) + { qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML ); + } else { if ( assumeBuilddir ) + { qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir + } if ( CalamaresUtils::haveExtraDirs() ) for ( auto s : CalamaresUtils::extraDataDirs() ) + { qmlDirs << ( s + QML ); + } qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML ); } @@ -152,14 +157,20 @@ settingsFileCandidates( bool assumeBuilddir ) QStringList settingsPaths; if ( CalamaresUtils::isAppDataDirOverridden() ) + { settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings ); + } else { if ( assumeBuilddir ) + { settingsPaths << QDir::current().absoluteFilePath( settings ); + } if ( CalamaresUtils::haveExtraDirs() ) for ( auto s : CalamaresUtils::extraConfigDirs() ) + { settingsPaths << ( s + settings ); + } settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings ); } @@ -173,16 +184,22 @@ brandingFileCandidates( bool assumeBuilddir, const QString& brandingFilename ) { QStringList brandingPaths; if ( CalamaresUtils::isAppDataDirOverridden() ) + { brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename ); + } else { if ( assumeBuilddir ) + { brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename ); + } if ( CalamaresUtils::haveExtraDirs() ) for ( auto s : CalamaresUtils::extraDataDirs() ) + { brandingPaths << ( s + brandingFilename ); + } brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename ); - brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename); + brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename ); } return brandingPaths; @@ -210,11 +227,15 @@ CalamaresApplication::initQmlPath() if ( !found || !importPath.exists() || !importPath.isReadable() ) { cError() << "Cowardly refusing to continue startup without a QML directory." - << Logger::DebugList( qmlDirCandidatesByPriority ); + << Logger::DebugList( qmlDirCandidatesByPriority ); if ( CalamaresUtils::isAppDataDirOverridden() ) + { cError() << "FATAL: explicitly configured application data directory is missing qml/"; + } else + { cError() << "FATAL: none of the expected QML paths exist."; + } ::exit( EXIT_FAILURE ); } @@ -245,11 +266,15 @@ CalamaresApplication::initSettings() if ( !found || !settingsFile.exists() || !settingsFile.isReadable() ) { cError() << "Cowardly refusing to continue startup without settings." - << Logger::DebugList( settingsFileCandidatesByPriority ); + << Logger::DebugList( settingsFileCandidatesByPriority ); if ( CalamaresUtils::isAppDataDirOverridden() ) + { cError() << "FATAL: explicitly configured application data directory is missing settings.conf"; + } else + { cError() << "FATAL: none of the expected configuration file paths exist."; + } ::exit( EXIT_FAILURE ); } @@ -273,7 +298,7 @@ CalamaresApplication::initBranding() } QString brandingDescriptorSubpath = QString( "branding/%1/branding.desc" ).arg( brandingComponentName ); - QStringList brandingFileCandidatesByPriority = brandingFileCandidates( isDebug(), brandingDescriptorSubpath); + QStringList brandingFileCandidatesByPriority = brandingFileCandidates( isDebug(), brandingDescriptorSubpath ); QFileInfo brandingFile; bool found = false; @@ -292,11 +317,15 @@ CalamaresApplication::initBranding() if ( !found || !brandingFile.exists() || !brandingFile.isReadable() ) { cError() << "Cowardly refusing to continue startup without branding." - << Logger::DebugList( brandingFileCandidatesByPriority ); + << Logger::DebugList( brandingFileCandidatesByPriority ); if ( CalamaresUtils::isAppDataDirOverridden() ) + { cError() << "FATAL: explicitly configured application data directory is missing" << brandingComponentName; + } else + { cError() << "FATAL: none of the expected branding descriptor file paths exist."; + } ::exit( EXIT_FAILURE ); } @@ -307,10 +336,8 @@ CalamaresApplication::initBranding() void CalamaresApplication::initModuleManager() { - m_moduleManager = new Calamares::ModuleManager( - Calamares::Settings::instance()->modulesSearchPaths(), this ); - connect( m_moduleManager, &Calamares::ModuleManager::initDone, - this, &CalamaresApplication::initView ); + m_moduleManager = new Calamares::ModuleManager( Calamares::Settings::instance()->modulesSearchPaths(), this ); + connect( m_moduleManager, &Calamares::ModuleManager::initDone, this, &CalamaresApplication::initView ); m_moduleManager->init(); } @@ -322,18 +349,14 @@ CalamaresApplication::initView() initJobQueue(); cDebug() << "STARTUP: initJobQueue done"; - m_mainwindow = new CalamaresWindow(); //also creates ViewManager + m_mainwindow = new CalamaresWindow(); //also creates ViewManager - connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, - this, &CalamaresApplication::initViewSteps ); - connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed, - this, &CalamaresApplication::initFailed ); + connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, this, &CalamaresApplication::initViewSteps ); + connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed, this, &CalamaresApplication::initFailed ); m_moduleManager->loadModules(); - m_mainwindow->move( - this->desktop()->availableGeometry().center() - - m_mainwindow->rect().center() ); + m_mainwindow->move( this->desktop()->availableGeometry().center() - m_mainwindow->rect().center() ); cDebug() << "STARTUP: CalamaresWindow created; loadModules started"; } @@ -350,7 +373,9 @@ CalamaresApplication::initViewSteps() m_mainwindow->showMaximized(); } else + { m_mainwindow->show(); + } ProgressTreeModel* m = new ProgressTreeModel( nullptr ); ProgressTreeView::instance()->setModel( m ); @@ -360,11 +385,13 @@ CalamaresApplication::initViewSteps() cDebug() << Logger::SubEntry << steps.count() << "view steps loaded."; // Tell the first view that it's been shown. if ( steps.count() > 0 ) - steps[0]->onActivate(); + { + steps[ 0 ]->onActivate(); + } } void -CalamaresApplication::initFailed(const QStringList& l) +CalamaresApplication::initFailed( const QStringList& l ) { cError() << "STARTUP: failed modules are" << l; m_mainwindow->show(); diff --git a/src/calamares/CalamaresApplication.h b/src/calamares/CalamaresApplication.h index f337c54e5..634f4cdb2 100644 --- a/src/calamares/CalamaresApplication.h +++ b/src/calamares/CalamaresApplication.h @@ -82,4 +82,4 @@ private: bool m_debugMode; }; -#endif // CALAMARESAPPLICATION_H +#endif // CALAMARESAPPLICATION_H diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index 626b8588c..d80b6cb67 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -21,33 +21,39 @@ #include "CalamaresWindow.h" +#include "Branding.h" +#include "Settings.h" #include "ViewManager.h" #include "progresstree/ProgressTreeView.h" #include "utils/CalamaresUtilsGui.h" -#include "utils/Logger.h" #include "utils/DebugWindow.h" +#include "utils/Logger.h" #include "utils/Retranslator.h" -#include "Settings.h" -#include "Branding.h" #include #include #include #include -#include -#include #include #include +#include +#include static inline int windowDimensionToPixels( const Calamares::Branding::WindowDimension& u ) { if ( !u.isValid() ) + { return 0; + } if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Pixies ) + { return u.value(); + } if ( u.unit() == Calamares::Branding::WindowDimensionUnit::Fonties ) + { return u.value() * CalamaresUtils::defaultFontHeight(); + } return 0; } @@ -58,14 +64,13 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) { // If we can never cancel, don't show the window-close button if ( Calamares::Settings::instance()->disableCancel() ) + { setWindowFlag( Qt::WindowCloseButtonHint, false ); + } - CALAMARES_RETRANSLATE( - setWindowTitle( Calamares::Settings::instance()->isSetupMode() - ? tr( "%1 Setup Program" ).arg( *Calamares::Branding::ProductName ) - : tr( "%1 Installer" ).arg( *Calamares::Branding::ProductName ) - ); - ) + CALAMARES_RETRANSLATE( setWindowTitle( Calamares::Settings::instance()->isSetupMode() + ? tr( "%1 Setup Program" ).arg( *Calamares::Branding::ProductName ) + : tr( "%1 Installer" ).arg( *Calamares::Branding::ProductName ) ); ) const Calamares::Branding* const branding = Calamares::Branding::instance(); @@ -75,7 +80,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) using CalamaresUtils::windowPreferredWidth; // Needs to match what's checked in DebugWindow - this->setObjectName("mainApp"); + this->setObjectName( "mainApp" ); QSize availableSize = qApp->desktop()->availableGeometry( this ).size(); QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ), @@ -87,7 +92,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) auto brandingSizes = branding->windowSize(); int w = qBound( minimumSize.width(), windowDimensionToPixels( brandingSizes.first ), availableSize.width() ); - int h = qBound( minimumSize.height(), windowDimensionToPixels( brandingSizes.second ), availableSize.height() ); + int h = qBound( minimumSize.height(), windowDimensionToPixels( brandingSizes.second ), availableSize.height() ); cDebug() << Logger::SubEntry << "Proposed window size:" << w << h; resize( w, h ); @@ -96,25 +101,26 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) setLayout( mainLayout ); QWidget* sideBox = new QWidget( this ); - sideBox->setObjectName("sidebarApp"); + sideBox->setObjectName( "sidebarApp" ); mainLayout->addWidget( sideBox ); QBoxLayout* sideLayout = new QVBoxLayout; sideBox->setLayout( sideLayout ); // Set this attribute into qss file - sideBox->setFixedWidth( qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) ); + sideBox->setFixedWidth( + qBound( 100, CalamaresUtils::defaultFontHeight() * 12, w < windowPreferredWidth ? 100 : 190 ) ); sideBox->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); QHBoxLayout* logoLayout = new QHBoxLayout; sideLayout->addLayout( logoLayout ); logoLayout->addStretch(); QLabel* logoLabel = new QLabel( sideBox ); - logoLabel->setObjectName("logoApp"); + logoLabel->setObjectName( "logoApp" ); //Define all values into qss file { QPalette plt = sideBox->palette(); sideBox->setAutoFillBackground( true ); - plt.setColor( sideBox->backgroundRole(),branding->styleString( Calamares::Branding::SidebarBackground ) ); + plt.setColor( sideBox->backgroundRole(), branding->styleString( Calamares::Branding::SidebarBackground ) ); plt.setColor( sideBox->foregroundRole(), branding->styleString( Calamares::Branding::SidebarText ) ); sideBox->setPalette( plt ); logoLabel->setPalette( plt ); @@ -133,22 +139,16 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) { QPushButton* debugWindowBtn = new QPushButton; debugWindowBtn->setObjectName( "debugButton" ); - CALAMARES_RETRANSLATE( - debugWindowBtn->setText( tr( "Show debug information" ) ); - ) + CALAMARES_RETRANSLATE( debugWindowBtn->setText( tr( "Show debug information" ) ); ) sideLayout->addWidget( debugWindowBtn ); debugWindowBtn->setFlat( true ); debugWindowBtn->setCheckable( true ); - connect( debugWindowBtn, &QPushButton::clicked, - this, [ = ]( bool checked ) - { + connect( debugWindowBtn, &QPushButton::clicked, this, [=]( bool checked ) { if ( checked ) { m_debugWindow = new Calamares::DebugWindow(); m_debugWindow->show(); - connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, - this, [ = ]() - { + connect( m_debugWindow.data(), &Calamares::DebugWindow::closed, this, [=]() { m_debugWindow->deleteLater(); debugWindowBtn->setChecked( false ); } ); @@ -156,7 +156,9 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) else { if ( m_debugWindow ) + { m_debugWindow->deleteLater(); + } } } ); } @@ -166,7 +168,9 @@ CalamaresWindow::CalamaresWindow( QWidget* parent ) m_viewManager = Calamares::ViewManager::instance( this ); if ( branding->windowExpands() ) + { connect( m_viewManager, &Calamares::ViewManager::enlarge, this, &CalamaresWindow::enlarge ); + } // NOTE: Although the ViewManager has a signal cancelEnabled() that // signals when the state of the cancel button changes (in // particular, to disable cancel during the exec phase), @@ -201,5 +205,7 @@ CalamaresWindow::closeEvent( QCloseEvent* event ) qApp->quit(); } else + { event->ignore(); + } } diff --git a/src/calamares/CalamaresWindow.h b/src/calamares/CalamaresWindow.h index 310aa3eab..03ae560ec 100644 --- a/src/calamares/CalamaresWindow.h +++ b/src/calamares/CalamaresWindow.h @@ -27,7 +27,7 @@ namespace Calamares { class DebugWindow; class ViewManager; -} +} // namespace Calamares /** * @brief The CalamaresWindow class represents the main window of the Calamares UI. @@ -55,4 +55,4 @@ private: Calamares::ViewManager* m_viewManager; }; -#endif // CALAMARESWINDOW_H +#endif // CALAMARESWINDOW_H diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index f218b8ab9..d463b789d 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -24,11 +24,10 @@ #include "kdsingleapplicationguard/kdsingleapplicationguard.h" #include "utils/Dirs.h" #include "utils/Logger.h" -#include "CalamaresConfig.h" #ifdef WITH_KF5Crash -#include #include +#include #endif #include @@ -38,14 +37,13 @@ static void handle_args( CalamaresApplication& a ) { - QCommandLineOption debugOption( QStringList{ "d", "debug"}, + QCommandLineOption debugOption( QStringList { "d", "debug" }, "Also look in current directory for configuration. Implies -D8." ); - QCommandLineOption debugLevelOption( QStringLiteral("D"), - "Verbose output for debugging purposes (0-8).", "level" ); - QCommandLineOption configOption( QStringList{ "c", "config"}, - "Configuration directory to use, for testing purposes.", "config" ); - QCommandLineOption xdgOption( QStringList{"X", "xdg-config"}, - "Use XDG_{CONFIG,DATA}_DIRS as well." ); + QCommandLineOption debugLevelOption( + QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8).", "level" ); + QCommandLineOption configOption( + QStringList { "c", "config" }, "Configuration directory to use, for testing purposes.", "config" ); + QCommandLineOption xdgOption( QStringList { "X", "xdg-config" }, "Use XDG_{CONFIG,DATA}_DIRS as well." ); QCommandLineParser parser; parser.setApplicationDescription( "Distribution-independent installer framework" ); @@ -61,22 +59,32 @@ handle_args( CalamaresApplication& a ) a.setDebug( parser.isSet( debugOption ) ); if ( parser.isSet( debugOption ) ) + { Logger::setupLogLevel( Logger::LOGVERBOSE ); + } else if ( parser.isSet( debugLevelOption ) ) { bool ok = true; int l = parser.value( debugLevelOption ).toInt( &ok ); unsigned int dlevel = 0; if ( !ok || ( l < 0 ) ) + { dlevel = Logger::LOGVERBOSE; + } else - dlevel = static_cast( l ); // l >= 0 + { + dlevel = static_cast< unsigned int >( l ); // l >= 0 + } Logger::setupLogLevel( dlevel ); } if ( parser.isSet( configOption ) ) + { CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) ); + } if ( parser.isSet( xdgOption ) ) + { CalamaresUtils::setXdgDirs(); + } } int @@ -118,9 +126,13 @@ main( int argc, char* argv[] ) 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 returnCode; diff --git a/src/calamares/testmain.cpp b/src/calamares/testmain.cpp index 11ea9eaca..0f07e6e13 100644 --- a/src/calamares/testmain.cpp +++ b/src/calamares/testmain.cpp @@ -22,9 +22,9 @@ * bindings. */ +#include "modulesystem/Module.h" #include "utils/Logger.h" #include "utils/Yaml.h" -#include "modulesystem/Module.h" #include "GlobalStorage.h" #include "Job.h" @@ -40,28 +40,47 @@ struct ModuleConfig { - QString moduleName() const { return m_module; } - QString configFile() const { return m_jobConfig; } - QString language() const { return m_language; } - QString globalConfigFile() const { return m_globalConfig; } + QString + moduleName() const + { + return m_module; + } + QString + configFile() const + { + return m_jobConfig; + } + QString + language() const + { + return m_language; + } + QString + globalConfigFile() const + { + return m_globalConfig; + } QString m_module; QString m_jobConfig; QString m_globalConfig; QString m_language; -} ; +}; static ModuleConfig handle_args( QCoreApplication& a ) { - QCommandLineOption debugLevelOption( QStringLiteral("D"), - "Verbose output for debugging purposes (0-8).", "level" ); - QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global "), - QStringLiteral( "Global settings document" ), "global.yaml" ); - QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job"), - QStringLiteral( "Job settings document" ), "job.yaml" ); + QCommandLineOption debugLevelOption( + QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8).", "level" ); + QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global " ), + QStringLiteral( "Global settings document" ), + "global.yaml" ); + QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job" ), + QStringLiteral( "Job settings document" ), + "job.yaml" ); QCommandLineOption langOption( QStringList() << QStringLiteral( "l" ) << QStringLiteral( "language" ), - QStringLiteral( "Language (global)" ), "languagecode" ); + QStringLiteral( "Language (global)" ), + "languagecode" ); QCommandLineParser parser; parser.setApplicationDescription( "Calamares module tester" ); @@ -73,7 +92,7 @@ handle_args( QCoreApplication& a ) parser.addOption( jobOption ); parser.addOption( langOption ); parser.addPositionalArgument( "module", "Path or name of module to run." ); - parser.addPositionalArgument( "job.yaml", "Path of job settings document to use.", "[job.yaml]"); + parser.addPositionalArgument( "job.yaml", "Path of job settings document to use.", "[job.yaml]" ); parser.process( a ); @@ -83,9 +102,13 @@ handle_args( QCoreApplication& a ) unsigned int l = parser.value( debugLevelOption ).toUInt( &ok ); unsigned int dlevel = 0; if ( !ok ) + { dlevel = Logger::LOGVERBOSE; + } else + { dlevel = l; + } Logger::setupLogLevel( dlevel ); } @@ -104,9 +127,11 @@ handle_args( QCoreApplication& a ) { QString jobSettings( parser.value( jobOption ) ); if ( jobSettings.isEmpty() && ( args.size() == 2 ) ) - jobSettings = args.at(1); + { + jobSettings = args.at( 1 ); + } - return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) }; + return ModuleConfig { args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) }; } } @@ -120,14 +145,18 @@ load_module( const ModuleConfig& moduleConfig ) bool ok = false; QVariantMap descriptor; - for ( const QString& prefix : QStringList{ "./", "src/modules/", "modules/" } ) + for ( const QString& prefix : QStringList { "./", "src/modules/", "modules/" } ) { // Could be a complete path, eg. src/modules/dummycpp/module.desc fi = QFileInfo( prefix + moduleName ); if ( fi.exists() && fi.isFile() ) + { descriptor = CalamaresUtils::loadYaml( fi, &ok ); + } if ( ok ) + { break; + } // Could be a path without module.desc fi = QFileInfo( prefix + moduleName ); @@ -135,8 +164,13 @@ load_module( const ModuleConfig& moduleConfig ) { fi = QFileInfo( prefix + moduleName + "/module.desc" ); if ( fi.exists() && fi.isFile() ) + { descriptor = CalamaresUtils::loadYaml( fi, &ok ); - if ( ok ) break; + } + if ( ok ) + { + break; + } } } @@ -154,15 +188,12 @@ load_module( const ModuleConfig& moduleConfig ) } QString moduleDirectory = fi.absolutePath(); - QString configFile( - moduleConfig.configFile().isEmpty() - ? moduleDirectory + '/' + name + ".conf" - : moduleConfig.configFile() ); + QString configFile( moduleConfig.configFile().isEmpty() ? moduleDirectory + '/' + name + ".conf" + : moduleConfig.configFile() ); cDebug() << "Module" << moduleName << "job-configuration:" << configFile; - Calamares::Module* module = Calamares::Module::fromDescriptor( - descriptor, name, configFile, moduleDirectory ); + Calamares::Module* module = Calamares::Module::fromDescriptor( descriptor, name, configFile, moduleDirectory ); return module; } @@ -174,14 +205,18 @@ main( int argc, char* argv[] ) ModuleConfig module = handle_args( a ); if ( module.moduleName().isEmpty() ) + { return 1; + } std::unique_ptr< Calamares::Settings > settings_p( new Calamares::Settings( QString(), true ) ); std::unique_ptr< Calamares::JobQueue > jobqueue_p( new Calamares::JobQueue( nullptr ) ); auto gs = jobqueue_p->globalStorage(); if ( !module.globalConfigFile().isEmpty() ) + { gs->loadYaml( module.globalConfigFile() ); + } if ( !module.language().isEmpty() ) { QVariantMap vm; @@ -199,7 +234,9 @@ main( int argc, char* argv[] ) } if ( !m->isLoaded() ) + { m->loadSelf(); + } if ( !m->isLoaded() ) { @@ -207,12 +244,10 @@ main( int argc, char* argv[] ) return 1; } - using TR = Logger::DebugRow; + using TR = Logger::DebugRow< const char*, const QString >; - cDebug() << "Module metadata" - << TR( "name", m->name() ) - << TR( "type", m->typeString() ) - << TR( "interface", m->interfaceString() ); + cDebug() << "Module metadata" << TR( "name", m->name() ) << TR( "type", m->typeString() ) + << TR( "interface", m->interfaceString() ); cDebug() << "Job outputs:"; Calamares::JobList jobList = m->jobs(); @@ -224,11 +259,11 @@ main( int argc, char* argv[] ) Calamares::JobResult r = p->exec(); if ( !r ) { - cError() << "Job #" << count << "failed" - << TR( "summary", r.message() ) - << TR( "details", r.details() ); + cError() << "Job #" << count << "failed" << TR( "summary", r.message() ) << TR( "details", r.details() ); if ( r.errorCode() > 0 ) + { ++failure_count; + } } ++count; } From 85845c9b3eb7e448954f08a26c6f8f1850e0de50 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Jun 2019 08:32:28 +0200 Subject: [PATCH 42/44] [calamares] cLog() isn't a thing, return to cDebug() --- src/calamares/CalamaresApplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 0f9a8a208..755808f5f 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -89,8 +89,8 @@ CalamaresApplication::init() CalamaresApplication::~CalamaresApplication() { - cLog( Logger::LOGVERBOSE ) << "Shutting down Calamares..."; - cLog( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown."; + cDebug( Logger::LOGVERBOSE ) << "Shutting down Calamares..."; + cDebug( Logger::LOGVERBOSE ) << Logger::SubEntry << "Finished shutdown."; } From 5dfc4884b3b038895bf1cb8ce908bb233c44b48f Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Jun 2019 12:45:47 +0200 Subject: [PATCH 43/44] [calamares] Increase constness - The model shouldn't change items at all. --- src/calamares/progresstree/ViewStepItem.cpp | 6 +++--- src/calamares/progresstree/ViewStepItem.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calamares/progresstree/ViewStepItem.cpp b/src/calamares/progresstree/ViewStepItem.cpp index 5af73fcfd..27e56ef55 100644 --- a/src/calamares/progresstree/ViewStepItem.cpp +++ b/src/calamares/progresstree/ViewStepItem.cpp @@ -29,17 +29,17 @@ ViewStepItem::ViewStepItem( std::function< QString() > prettyName, std::function< const Calamares::ViewStep*() > accessor, ProgressTreeItem* parent ) : ProgressTreeItem( parent ) + , m_accessor( accessor ) + , m_prettyName( prettyName ) , m_step( nullptr ) { - m_prettyName = prettyName; - m_accessor = accessor; } ViewStepItem::ViewStepItem( const Calamares::ViewStep* step, ProgressTreeItem* parent ) : ProgressTreeItem( parent ) + , m_step( step ) { - m_step = step; } void diff --git a/src/calamares/progresstree/ViewStepItem.h b/src/calamares/progresstree/ViewStepItem.h index 3095ef43b..84b9e0e98 100644 --- a/src/calamares/progresstree/ViewStepItem.h +++ b/src/calamares/progresstree/ViewStepItem.h @@ -44,9 +44,9 @@ public: QVariant data( int role ) const override; private: - std::function< const Calamares::ViewStep*() > m_accessor; - std::function< QString() > m_prettyName; - const Calamares::ViewStep* m_step; + const std::function< const Calamares::ViewStep*() > m_accessor; + const std::function< QString() > m_prettyName; + const Calamares::ViewStep* const m_step; }; From 3b146d47d07f3ea48646988c2803f7c4ae84b03d Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 13 Jun 2019 11:06:44 +0200 Subject: [PATCH 44/44] CI: Remove mention of cLog from documentation --- ci/HACKING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/HACKING.md b/ci/HACKING.md index 1ffa4db8d..02eb8fd17 100644 --- a/ci/HACKING.md +++ b/ci/HACKING.md @@ -183,8 +183,8 @@ connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this] Debugging --------- -Use `cDebug()` and `cLog()` from `utils/Logger.h`. You can pass a debug-level to -either macro (6 is debugging, higher is less important). Use `cWarning()` for warning +Use `cDebug()` from `utils/Logger.h`. You can pass a debug-level to the +macro (6 is debugging, higher is less important). Use `cWarning()` for warning messages (equivalent to level 2) and `cError()` for errors (level 1). Warnings and errors will add relevant text automatically. See `libcalamares/utils/Logger.h` for details.