diff --git a/AUTHORS b/AUTHORS index f39b579f4..a1c1bae5b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,24 @@ -Teo Mrnjavac -Adriaan de Groot +# MAINTAINER + +Teo Mrnjavac (maintainer -2017) +Adriaan de Groot (maintainer 2017-) + +# CONTRIBUTORS + +Alf Gaida +Allen Welkie +Andrius Štikonas +Bernhard Landauer +Bezzy1999 +bill-auger +crispg72 +demmm +Gabriel Craciunescu +Kai Dohmen +Kevin Kofler +Kyle Robertze +Lisa Vitolo +n3rdopolis +Philip Müller +Ramon Buldó +Rohan Garg diff --git a/CMakeLists.txt b/CMakeLists.txt index aa0d9016b..fbc1cac26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,12 +113,22 @@ set( QT_VERSION 5.6.0 ) find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED Core Gui Widgets LinguistTools Svg Quick QuickWidgets ) find_package( YAMLCPP 0.5.1 REQUIRED ) find_package( PolkitQt5-1 REQUIRED ) +find_package(ECM 5.18 NO_MODULE) +if( ECM_FOUND ) + set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH}) +endif() option( INSTALL_CONFIG "Install configuration files" ON ) option( WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON ) option( WITH_PYTHONQT "Enable next generation Python modules API (experimental, requires PythonQt)." OFF ) +option( WITH_KF5Crash "Enable crash reporting with KCrash." ON ) option( BUILD_TESTING "Build the testing tree." ON ) +find_package( KF5 COMPONENTS CoreAddons Crash ) +if( NOT KF5Crash_FOUND ) + set( WITH_KF5Crash OFF ) +endif() + if( BUILD_TESTING ) enable_testing() endif () @@ -277,6 +287,7 @@ add_subdirectory( src ) add_feature_info(Python ${WITH_PYTHON} "Python job modules") add_feature_info(PythonQt ${WITH_PYTHONQT} "Python view modules") add_feature_info(Config ${INSTALL_CONFIG} "Install Calamares configuration") +add_feature_info(KCrash ${WITH_KF5Crash} "Crash dumps via KCrash") feature_summary(WHAT ALL) diff --git a/CMakeModules/FindPythonQt.cmake b/CMakeModules/FindPythonQt.cmake index 0d886902d..8de40853f 100644 --- a/CMakeModules/FindPythonQt.cmake +++ b/CMakeModules/FindPythonQt.cmake @@ -9,12 +9,19 @@ if(NOT PYTHONLIBS_FOUND) message(FATAL_ERROR "error: Python is required to build PythonQt") endif() +# Cut X.Y[.Z] down to just X.Y string(REGEX REPLACE "^([0-9][0-9]*)\.([0-9][0-9]*)" - "\\1" - PYTHONLIBS_MAJMIN + "\\1.\\2@" + _PYTHONLIBS_MAJMIN ${PYTHONLIBS_VERSION_STRING} ) +string(REGEX REPLACE + "@.*" + "" + PYTHONLIBS_MAJMIN + ${_PYTHONLIBS_MAJMIN} +) if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}") find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.") @@ -30,7 +37,7 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h DOC "Path to the PythonQt include directory") if ( NOT PythonQt_FIND_QUIETLY ) - message( STATUS "Searching for PythonQt (Python ${PYTHONLIBS_MAJMIN}) .." ) + message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." ) if ( PYTHONQT_INCLUDE_DIR ) message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" ) endif() @@ -99,8 +106,12 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG) endif() if ( NOT PythonQt_FIND_QUIETLY ) - message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) - message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) + if ( PYTHONQT_LIBRARY ) + message( STATUS " .. found library ${PYTHONQT_LIBRARY}" ) + endif() + if ( PYTHONQT_QTALL_LIBRARY ) + message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" ) + endif() endif() diff --git a/README.md b/README.md index dcb5e3b67..b16493b17 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,15 @@ Main: * yaml-cpp >= 0.5.1 * Python >= 3.3 * Boost.Python >= 1.55.0 -* dmidecode +* extra-cmake-modules (recommended; required for some modules) Modules: * welcome: * NetworkManager - * UPower + * UPower (optional, runtime) * partition: - * extra-cmake-modules * KF5: KCoreAddons, KConfig, KI18n, KIconThemes, KIO, KService - * KPMcore >= 3.0.3 + * KPMcore >= 3.0.2 * bootloader: * systemd-boot or GRUB * unpackfs: @@ -37,4 +36,7 @@ Modules: ### Building -See [wiki](https://github.com/calamares/calamares/wiki) for up to date building and deployment instructions. +See [wiki](https://github.com/calamares/calamares/wiki) for up to date +[building](https://github.com/calamares/calamares/wiki/Developer's-Guide) +and [deployment](https://github.com/calamares/calamares/wiki/Deployer's-Guide) +instructions. diff --git a/ci/HACKING.md b/ci/HACKING.md index 92d1a5a48..4d84fc33d 100644 --- a/ci/HACKING.md +++ b/ci/HACKING.md @@ -1,9 +1,15 @@ Hacking on Calamares ==================== +These are the guidelines for hacking on Calamares. Except for the licensing, +which **must** be GPLv3+, these are guidelines and -- like PEP8 -- the most +important thing is to know when you can ignore them. + + Licensing --------- -Calamares is released under the terms of the GNU GPL, version 3 or later. Every source file must have a license header, with a list of copyright holders and years. +Calamares is released under the terms of the GNU GPL, version 3 or later. +Every source file must have a license header, with a list of copyright holders and years. Example: ``` @@ -34,9 +40,9 @@ organization, etc. Please add your name to files you touch when making any contribution (even if it's just a typo-fix which might not be copyrightable in all jurisdictions). -Formatting ----------- +Formatting C++ +-------------- This formatting guide applies to C++ code only; for Python modules, we use [pycodestyle][https://github.com/PyCQA/pycodestyle] to apply a check of some PEP8 guidelines. @@ -48,10 +54,10 @@ some PEP8 guidelines. * No space before brackets, except for keywords, for example `function( argument )` but `if ( condition )`. * For pointer and reference variable declarations, put a space before the variable name - and no space between the type and the `*` or `&`. -* `for`, `if`, `else`, `while` and similar statements put the brackets on the next line, - although brackets are not needed for single statements. -* Function and class definitions have their brackets on separate lines. + and no space between the type and the `*` or `&`, e.g. `int* p`. +* `for`, `if`, `else`, `while` and similar statements put the braces on the next line, + if the following block is more than one statement. Use no braces for single statements. +* Function and class definitions have their braces on separate lines. * A function implementation's return type is on its own line. * `CamelCase.{cpp,h}` style file names. @@ -63,8 +69,9 @@ MyClass::myMethod( QStringList list, const QString& name ) if ( list.isEmpty() ) return false; + cDebug() << "Items in list .."; foreach ( const QString& string, list ) - cDebug() << "Current string is " << string; + cDebug() << " .." << string; switch ( m_enumValue ) { @@ -77,7 +84,7 @@ MyClass::myMethod( QStringList list, const QString& name ) } ``` -You can use the `hacking/calamaresstyle` script to run +You can use the `ci/calamaresstyle` script to run [astyle](http://astyle.sf.net) on your code and have it formatted the right way. @@ -85,6 +92,7 @@ way. order to take advantage of this functionality you will need to acquire the [EditorConfig](http://editorconfig.org/#download) plug-in for your editor. + Naming ------ * Use CamelCase for everything. @@ -97,6 +105,7 @@ Naming * If it's a getter for a boolean, prefix with 'is', so `isCondition()`. * A setter is `setVariable( arg )`. + Includes -------- Header includes should be listed in the following order: @@ -109,8 +118,9 @@ Header includes should be listed in the following order: They should also be sorted alphabetically for ease of locating them. -Includes in a header file should be kept to the absolute minimum, as to keep compile times short. This can be achieved by using forward declarations instead of includes, -like `class QListView;`. +Includes in a header file should be kept to the absolute minimum, as to keep +compile times short. This can be achieved by using forward declarations +instead of includes, like `class QListView;`. Example: ``` @@ -129,6 +139,7 @@ Example: Use include guards, not `#pragma once`. + C++ tips -------- All C++11 features are acceptable, and the use of new C++11 features is encouraged when @@ -141,8 +152,8 @@ range-based `for` syntax introduced with C++11 is preferred ([see this blog post When re-implementing a virtual method, always add the `override` keyword. -Try to keep your code const correct. Declare methods const if they don't mutate the -object, and use const variables. It improves safety, and also makes it easier to +Try to keep your code const correct. Declare methods const if they don't mutate the +object, and use const variables. It improves safety, and also makes it easier to understand the code. For the Qt signal-slot system, the new (Qt5) syntax is to be preferred because it allows @@ -160,10 +171,31 @@ connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this] }); ``` -Debugging ---------- -Use `cDebug()` and `cLog()` from `utils/Logger.h`. - - [1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/ [2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax + + +Debugging +--------- +Use `cDebug()` and `cLog()` from `utils/Logger.h`. You can pass a debug-level to +either macro (1 is debugging, higher is less important). Use `cLog()` for warning +messages. It is recommended to add *WARNING* as the first part of a warning +message. + +For log messages that are continued across multiple calls to `cDebug()`, +in particular listing things, conventional formatting is as follows: +* End the first debug message with ` ..` +* Indent following lines with ` ..` + + +Commit Messages +--------------- +Keep commit messages short(-ish) and try to describe what is being changed +*as well as why*. Use the commit keywords for GitHub, especially *FIXES:* +to auto-close issues when they are resolved. + +For functional changes to Calamares modules or libraries, try to put +*[modulename]* in front of the first line of the commit message. + +For non-functional changes to infrastructure, try to label the change +with the kind of change, e.g. *CMake* or *i18n* or *Documentation*. diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt index 6129aa553..f47a0a9f5 100644 --- a/src/calamares/CMakeLists.txt +++ b/src/calamares/CMakeLists.txt @@ -49,6 +49,13 @@ SET_TARGET_PROPERTIES(calamares_bin RUNTIME_OUTPUT_NAME calamares ) +if( WITH_KF5Crash ) + set( LINK_LIBRARIES + KF5::CoreAddons + KF5::Crash + ) +endif() + target_link_libraries( calamares_bin PRIVATE ${CALAMARES_LIBRARIES} diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp index a265d1e31..47caa558b 100644 --- a/src/calamares/main.cpp +++ b/src/calamares/main.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac + * Copyright 2017, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,11 +20,17 @@ #include "CalamaresApplication.h" +#include "CalamaresConfig.h" #include "kdsingleapplicationguard/kdsingleapplicationguard.h" #include "utils/CalamaresUtils.h" #include "utils/Logger.h" #include "CalamaresConfig.h" +#ifdef WITH_KCRASH +#include +#include +#endif + #include #include #include @@ -33,6 +40,24 @@ main( int argc, char* argv[] ) { CalamaresApplication a( argc, argv ); +#ifdef WITH_KCRASH + KAboutData aboutData( "calamares", + "Calamares", + a.applicationVersion(), + "The universal system installer", + KAboutLicense::GPL_V3, + QString(), + QString(), + "https://calamares.io", + "https://github.com/calamares/calamares/issues" ); + KAboutData::setApplicationData( aboutData ); + KCrash::initialize(); + // KCrash::setCrashHandler(); + KCrash::setDrKonqiEnabled( true ); + KCrash::setFlags( KCrash::SaferDialog | KCrash::AlwaysDirectly ); + // TODO: umount anything in /tmp/calamares-... as an emergency save function +#endif + QCommandLineParser parser; parser.setApplicationDescription( "Distribution-independent installer framework" ); parser.addHelpOption(); diff --git a/src/libcalamares/CalamaresConfig.h.in b/src/libcalamares/CalamaresConfig.h.in index 6fbab422c..cafbe9276 100644 --- a/src/libcalamares/CalamaresConfig.h.in +++ b/src/libcalamares/CalamaresConfig.h.in @@ -10,6 +10,12 @@ //cmakedefines for CMake variables (e.g. for optdepends) go here #cmakedefine WITH_PYTHON + +#cmakedefine WITH_KF5Crash +#ifdef WITH_KF5Crash +#define WITH_KCRASH +#endif + #cmakedefine WITH_PYTHONQT #endif // CALAMARESCONFIG_H diff --git a/src/modules/netinstall/NetInstallPage.cpp b/src/modules/netinstall/NetInstallPage.cpp index 28c836a79..a8e37aa0c 100644 --- a/src/modules/netinstall/NetInstallPage.cpp +++ b/src/modules/netinstall/NetInstallPage.cpp @@ -88,7 +88,9 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) // even if the reply is corrupt or missing. if ( reply->error() != QNetworkReply::NoError ) { - cDebug() << reply->errorString(); + cDebug() << "WARNING: unable to fetch netinstall package lists."; + cDebug() << " ..Netinstall reply error: " << reply->error(); + cDebug() << " ..Request for url: " << reply->url().toString() << " failed with: " << reply->errorString(); ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) ); emit checkReady( !m_required ); return; @@ -96,7 +98,9 @@ NetInstallPage::dataIsHere( QNetworkReply* reply ) if ( !readGroups( reply->readAll() ) ) { - cDebug() << "Netinstall groups data was received, but invalid."; + cDebug() << "WARNING: netinstall groups data was received, but invalid."; + cDebug() << " ..Url: " << reply->url().toString(); + cDebug() << " ..Headers: " << reply->rawHeaderList(); ui->netinst_status->setText( tr( "Network Installation. (Disabled: Received invalid groups data)" ) ); reply->deleteLater(); emit checkReady( !m_required ); diff --git a/src/modules/plymouthcfg/plymouthcfg.conf b/src/modules/plymouthcfg/plymouthcfg.conf index 6d7ae5c27..47c54f5ff 100644 --- a/src/modules/plymouthcfg/plymouthcfg.conf +++ b/src/modules/plymouthcfg/plymouthcfg.conf @@ -1,4 +1,28 @@ +# Plymouth Configuration Module +# +# This module can be used to setup the default plymouth theme to +# be used with your distribution +# +# You should only use this module if the plymouth package is installed +# on the build configurations of your distribution & the plymouth +# theme you want to configure is installed as well. If the unpacked +# filesystem configures a plymouth theme already, there is no need +# to change it here. --- -# The plymouth theme to be set if plymouth binary is present -# leave commented if packaged default theme should be used -# plymouth_theme: spinfinity + + +# Leave this commented if you want to use the default theme +# shipped with your distribution configurations. Make sure that +# the theme exists in the themes directory of plymouth path. +# Debian / Ubuntu comes with themes "joy", "script", "softwaves", +# possibly others. Look in /usr/share/plymouth/themes for more. +# +# Specifying a non-existent theme will leave the plymouth +# configuration set to that theme. It is up to plymouth to +# deal with that. + +plymouth_theme: spinfinity + + + +