Skip to content

Commit

Permalink
Allow arbitrary argument order for ssu ar
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernd Wachter committed Apr 10, 2013
1 parent 354572f commit 2f09bbf
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
20 changes: 16 additions & 4 deletions libssu/ssurepomanager.cpp
Expand Up @@ -144,10 +144,22 @@ void SsuRepoManager::update(){

// ... and create all repositories required for this device
foreach (const QString &repo, repos){
QFile repoFile(QString("%1/ssu_%2_%3.repo")
.arg(ZYPP_REPO_PATH)
.arg(repo)
.arg(rndMode ? "rnd" : "release"));
QString repoFilePath = QString("%1/ssu_%2_%3.repo")
.arg(ZYPP_REPO_PATH)
.arg(repo)
.arg(rndMode ? "rnd" : "release");

if (url(repo, rndMode) == ""){
// TODO, repositories should only be disabled if they're not required
// for this machine. For required repositories error is better
QTextStream qerr(stderr);
qerr << "Repository " << repo << " does not contain valid URL, skipping and disabling." << endl;
disable(repo);
QFile(repoFilePath).remove();
continue;
}

QFile repoFile(repoFilePath);

if (repoFile.open(QIODevice::WriteOnly | QIODevice::Text)){
QTextStream out(&repoFile);
Expand Down
16 changes: 15 additions & 1 deletion rndssucli/rndssucli.cpp
Expand Up @@ -100,6 +100,7 @@ void RndSsuCli::optMode(QStringList opt){
void RndSsuCli::optModifyRepo(int action, QStringList opt){
SsuRepoManager repoManager;
QTextStream qout(stdout);
QTextStream qerr(stderr);

if (opt.count() == 3){
switch(action){
Expand All @@ -125,7 +126,20 @@ void RndSsuCli::optModifyRepo(int action, QStringList opt){
break;
}
} else if (opt.count() == 4 && action == Add){
repoManager.add(opt.at(2), opt.at(3));
QString url, repo;

if (opt.at(2).indexOf(QRegExp("[a-z]*://", Qt::CaseInsensitive)) == 0){
url = opt.at(2);
repo = opt.at(3);
} else if (opt.at(3).indexOf(QRegExp("[a-z]*://", Qt::CaseInsensitive)) == 0){
url = opt.at(3);
repo = opt.at(2);
} else {
qerr << "Invalid parameters for 'ssu ar': URL required." << endl;
return;
}

repoManager.add(repo, url);
repoManager.update();
uidWarning();
}
Expand Down
3 changes: 3 additions & 0 deletions rpm/ssu.changes
@@ -1,3 +1,6 @@
* Wed Apr 10 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.31.4
- Allow arbitrary argument order for ssu ar

* Sat Apr 06 2013 Bernd Wachter <bernd.wachter@jollamobile.com> - 0.31.3
- Add warning when updating repos as non-root to ssu cli
- Rewrite repo files on flavour, release and mode changes
Expand Down
2 changes: 1 addition & 1 deletion rpm/ssu.spec
@@ -1,5 +1,5 @@
Name: ssu
Version: 0.31.3
Version: 0.31.4
Release: 1
Summary: SSU enabler for RND
Group: System/Base
Expand Down

0 comments on commit 2f09bbf

Please sign in to comment.