Put the Item class in a separate header; give it functionality
to create itself from Variants (e.g. from the configuration data)
and to run itself (do whatever the item is supposed to do).
This makes the polymorphic approach unnecessary: we just have
items that are sufficiently smart.
This moves do-a-thing to the Item, while the Job now has one
job: be a loop around creating Items and running items.
The filenames don't matter, but the contents of the file are also
UTF-8, and depending on the default encoding of the Python
interpreter, this can fail on non-ASCII characters in the
file. Set the encoding explicitly while reading and writing
the NetworkManager configuration files.
FIXES#1848
- modules with no configuration should be marked 'noconfig',
but umount is special: it has no **useful** configuration
(maybe no **non-deprecated** configuration), but isn't
marked 'noconfig' **yet**.
- this module needs work to handle BTRFS special-cases *anyway*
- limited in scope, few options: port it while doing the
special-cases
So far, this is just a C++ stub.
SEE #1659#1644
The translations apply to labels and a tooltip, which depends on
the partition-table type. Move the strings together and make
the whole range of the switch explicitly.
- some switch statements handle a bunch of items explicitly,
then default the rest. Clang complains about that. Turn off
the warning for these specific switches, since there's dozens
of values that simply do not need to be handled.
We want to use the KPMCore function consistently, but Calamares
uses a qint64 most of the time. Centralize the cast to double
in one place in the code.
- these are internal classes, with no real Qt machinery; remove
the Q_OBJECT macros.
- replace the tr() calls with calls with an explicit context,
so that translations do not change.
If there is no subvolume set, skip creation of that subvolume.
This allows root to be on a bare FS, without a tag or subvolume
name. To achieve this, use
subvolume: no
(no quotes there) in the YAML.
Timezones 5.0 and 5.5 have considerable overlap; clear up most
of it. Since a pixel is about 55x55km on the ground, and the
translation of latitude and longitude is sketchy at best,
accuracy on this timezone map is not very good.
FIXES#1832
- typo (canmount vs canMount)
- the canMount property is nominally a string, but YAML is 'special'
and interprets 'on' and 'off' and 'yes' and 'no' and other strings
as booleans unless quoted.
- log device node (/dev/sdb) instead of its name
- don't log job's prettyName() because that's translated, and also
contains user-visible private names (introducing a non-translated,
nicely redacted version of prettyName() seems like too much effort
for something that can be reconstructed from bits earlier in the log)
- use hex-trailer
- while here, convert DebugRow to use a copy rather than a reference,
to avoid dangling references when applied to temporaries
- convert *partition* module to use the RedactedNames
- toml.dump() takes a file-like object
- toml.loads() takes a whole string to parse, (e.g. the TOML data),
not a pathname, so change to toml.load() which takes a file-like
object.
- If the config file doesn't exist, the dictionary is empty
- If it **does** exist, it might not have key 'default_session' in it
Either case should avoid a KeyError by using get() (or setdefault,
in this context). Subsequent use of os.path.exists() is strange,
since the value is a **group** (e.g. a dictionary) in the config
file. Just check if it exists, and then fill something in.
- the (n/m) lines are output of specific steps, not actual package-
installation. So look for "<action> <packagename> ..." lines instead.
This means we keep some state around, and need extra machinery to
report those lines rather than the generic progress reporting
that reports on groups.
- during install and remove, check for (n/m) output lines which
report progress of the pacman actions and turn those into progress
reports for the *packages* module.
- remove from GS
- remove duplication across Config and ChoicePage
- improve translations (presumably "msdos or gpt" is the most
complicated it will get)
FIXES#1735
- the partition module makes a nice descriptive widget,
which includes the text it **also** has for the summary;
(the text is intended for the QML summary).
- In general, if a module has a widget for the summary, assume
that that is the **whole** summary and use it instead of text.
This resolves duplicate summaries -- showing the text of the
partitioning-step, followed by its widget -- introduced in July.
- make the installation work,
- special case because rsync can return error 23 (which throws, from
inside the Python API) which still means "it was ok".
SEE #1740
By processing each line in turn (and just counting is) rather
than collecting all of the lines of output from the tools,
we end up with lower memory usage.
- document a bit more of the methods
- provide convenience method enableOutputProcessing() alongside
an explicit setter; adjust tests to the changed API.
- add an executable() information method.
- this was an internal class for logging commands, let's lift
it up to the Logger framework where it might be more generally
useful (or not .. everything needs special-casing for actual
redaction).
This is an experiment in Python API that will allow a callback
function in the Python module to be called for each output line.
It builds on the run-a-process extensions that are being built
simultaneously.
The background idea is that, while CalamaresUtils::System::runCommand()
is a useful general API, it is
- still missing flexibility
- lacking a way to process output from the command "as it happens"
Waiting until the process ends, and then reading all stdout, is
inconvenient for processes that produce a **lot** of output,
and also makes it impossible to report progress. One module
in calamares-extensions has its own run-a-process implementation
for reading output, and this branch aims to introduce something
similar into Calamares core.
- when (manually) using an existing LV, it shouldn't be closed
prior to formatting, since that kills the volume and then the
path (/dev/myvg/mylv) no longer exists. Then creating the
filesysytem on that device path fails.
- Strings were being used as logical values, and then logged
(which should be in English) and also used in the UI (which
should be localized). Replace with a MessageAndPath class,
used only locally, that defers the translation until called-
upon explicitly.
- Replace some VG stuff with similar calls to apply().
Returning partition full-paths instead of only the block-device-name
simplifies later code -- which would prepend /dev/ to the block-
device-name and umount that.
- the tryX() functions weirdly return a string that is used for
debug-logging. Document that. The untranslated string is
later used for user-facing messages. Mark that as FIXME.
- factor out the loop-over-names-and-append to news, because that
makes the overall story of what is happening hard to read.
- all calls to tryCryptoClose() called tryUnmount() first, so
put that call inside tryCryptoClose(), so the interface is simpler.
- improve descriptive-strings in logging ("set?" is not very
meaningful)
- log only the unsatisfied entries, since the preceding
log-message suggests that that is what is happening.
QLabel allows scaling of the Pixmap by itself, and we have a
FixedAspectRatioLabel that scales a pixmap nicely. Use that.
(The new label type needed to be introduced to designer)
The screenshot should expand more agressively, so that it
does not get margins -- that just leave space around the
name and description -- when the window expands. Adjust some
of the stretching and layout in the UI file.
It is easier to put screenshots somewhere where
they can be searched-for, rather than requiring either
absolute paths (inconvenient to try out someone's
settings) or relative paths (because who knows where
Calamares will be run during testing).
The summary page can rely on the Config object to create
lists of relevant steps; this code was declared but not
defined / implemented for Config (but also not called, so
it was ok). This is basically shuffling bits around in
preparation for using the model directly, rather than
re-implementing the widget-creation code.
While here, split off the page-resizing into a free function
so that the code reads nicer.
- the page doesn't need to remember what step it belongs to,
if the step tells it when creating widgets.
- detach naming from the viewstep API that calls it.
The `partition.conf` file contains an EFI-size. The default is 300MiB,
but distributions might like to use a bigger (or smaller) value.
Apply the configuration consistently everywhere where we need
"the size of the EFI partition". Extend the internal method
to look at the configured size.
Apparently everyone shipping a squashfs image also has the tools
installed, because the error message reporting that the tools-are-
missing contained a reference to an undefined variable.
Fix that, and while here improve the error message so you
don't get a whole path as a title in the error message.
The slightly weird error-message construction is so that no
messages change and no translation work is needed.
All **other** modules fully specify libcalamares; only unpackfs
was importing shortcuts. Change to conventional usage (partly
because that's easier on the pylint implementation, partly because
it's then consistent with the rest).
Apparently nobody ever hit the else-branch here (because
each DM has exactly one implementation -- that's what the
check is there for!) because the logging of the error
itself would raise IndexError or ValueError.
- Make clear that the @ is a string-location, and how long the
pre-script is (although in practice, it will be either null
and 0, or the values set in the loadmodule executable).
Read, then write, the NM file. Add a note about how we might
handle this better. Rename live_user() function to give it
a verb (and avoid UnboundLocal when using a variable of the same name).
This class doesn't really set a pointer -- it is a scoped assignment
through a pointer, which **can** set a value on destruction (when
it leaves scope). Rename it.
While here, extend the API so that it can do an assignment to the
underlying object **now**, while also doing a scoped assignment
later when it leaves scope. This makes some code a bit easier
to read ("in this scope, X is now <v> and then it becomes <v'>")
This class was used only once, and is confusing because
the assignment happens always, but to the opposite value
as what was visible. It can be replaced with other
scoped assignment, instead.
Removes the tests for it, too.
- when an emergency strikes, log the modules that are skipped
with a Once, but if an emergency module runs, refresh that
Once so that the function header is printed again -- to
distinguish JobQueue debugging from the logging from the
emergency module.
- iterate over the lines of the source file, rather
than over indexes, and make clear that the hooks, modules and files
lines are replaced, rather than merged.
- this calls write() more often, but it's only a few lines
- don't chain directly from modify_mkinitcpio_conf() to the
function that writes the file write_mkinitcpio_lines();
split into "figure out what needs to be written" and calling
that writing-function, so that we can test / check / log
if needed between the two.
- put the system-information and -detection functions at top
and the "do the actual work" things below
- don't mix the boolean do-we-use-this flags with the
lists of files and modules which are the important
parts of modify_mkinitcpio_conf
- Transifex tools complain about missing Q_OBJECT (which makes
some sense -- you end up with a different context for calls
to tr(), of the base class).
Move some of the texts to the new TranslationFix, from ViewManager,
and use them. Keep them in ViewManager, too, so that the translations
with context ViewManager are not removed just now.