Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for new release URL macro of SailfishOS 4.6 #285

Merged
merged 5 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ project(sailfishos-chum-gui
set(GITHUB_TOKEN "unset" CACHE STRING "GitHub access token for GraphQL queries")
set(GITLAB_TOKEN "unset" CACHE STRING "GitLab access site-token pair(s) for GraphQL queries")
set(FORGEJO_TOKEN "unset" CACHE STRING "Forgejo (and Gitea) access site-token pair(s) for API queries")
set(SAILFISHOS_TARGET_VERSION 0 CACHE STRING "Target Sailfish OS version")

include(FindPkgConfig)

Expand Down
3 changes: 2 additions & 1 deletion rpm/sailfishos-chum-gui.spec
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ Links:

%build
# SFOS RPM cmake macro disables RPATH
%cmake -DCHUMGUI_VERSION=%{version} \
%cmake -DCHUMGUI_VERSION=%(echo %{version} | grep -Eo '^[0-9]+(\.[0-9]+)*') \
Olf0 marked this conversation as resolved.
Show resolved Hide resolved
-DSAILFISHOS_TARGET_VERSION=%{!?sailfishos_version:0}%{?sailfishos_version} \
-DCMAKE_SKIP_RPATH:BOOL=OFF \
-DCMAKE_INSTALL_RPATH=%{_datadir}/%{name}/lib: \
-DGITHUB_TOKEN=%(cat %{SOURCE1}) \
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ set_source_files_properties(projectforgejo.cpp PROPERTIES
COMPILE_DEFINITIONS FORGEJO_TOKEN=\"${FORGEJO_TOKEN}\"
)

set_source_files_properties(ssu.cpp PROPERTIES
COMPILE_DEFINITIONS SAILFISHOS_TARGET_VERSION=${SAILFISHOS_TARGET_VERSION}
)

target_link_libraries(${PROJECT_NAME}
Qt5::Quick
Qt5::DBus
Expand Down
12 changes: 9 additions & 3 deletions src/ssu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
#include <QDBusPendingReply>
#include <QDebug>

#if defined(SAILFISHOS_TARGET_VERSION) && SAILFISHOS_TARGET_VERSION >= 40600
Olf0 marked this conversation as resolved.
Show resolved Hide resolved
#define RELEASE_TAG "%(releaseMajorMinor)"
#else
#define RELEASE_TAG "%(release)"
#endif

static QString s_repo_regular(
QStringLiteral("https://repo.sailfishos.org/obs/sailfishos:/chum/%(release)_%(arch)/"));
QStringLiteral("https://repo.sailfishos.org/obs/sailfishos:/chum/" RELEASE_TAG "_%(arch)/"));
static QString s_repo_regular_alias(
QStringLiteral("sailfishos-chum"));
static QString s_repo_regular_prefix(
QStringLiteral("https://repo.sailfishos.org/obs/sailfishos:/chum/"));
static QString s_repo_testing(
QStringLiteral("https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/%(release)_%(arch)/"));
QStringLiteral("https://repo.sailfishos.org/obs/sailfishos:/chum:/testing/" RELEASE_TAG "_%(arch)/"));
static QString s_repo_testing_alias(
QStringLiteral("sailfishos-chum-testing"));
static QString s_repo_testing_prefix(
Expand Down Expand Up @@ -131,7 +137,7 @@ void Ssu::setRepo(const QString &version, bool testing) {
QString url = testing ? s_repo_testing : s_repo_regular;

if (!version.isEmpty()) {
url = url.replace(QLatin1String("%(release)"), version);
url = url.replace(QLatin1String(RELEASE_TAG), version);
}

if (rname != m_repo_name) {
Expand Down
Loading