Commit aef653bf authored by sage's avatar sage

Merge branch 'jb46366' into 'master'

Jb46366

See merge request !28
parents 026a2fd3 030f8806
......@@ -52,6 +52,8 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
{
SsuLog *ssuLog = SsuLog::instance();
QStringList adaptationRepoList = adaptationRepos();
QString model = deviceVariant(true);
// special handling for adaptation-repositories
// - check if repo is in right format (adaptation\d*)
// - check if the configuration has that many adaptation repos
......@@ -74,7 +76,6 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
storageHash->insert("adaptation", adaptationRepo);
ssuLog->print(LOG_DEBUG, "Found first adaptation " + adaptationName);
QString model = deviceVariant(true);
QHash<QString, QString> h;
// add global variables for this model
......@@ -97,6 +98,23 @@ QString SsuDeviceInfo::adaptationVariables(const QString &adaptationName, QHash<
return "adaptation";
}
// If adaptation has defined repository-specific-variables and it matches to the
// repository name then also get those variables.
else if (boardMappings->contains(model + "/repository-specific-variables")) {
QStringList sections = boardMappings->value(model + "/repository-specific-variables").toStringList();
if (sections.contains(model + "-" + adaptationName)) {
QHash<QString, QString> h;
variableSection(model + "-" + adaptationName, &h);
QHash<QString, QString>::const_iterator i = h.constBegin();
while (i != h.constEnd()) {
storageHash->insert(i.key(), i.value());
i++;
}
}
}
return adaptationName;
}
......
......@@ -26,6 +26,17 @@ void DeviceInfoTest::testAdaptationVariables()
QCOMPARE(repoName, QString("adaptation"));
}
void DeviceInfoTest::testFeatureVariables()
{
SsuDeviceInfo deviceInfo("N950");
QHash<QString, QString> featureVariables;
QString repoName = deviceInfo.adaptationVariables("feature1", &featureVariables);
QHash<QString, QString> featureVariablesExpected;
featureVariablesExpected["feature"] = "test";
QCOMPARE(featureVariables, featureVariablesExpected);
QCOMPARE(repoName, QString("feature1"));
}
void DeviceInfoTest::testDeviceUid()
{
QVERIFY2(!SsuDeviceInfo().deviceUid().isEmpty(), "No method to get device UID on this platform");
......
......@@ -16,6 +16,7 @@ class DeviceInfoTest: public QObject
private slots:
void testAdaptationVariables();
void testFeatureVariables();
void testDeviceUid();
void testVariableSection();
void testValue();
......
......@@ -16,6 +16,7 @@ N950=N9
family=n950-n9
adaptation-repos=n9xx-common,n950-n9
variables = n9
repository-specific-variables=N9-feature1
[var-n9]
foo-n9 = foo-n9-val
......@@ -49,3 +50,7 @@ bar2 = bar2Val
[var-baz]
variables = foo, bar
[var-N9-feature1]
feature=test
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