Commit Graph

277 Commits

Author SHA1 Message Date
Adriaan de Groot
c71385e93f i18n: fix broken translation in CommandList 2018-02-07 17:43:26 +01:00
Adriaan de Groot
f954496acf i18n: avoid translation tricks, use QCoreApplication::translate
Instead of using tr and some macro hacks to get lupdate to
recognize the translation, instead use QCoreApplication::translate()
which takes its own context for translation.
2018-02-07 17:43:26 +01:00
Adriaan de Groot
aed904e3b4 Merge branch 'i897-timeout'
FIXES #897
2018-01-29 22:12:36 +01:00
Adriaan de Groot
2da430fa36 [libcalamares] Allow CommandLine to have unset timeout
- Introduce enum for the appropriate constant
 - If the timeout isn't set, then defer to the timeout set
   on the commandlist when running the commands.
2018-01-29 21:25:18 +01:00
Adriaan de Groot
c641f5dec6 [libcalamares] Implement object-style command line
- handle command: and timeout: entries
 - test for setting the values
2018-01-29 21:08:42 +01:00
Adriaan de Groot
fe2be46d3f [libcalamares] Extend command-list with timeouts
- Replace plain StringList with a list of <String, timeout> pairs,
   and run that instead. All code paths still use the default 10sec
   timeout and there's no way to change that.
2018-01-29 17:10:56 +01:00
Adriaan de Groot
778feb50e8 [libcalamares] Additional convenience for doubles 2018-01-29 14:45:42 +01:00
Adriaan de Groot
54a9bbb949 [libcalamares] Don't eat output on timeout.
- Copy stdout from timed-out process into the output variable,
   instead of just dumping it into the log file. This will
   improve the user experience, too, because they will get some
   feedback / explanation of what the process has done.
2018-01-26 18:19:38 +01:00
Adriaan de Groot
26dfd56f6d [libcalamares] Additional convenience function extracting int 2018-01-24 16:19:22 +01:00
Adriaan de Groot
b828580464 Merge remote-tracking branch 'origin/simplify-plugin' 2018-01-24 14:22:35 +01:00
Adriaan de Groot
9a9c6da6db i18n: try to trick Transifex into recognizing these strings 2018-01-23 12:11:34 +01:00
Adriaan de Groot
97fb83c743 [libcalamares] Change debug logging of how job name is derived 2018-01-17 09:17:36 -05:00
Adriaan de Groot
abc6914528 [libcalamares] Enforce singleton-ness of CalamaresPython::Helper
- unset instance pointer on destruction
 - make constructor private, and the instance accessor
   should create an instance if there isn't one.
2018-01-17 06:18:43 -05:00
Adriaan de Groot
86b899566e [libcalamares] Silence compiler warnings about PluginFactories
- d_ptr shadows QObject d_ptr, which clang complains about
 - rename, and don't use Q_D and similar because it messes with internals.
2018-01-16 13:23:51 +01:00
Adriaan de Groot
510af704d8 [libcalamares] Improve documentation
- reference to _WITH_JSON is bogus copy-replace from other code
 - fix style of sample code.
2018-01-16 13:23:51 +01:00
Adriaan de Groot
0020fd885c [libcalamares] Remove unused extern declaration 2018-01-16 13:23:51 +01:00
Adriaan de Groot
a2bdc12f25 [libcalamares] Drop unused plugin defines
- Remove some superfluous intermediate defines
 - baseFactory was not used (always Calamares::PluginFactory)
 - Move DECLARATION and DEFINITIONS apart
 - CALAMARES_PLUGIN_FACTORY_DEFINITION was redefined (identically)
 - CALAMARES_PLUGIN_FACTORY_DECLARATION was redefined (identically)
 - __VA_ARGS__ was constant
2018-01-16 13:23:09 +01:00
Adriaan de Groot
f01c7cda6b [libcalamares] Fix debug output classname 2018-01-15 08:41:24 -05:00
Adriaan de Groot
913690650f [libcalamares] Move CommandList into libcalamares
- Move CommandList so it can be used from more modules than
   just ShellProcess
 - Allow a CommandList to run itself. This centralizes
   code for executing one or more commands and simplifies
   the ShellProcess module.

Various small cleanups:
 - mention instance id in log message
 - code formatting / style
2018-01-15 06:52:55 -05:00
Adriaan de Groot
60f4dd7b3b [libcalamares] Improve explanation of failed processes. 2018-01-15 05:51:58 -05:00
Adriaan de Groot
4ff1a0d5ea [libcalamares] another convenience for running commands
Back targetEnvCommand() with a more general runCommand()
that takes an argument selecting the location to run
the command in. This allows us also to use the same
API for running processes in the host during install,
as we do for running them in the target system.

One reason for this change is wanting to run (user-specified)
commands and independently from the global dontChroot setting,
run those commands in the live system or the target.

This changes the ABI of the DLL, since targetEnvCommand()
is no longer exported. Plugins will need to be recompiled.

 - refactor targetEnvCommand() into more general runCommand().
 - While here, allow host system commands to run even if
   there is no global storage.
 - provide convenience accessors for ProcessResult members
 - Move explanation of process errors out of ProcessJob
   - Move from ProcessJob to ProcessResult, so it can be
     reused outside of ProcessJob (e.g. from ShellProcessJob).
   - Add some convenience functions, too.
2018-01-12 10:32:42 -05:00
Adriaan de Groot
f8a53f9646 [libcalamares] Refactor explanation of process-job errors 2017-12-21 16:30:13 +01:00
Adriaan de Groot
762ad54344 Documentation: change http links to GitHub to https 2017-12-20 08:39:09 -05:00
Adriaan de Groot
8a053f3c9b [libcalamares] Allow retrieving chroot mode from system (as well as settings) 2017-12-03 10:09:00 -05:00
Adriaan de Groot
298ff0cbeb Merge branch '3.1.x-stable' 2017-12-03 04:43:23 -05:00
Adriaan de Groot
517dbfab06 [libcalamares] The script namespace is actually a dict
Use dict methods, in particular d.get(k, v), to retrieve
the pretty_name() function (or None if it isn't there).
Using getattr() on a dict will not return values in the
dict.
2017-12-01 16:42:56 -05:00
Adriaan de Groot
0d413ba750 Merge branch '3.1.x-stable' 2017-11-29 08:58:32 -05:00
Adriaan de Groot
12369abaa4 [libcalamares] Refactor to reduce compiler warnings 2017-11-29 08:49:44 -05:00
Adriaan de Groot
c284304872 [libcalamares] Adjust copyright lines 2017-11-28 11:41:17 -05:00
Adriaan de Groot
cc195eb3d4 [libcalamares] Improve reporting of CalledProcessError
For called processes, replace the not-very-useful type message
with the command-explanation, and replace the value (previously
command-explanation) by the stderr of the failed command.

FIXES #865
2017-11-28 11:38:26 -05:00
Adriaan de Groot
9df796a3fd [libcalamares] Log earlier, warnings-- 2017-11-28 11:26:59 -05:00
Adriaan de Groot
1e27c6438a [libcalamares] Special-case CalledProcessError 2017-11-28 11:21:42 -05:00
Adriaan de Groot
a0a8ab0048 [libcalamares] Refactor Python target_env calls
This is why the whole refactoring started: to get the process output
and exit code in one spot so we can attach the process output
to the (Python exception) CalledProcessError in all the code
paths, not just those that are explicitly looking for output.
2017-11-28 10:55:53 -05:00
Adriaan de Groot
6693d91152 [libcalamares] Refactor bp:list -> QStringList 2017-11-28 10:42:00 -05:00
Adriaan de Groot
9d31380980 [libcalamares] Refactor target-environment calls
- Add a more general targetEnvCommand() that returns both
   error code and process output.
 - Change existing targetEnvCall() and targetEnvOutput()
   to use general form while discarding some data.
2017-11-28 10:27:24 -05:00
Adriaan de Groot
f5aec1ad8a [libcalamares] Add output to CalledProcessError
- Refactor, internal _handle_check_target_env_call_error doesn't need
   to be in header or visible.
 - Add optional output (of the command) to the Python exception.
2017-11-28 08:53:40 -05:00
Adriaan de Groot
1f3f6111f7 [libcalamares] Log output from failed commands 2017-11-28 08:40:12 -05:00
Adriaan de Groot
b4d4351825 [libcalamares] Better Python traceback handling:
- log the whole error message as plain text
 - convert to HTML only for the ui
2017-11-28 08:33:32 -05:00
Adriaan de Groot
188050a77c Merge branch 'master' into usertracking 2017-11-21 07:29:49 -05:00
Adriaan de Groot
e8e284f724 Merge remote-tracking branch 'origin/kcrash' 2017-11-13 13:18:53 +01:00
Adriaan de Groot
7a7e2b16cb [libcalamares] Some extra system-information functions 2017-11-08 09:51:46 -05:00
Adriaan de Groot
e83b4d33f8 [libcalamares] Another convenience config-extraction function 2017-11-08 07:40:44 -05:00
Adriaan de Groot
f3eb557fdb [libcalamares] Provide some convenience functions for extracting configuration data 2017-11-03 11:02:06 -04:00
Adriaan de Groot
2d31e987c0 [libcalamaresui] Unrelated typedef for JobList 2017-11-03 11:02:06 -04:00
Adriaan de Groot
33f78b375d Merge branch 'master' into kcrash 2017-09-27 09:52:01 -04:00
Adriaan de Groot
dcc66c2793 Clang: for gcc, don't produce empty COMPILE_FLAGS 2017-09-25 17:08:09 +02:00
Adriaan de Groot
6924bd7d23 Clang: produce fewer warnings (all caused by boost headers) 2017-09-25 16:33:48 +02:00
Adriaan de Groot
7f00073e7f Clang: warnings-- 2017-09-25 16:23:47 +02:00
Adriaan de Groot
a4a05acc61 Remove more crashreporter references 2017-09-20 09:25:05 +02:00
Adriaan de Groot
40c49bd50d Clang: be more explicit about marking third-party code.
- This is only a partial solution to warnings caused by third-party
   code, since #including the headers from other sources won't apply
   the warning-suppressions.
 - Flags are not applied when building the source as part of a larger
   target, but are on re-building just one object (it seems -- CMake
   issue to track down).
2017-09-21 04:53:09 -04:00
Adriaan de Groot
34761c4214 Clang: reduce 0-as-nullptr warnings 2017-09-20 09:24:22 -04:00
Adriaan de Groot
337903db09 Clang: reduce warnings about overriden destructors 2017-09-20 09:11:18 -04:00
Adriaan de Groot
9693d7a5bd Memory: clean up interface used to get memory (RAM) size 2017-09-20 09:11:02 -04:00
Adriaan de Groot
0c129f2460 Reduce third-part warnings a better way.
Thanks to Kevin Kofler for pointing out what I'd forgotten about
source-file flags. While at it, introduce a generic mechanism for
suppressing warnings in third-party code.

Mostly reverts 4930484931
2017-09-19 16:49:14 +02:00
Adriaan de Groot
13807ceabf Licensing: add self
- to all the files I've touched recently
 - to (very incomplete) AUTHORS list

Licensing: add license info to top-level CMakeLists.txt
2017-09-19 15:57:25 +02:00
Adriaan de Groot
6d880b5631 Replace memory-size detection.
- drop use of dmidecode to determine exact physical memory size
 - use sysinfo() to find memory size (assumes linux 2.3.48 or later)
2017-09-19 15:57:25 +02:00
Adriaan de Groot
ddb6455365 Revert be2338ff0 (intended just to reduce warnings)
- keep the calamaresstyle formatting changes,
 - drop shadowing and nullptr changes.

FIXES #805
2017-09-18 15:11:18 +02:00
Adriaan de Groot
4930484931 CMake: massage build of libcalamares
- Build also two OBJECT libraries,
 - Allow changing Clang warnings for third-party code.
2017-09-18 14:59:53 +02:00
Adriaan de Groot
eede92646d CMake: shuffle includes, drop useless (empty) QT_INCLUDE_DIR 2017-09-18 12:32:37 +02:00
Adriaan de Groot
a266ecb133 CMake: simplify definitions, distinguish kinds of sources 2017-09-17 06:48:07 -04:00
Adriaan de Groot
03d9dbe099 Clean up CMakeLists, linking 2017-09-13 18:29:56 +02:00
Adriaan de Groot
be2338ff08 Clang: reduce warnings 2017-09-13 08:03:18 -04:00
Adriaan de Groot
297e97da19 Clang: tidy up warnings in logger 2017-09-11 11:03:25 +02:00
Adriaan de Groot
9116718448 Clang: warnings-reduction 2017-09-10 15:19:36 -04:00
Adriaan de Groot
a06911e9aa Clang: refactor units-converters, reduce warnings 2017-09-10 13:22:32 -04:00
Adriaan de Groot
106f18e074 Log process output of failed commands
FIXES #612
2017-08-23 16:44:09 -04:00
Adriaan de Groot
2c81fceacb Python: KeyError because pretty_name may not exist 2017-08-23 04:59:04 -04:00
Adriaan de Groot
5dc70ac261 Python-i18n: apply C++-coding style 2017-08-21 12:36:04 -04:00
Adriaan de Groot
538c59adb9 Python-i18n: add /usr/local/share/locale to search 2017-08-21 12:34:38 -04:00
Adriaan de Groot
d6d5f54d00 Python-i18n: clarify debugging 2017-08-21 10:37:35 -04:00
Adriaan de Groot
22fd428664 Python-i18: avoid duplicate path entries 2017-08-18 14:22:59 -04:00
Adriaan de Groot
3a1d5ed533 Python-i18n: (inefficiently) search for suitable gettext dirs 2017-08-18 13:06:44 -04:00
Adriaan de Groot
78b3c8ed32 Python-i18n: allow None as a gettext path (searches default) 2017-08-16 16:45:34 +02:00
Adriaan de Groot
74be2fd098 Python-i18n: implement gettext functions in libcalamares.utils
- remove Job.gettextPath
 - add libcalamares.utils.gettext_path()
 - add libcalamares.utils.gettext_lang()
 - modify examples in main.py
 - add some gettext debug-output from dummypython
 - correct namespace mis-labeling
 - provide two forms of GlobalStorage
   - regular use, has a JobQueue with storage
   - testing use, creates GlobalStorage separately, provide
     independent access to that for Python.
2017-08-16 10:53:11 +02:00
Adriaan de Groot
d4c714c400 Python: fix up testing script
- Didn't run at all (at least since v3.1) because of mismatch between
  GlobalStorage constructor arguments and use; special-case None
  in the C++ code to allocate a new GlobalStorage object.
2017-08-15 13:58:43 +02:00
Adriaan de Groot
6370898154 Python-i18n: make it compile again 2017-08-15 13:21:17 +02:00
Adriaan de Groot
cbfdd8690d Python-i18n: WIP, moving API to libcalamares.utils 2017-08-15 12:31:47 +02:00
Adriaan de Groot
b922d88b0f Python-i18n: add a gettext_path for python job modules 2017-08-10 15:39:24 -04:00
Adriaan de Groot
34b96148ae Python: at beginning of job, if pretty status has changed, emit progress to update it in the UI. 2017-07-10 11:58:57 -04:00
Adriaan de Groot
11e5a6cbe0 Python: trim description to the first line of run.__doc__ 2017-07-10 11:58:57 -04:00
Adriaan de Groot
a72cc0eeb4 Python: use the module run().__doc__ as a pretty description. 2017-07-05 06:46:29 -04:00
Adriaan de Groot
f12ae5db3b Python: get docstring from run() method 2017-07-05 06:46:29 -04:00
Adriaan de Groot
75b5303b49 i18n: stop trying to install Qt translations 2017-06-29 06:29:29 -04:00
Adriaan de Groot
5cd328dad3 Clang: if we're going to crash on purpose, crash the C++ way 2017-06-28 08:44:59 -04:00
Adriaan de Groot
0d884869e5 Clang: reduce warnings about code-documentation 2017-06-27 07:17:40 -04:00
Adriaan de Groot
f2d2218070 Clang: fix warning about implict copy-ctor with explicit move-ctor 2017-06-27 07:15:31 -04:00
Adriaan de Groot
8ea14d7957 Release: add copyright to files I've touched 2017-06-21 08:27:10 -04:00
Adriaan de Groot
2148538fac Clang: reduce warnings 2017-06-21 07:28:38 -04:00
Adriaan de Groot
d29acf4a06 Logging: add a global storage dump method 2017-06-06 09:22:21 -04:00
Teo Mrnjavac
6c7cdb5f50 Documentation++ 2017-03-01 13:35:06 +01:00
Teo Mrnjavac
b1c67f429f Update headers. 2016-12-16 17:03:13 +01:00
Teo Mrnjavac
99ca3d768d Expose translator locale name. 2016-12-16 17:03:13 +01:00
Teo Mrnjavac
3170067089 Make JobResult inheritable and remove obsolete Status enum. 2016-12-16 17:03:00 +01:00
Teo Mrnjavac
0f734c8c5c Make sure to only call Py_Initialize if Python is not initialized. 2016-12-16 17:03:00 +01:00
Teo Mrnjavac
2c3b56c803 Link against PythonQt; new PythonQtViewModule stub. 2016-12-16 17:03:00 +01:00
Teo Mrnjavac
ada620effc Find PythonQt. 2016-12-16 17:03:00 +01:00
Kevin Kofler
00d9f211f5 Add support for C++/Qt batch job plugins
These job plugins work similarly to view modules, with the following
differences:

* These jobs need to link only libcalamares, not libcalamaresui. For
  this reason, PluginFactory was moved from libcalamaresui to
  libcalamares. (It depends only on QtCore.)

* Instead of deriving from ViewModule, derive from CppJob (which is a
  subclass of Job).

* Like process and Python jobs, a job plugin is a single job, whereas a
  ViewModule can generate a whole list of jobs.

The CppJob and CppJobModule classes are new. In Module::fromDescriptor,
the combination type=job, intf=qtplugin is now supported and mapped to
CppJobModule.
2016-09-27 17:25:09 +02:00
Jonathan Carter
c83ca9af44 Fix spelling mistake in kdsingleapplicationguard.cpp (#257)
s/emty/empty/g.
2016-09-12 07:56:13 +02:00
Andrius Štikonas
9f0ca042fe Port away from most cases of Q_FOREACH to C++11 ranged for loop.
In order to avoid deep copies, Qt containers over which we iterate must be const
The remaining unported cases require qAsConst (Qt 5.7) or std::as_const (C++17)
2016-09-01 16:46:14 +01:00
Teo Mrnjavac
0684a761bd Copyright. 2016-08-19 12:49:36 +02:00