Skip to content

Commit

Permalink
Merge pull request #16 from sailfishos/jb61468
Browse files Browse the repository at this point in the history
Add major and minor release versions in repo variables
  • Loading branch information
keto authored Mar 12, 2024
2 parents 49ef9f8 + bd9290c commit c9efabb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion libssu/ssurepomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ QStringList SsuRepoManager::repoVariables(QHash<QString, QString> *storageHash,
SsuCoreConfig *settings = SsuCoreConfig::instance();
QStringList configSections;
SsuSettings repoSettings(SSU_REPO_CONFIGURATION, SSU_REPO_CONFIGURATION_DIR);
QString release = settings->release(rnd);

// fill in all arbitrary repo specific variables from ssu.ini
var.variableSection(settings, "repository-url-variables", storageHash);
Expand Down Expand Up @@ -406,7 +407,10 @@ QStringList SsuRepoManager::repoVariables(QHash<QString, QString> *storageHash,
configSections << "release" << "all";
}

storageHash->insert("release", settings->release(rnd));
storageHash->insert("release", release);
storageHash->insert("releaseMajor", release.section('.', 0, 0));
storageHash->insert("releaseMinor", release.section('.', 1, 1));
storageHash->insert("releaseMajorMinor", release.section('.', 0, 1));

if (!storageHash->contains("debugSplit"))
storageHash->insert("debugSplit", "packages");
Expand Down
3 changes: 3 additions & 0 deletions tests/ut_urlresolver/testdata/repos.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ mer-core=https://%(packagesDomain)/%(release)/mer/%(arch)/%(debugSplit)/
adaptation-common-main=https://%(packagesDomain)/releases/%(release)/nemo/adaptation-%(deviceFamily)-common/%(arch)/
adaptation=https://%(packagesDomain)/releases/%(release)/nemo/adaptation-%(adaptation)/%(arch)/
nemo=https://%(packagesDomain)/releases/%(release)/nemo/platform/%(arch)/
major=https://%(packagesDomain)/releases/%(releaseMajor)/major/%(arch)/
minor=https://%(packagesDomain)/releases/%(releaseMinor)/minor/%(arch)/
majmin=https://%(packagesDomain)/releases/%(releaseMajorMinor)/majmin/%(arch)/

[rnd]
mer-core=https://%(packagesDomain)/mer/%(release)/builds/%(arch)/%(debugSplit)/
Expand Down
10 changes: 7 additions & 3 deletions tests/ut_urlresolver/urlresolvertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ void UrlResolverTest::initTestCase()
/*
rndRepos["non-oss"] = "";
*/
releaseRepos["nemo"] = QString("https://packages.example.com/releases/0.1/nemo/platform/%1/").arg(arch);
releaseRepos["mer-core"] = QString("https://packages.example.com/0.1/mer/%1/packages/").arg(arch);
releaseRepos["jolla"] = QString("https://packages.example.com/releases/0.1/jolla/%1/").arg(arch);
releaseRepos["nemo"] = QString("https://packages.example.com/releases/1.2.3/nemo/platform/%1/").arg(arch);
releaseRepos["mer-core"] = QString("https://packages.example.com/1.2.3/mer/%1/packages/").arg(arch);
releaseRepos["jolla"] = QString("https://packages.example.com/releases/1.2.3/jolla/%1/").arg(arch);
releaseRepos["major"] = QString("https://packages.example.com/releases/1/major/%1/").arg(arch);
releaseRepos["minor"] = QString("https://packages.example.com/releases/2/minor/%1/").arg(arch);
releaseRepos["majmin"] = QString("https://packages.example.com/releases/1.2/majmin/%1/").arg(arch);
}

void UrlResolverTest::cleanupTestCase()
Expand Down Expand Up @@ -115,6 +118,7 @@ void UrlResolverTest::simpleRepoUrlLookup()

void UrlResolverTest::checkReleaseRepoUrls()
{
ssu.setRelease("1.2.3");
QHashIterator<QString, QString> i(releaseRepos);
while (i.hasNext()) {
QString url;
Expand Down

0 comments on commit c9efabb

Please sign in to comment.