Commit fe572c4c authored by Aard's avatar Aard

[ssu] Move basic repo handling to repo manager

parent cb06cf87
......@@ -105,6 +105,22 @@ void SsuRepoManager::remove(QString repo){
ssuSettings->sync();
}
QStringList SsuRepoManager::repos(bool rnd, int filter){
SsuDeviceInfo deviceInfo;
return repos(rnd, deviceInfo, filter);
}
QStringList SsuRepoManager::repos(bool rnd, SsuDeviceInfo &deviceInfo, int filter){
QStringList result;
result = deviceInfo.repos(rnd, filter);
result.sort();
result.removeDuplicates();
return result;
}
void SsuRepoManager::update(){
// - delete all non-ssu managed repositories (missing ssu_ prefix)
// - create list of ssu-repositories for current adaptation
......
......@@ -12,11 +12,13 @@
#include <QHash>
#include "ssu.h"
class SsuDeviceInfo;
class SsuRepoManager: public QObject {
Q_OBJECT
public:
SsuRepoManager();
/**
* Add a repository. Note: Repositories ending with -debuginfo receive special
......@@ -42,6 +44,16 @@ class SsuRepoManager: public QObject {
* Remove a repository
*/
void remove(QString repo);
/**
* Collect the list of repositories from different submodules
*/
QStringList repos(bool rnd, int filter=Ssu::NoFilter);
/**
* Collect the list of repositories from different submodules.
* This form takes a reference to a custom device info instance
* to allow overrides.
*/
QStringList repos(bool rnd, SsuDeviceInfo &deviceInfo, int filter=Ssu::NoFilter);
/**
* Resolve repository specific variables, and store them in storageHash. Does
* not include adaptation specific variables, see SsuDeviceInfo::adaptationVariables
......
......@@ -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, Ssu::BoardFilter);
repos = repoManager.repos(rndRepo, deviceInfo, 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, Ssu::BoardFilterUserBlacklist);
repos = repoManager.repos(rndRepo, deviceInfo, Ssu::BoardFilterUserBlacklist);
else {
qout << "Printing repository configuration for '" << device << "'" << endl << endl;
repos = deviceInfo.repos(rndRepo, Ssu::BoardFilter);
repos = repoManager.repos(rndRepo, deviceInfo, Ssu::BoardFilter);
}
SsuCoreConfig *ssuSettings = SsuCoreConfig::instance();
......@@ -447,7 +447,7 @@ void RndSsuCli::optRepos(QStringList opt){
repos.clear();
continue;
}
repos = deviceInfo.repos(rndRepo, Ssu::UserFilter);
repos = repoManager.repos(rndRepo, deviceInfo, Ssu::UserFilter);
qout << endl << "Enabled repositories (user): " << endl;
} else if (i==1){
repos = deviceInfo.disabledRepos();
......
......@@ -99,8 +99,9 @@ QString SsuKickstarter::replaceSpaces(const QString &value){
QStringList SsuKickstarter::repos(){
QStringList result;
SsuDeviceInfo deviceInfo(deviceModel);
SsuRepoManager repoManager;
QStringList repos = deviceInfo.repos(rndMode, Ssu::BoardFilter);
QStringList repos = repoManager.repos(rndMode, deviceInfo, 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