Commit cb06cf87 authored by Aard's avatar Aard

[ssu] Move repo filters to Ssu

parent da8c1e3f
......@@ -97,7 +97,15 @@ class Ssu: public QObject {
/// See SsuCoreConfig::useSslVerify
Q_INVOKABLE bool useSslVerify();
/**
* Filters to control the output of the repository lookup methods
*/
enum RepoFilter {
NoFilter, ///< All repositories (global + user)
UserFilter, ///< Only user configured repositories
BoardFilter, ///< Only global repositories, with user blacklist ignored
BoardFilterUserBlacklist ///< Only global repositories, with user blacklist applied
};
/**
* List of possible device modes
*
......
......@@ -314,9 +314,9 @@ QStringList SsuDeviceInfo::repos(bool rnd, int filter){
int adaptationCount = adaptationRepos().size();
QStringList result;
if (filter == SsuRepoManager::NoFilter ||
filter == SsuRepoManager::BoardFilter ||
filter == SsuRepoManager::BoardFilterUserBlacklist){
if (filter == Ssu::NoFilter ||
filter == Ssu::BoardFilter ||
filter == Ssu::BoardFilterUserBlacklist){
// for repo names we have adaptation0, adaptation1, ..., adaptationN
for (int i=0; i<adaptationCount; i++)
result.append(QString("adaptation%1").arg(i));
......@@ -343,8 +343,8 @@ QStringList SsuDeviceInfo::repos(bool rnd, int filter){
// TODO: in strict mode, filter the repository list from there
SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();
if (filter == SsuRepoManager::NoFilter ||
filter == SsuRepoManager::UserFilter){
if (filter == Ssu::NoFilter ||
filter == Ssu::UserFilter){
ssuSettings->beginGroup("repository-urls");
result.append(ssuSettings->allKeys());
ssuSettings->endGroup();
......@@ -354,9 +354,9 @@ QStringList SsuDeviceInfo::repos(bool rnd, int filter){
result.append(ssuSettings->value("enabled-repos").toStringList());
}
if (filter == SsuRepoManager::NoFilter ||
filter == SsuRepoManager::UserFilter ||
filter == SsuRepoManager::BoardFilterUserBlacklist){
if (filter == Ssu::NoFilter ||
filter == Ssu::UserFilter ||
filter == Ssu::BoardFilterUserBlacklist){
// read the disabled repositories from user configuration
if (ssuSettings->contains("disabled-repos")){
foreach (const QString &key, ssuSettings->value("disabled-repos").toStringList())
......
......@@ -11,7 +11,7 @@
#include <QObject>
#include "ssusettings.h"
#include "ssurepomanager.h"
#include "ssu.h"
class SsuDeviceInfo: public QObject {
Q_OBJECT
......@@ -68,7 +68,7 @@ class SsuDeviceInfo: public QObject {
* only board-specific, or only user-specific are returned.
* Disabled repositories are excluded depending on filter settings.
*/
QStringList repos(bool rnd=false, int filter=SsuRepoManager::NoFilter);
QStringList repos(bool rnd=false, int filter=Ssu::NoFilter);
/**
* Override device model autodetection
*/
......
......@@ -11,19 +11,11 @@
#include <QObject>
#include <QHash>
#include "ssu.h"
class SsuRepoManager: public QObject {
Q_OBJECT
public:
/**
* Filters to control the output of the repository lookup methods
*/
enum RepoFilter {
NoFilter, ///< All repositories (global + user)
UserFilter, ///< Only user configured repositories
BoardFilter, ///< Only global repositories, with user blacklist ignored
BoardFilterUserBlacklist ///< Only global repositories, with user blacklist applied
};
SsuRepoManager();
/**
......
......@@ -392,7 +392,7 @@ void RndSsuCli::optRepos(QStringList opt){
// micMode? handle it and return, as it's a lot simpler than full mode
if (micMode){
repos = deviceInfo.repos(rndRepo, SsuRepoManager::BoardFilter);
repos = deviceInfo.repos(rndRepo, Ssu::BoardFilter);
foreach (const QString &repo, repos){
QString repoName = repo;
if (repo.endsWith("-debuginfo")){
......@@ -412,10 +412,10 @@ void RndSsuCli::optRepos(QStringList opt){
}
if (device.isEmpty())
repos = deviceInfo.repos(rndRepo, SsuRepoManager::BoardFilterUserBlacklist);
repos = deviceInfo.repos(rndRepo, Ssu::BoardFilterUserBlacklist);
else {
qout << "Printing repository configuration for '" << device << "'" << endl << endl;
repos = deviceInfo.repos(rndRepo, SsuRepoManager::BoardFilter);
repos = deviceInfo.repos(rndRepo, Ssu::BoardFilter);
}
SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();
......@@ -447,7 +447,7 @@ void RndSsuCli::optRepos(QStringList opt){
repos.clear();
continue;
}
repos = deviceInfo.repos(rndRepo, SsuRepoManager::UserFilter);
repos = deviceInfo.repos(rndRepo, Ssu::UserFilter);
qout << endl << "Enabled repositories (user): " << endl;
} else if (i==1){
repos = deviceInfo.disabledRepos();
......
......@@ -100,7 +100,7 @@ QStringList SsuKickstarter::repos(){
QStringList result;
SsuDeviceInfo deviceInfo(deviceModel);
QStringList repos = deviceInfo.repos(rndMode, SsuRepoManager::BoardFilter);
QStringList repos = deviceInfo.repos(rndMode, Ssu::BoardFilter);
foreach (const QString &repo, repos){
QString repoUrl = ssu.repoUrl(repo, rndMode, QHash<QString, QString>(), repoOverride);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment