- parameter instanceKey was left over from previous work that
special-cased the weight of Python modules.
- while here, consistently do `~T() override`
- switch to QStringList as parameter, since consumers (that is,
the debug dialog, which is what this is for) are interested
just in the **names** of the jobs.
- to allow mutex locking in const methods, mark them mutable.
- point to main Calamares site in the 'part of' headers instead
of to github (this is the "this file is part of Calamares"
opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
this is the 3-paragraph summary of the GPL-3.0-or-later, which has
a meaning entirely covered by the SPDX tag.
- the translations generated from public-domain files are CC0-1.0
- the files derived from Unicode tables are close to CC0-1.0,
possibly except that there is a FileCopyrightText line
- CC0-1.0 for the uninteresting version-headers
- GPL-3.0-or-later for the services
- add SPDX identifiers to Calamares C++ libraries and application sources
- add SPDX identifiers to Calamares QML (panels and slideshow)
- the `qmldir` is a list of names of things in the directory,
so CC0-1.0 it as "uninteresting"
- QRC files are lists of names of things in the directory,
so CC0-1.0 them as well
There's lots of (YAML) test data that is just trivial configurations
for modules. Since the configurations themselves are **also** CC0-1.0,
and the tests are less interesting, license them equally liberally.
The build instructions are not that interesting, it's a toss-up
between CC0 and BSD-2, but because other CMake bits are BSD-2-Clause,
apply that to more CMakeLists. The copyright date isn't all that
accurate, but these are just inconsequential files.
While here, tidy up and get rid of some useless intermediates.
Re-jig the module-weight calculations.
- modules can have a weight
- module instances can have a weight
- jobs, from the module, can have a weight
This is now configurable on a case-by-case basis, rather than having
C++ only as an option and a weird hack for unpackfs.
This is more a test-inspired hack than anything else: since signals
are delivered asynchronously, we can end up delivering progress
signals out-of-order, and then the signal spy lists them wrong:
progress goes backwards.
Insert a tiny delay between jobs to allow signals to be delivered
in-order.
- compute weights and accumulations beforehand
- mutex-lock structures so you can enqueue while running jobs
- simplify progress reporting calculations
- doesn't actually run any jobs
In advance of PR #1491, test loading and stringlist extraction.
- from code, extraction works "normally"
- for YAML data, the stringlist isn't actually a stringlist
- The weight is the module (instance) weight, which can be
- the default weight of 1
- the weight specified for the module (in module.desc / the module
descriptor; this defaults to 1, above)
- the weight specified for the instance (in settings.conf)
The last of these "wins"; weights are constrained to 1..100
The weight isn't actually used in progress computation yet.
- loads emergency, noconfig, requiredModules keys
- warns (and marks descriptor invalid) if there are unused / unknown
keys left over in the descriptor data.
- add fields -- all const, all bogus -- to the descriptor,
introduce a stub method to load the descriptor from
YAML data (e.g. read from module.desc)
- lighten the type-naming in Module a little, with usings
- In most cases, you **know** the table covers all the enum
values, and the extra parameter *ok* is just annoying.
Provide a convenience that doesn't distinguish empty
from empty-but-valid.
- move the enums
- expose the named-enum functions for them
- **start** replacing Descriptor with something stronger; this fails
zero tests so it obviously wasn't tested at all
- setting the weight in *instances* should be different from letting
the default weight (of 1) stand; explicitly saying 1 should
carry some weight (ha!)
- any invalid instance key will cause a complaint
- "new" custom instances in sequence get a complaint, but
the instance description added to the list is valid
- there's no reason to ignore custom instances that are **not**
mentioned in the *instances* section: it may be useful to
name more that one even without distinct config files.
- no more weights in constructors; do that in fromSettings() only.
- simplify test to drop those constructors
- set config file also for "normal" descriptors; fix test
- expose, for testing purposes, the load-from-YAML-data part
alongside the public constructor that reads a YAML file
- add test for building the list of instances
- looks funny
- is hard to get clang-format to respect this; it's intended as an
access-modifier, but those are baked into the code rather than
being configurable.
- is probably rare enough that #ifdef is acceptable
- Requirement.cpp was there "just in case" the header grew
functions that need an implementation, but that seems
unlikely (the header is just a struct of POD).
- the scripts are BSD-2-clause,
- the generated files are CC0 (I'm not *100%* sure about the
derived file CountryData_p.cpp, which lists countries and
country codes -- it **is** extracted from CLDR data which
is not CC0)
- QStringList doesn't round-trip correctly; add a test to
demonstrate that.
- Fix existing test to **not** use QStringList, but QVariantList
(of strings), which is how other code would use it.
The above is **kind** of moot because nothing uses the YAML-save
function, but it might.
While here, fix another test: YAML-loading can load JSON just fine.
- add apidox to all the untranslatedFS() methods
- add the most-basic of untranslatedFS(), which works on a given
FileSystem::Type; this one can handle special cases where
Cala needs a different untranslated name than what KPMCore provides.
- for the purposes of Calamares's nearest-location selection algorithm
for timezone selection, introduce spot patches: alternate markers
on the map to indicate "things close to here belong in this timezone".
- hide the implementation detail in the find() methods.
- Cape Town is in South Africa, so one might expect it to get South
Africa's timezone -- which is Africa/Johannesburg -- but Windhoek
is closer, so it gets that.
- Port Elisabeth is similar: Maseru lies between it an Johannesburg,
so it gets the wrong timezone, too.
These both illustrate how the limited resolution of the map, together
with the "closest location" lookup, can give poor results. For most
of South Africa, the "wrong" timezone is closer than the right one.
- introduce a distance function and use that, rather than coding it
inside the find() function. This is prep-work for unifying the
find() calls, based on various coordinate systems.
Go over the locale module again:
- new models that avoid weird casts and inconvenient iteration
- shared timezone data
- simple sorting and filtering
- simplify the map / QML version
FIXES#1476FIXES#1426
- test insert, remove, emitted signals
- test loading and saving of YAML and JSON
This shows up a big bug in the YAML saving code (which was never
used, it seems, anyway)
- the loadJson behavior did too many notifications, and was likely to
deadlock; write directly to the map instead and emit only once.
- the loadYaml method did something very different from its
documentation or intent.
It's convenient when e.g. QComboBox::currentData() gets the key
"automatically", and the default role for that method is UserRole,
so let the value of KeyRole overlap.
The (renamed) class TranslatableString keeps a key value
(e.g. New_York) and a human-readable version around; the
human-readable one is passed through QObject::tr() for translation
on-the-fly.
- The models are overly complicated: **overall** there is just one
list of timezones, and we need various views on that list.
Start over with an empty model of regions.
- The language code "ie" is not recognized,
- "ia" is, and it seems to be the post-war variant of
Interlingue, so we may want to rename / relabel.
The testEsperanto test -- now split into scripts and
esperanto -- would have picked "ie" out of the list
because it does map to C locale.
The TODO said it was unused: it **is** used, but only in
a very limited scope. Drop it from jobs where it wasn't
useful (e.g. those that just return prettyName(), outside
of the partition module).
This builds some machinery so that we can create
a detector for member-functions (methods) named <whatever>.
Use the macro to build the machinery:
DECLARE_HAS_METHOD(myFunction)
then after that,
has_myFunction<T>
is either std::true_type or std::false_type
depending on whether T has a method myFunction.
- The sources were in src/calamares but processed and generated
in libcalamares, which is weird at best.
- Generate an "extended" version header.
- Use the extended version in the logger and nowhere else.
- While here, minor coding style cleanups
The overall change here means that after running CMake, only
Logger.cpp needs to be rebuilt (if the extended version has
changed) and not a handful of other files that don't need the
full version number, but do happen to include CalamaresVersion.h
- most of the things in utils/ are in the CalamaresUtils namespace,
let Permissions follow suit. Chase the name change in the
*preservefiles* module.
- add an `apply()` function for doing the most basic of chmod.
Note that we don't use `QFile::setPermissions()` because the
**values** used are different (0755 for chmod is 0x755 in the
enum value passed to `setPermissions()`).
- Expand the documentation, emphasize octal-vs-decimal
- east-const consistently in this file (most of Calamares is west-const)
- shuffle the is-valid bool to the end of the data members,
so sorting by size.
- continuations, for the console, no longer print the date + level,
which makes things easier to visually group and read.
- the file log is mostly unchanged, except it contains more spaces now.
- Some variant helpers take a default parameter if the map does not
contains the given key or if the type mismatches. Make all helpers
behave the same.
- QString to-integer members detect if an integer string begins with
"0x" (base 16) or "0", base 8; but QVariant members do not.
- QString: the C language convention is used is base is set to 0.
- Convert to QString and use its member toLongLong() and set base to 0
to detect integer strings begin with a prefix.
- The size of a 2GiB partition (in bytes) is larger than the largest
32-bit signed integer; we hit signed overflow while calculating
2^11 * 2^10 * 2^10 and the test fails.
- Switch the whole table of sizes to qint64 instead.
- For testing purposes only, introduce a _qi suffix for qint64.
FIXES#1430
- All the headers go to relevant subdirs, but we don't keep
libcalamares and libcalamaresui apart.
- While here, remove unused variable from libcalamares CMake
- link the library privately -- the public API uses QVariantMap
- install FindYAMLCPP just in case
- add yamlcpp explicitly in the few places that really need it
(e.g. netinstall testing the parsing of netinstall.yaml)
- Add the Calamares CMake-modules to the search path automatically
- Export to CalamaresTargets.cmake and use namespace Calamares::
- Document imported targets
- Find Qt, because the translations machinery will need macros from that
- The installed lib links to IMPORTED libraries from KF5, so we need
to find them (again) as well.
- Value is configurable (through the "selector" which is passed
to GeoIP lookups). This is convenient for tests so you can "fix"
the value that the lookup will return.
This makes it possible to remove QML from Calamares, possibly yielding
a smaller, lighter installer; it takes with it the nice slideshow,
modern configurable navigation and the QML UIs built for various modules.
By default, WITH_QML is on and the "normal" feature set is retained.
- look for Qml modules only when WITH_QML is on (the default)
- look for Network, since that's pulled in only implicitly
- disable the QML Calamares models (modules/*q) if no QML is
enabled; longer-term plan is to merge the **pages** back to
the "upstream" modules, and have things be run-time switchable,
but that's not here yet. Also disable the notesqml module when
QML is off.
- reminder to make all the ABI-relevant WITH_* settings available as #defines
- move the compilation of KDSAG to the calamares executable, not the library
- when DBus activation is on, drop all of kdsingleapplicationguard
- It is the requirements model (checking) that reports progress, and now
the model is accessible (ask for it with requirementsModel(), make the
messages come from there.
- The architecture of letting someone build up a list of requirements
from data emitted by the ModuleManager is broken: if it gets loaded
later, it will miss data; passing around complicated objects is
no fun anyway. Get rid of it, on the way to "ModuleManager has
its own model of requirements".
- Give the ModuleManager a RequirementsModel -- that is the source
of truth about the module-requirements of the modules managed
by that particular ModuleManager.
- Let the RequirementsChecker operate on a given RequirementsModel.
- All failures were being reported as Timeout, which is confusing
when they are not. Introduce HttpError for the not-timeout
other kinds of errors.
- Add operator<< for RequestStatus for nicer error logging.
- Use << Logger::NoQuote{} to turn off quoting **and** the space
- In practice, in Calamares we use this only around other processes'
output, where we want neither quotes nor spaces.
- the test checks that the default locale is C or en_US .. let's just
make it so instead of relying on the environment. This fixes tests
on my dev-laptop, which happens to be set to en_NL (with volapuk
date format).
- When writing YAML, given a float **always** write
some decimal digits (e.g. "1.0" rather than "1")
so that the type of the written-out thing stays
float.
- Avoids test failure with the sample `welcome.conf`
file which reads 1.0 and would write out 1, which then
led to type differences.
- Handle qlonglong explicitly
- Add a fallbackfor things that convert to qulonglong, to
avoid these remaining integer types from hitting the
very end of the if-chain, and being written out as
the **string** "<typename>"
- In production, cDebug() might not show up, so the log will not
contain the lines saying what program is being run;
- Errors should at least mention the program name, but "env" or
"chroot" is not useful, so pull that from *args*, which is
the command we actually want to run.
- an empty command isn't going to work (although it might successfully
run chroot or env in the target system, that's not useful)
- while here, move variable declarations closer to their use.
- put signals in conventional place
- remove const int& parameter, that can just be int
- drop oddly-guarded code (that leaks memory); if the index (row)
being passed in, it's probably best to just crash
- remove unused signal warningMessageChanged
- the checker only collects and calls requirements; it has no
UI component, and only manages data (and a thread to do the
checking). Move it out of the UI library.
- the `parent` when installing a translator was not used, so drop it
from the API. Chase some uses of the API, but leave welcome-modules
broken: there's a merge of those coming.
- In some cases, it makes sense to close Calamares automatically
when it is done. Set *quit-at-end* to do so -- although this
probably also means you should remove the *finished* page.
- while the queue is executing (the thread is running jobs) the
isRunning() method returns true.
- re-work some internals to reset isRunning() before emitting
finished() signal.
- If we're converting a YAML map to a QVariant (Map), may as well
express that in the types. This makes the return from, say,
`yamlMapToVariant()` cheaper, but incurs conversion in
`yamlToVariant()` .. previously the place for costs was
swapped around.
- For those cases that want-and-expect a Map, or List, this makes
the calls slightly cheaper. For the generic case, the costs move
around internally.
- Replace a map-of-strings with a class type.
- For now, doesn't compile.
- Intention is to construct from a YAML / QVariant from the
*instances* list in `settings.conf`.
- 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.
- 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.
- 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.
- 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
- 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.
- 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.
- 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.
- 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)
- 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.
- 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.
- 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.
- 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.