Skip to content

Commit

Permalink
Rename rndssucli to ssucli, drop compat symlinks
Browse files Browse the repository at this point in the history
The ssu CLI has been non-RnD specific for ages, get rid
of some more legacy stuff
  • Loading branch information
Bernd Wachter committed Aug 20, 2014
1 parent e3e6f4a commit ccaa3eb
Show file tree
Hide file tree
Showing 21 changed files with 291 additions and 92 deletions.
2 changes: 0 additions & 2 deletions rpm/ssu.spec
Expand Up @@ -30,7 +30,6 @@ Requires: ssu-network-proxy
%files
%defattr(-,root,root,-)
%{_libdir}/zypp/plugins/urlresolver/*
%{_bindir}/rndssu
%{_bindir}/ssu
%{_libdir}/libssu.so.*
%dir %{_sysconfdir}/zypp/credentials.d
Expand Down Expand Up @@ -148,7 +147,6 @@ cd .. && doxygen doc/Doxyfile
%install
cd build && make INSTALL_ROOT=%{buildroot} install
mkdir -p %{buildroot}/%{_sysconfdir}/zypp/credentials.d
ln -s %{_bindir}/ssu %{buildroot}/%{_bindir}/rndssu
mkdir -p %{buildroot}/%{_docdir}/%{name}
cd .. && cp -R doc/html/* %{buildroot}/%{_docdir}/%{name}/

Expand Down
6 changes: 3 additions & 3 deletions ssu.pro
Expand Up @@ -4,15 +4,15 @@ contains(QT_VERSION, ^4\\.[0-7]\\..*) {

TEMPLATE = subdirs
SUBDIRS = libssu libssunetworkproxy ssud
SUBDIRS += rndssucli ssuurlresolver ssuks
SUBDIRS += ssucli ssuurlresolver ssuks

ssuconfhack {
SUBDIRS += ssuconfperm
}

SUBDIRS += tests tools

rndssucli.depends = libssu
ssucli.depends = libssu
rndregisterui.depends = libssu
ssuurlresolver.depends = libssu
tests.depends = libssu
Expand Down Expand Up @@ -40,5 +40,5 @@ system(qdbusxml2cpp \

system(qdbusxml2cpp \
-c SsuProxy \
-p rndssucli/ssuproxy.h:rndssucli/ssuproxy.cpp \
-p ssucli/ssuproxy.h:ssucli/ssuproxy.cpp \
dbus/org.nemo.ssu.xml)
6 changes: 3 additions & 3 deletions rndssucli/main.cpp → ssucli/main.cpp
Expand Up @@ -11,13 +11,13 @@
#include <QLibraryInfo>
#include <QTimer>
#include "libssunetworkproxy/ssunetworkproxy.h"
#include "rndssucli.h"
#include "ssucli.h"

int main(int argc, char** argv){
QCoreApplication app(argc, argv);
QCoreApplication::setOrganizationName("Jolla");
QCoreApplication::setOrganizationDomain("http://www.jollamobile.com");
QCoreApplication::setApplicationName("rndssu");
QCoreApplication::setApplicationName("ssu");

QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
Expand All @@ -26,7 +26,7 @@ int main(int argc, char** argv){

set_application_proxy_factory();

RndSsuCli mw;
SsuCli mw;
QTimer::singleShot(0, &mw, SLOT(run()));

return app.exec();
Expand Down
73 changes: 35 additions & 38 deletions rndssucli/rndssucli.cpp → ssucli/ssucli.cpp
@@ -1,5 +1,5 @@
/**
* @file rndssucli.cpp
* @file ssucli.cpp
* @copyright 2012 Jolla Ltd.
* @author Bernd Wachter <bernd.wachter@jollamobile.com>
* @date 2012
Expand All @@ -16,9 +16,9 @@

#include <QDebug>

#include "rndssucli.h"
#include "ssucli.h"

RndSsuCli::RndSsuCli(): QObject(){
SsuCli::SsuCli(): QObject(){
connect(this,SIGNAL(done()),
QCoreApplication::instance(),SLOT(quit()), Qt::DirectConnection);
connect(&ssu, SIGNAL(done()),
Expand All @@ -32,11 +32,11 @@ RndSsuCli::RndSsuCli(): QObject(){
state = Idle;
}

RndSsuCli::~RndSsuCli(){
SsuCli::~SsuCli(){
ssuProxy->quit();
}

void RndSsuCli::handleResponse(){
void SsuCli::handleResponse(){
QTextStream qout(stdout);

if (ssu.error()){
Expand All @@ -48,7 +48,7 @@ void RndSsuCli::handleResponse(){
}
}

void RndSsuCli::handleDBusResponse(){
void SsuCli::handleDBusResponse(){
QTextStream qout(stdout);

if (ssuProxy->error()){
Expand All @@ -60,7 +60,7 @@ void RndSsuCli::handleDBusResponse(){
}
}

void RndSsuCli::optDomain(QStringList opt){
void SsuCli::optDomain(QStringList opt){
QTextStream qout(stdout);

if (opt.count() == 3 && opt.at(2) == "-s"){
Expand All @@ -78,7 +78,7 @@ void RndSsuCli::optDomain(QStringList opt){
}
}

void RndSsuCli::optFlavour(QStringList opt){
void SsuCli::optFlavour(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);

Expand Down Expand Up @@ -107,7 +107,7 @@ void RndSsuCli::optFlavour(QStringList opt){
}
}

void RndSsuCli::optMode(QStringList opt){
void SsuCli::optMode(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);

Expand Down Expand Up @@ -156,7 +156,7 @@ void RndSsuCli::optMode(QStringList opt){
}
}

void RndSsuCli::optModel(QStringList opt){
void SsuCli::optModel(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);
SsuDeviceInfo deviceInfo;
Expand All @@ -170,7 +170,7 @@ void RndSsuCli::optModel(QStringList opt){
}
}

void RndSsuCli::optModifyRepo(enum Actions action, QStringList opt){
void SsuCli::optModifyRepo(enum Actions action, QStringList opt){
SsuRepoManager repoManager;
QTextStream qout(stdout);
QTextStream qerr(stderr);
Expand Down Expand Up @@ -229,7 +229,7 @@ void RndSsuCli::optModifyRepo(enum Actions action, QStringList opt){
}
}

void RndSsuCli::optRegister(QStringList opt){
void SsuCli::optRegister(QStringList opt){
/*
* register a new device
*/
Expand Down Expand Up @@ -271,7 +271,7 @@ void RndSsuCli::optRegister(QStringList opt){
state = Busy;
}

void RndSsuCli::optRelease(QStringList opt){
void SsuCli::optRelease(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);

Expand Down Expand Up @@ -320,7 +320,7 @@ void RndSsuCli::optRelease(QStringList opt){
}
}

void RndSsuCli::optRepos(QStringList opt){
void SsuCli::optRepos(QStringList opt){
QTextStream qout(stdout);
SsuRepoManager repoManager;
SsuDeviceInfo deviceInfo;
Expand Down Expand Up @@ -468,7 +468,7 @@ void RndSsuCli::optRepos(QStringList opt){
state = Idle;
}

void RndSsuCli::optStatus(QStringList opt){
void SsuCli::optStatus(QStringList opt){
QTextStream qout(stdout);
QTextStream qerr(stderr);
SsuDeviceInfo deviceInfo;
Expand Down Expand Up @@ -501,7 +501,7 @@ void RndSsuCli::optStatus(QStringList opt){
qout << "Release: " << ssu.release() << endl;
}

void RndSsuCli::optUpdateCredentials(QStringList opt){
void SsuCli::optUpdateCredentials(QStringList opt){
QTextStream qout(stdout);
/*
* update the credentials
Expand All @@ -521,7 +521,7 @@ void RndSsuCli::optUpdateCredentials(QStringList opt){
}
}

void RndSsuCli::optUpdateRepos(QStringList opt){
void SsuCli::optUpdateRepos(QStringList opt){
QTextStream qerr(stdout);

QDBusPendingReply<> reply = ssuProxy->updateRepos();
Expand All @@ -534,7 +534,7 @@ void RndSsuCli::optUpdateRepos(QStringList opt){
}
}

void RndSsuCli::run(){
void SsuCli::run(){
QTextStream qout(stdout);
QTextStream qerr(stderr);

Expand All @@ -544,9 +544,6 @@ void RndSsuCli::run(){
if (!ssuSettings->isWritable())
qerr << "WARNING: ssu.ini does not seem to be writable. Setting values might not work." << endl;

if (arguments.at(0).endsWith("rndssu"))
qout << "NOTE: this binary is now called ssu. The rndssu symlink will go away after some time" << endl;

// make sure there's a first argument to parse
if (arguments.count() < 2){
usage();
Expand All @@ -558,28 +555,28 @@ void RndSsuCli::run(){
const char *shortopt; // option shortcut name
int minargs; // minimum number of required args
int maxargs; // -1 for "function will handle max args"
void (RndSsuCli::*handler)(QStringList opt); // handler function
void (SsuCli::*handler)(QStringList opt); // handler function
} handlers[] = {
// functions accepting no additional arguments
"status", "s", 0, 0, &RndSsuCli::optStatus,
"updaterepos", "ur", 0, 0, &RndSsuCli::optUpdateRepos,
"status", "s", 0, 0, &SsuCli::optStatus,
"updaterepos", "ur", 0, 0, &SsuCli::optUpdateRepos,

// functions requiring at least one argument
"addrepo", "ar", 1, 2, &RndSsuCli::optAddRepo,
"removerepo", "rr", 1, 1, &RndSsuCli::optRemoveRepo,
"enablerepo", "er", 1, 1, &RndSsuCli::optEnableRepo,
"disablerepo", "dr", 1, 1, &RndSsuCli::optDisableRepo,
"addrepo", "ar", 1, 2, &SsuCli::optAddRepo,
"removerepo", "rr", 1, 1, &SsuCli::optRemoveRepo,
"enablerepo", "er", 1, 1, &SsuCli::optEnableRepo,
"disablerepo", "dr", 1, 1, &SsuCli::optDisableRepo,

// functions accepting 0 or more arguments
// those need to set state to Idle on success
"register", "r", 0, -1, &RndSsuCli::optRegister,
"repos", "lr", 0, -1, &RndSsuCli::optRepos,
"flavour", "fl", 0, -1, &RndSsuCli::optFlavour,
"mode", "m", 0, -1, &RndSsuCli::optMode,
"model", "mo", 0, -1, &RndSsuCli::optModel,
"release", "re", 0, -1, &RndSsuCli::optRelease,
"update", "up", 0, -1, &RndSsuCli::optUpdateCredentials,
"domain", "do", 0, -1, &RndSsuCli::optDomain,
"register", "r", 0, -1, &SsuCli::optRegister,
"repos", "lr", 0, -1, &SsuCli::optRepos,
"flavour", "fl", 0, -1, &SsuCli::optFlavour,
"mode", "m", 0, -1, &SsuCli::optMode,
"model", "mo", 0, -1, &SsuCli::optModel,
"release", "re", 0, -1, &SsuCli::optRelease,
"update", "up", 0, -1, &SsuCli::optUpdateCredentials,
"domain", "do", 0, -1, &SsuCli::optDomain,
};

bool found = false;
Expand Down Expand Up @@ -619,7 +616,7 @@ void RndSsuCli::run(){
usage();
}

void RndSsuCli::uidWarning(QString message){
void SsuCli::uidWarning(QString message){
if (message.isEmpty())
message = "Run 'ssu ur' as root to recreate repository files";

Expand All @@ -629,7 +626,7 @@ void RndSsuCli::uidWarning(QString message){
}
}

void RndSsuCli::usage(QString message){
void SsuCli::usage(QString message){
QTextStream qout(stderr);
qout << "\nUsage: ssu <command> [-command-options] [arguments]" << endl
<< endl
Expand Down
12 changes: 6 additions & 6 deletions rndssucli/rndssucli.h → ssucli/ssucli.h
@@ -1,12 +1,12 @@
/**
* @file rndssucli.h
* @file ssucli.h
* @copyright 2012 Jolla Ltd.
* @author Bernd Wachter <bernd.wachter@jollamobile.com>
* @date 2012
*/

#ifndef _RndSsuCli_H
#define _RndSsuCli_H
#ifndef _SsuCli_H
#define _SsuCli_H

#include <QObject>
#include <QSettings>
Expand All @@ -16,12 +16,12 @@
#include "libssu/ssu.h"
#include "ssuproxy.h"

class RndSsuCli: public QObject {
class SsuCli: public QObject {
Q_OBJECT

public:
RndSsuCli();
~RndSsuCli();
SsuCli();
~SsuCli();

public slots:
void run();
Expand Down
6 changes: 3 additions & 3 deletions rndssucli/rndssucli.pro → ssucli/ssucli.pro
@@ -1,12 +1,12 @@
TARGET = ssu
include(../ssuapplication.pri)
include(rndssucli_dependencies.pri)
include(ssucli_dependencies.pri)

QT += network dbus
CONFIG += link_pkgconfig

HEADERS = rndssucli.h \
HEADERS = ssucli.h \
ssuproxy.h
SOURCES = main.cpp \
rndssucli.cpp \
ssucli.cpp \
ssuproxy.cpp
File renamed without changes.
26 changes: 26 additions & 0 deletions ssucli/ssuproxy.cpp
@@ -0,0 +1,26 @@
/*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp -c SsuProxy -p ssucli/ssuproxy.h:ssucli/ssuproxy.cpp dbus/org.nemo.ssu.xml
*
* qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/

#include "ssucli/ssuproxy.h"

/*
* Implementation of interface class SsuProxy
*/

SsuProxy::SsuProxy(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
{
}

SsuProxy::~SsuProxy()
{
}

0 comments on commit ccaa3eb

Please sign in to comment.