Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[ssu] Move basic repo handling to repo manager
  • Loading branch information
Bernd Wachter committed Oct 6, 2013
1 parent cb06cf8 commit fe572c4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
16 changes: 16 additions & 0 deletions libssu/ssurepomanager.cpp
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion libssu/ssurepomanager.h
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions rndssucli/rndssucli.cpp
Expand Up @@ -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")){
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion ssuks/ssukickstarter.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit fe572c4

Please sign in to comment.