Merge pull request #273 from shainer/master
Non-critical package groups in netinstall module
This commit is contained in:
commit
1ab943a0f0
@ -85,6 +85,9 @@ void NetInstallPage::readGroups( const QByteArray& yamlData )
|
|||||||
if ( groupDefinition["hidden"] )
|
if ( groupDefinition["hidden"] )
|
||||||
m_groups[name].hidden = yamlToVariant( groupDefinition["hidden"] ).toBool();
|
m_groups[name].hidden = yamlToVariant( groupDefinition["hidden"] ).toBool();
|
||||||
|
|
||||||
|
if ( groupDefinition["critical"] )
|
||||||
|
m_groups[name].critical = yamlToVariant( groupDefinition["critical"] ).toBool();
|
||||||
|
|
||||||
m_groupOrder.append( name );
|
m_groupOrder.append( name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,25 +127,25 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
|
|||||||
emit checkReady( isReady() );
|
emit checkReady( isReady() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList NetInstallPage::selectedPackages() const
|
QList<Group> NetInstallPage::selectedGroups() const
|
||||||
{
|
{
|
||||||
QStringList selectedPackages;
|
QList<Group> selectedGroups;
|
||||||
|
|
||||||
// Add all the packages for groups that are toggled in the view.
|
// Add all the groups that are toggled in the view.
|
||||||
for ( auto it = m_groupWidgets.constBegin(); it != m_groupWidgets.constEnd(); it++ )
|
for ( auto it = m_groupWidgets.constBegin(); it != m_groupWidgets.constEnd(); it++ )
|
||||||
{
|
{
|
||||||
if ( it.value()->isToggled() )
|
if ( it.value()->isToggled() )
|
||||||
selectedPackages += m_groups[it.key()].packages;
|
selectedGroups += m_groups[it.key()];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add all the packages for groups that are hidden but selected.
|
// Add all groups that are hidden but selected.
|
||||||
for ( const Group& group : m_groups.values() )
|
for ( const Group& group : m_groups.values() )
|
||||||
{
|
{
|
||||||
if ( group.hidden && group.selected )
|
if ( group.hidden && group.selected )
|
||||||
selectedPackages += group.packages;
|
selectedGroups += group;
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedPackages;
|
return selectedGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetInstallPage::loadGroupList()
|
void NetInstallPage::loadGroupList()
|
||||||
|
@ -34,29 +34,30 @@ namespace Ui
|
|||||||
class Page_NetInst;
|
class Page_NetInst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Representation of a package group.
|
||||||
|
struct Group
|
||||||
|
{
|
||||||
|
Group()
|
||||||
|
: Group( "","",false, false, false ) { }
|
||||||
|
Group( QString name, QString description, bool selected, bool hidden, bool critical )
|
||||||
|
: name( name ), description( description ), selected( selected ), hidden( hidden ), critical( critical ) { }
|
||||||
|
Group( QString name, QString description )
|
||||||
|
: Group( name, description, false, false, false ) { }
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
QString description;
|
||||||
|
QStringList packages;
|
||||||
|
|
||||||
|
// See README.md for a description of these fields.
|
||||||
|
bool selected = false;
|
||||||
|
bool hidden = false;
|
||||||
|
bool critical = false;
|
||||||
|
};
|
||||||
|
|
||||||
class NetInstallPage : public QWidget
|
class NetInstallPage : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
// Internal representation of a package group.
|
|
||||||
struct Group
|
|
||||||
{
|
|
||||||
Group()
|
|
||||||
: Group( "","",false, false ) { }
|
|
||||||
Group( QString name, QString description, bool selected, bool hidden )
|
|
||||||
: name( name ), description( description ), selected( selected ), hidden( hidden ) { }
|
|
||||||
Group( QString name, QString description )
|
|
||||||
: Group( name, description, false, false ) { }
|
|
||||||
|
|
||||||
QString name;
|
|
||||||
QString description;
|
|
||||||
QStringList packages;
|
|
||||||
|
|
||||||
// See README.md for a description of these two fields.
|
|
||||||
bool selected = false;
|
|
||||||
bool hidden = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetInstallPage( QWidget* parent = nullptr );
|
NetInstallPage( QWidget* parent = nullptr );
|
||||||
|
|
||||||
@ -69,10 +70,9 @@ public:
|
|||||||
// in the global storage. This should be called before displaying the page.
|
// in the global storage. This should be called before displaying the page.
|
||||||
void loadGroupList();
|
void loadGroupList();
|
||||||
|
|
||||||
// Returns the list of packages belonging to groups that are
|
// Return a list of groups currently selected. No data is cached here, so
|
||||||
// selected in the view in this given moment. No data is cached here, so
|
// this function does not run in constant time.
|
||||||
// this function does not have constant time.
|
QList<Group> selectedGroups() const;
|
||||||
QStringList selectedPackages() const;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void dataIsHere( QNetworkReply* );
|
void dataIsHere( QNetworkReply* );
|
||||||
|
@ -125,12 +125,31 @@ NetInstallViewStep::onLeave()
|
|||||||
cDebug() << "Leaving netinstall, adding packages to be installed"
|
cDebug() << "Leaving netinstall, adding packages to be installed"
|
||||||
<< "to global storage";
|
<< "to global storage";
|
||||||
|
|
||||||
if ( !m_widget->selectedPackages().empty() )
|
const QList<Group>& selectedGroups = m_widget->selectedGroups();
|
||||||
|
|
||||||
|
if ( !selectedGroups.empty() )
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> packagesWithOperation;
|
QMap<QString, QVariant> packagesWithOperation;
|
||||||
// Gets all packages selected in the page; includes groups that are
|
QStringList packages, critical_packages;
|
||||||
// selected by default but not displayed.
|
|
||||||
packagesWithOperation.insert( "install", m_widget->selectedPackages() );
|
// We have two types of groups: "critical" (failing to install any of
|
||||||
|
// the packages makes Calamares fail) and "non critical" (we only log
|
||||||
|
// an error if the installation fails). We distinguish them here and select
|
||||||
|
// the correct package operation.
|
||||||
|
for (const Group& group : selectedGroups) {
|
||||||
|
if (group.critical) {
|
||||||
|
critical_packages += group.packages;
|
||||||
|
} else {
|
||||||
|
packages += group.packages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!critical_packages.empty()) {
|
||||||
|
packagesWithOperation.insert( "install", critical_packages );
|
||||||
|
}
|
||||||
|
if (!packages.empty()) {
|
||||||
|
packagesWithOperation.insert( "try_install", packages);
|
||||||
|
}
|
||||||
|
|
||||||
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||||
gs->insert( "packageOperations", QVariant( packagesWithOperation ) );
|
gs->insert( "packageOperations", QVariant( packagesWithOperation ) );
|
||||||
|
@ -27,8 +27,16 @@ The URL must point to a YAML file. Here is a short example of how the YAML file
|
|||||||
|
|
||||||
The file is composed of a list of entry, each describing one group. The keys *name*, *description* and *packages* are required.
|
The file is composed of a list of entry, each describing one group. The keys *name*, *description* and *packages* are required.
|
||||||
|
|
||||||
Two more keys are supported, *hidden* (if true, do not show the group on the page) and *selected* (if true, display the group as selected). Both default to false if not present.
|
Three more keys are supported:
|
||||||
If both keys are set to true for the same group, you are basically creating a "default" group of packages which will always be installed in the user's system.
|
|
||||||
|
- hidden: if true, do not show the group on the page. Defaults to false.
|
||||||
|
- selected: if true, display the group as selected. Defaults to false.
|
||||||
|
- critical: if true, make the installation process fail if installing
|
||||||
|
any of the packages in the group fails. Otherwise, just log a warning.
|
||||||
|
Defaults to false.
|
||||||
|
|
||||||
|
If you set both *hidden* and *selected* for a group, you are basically creating a "default" group of packages
|
||||||
|
which will always be installed in the user's system.
|
||||||
|
|
||||||
## Configuration of the module
|
## Configuration of the module
|
||||||
Here is the set of instructions to have the module work in your Calamares. As of July 2016, this has been successfully
|
Here is the set of instructions to have the module work in your Calamares. As of July 2016, this has been successfully
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
description: "Default group"
|
description: "Default group"
|
||||||
hidden: true
|
hidden: true
|
||||||
selected: true
|
selected: true
|
||||||
|
critical: false
|
||||||
packages:
|
packages:
|
||||||
- base
|
- base
|
||||||
- chakra-live-skel
|
- chakra-live-skel
|
||||||
@ -165,6 +166,7 @@
|
|||||||
- kapudan
|
- kapudan
|
||||||
- name: "Wireless"
|
- name: "Wireless"
|
||||||
description: "Tools for wireless connections"
|
description: "Tools for wireless connections"
|
||||||
|
critical: false
|
||||||
packages:
|
packages:
|
||||||
- crda
|
- crda
|
||||||
- ndiswrapper
|
- ndiswrapper
|
||||||
@ -198,49 +200,4 @@
|
|||||||
- kdegraphics-svgpart
|
- kdegraphics-svgpart
|
||||||
- kdegraphics-thumbnailers
|
- kdegraphics-thumbnailers
|
||||||
- imagemagick
|
- imagemagick
|
||||||
- name: "Burning"
|
|
||||||
description: "Set of packages for disc burning"
|
|
||||||
packages:
|
|
||||||
- dvd+rw-tools
|
|
||||||
- vcdimager
|
|
||||||
- transcode
|
|
||||||
- emovix
|
|
||||||
- k3b
|
|
||||||
- libdvdcss
|
|
||||||
- name: "Printing"
|
|
||||||
description: "Print much?"
|
|
||||||
packages:
|
|
||||||
- cups
|
|
||||||
- gutenprint
|
|
||||||
- cups-pdf
|
|
||||||
- kdeadmin-print-manager
|
|
||||||
- hplip
|
|
||||||
- epsoneplijs
|
|
||||||
- epson-inkjet-printer-escpr
|
|
||||||
- python2-gobject2
|
|
||||||
- samba
|
|
||||||
- name: "Multimedia"
|
|
||||||
description: "Music and video players"
|
|
||||||
packages:
|
|
||||||
- kdemultimedia-dragonplayer
|
|
||||||
- kdenlive
|
|
||||||
- amarok
|
|
||||||
- name: "Miscellaneous"
|
|
||||||
description: "Useful tools and apps"
|
|
||||||
packages:
|
|
||||||
- imagewriter
|
|
||||||
- tomoyo-tools
|
|
||||||
- python2-gobject ## needed for systemd-analyze
|
|
||||||
- clamav
|
|
||||||
- kdenetwork-kget ## maybe move to a network group?
|
|
||||||
- kdeplasma-addons-applets-lancelot
|
|
||||||
- kdeplasma-applets-homerun
|
|
||||||
- kdeplasma-applets-appmenu-qml
|
|
||||||
- kdeplasma-addons-runners-characters
|
|
||||||
- kdeplasma-addons-runners-converter
|
|
||||||
- kdeplasma-addons-runners-datetime
|
|
||||||
- kdeplasma-addons-runners-dictionary ##4.10 option
|
|
||||||
- kdeplasma-addons-runners-spellchecker
|
|
||||||
- appmenu-qt ## needed for menubar options in 4.10
|
|
||||||
- kscreen
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user