Commit Graph

681 Commits

Author SHA1 Message Date
Adriaan de Groot
841ea9ff48 [libcalamares] Tidy up includes
- Remove commented-out includes
- Consistent punctuation
2020-03-09 21:05:15 -05:00
Adriaan de Groot
ef249043f9 [libcalamares] call Python method only from Python thread 2020-03-09 15:39:35 -05:00
Adriaan de Groot
b4aaf85ccf [libcalamares] Call Python function if available for status 2020-03-09 15:13:40 -05:00
Adriaan de Groot
252089e372 [libcalamares] Refactor pretty_name() call
- Split out a general method-that-returns-string caller.
2020-03-09 15:01:07 -05:00
Adriaan de Groot
aa62ca639b [libcalamares] Start getting prettyDescription from Python 2020-03-09 10:34:57 -05:00
Adriaan de Groot
9b5a391c86 [libcalamares] Factor out Python helper
- the strange construction of Helper and treating it as a singleton
  can be factored out into a separate singleton-handling instance()
  function. The Helper should never be destroyed.
2020-03-09 10:05:01 -05:00
Adriaan de Groot
3025c5383b [libcalamares] Document the pretty*() functions for Jobs 2020-03-05 08:54:42 -05:00
Adriaan de Groot
6d29c19e3e [libcalamares] Progress is float 2020-03-04 21:40:40 -05:00
Adriaan de Groot
0abde6f1a7 [libcalamares] Don't print funcinfo in continuations
- when a single function does more logging, it generally marks
  those as subsequent debug-messages (with Continuation, or SubEntry)
  and we don't need to print funcinfo for those, since it was already
  printed the first time.
2020-03-03 17:00:57 +01:00
Adriaan de Groot
5248a37eb3 [libcalamares] Add FUNC_INFO into all debug messages
- This is needlessly verbose
- Chase CreatePartitionTableJob which needs to bind to a temporary
2020-03-03 17:00:57 +01:00
Adriaan de Groot
3ddee8090c [libcalamares] Drop intermediate CLog class
- All the real work is done in CDebug, so remove the base class.
2020-03-03 17:00:57 +01:00
Adriaan de Groot
0793971d01 [libcalamares] Warnings--, unused variable 2020-02-27 23:18:13 +01:00
Adriaan de Groot
b0abb99ee1 [libcalamares] Don't log useless FUNC_INFO for Python
- When a Python module calls utils.debug(), there's no point
  in logging the C++ funcinfo that passes the parameters on;
  don't use cDebug() with its attendant magic.
2020-02-27 13:24:23 +01:00
Adriaan de Groot
f818d4b446 [libcalamares] Log Q_FUNC_INFO as part of debug
- Warnings, errors, don't get funcinfo, but regular cDebug()
  calls do. Other special-cases, like calling Logger::CDebug()
  constructor explicitly, don't get funcinfo either.

FIXES #1328
2020-02-27 13:20:19 +01:00
Adriaan de Groot
3456aabfce [libcalamares] Expand utility of list-logging
- Allow logging any QList type (needs explicit call in usage).
- Add a DebugList inheriting from DebugListT to keep existing
  code that logs QStringLists.
- For Calamares 3.3, consider using C++17 and class template deduction.
2020-02-27 11:59:24 +01:00
Adriaan de Groot
2db3b413f4 [libcalamares] Unmount with mount point, not device
- The manpage for umount says that -R can only be used with
  a mount point (e.g. /usr/local) and not a device name;
  this makes sense because a device might be mounted in multiple
  locations, but the mountpoint (and things mounted under it) lives
  in the filesystem tree.
- Existing code tried to unmount -R the device, not the mount point,
  and so always failed; leaving things mounted that shouldn't.
2020-02-24 20:58:02 +01:00
Adriaan de Groot
14979b1630 [libcalamares] TemporaryMount with backwards logic
- because mount() returns an exit code, and 0 is "success",
  the if (!code) was backwards: when mounting succeeded, the
  TemporaryMount object thought it failed.
- This leads to temp-mounts being left *all over* the place
  from os-prober and fstab-handling.
2020-02-24 15:21:31 +01:00
Adriaan de Groot
ee52e37b36 [libcalamares] Don't hard-code full paths
- See editorial in the code-comment. Still need to test that
   chroot(8) doesn't need a full path, otherwise this will
   go to /usr/bin/env udevadm to force lookup (redundantly
   if not in a chroot)
2020-02-24 13:15:13 +01:00
Adriaan de Groot
862b7e34df [libcalamares] Add tests for file-overwrite 2020-02-24 12:38:08 +01:00
Adriaan de Groot
f89951716e [libcalamares] Add mode to createTargetFile()
- Unconditionally **not** overwriting the target file isn't an option:
  writing hostname, for instance, expects that to be done even
  if `/etc/hostname` already exists on the target filesystem.
2020-02-24 12:14:50 +01:00
Adriaan de Groot
e49fb74847 [libcalamares] Fix more tests 2020-02-21 17:58:55 +01:00
Adriaan de Groot
39cc43f26b [libcalamares] Fix tests
- QCOMPARE() is sensitive to differing types in actual and expected,
  and uchar and int (and mode_t and int) are different.
2020-02-21 17:53:43 +01:00
Adriaan de Groot
1bb43e06e2 Merge branch 'master' into kpmcore-manager 2020-02-19 18:34:44 +01:00
Adriaan de Groot
81752b6f7c [libcalamares] Document how TranslatedString context works
- Support re-using class-specific tr() calls in a standard way
- Document this in the netinstall.conf which uses it
2020-02-19 14:23:34 +01:00
Adriaan de Groot
0ef28f6a50 [libcalamares] Translatable config strings use tr()-infrastructure
- Allow TranslatedString to get a context parameter; if it has
  one, it will try to use the regular tr()-infrastructure
  **as fallback** for the translations from the config file itself.
- This makes it possible to offer -- and translate -- some "standard"
  phrases in the module, while allowing the config file the knob
  to change strings. Using one of the standard strings gets translations
  for "free", while introducing something entirely new means sourcing
  translations for it as well.
2020-02-19 14:04:35 +01:00
Adriaan de Groot
371fe267b1 Merge branch 'better-hostname' 2020-02-17 17:10:21 +01:00
Adriaan de Groot
94f5b13db0 [libcalamaresui] Restore previous DLLEXPORT names
- Different libraries should have different EXPORTs, so that
   you can IMPORT one while building the other. Reported (and
   kindly explained) by Kevin Kofler.
 - Stick to one header file, though.

While here, update copyright on file.
2020-02-17 16:55:17 +01:00
Adriaan de Groot
6719a41aef [libcalamares] Switch tests to calamares_add_test() 2020-02-17 15:05:00 +01:00
Adriaan de Groot
51e135cfbd CMake: chase introduction of IMPORTED yamlcpp 2020-02-17 15:01:05 +01:00
Adriaan de Groot
92260e7d0b [libcalamares] Document DllMacro.h and add STATICTEST
- document the export macros
 - introduce a "static" that is switched off when re-building code
   for tests.
2020-02-17 11:43:20 +01:00
Adriaan de Groot
b044549013 [libcalamares] Merge PluginDllMacro.h into DllMacro.h
- Let's just have one header definining export- and visibility-
   macros for Calamares. They are still selected based on the
   export flags (*_PRO), just defined in one header instead of two.
2020-02-17 11:37:35 +01:00
Adriaan de Groot
781322ab41 [libcalamares] Use more descriptive variable name
- If the test failed, you'd get a cryptic message like
	FAIL!  : NetworkTests::testPing() 'r' returned FALSE. ()
   So rename the variable so the failure mode is more obvious.
   (Could have used QVERIFY2() instead, this is simpler)
2020-02-14 13:23:19 +01:00
Adriaan de Groot
f6526f7d9f [libcalamares] Add some tests for CreationResult
- More important is the compiler warning that will show up
   if we add more failure states.
2020-02-14 13:21:16 +01:00
Adriaan de Groot
274115c727 [libcalamares] Update tests to reflect changed API 2020-02-14 13:07:29 +01:00
Adriaan de Groot
2d7398161d [libcalamares] More detail for createTargetFile()
- Return a result-object with statrus information and the path
   which was previously used (empty for "failures").
2020-02-14 13:03:51 +01:00
Adriaan de Groot
d931b146e3 [partition] Shuffle new conveniences into partition service
- the general stuff from KPMHelpers ends up in the partition
   service; that only gets compiled when KPMCore is available anyway.
2020-02-13 13:48:12 +01:00
Adriaan de Groot
e72ecaafd3 Merge branch 'kpmcore-manager'
Introduces a "partitioning service" into libcalamares,
shuffles a bunch of things into it, tries to help out
with settling the system between partitioning actions.
2020-02-13 13:41:53 +01:00
Adriaan de Groot
c7780db07a Merge branch 'model-q'
- Make models of some things previously held as lists, as
   prep-work for QML modules.
2020-02-12 14:08:07 +01:00
Adriaan de Groot
ca13d1670e [libcalamares] Merge more from Camilo
- Complete the model for locales
2020-02-12 13:40:59 +01:00
Adriaan de Groot
59ddda6225 Merge branch 'wrangle-boost' 2020-02-12 12:44:09 +01:00
Adriaan de Groot
9408601074 [libcalamares] Move Python wrapper
- Take the Python wrapper for GlobalStorage out of the GlobalStorage.h
   header and add it to PythonHelper instead, saving some work in
   all the cases that only GS is interesting, not the Python bits.
2020-02-12 12:37:43 +01:00
Adriaan de Groot
a11280b427 [libcalamares] Expand tests for printable entropy 2020-02-12 12:22:02 +01:00
Adriaan de Groot
090716ba4f [libcalamares] Warnings-- in Entropy
- reading a file yields a qint64
 - need to mash the unsigned data from twister to signed char data.
2020-02-12 12:15:13 +01:00
Adriaan de Groot
7efed8226c [libcalamares] Warnings--, update copyright 2020-02-12 12:10:58 +01:00
Adriaan de Groot
c1151cbcfa [libcalamares] Update copyright info 2020-02-12 12:08:46 +01:00
Adriaan de Groot
8181808bec [libcalamares] Fix build
- drop now-obsolete boost-warnings.h
 - add missing namespace alias to GlobalStorage.h (removed accidentally
   in previous commit)
2020-02-12 11:25:10 +01:00
Adriaan de Groot
3b35ca7bb9 [libcalamares] Simplify includes
- PythonHelper.h already pulls in all the Python machinery
2020-02-12 11:04:15 +01:00
Adriaan de Groot
95722541d0 [libcalamares] Untangle Python includes
- Use BoostPython.h to manage overall includes
 - Remove local home-grown variations
2020-02-12 11:02:38 +01:00
Adriaan de Groot
f8998834cf [libcalamares] Simplify includes (no Python used in JobQueue) 2020-02-12 10:55:36 +01:00
Adriaan de Groot
d42e757576 [libcalamares] Simplify includes
- CalamaresVersion used by the job, not the API presented to Python.
 - Untangle Qt includes from there.
2020-02-12 10:48:19 +01:00