Skip to content

Commit

Permalink
Improve repository variable handling.
Browse files Browse the repository at this point in the history
[ssu] Add way to define repository specific vars for adaptation. JB#46366

This makes it possible to have repository variables to be defined in
adaptation side, e.g., if you have feature repository and you want to
vary its repository variables with adaptation this makes it possible.

Signed-off-by: Marko Saukko <marko.saukko@jolla.com>
  • Loading branch information
saukko committed Jun 20, 2019
1 parent a0975fb commit a534fc8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion libssu/ssudeviceinfo.cpp
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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;
}

Expand Down

0 comments on commit a534fc8

Please sign in to comment.