The check for skipping a subdirectory was applied to Python subdirs,
not to C++ subdirs. This meant that a skipped module would notice
only in calamares_add_plugin() that it should be skipped. The **rest**
of the CMakeLists.txt in the to-be-skipped modules' subdirectory
was not skipped, and so a test might be added for a module that
was skipped. Depending on how the test consumes the code/module
under test, that might fail to link.
Example module is *initramfs*. Reported by yonggan.
The skip-checking is now in the functions for adding plugins and
subdirectories, so that third-party building should get it
as well, for free. Since AddModuleSubdirectory and AddPlugin
use the newly split-out module, handling SKIP_MODULES and USE_*
consistently across module repositories is now easier.
While here, make accumulating-the-skipped-modules explicit.
There are two ways to skip building a module:
- SKIP_MODULES (individually listed)
- USE_* (pick one from a collection)
Move the handling for those ways to a separate function, so that it
can be re-used in the calamares-extensions module too, or other
external module repositories.
- 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 intended license for the CMake modules is BSD-2-Clause;
there's no desire to restrict what can be done with these,
and CMake modules are generally 2-clause licensed.
- The variables that are set for out-of-tree builds are prefixed
with to avoid name clashes; make the module-infrastructure
respect those instead of the in-tree variable names.
- .. and then duplicate the in-tree variables to the out-of-tree
variables, so we only need one set of module instructions.
- The Python configuration tests sometimes need extra setup, so
do that through a CMakeTests.txt file in the test directory.
- Patch up existing tests:
- grubcfg needs /tmp/calamares/etc/default to exist
- rawfs won't work on FreeBSD because of differences in /proc
- If a module has tests/#.global or tests/#.job, these are used
as arguments to a test-run of loadmodule (which reads them
and runs the module with that configuration).
- This makes the old python-loading test and test-runner entirely
obsolete, so remove them too.
- Loading the module will check Python modules for syntax,
and C++ modules for symbols. This would be a good idea,
except for where it calls exec() and does things to the
running system. Most modules are harmless with an empty
config, but you never know (e.g. a process module).
Switching to INSTALL_CONFIG=OFF breaks tests by not having them
in the build directory. Some logic was coupling not-installing
to not-using-in-build-dir too closely.
Since we install the CMake files now, also put license headers in them.
These files are intended to help plugin and branding component authors
write them in a simple Calamares-idiomatic way.
If Python isn't found, or PythonQt isn't found, there is no point
in copying over the modules into the build tree; this may even be
misleading because the files are there, but won't work and this
will be noticed at runtime only.
Instead, skip the modules and explain why.
Make a function out of explaining-skipped-modules, and call it
not only after collecting all the modules, but also after
the feature summary, so that it's quite clear which modules
are skipped.
Modules may be skipped for different reasons: SKIP_MODULES
is the traditional approach to suppress some, but other modules
may have unmet build requirements (e.g. Plasma Look-and-Feel,
or the Partitioning module) and should be able to opt-out
of being built. For all those skipped, log it explicitly after
all the modules have been examined.
Only CMake-based (e.g. C++) modules support opting-out in this way.