Currently, the `bytesToSectors()` function rounds a partition size to the
nearest MiB unit, which may lead to inconsistencies when a partition
is expected to only be a few KiB's.
This patch changes the behaviour of `bytesToSectors()` so that it aligns
on sector size, without rounding the partition size to a multiple of
1MiB.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Currently, all size units are expressed as KiB, MiB or GiB (resp. 2^10,
2^20 or 2^30).
In order to maximize compatibility and consistent results with other
partitioning tools, this commit adds support for sizes expressed as KB,
MB or GB (resp. 10^3, 10^6 or 10^9).
This change won't affect existing users, it simply adds a new option
that wasn't previously handled.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
- this is not entirely straightfoward, since we need
different constructor arguments for the objects
Calamares creates (no QVariantList& args, in particular).
Implement our own registerPlugin() and createInstance()
for that.
- work around a bug in K_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY
As the config files integer are now of type `QVariant::LongLong` instead
of `QVariant::Int`, requirements relying on this type were not parsed
correctly.
This patch fixes this, and adds an option to the python conversion to
take into account `QVariant::LongLong` types.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Currently, a number of configuration parsing-related functions and
classes use only `int` type for dealing with integers. Should the user
need a bigger integer value, this would result in an erroneous value
being used (`0`), as the correct value would overflow the 32-bits type.
In order to prevent these overflow, this patch replaces `int` with
`qint64` in the following functions & classes :
* CalamaresUtils::yamlScalarToVariant()
* CalamaresUtils::getInteger
* NamedSuffix
* PartitionSize
This way, sizes or other integer values greater than 2^31 (for signed
types) can be used.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
When the rootfs partition is read-only, mount points for the other
partitions cannot be created, therefore they need to be created in a
tmpfs, already mounted somewhere in `/`.
However, the extra mounts are only mounted at the end, which causes an
error as no tmpfs is currently mounted.
This patch makes sure all extra mounts are mounted right after the `/`
partition, allowing the use of a read-only rootfs.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This variable is declared in `if m:`. Of course if this codepath doesn't
run, the variable is not declared an Python doesn't like this kind of
surprise...
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
- If KPMcore is found -- it requires some other KDE Frameworks but
at least in pre-4.0 versions doesn't check very well for them --
then missing its dependencies is no cause for CMake failure.
Instead, log it nicely and suppress the module.
- stop compiler warnings with some judicious casting;
that's what you get when a container indexed by int
stored those indexes as quintptr.
- apply coding style
- do static initialization more carefully
- float -> qreal (double) because that's what the Qt API expects,
to reduce type-conversion warnings
- apply current coding style
- calamares_automoc() sets AUTOMOC, but also adds some flags
to avoid compilation warnings from the generated MOC code.
- drop weird hard-coded include paths
- Although milliseconds::count() is long long, we pass it to
a Qt interface that only takes int; let's assume we have
only a 32-bit count, since a timeout of 4 billion milliseconds
is roughly 46 days, which we'll just call "no timeout".
- Drop the round-trip of forming a JSON document from a QVariant,
then parsing the document into JSON objects and building a
model out of that. View the Variant directly.
- This is a fairly specialized class, for use only in the
whole-application where it ties in with the module system.
Move it to the application directory and slim down the UI library.
- Include it from the new location.
- Add UIC to Calamares (the application) because there's now
a designer-based widget in it.
- KDE and GNOME selection images were drawn by me for the bogus
package model, and should not be used.
- Keep Calamares logo though, even if it doesn't make much sense
to use it in package selection.
- Keep the no-selection image since it might be used more often,
but it's not very good.
- The ID and Screenshot entries might be weird in AppData (in particular,
a remove URL) so put those back under the control of Calamares even
when using AppData as the source of descriptions.
- Document all the static inline methods that do the work
- Fill up a QVariantMap from <name>, <summary> and <description><p>
elements, and use that to initialize the PackageItem.
- Doing a manual read of the XML, since existing appdata libraries
don't seem to have a convenient entry for what I need.
- Expand tests to loading AppData (currently, they fail).
- Massage the implementation a bit, don't insert a meaningless
copy of the key as the untranslated message.
- Add isEmpty() to check for presence of the untranslated message.
- Document API.
- Update tests.
- Add a FALLTHRU macro to annotate fallthrough situations in both
Clang and GCC,
- Annotate intentional fallthroughs.
- Add missing break which meant that the selection mode was
always multiple-selection.
- The tests should be run in C locale, otherwise the plain get()
function uses the current locale, which will fail (e.g. running
LANG=nl ./libcalamareslocaletest returns the Dutch strings for
plain get, which isn't what we expect).
- sr@latin is still special.
- While QObject::tr and gettext give us translations **most** of the
time via the translation mechanism, we sometimes have strings
embedded in configuration files that need to be shown to people
as well. Follow the .desktop style in handling this.
- A key's value **might** be translated; use `key[lang]` for the
translation into one of the languages that Calamares understands.
Code that expects a translated (human-readable) string in a configuration
file can use TranslatedString to collect all the translations of a
given key, so that it displays the right string from the configuration
when needed.
- Using id's as keys in a map orders them indeterminately -- in
practice, alphabetically by key. Switch to a list form so that
the products stick to the order they have in the config file
(which means distro's can list "preferred" versions at top).
- Change to std::chrono::seconds wasn't tried against the (optional)
PythonQt bindings, leading to build failure. Reported by Phil (Manjaro).
FIXES#1210
- Need to create just one QApplication (subclass) with the right
parameters for the UI to work.
- If the UI is enabled and it's a View module, then show the widget
rather than running the jobs.
- The ViewManager needs branding information, which wasn't
initialized -- leading to crashes. Add -b option to give
a specific branding, and default to something take makes
sense when testing modules from the build directory.
- Allows the module to load; doesn't show the UI though.
Package chooser is a **low density** package selector -- unlike
netinstall which offers a high density tree view -- for picking
zero, one, or more items from a small collection of packages.
This can be used, e.g., for "pick exactly one desktop environment",
"pick zero or more text editors" which can then be installed
by another module. The UI is big and shiny (rather than netinstall's
text-based tree view) and isn't suitable for more than a dozen or
so items.
- preservefiles generally needs to have the target filesystems
mounted, so that it can preserve to them; but you can also
configure it such that there is no need for mounted filesystems
(e.g. in OEM setup).
- Add an example line in CMakeLists.txt to show how that would be done.
- The mount module must happen before unpackfs because that (mount)
module sets up the root mount point (in /tmp) and some other
variables needed later.
- While called from the ViewManager (to post the debug log)
this isn't really part of the ViewManager itself, so factor
out the pasting code into its own file.
Added new configuration "efiMountOptions" to fstab.conf
When generating the fstab entry for the ESP, take the mount options from
the new configuration or fall back to "mountOptions".