2015-09-07 19:36:45 +02:00
# include "./config.h"
# include "./manager.h"
2015-08-10 22:46:01 +02:00
# include <c++utilities/conversion/stringconversion.h>
# include <QFile>
# include <QJsonDocument>
# include <QJsonObject>
# include <QJsonArray>
2016-02-27 21:00:58 +01:00
# include <QStandardPaths>
2015-08-10 22:46:01 +02:00
# include <iostream>
using namespace std ;
using namespace ApplicationUtilities ;
using namespace ConversionUtilities ;
2016-02-15 18:26:05 +01:00
using namespace ChronoUtilities ;
2015-08-10 22:46:01 +02:00
2015-09-05 17:25:05 +02:00
namespace RepoIndex {
bool useShSyntax = false ;
const char * shchar = " " ;
2015-08-10 22:46:01 +02:00
/*!
* \ class Alpm : : Config
* \ brief The ConfigArgs class bundles the command line arguments for the application .
*/
/*!
* \ brief Initializes the command line arguments for the configuration of the application .
*/
ConfigArgs : : ConfigArgs ( ArgumentParser & parser ) :
helpArg ( parser ) ,
2016-05-26 02:29:56 +02:00
packagesArg ( " packages " , ' p ' , " specifies the packages " ) ,
buildOrderArg ( " build-order " , ' b ' , " calculates the build order to build the specified packages " ) ,
addSourceOnlyDepsArg ( " add-src-only-deps " , ' a ' , " adds source-only dependencies to build chain " ) ,
requireSourcesArg ( " require-sources " , ' q ' , " requires specified packages to be from a source repository " ) ,
serverArg ( " server " , ' s ' , " runs a websocket server providing the web interface with information " ) ,
repoNameArg ( " repo " , ' r ' , " specifies the repository " ) ,
upgradeLookupArg ( " upgrade-lookup " , ' u ' , " checks available upgrades for the specified repository " ) ,
mingwBundleArg ( " mingw-w64-bundle " , ' m ' , " creates an archive with the runtime-relevant files from the specified mingw-w64-packages and their dependencies " ) ,
repoindexConfArg ( " repoindex-conf " , ' c ' , " specifies the path of the repo index config file (default is /etc/repoindex.conf " ) ,
rootdirArg ( " root-dir " , ' r ' , " specifies the root directory (default is /) " ) ,
dbpathArg ( " db-path " , ' d ' , " specifies the pacman database path (default is /var/lib/pacman) " ) ,
pacmanConfArg ( " pacman-conf " , ' p ' , " specifies the path of the pacman config file (default is /etc/pacman.conf " ) ,
reposFromPacmanConfEnabled ( " repos-from-pacman-conf " , ' \0 ' , " enables repositories from the pacman config file " ) ,
websocketAddrArg ( " addr " , ' \0 ' , " specifies the listening address for the websocket server, default is 127.0.0.1 " ) ,
websocketPortArg ( " port " , ' \0 ' , " specifies the listening port for the websocket server, default is 1234 " ) ,
certFileArg ( " cert-file " , ' \0 ' , " specifies the SSL certificate " ) ,
keyFileArg ( " key-file " , ' \0 ' , " specifies the private SSL key " ) ,
insecureArg ( " insecure " , ' \0 ' , " forces the server to run in insecure mode " ) ,
aurArg ( " aur " , ' \0 ' , " enables/disables AUR queries " ) ,
verboseArg ( " verbose " , ' v ' , " be verbose " ) ,
outputFileArg ( " output-file " , ' f ' , " specifies the output file " ) ,
targetDirArg ( " target-dir " , ' t ' , " the directory to store the target archive " ) ,
targetNameArg ( " target-name " , ' n ' , " specifies the name of the target archive " ) ,
targetFormatArg ( " target-format " , ' e ' , " specifies the format of the target archive " ) ,
iconThemesArg ( " icon-packages " , ' i ' , " specifies the names of the icon packages to include " ) ,
defaultIconThemeArg ( " default-icon-theme " , ' \0 ' , " specifies the name of the default icon theme (should be included in --icon-packages) " ) ,
extraPackagesArg ( " extra-packages " , ' \0 ' , " specifies extra packages to be included " ) ,
qtPluginsArg ( " qt-plugins " , ' \0 ' , " specifies which Qt plugins to be included " ) ,
cacheDirArg ( " cache-dir " , ' \0 ' , " specifies the cache directory (default is /var/cache/repoindex) " ) ,
storageDirArg ( " storage-dir " , ' \0 ' , " specifies the storage directory (default is /var/lib/repoindex) " ) ,
shSyntaxArg ( " sh-syntax " , ' \0 ' , " prints the output using shell syntax: export REPOINDEX_RESULTS=('res1' 'res2' 'res3') or export REPOINDEX_ERROR='some error message' " )
2015-08-10 22:46:01 +02:00
{
2016-05-26 02:29:56 +02:00
const initializer_list < const char * > pathValueName = { " path " } ;
const initializer_list < const char * > pkgValueNames = { " package 1 " , " package 2 " , " package 3 " } ;
packagesArg . setRequiredValueCount ( - 1 ) ;
packagesArg . setRequired ( true ) ;
packagesArg . setImplicit ( true ) ;
packagesArg . setValueNames ( pkgValueNames ) ;
2015-08-19 02:13:28 +02:00
buildOrderArg . setDenotesOperation ( true ) ;
2016-02-20 03:00:34 +01:00
requireSourcesArg . setCombinable ( true ) ;
2015-08-10 22:46:01 +02:00
serverArg . setDenotesOperation ( true ) ;
2016-05-26 02:29:56 +02:00
repoNameArg . setRequiredValueCount ( 1 ) ;
repoNameArg . setRequired ( true ) ;
repoNameArg . setImplicit ( true ) ;
repoNameArg . setValueNames ( { " repo " } ) ;
2015-09-05 17:25:05 +02:00
upgradeLookupArg . setDenotesOperation ( true ) ;
2015-08-19 02:13:28 +02:00
mingwBundleArg . setDenotesOperation ( true ) ;
2015-08-10 22:46:01 +02:00
repoindexConfArg . setCombinable ( true ) ;
repoindexConfArg . setValueNames ( pathValueName ) ;
repoindexConfArg . setRequiredValueCount ( 1 ) ;
rootdirArg . setCombinable ( true ) ;
rootdirArg . setValueNames ( { " directory " } ) ;
rootdirArg . setRequiredValueCount ( 1 ) ;
dbpathArg . setCombinable ( true ) ;
dbpathArg . setValueNames ( pathValueName ) ;
dbpathArg . setRequiredValueCount ( 1 ) ;
pacmanConfArg . setCombinable ( true ) ;
pacmanConfArg . setValueNames ( pathValueName ) ;
pacmanConfArg . setRequiredValueCount ( 1 ) ;
2016-02-27 21:00:58 +01:00
reposFromPacmanConfEnabled . setCombinable ( true ) ;
2015-08-10 22:46:01 +02:00
websocketAddrArg . setCombinable ( true ) ;
websocketAddrArg . setValueNames ( { " IP address " } ) ;
websocketAddrArg . setRequiredValueCount ( 1 ) ;
websocketPortArg . setCombinable ( true ) ;
websocketPortArg . setValueNames ( { " port number " } ) ;
websocketPortArg . setRequiredValueCount ( 1 ) ;
certFileArg . setCombinable ( true ) ;
certFileArg . setValueNames ( pathValueName ) ;
certFileArg . setRequiredValueCount ( 1 ) ;
keyFileArg . setCombinable ( true ) ;
keyFileArg . setValueNames ( pathValueName ) ;
keyFileArg . setRequiredValueCount ( 1 ) ;
insecureArg . setCombinable ( true ) ;
2015-08-19 02:13:28 +02:00
aurArg . setCombinable ( true ) ;
aurArg . setRequiredValueCount ( 1 ) ;
aurArg . setValueNames ( { " enabled/disabled " } ) ;
verboseArg . setCombinable ( true ) ;
outputFileArg . setCombinable ( true ) ;
outputFileArg . setRequired ( true ) ;
outputFileArg . setRequiredValueCount ( 1 ) ;
2015-09-04 14:37:01 +02:00
outputFileArg . setValueNames ( pathValueName ) ;
targetDirArg . setCombinable ( true ) ;
targetDirArg . setRequiredValueCount ( 1 ) ;
targetDirArg . setValueNames ( pathValueName ) ;
targetNameArg . setCombinable ( true ) ;
targetNameArg . setRequired ( true ) ;
targetNameArg . setRequiredValueCount ( 1 ) ;
targetNameArg . setValueNames ( { " name " } ) ;
targetFormatArg . setCombinable ( true ) ;
targetFormatArg . setRequiredValueCount ( 1 ) ;
targetFormatArg . setValueNames ( { " zip/7z/tar.gz/tar.bz/tar.xz " } ) ;
iconThemesArg . setCombinable ( true ) ;
iconThemesArg . setRequiredValueCount ( - 1 ) ;
iconThemesArg . setValueNames ( pkgValueNames ) ;
2015-09-21 22:16:19 +02:00
defaultIconThemeArg . setCombinable ( true ) ;
defaultIconThemeArg . setRequiredValueCount ( 1 ) ;
defaultIconThemeArg . setValueNames ( { " theme name " } ) ;
extraPackagesArg . setCombinable ( true ) ;
extraPackagesArg . setRequiredValueCount ( - 1 ) ;
extraPackagesArg . setValueNames ( pkgValueNames ) ;
2016-04-25 22:30:11 +02:00
qtPluginsArg . setCombinable ( true ) ;
qtPluginsArg . setRequiredValueCount ( - 1 ) ;
qtPluginsArg . setValueNames ( { " plugin 1 " , " plugin 2 " } ) ;
2016-05-26 02:29:56 +02:00
addSourceOnlyDepsArg . setCombinable ( true ) ;
2015-09-05 17:25:05 +02:00
shSyntaxArg . setCombinable ( true ) ;
2016-05-26 02:29:56 +02:00
serverArg . setSubArguments ( { & rootdirArg , & dbpathArg , & pacmanConfArg , & reposFromPacmanConfEnabled , & certFileArg , & keyFileArg , & websocketAddrArg , & websocketPortArg , & insecureArg , & aurArg , & shSyntaxArg } ) ;
upgradeLookupArg . setSubArguments ( { & repoNameArg , & shSyntaxArg } ) ;
buildOrderArg . setSubArguments ( { & packagesArg , & aurArg , & addSourceOnlyDepsArg , & requireSourcesArg , & verboseArg , & shSyntaxArg } ) ;
mingwBundleArg . setSubArguments ( { & packagesArg , & targetDirArg , & targetNameArg , & targetFormatArg , & iconThemesArg , & defaultIconThemeArg , & extraPackagesArg , & qtPluginsArg } ) ;
2016-01-06 02:08:24 +01:00
cacheDirArg . setCombinable ( true ) ;
cacheDirArg . setRequiredValueCount ( 1 ) ;
cacheDirArg . setValueNames ( pathValueName ) ;
2016-02-12 01:05:08 +01:00
storageDirArg . setCombinable ( true ) ;
storageDirArg . setRequiredValueCount ( 1 ) ;
storageDirArg . setValueNames ( pathValueName ) ;
2016-05-26 02:29:56 +02:00
parser . setMainArguments ( { & helpArg , & buildOrderArg , & upgradeLookupArg , & serverArg , & mingwBundleArg , & repoindexConfArg , & cacheDirArg , & storageDirArg } ) ;
2015-08-10 22:46:01 +02:00
}
/*!
* \ class Alpm : : Config
* \ brief The Config class represents the configuration for the application .
*/
/*!
* \ brief Creates the default configuration for the application .
*/
Config : : Config ( ) :
m_alpmRootDir ( QStringLiteral ( " / " ) ) ,
2015-08-19 02:13:28 +02:00
m_alpmDbPath ( QStringLiteral ( " /var/lib/pacman " ) ) ,
2015-08-10 22:46:01 +02:00
m_pacmanConfFile ( QStringLiteral ( " /etc/pacman.conf " ) ) ,
2016-01-06 02:08:24 +01:00
m_cacheDir ( QStringLiteral ( " /var/cache/repoindex " ) ) ,
2016-02-12 01:05:08 +01:00
m_storageDir ( QStringLiteral ( " /var/lib/repoindex " ) ) ,
2015-08-10 22:46:01 +02:00
m_websocketServerListeningAddr ( QHostAddress : : LocalHost ) ,
m_websocketServerListeningPort ( 1234 ) ,
m_serverInsecure ( false ) ,
2016-02-27 21:00:58 +01:00
m_serverCloseable ( true ) ,
2016-02-25 22:53:33 +01:00
m_localEnabled ( true ) ,
m_reposFromPacmanConfEnabled ( false ) ,
2015-08-19 02:13:28 +02:00
m_aurEnabled ( true ) ,
m_verbose ( false ) ,
m_runServer ( false )
2015-08-10 22:46:01 +02:00
{ }
/*!
* \ cond
*/
inline void assign ( quint16 & num , const QJsonValue & val )
{
if ( ! val . isUndefined ( ) ) {
auto n = val . toInt ( - 1 ) ;
if ( n > 0 & & n < = static_cast < quint16 > ( - 1 ) ) {
num = static_cast < quint16 > ( n ) ;
} else {
2015-09-05 17:25:05 +02:00
cerr < < shchar < < " Error: The specified value \" " < < n < < " \" is not a number. " < < endl ;
2015-08-10 22:46:01 +02:00
}
}
}
inline void assign ( QHostAddress & addr , const QString & val )
{
if ( ! val . isEmpty ( ) & & ! addr . setAddress ( val ) ) {
2015-09-11 21:59:47 +02:00
// checking some special values might be useful
if ( val = = QLatin1String ( " localhost " ) ) {
addr = QHostAddress : : LocalHost ;
} else if ( val = = QLatin1String ( " localhost-IPv6 " ) ) {
addr = QHostAddress : : LocalHostIPv6 ;
} else if ( val = = QLatin1String ( " any-IPv4 " ) ) {
addr = QHostAddress : : AnyIPv4 ;
} else if ( val = = QLatin1String ( " any-IPv6 " ) ) {
addr = QHostAddress : : AnyIPv6 ;
} else if ( val = = QLatin1String ( " any " ) ) {
addr = QHostAddress : : Any ;
} else {
cerr < < shchar < < " Error: Unable to parse the specified host address \" " < < val . toStdString ( ) < < " \" . " < < endl ;
}
2015-08-10 22:46:01 +02:00
}
}
inline void assign ( QString & str , const Argument & arg )
{
if ( arg . isPresent ( ) ) {
2016-05-26 02:29:56 +02:00
str = QString : : fromLocal8Bit ( arg . values ( ) . front ( ) ) ;
2015-08-10 22:46:01 +02:00
}
}
inline void assign ( quint16 & num , const Argument & arg )
{
if ( arg . isPresent ( ) ) {
try {
num = stringToNumber < quint16 > ( arg . values ( ) . front ( ) ) ;
} catch ( const ConversionException & ) {
2015-09-05 17:25:05 +02:00
cerr < < shchar < < " Error: The specified argument value \" " < < arg . values ( ) . front ( ) < < " \" is not a number. " < < endl ;
2015-08-10 22:46:01 +02:00
}
}
}
inline void assign ( bool & num , const Argument & arg )
{
num | = arg . isPresent ( ) ;
}
/*!
* \ endcond
*/
/*!
* \ brief Loads the configuration from the specified configuration file .
*/
void Config : : loadFromConfigFile ( const QString & configFilePath )
{
QFile file ( configFilePath ) ;
if ( file . open ( QFile : : ReadOnly ) ) {
QJsonParseError error ;
auto doc = QJsonDocument : : fromJson ( file . readAll ( ) , & error ) ;
if ( error . error = = QJsonParseError : : NoError ) {
auto mainObj = doc . object ( ) ;
auto alpmObj = mainObj . value ( QStringLiteral ( " alpm " ) ) . toObject ( ) ;
m_alpmRootDir = alpmObj . value ( QStringLiteral ( " rootDir " ) ) . toString ( m_alpmRootDir ) ;
m_alpmDbPath = alpmObj . value ( QStringLiteral ( " dbPath " ) ) . toString ( m_alpmDbPath ) ;
m_pacmanConfFile = alpmObj . value ( QStringLiteral ( " pacmanConfigFile " ) ) . toString ( m_pacmanConfFile ) ;
2015-09-11 21:59:47 +02:00
m_cacheDir = mainObj . value ( QStringLiteral ( " cacheDir " ) ) . toString ( m_cacheDir ) ;
2016-02-12 01:05:08 +01:00
m_storageDir = mainObj . value ( QStringLiteral ( " storageDir " ) ) . toString ( m_storageDir ) ;
2015-08-19 02:13:28 +02:00
auto aurObj = mainObj . value ( QStringLiteral ( " aur " ) ) . toObject ( ) ;
m_aurEnabled = aurObj . value ( QStringLiteral ( " enabled " ) ) . toBool ( m_aurEnabled ) ;
2015-08-10 22:46:01 +02:00
auto serverObj = mainObj . value ( QStringLiteral ( " server " ) ) . toObject ( ) ;
assign ( m_websocketServerListeningAddr , serverObj . value ( QStringLiteral ( " websocketListeningAddr " ) ) . toString ( ) ) ;
assign ( m_websocketServerListeningPort , serverObj . value ( QStringLiteral ( " websocketListeningPort " ) ) ) ;
m_serverCertFile = serverObj . value ( QStringLiteral ( " certFile " ) ) . toString ( m_serverCertFile ) ;
m_serverKeyFile = serverObj . value ( QStringLiteral ( " keyFile " ) ) . toString ( m_serverKeyFile ) ;
m_serverInsecure = serverObj . value ( QStringLiteral ( " insecure " ) ) . toBool ( m_serverInsecure ) ;
auto reposObj = mainObj . value ( QStringLiteral ( " repos " ) ) . toObject ( ) ;
2016-02-25 22:53:33 +01:00
m_localEnabled = reposObj . value ( QStringLiteral ( " localEnabled " ) ) . toBool ( m_localEnabled ) ;
m_reposFromPacmanConfEnabled = reposObj . value ( QStringLiteral ( " fromPacmanConfig " ) ) . toBool ( m_reposFromPacmanConfEnabled ) ;
2015-08-10 22:46:01 +02:00
for ( const auto & repo : reposObj . value ( QStringLiteral ( " add " ) ) . toArray ( ) ) {
m_repoEntries < < RepoEntry ( ) ;
m_repoEntries . back ( ) . load ( repo ) ;
}
} else {
2015-09-05 17:25:05 +02:00
cerr < < shchar < < " Error: Unable to parse config file \" " < < configFilePath . toLocal8Bit ( ) . data ( ) < < " \" : "
2015-08-19 02:13:28 +02:00
< < error . errorString ( ) . toLocal8Bit ( ) . data ( ) < < " at character " < < error . offset < < endl ;
2015-08-10 22:46:01 +02:00
}
} else {
2015-09-05 17:25:05 +02:00
cerr < < shchar < < " Error: Unable to open config file \" " < < configFilePath . toLocal8Bit ( ) . data ( ) < < " \" . " < < endl ;
2015-08-10 22:46:01 +02:00
}
}
/*!
* \ brief Loads the configuration from the configuration file .
*
* The config file is obtained from the specified config args . If no such argument is present ,
* some default locations are checked .
*/
void Config : : loadFromConfigFile ( const ConfigArgs & args )
{
if ( args . repoindexConfArg . isPresent ( ) ) {
2016-05-26 02:29:56 +02:00
loadFromConfigFile ( QString : : fromLocal8Bit ( args . repoindexConfArg . values ( ) . front ( ) ) ) ;
2015-08-10 22:46:01 +02:00
return ;
} else {
2016-02-27 21:00:58 +01:00
for ( const auto & defaultPath : { QStringLiteral ( " ./repoindex.conf " ) , QStandardPaths : : writableLocation ( QStandardPaths : : AppConfigLocation ) + QStringLiteral ( " /repoindex.conf " ) , QStringLiteral ( " /etc/repoindex.conf " ) } ) {
if ( ! defaultPath . isEmpty ( ) & & QFile : : exists ( defaultPath ) ) {
2015-08-10 22:46:01 +02:00
loadFromConfigFile ( defaultPath ) ;
return ;
}
}
}
}
/*!
* \ brief Loads the config from the specified configuration arguments .
*/
void Config : : loadFromArgs ( const ConfigArgs & args )
{
assign ( m_alpmRootDir , args . rootdirArg ) ;
assign ( m_alpmDbPath , args . dbpathArg ) ;
assign ( m_pacmanConfFile , args . pacmanConfArg ) ;
2015-08-19 02:13:28 +02:00
if ( args . aurArg . isPresent ( ) ) {
auto val = args . aurArg . values ( ) . front ( ) ;
2016-05-26 02:29:56 +02:00
if ( ! strcmp ( val , " enabled " ) ) {
2015-08-19 02:13:28 +02:00
m_aurEnabled = true ;
2016-05-26 02:29:56 +02:00
} else if ( ! strcmp ( val , " disabled " ) ) {
2015-08-19 02:13:28 +02:00
m_aurEnabled = false ;
} else {
2015-09-05 17:25:05 +02:00
cerr < < shchar < < " Warning: The specified value for the argument --aur-enabled is invalid and will be ignored. " < < endl ;
2015-08-19 02:13:28 +02:00
}
}
2015-08-10 22:46:01 +02:00
assign ( m_websocketServerListeningPort , args . websocketPortArg ) ;
assign ( m_serverCertFile , args . certFileArg ) ;
assign ( m_serverKeyFile , args . keyFileArg ) ;
assign ( m_serverInsecure , args . insecureArg ) ;
if ( args . websocketAddrArg . isPresent ( ) ) {
2016-05-26 02:29:56 +02:00
assign ( m_websocketServerListeningAddr , QString : : fromLocal8Bit ( args . websocketAddrArg . values ( ) . front ( ) ) ) ;
2015-08-10 22:46:01 +02:00
}
2015-08-19 02:13:28 +02:00
m_verbose = args . verboseArg . isPresent ( ) ;
m_runServer = args . serverArg . isPresent ( ) ;
2016-01-06 02:08:24 +01:00
if ( args . cacheDirArg . isPresent ( ) ) {
2016-05-26 02:29:56 +02:00
m_cacheDir = QString : : fromLocal8Bit ( args . cacheDirArg . values ( ) . front ( ) ) ;
2016-01-06 02:08:24 +01:00
}
2016-02-15 18:26:05 +01:00
if ( args . storageDirArg . isPresent ( ) ) {
2016-05-26 02:29:56 +02:00
m_storageDir = QString : : fromLocal8Bit ( args . storageDirArg . values ( ) . front ( ) ) ;
2016-02-15 18:26:05 +01:00
}
2016-02-27 21:00:58 +01:00
if ( args . reposFromPacmanConfEnabled . isPresent ( ) ) {
m_reposFromPacmanConfEnabled = true ;
}
}
/*!
* \ brief Ensures that the server is only accessable from the local machine .
*/
void Config : : loadLocalOnlySetup ( )
{
m_websocketServerListeningAddr = QHostAddress : : LocalHost ;
m_serverInsecure = true ;
2015-08-10 22:46:01 +02:00
}
2016-02-14 23:48:43 +01:00
RepoEntry : : RepoEntry ( ) :
2016-02-25 22:53:33 +01:00
m_sigLevel ( SignatureLevel : : UseDefault ) ,
m_ignored ( false )
2016-02-14 23:48:43 +01:00
{ }
2015-08-10 22:46:01 +02:00
/*!
* \ brief Loads the values from the specified JSON value .
*/
void RepoEntry : : load ( const QJsonValue & jsonValue )
{
auto obj = jsonValue . toObject ( ) ;
m_name = obj . value ( QStringLiteral ( " name " ) ) . toString ( m_name ) ;
2015-08-19 02:13:28 +02:00
m_dataBaseFile = obj . value ( QStringLiteral ( " dataBaseFile " ) ) . toString ( m_dataBaseFile ) ;
m_sourceDir = obj . value ( QStringLiteral ( " sourcesDir " ) ) . toString ( m_sourceDir ) ;
m_packageDir = obj . value ( QStringLiteral ( " packagesDir " ) ) . toString ( m_packageDir ) ;
2016-03-09 15:56:06 +01:00
for ( const auto & server : obj . value ( QStringLiteral ( " server " ) ) . toArray ( ) ) {
2015-08-10 22:46:01 +02:00
auto str = server . toString ( ) ;
if ( ! str . isEmpty ( ) ) {
2016-03-09 15:56:06 +01:00
m_server < < str ;
2015-08-10 22:46:01 +02:00
}
}
2015-08-19 02:13:28 +02:00
for ( const auto & upgradeSources : obj . value ( QStringLiteral ( " upgradeSources " ) ) . toArray ( ) ) {
auto str = upgradeSources . toString ( ) ;
if ( ! str . isEmpty ( ) ) {
m_upgradeSources < < str ;
}
}
2015-09-04 14:37:01 +02:00
const auto sigLevelValue = obj . value ( QStringLiteral ( " sigLevel " ) ) ;
if ( sigLevelValue . isString ( ) ) {
m_sigLevel = Manager : : parseSigLevel ( sigLevelValue . toString ( ) . toLocal8Bit ( ) . data ( ) ) ;
}
2016-02-15 18:26:05 +01:00
m_maxDatabaseAge = TimeSpan : : fromSeconds ( obj . value ( QStringLiteral ( " maxAge " ) ) . toDouble ( ) ) ;
2016-02-25 22:53:33 +01:00
m_ignored = obj . value ( QStringLiteral ( " ignored " ) ) . toBool ( m_ignored ) ;
2015-08-10 22:46:01 +02:00
}
} // namespace Alpm