appstream-1.0.patch 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. diff --git a/CMakeLists.txt b/CMakeLists.txt
  2. index 31460a6d5..89cee3182 100644
  3. --- a/CMakeLists.txt
  4. +++ b/CMakeLists.txt
  5. @@ -31,7 +31,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED CoreAddons Config Crash DBusAddons
  6. find_package(KF5Kirigami2 2.7.0)
  7. find_package(packagekitqt5 1.0.1 CONFIG)
  8. -find_package(AppStreamQt 0.15.3 CONFIG REQUIRED)
  9. +find_package(AppStreamQt5 1.0 CONFIG REQUIRED)
  10. find_package(KF5Attica 5.23 CONFIG)
  11. find_package(KF5NewStuff 5.53 CONFIG)
  12. @@ -85,7 +85,7 @@ set_package_properties(packagekitqt5 PROPERTIES
  13. URL "https://www.freedesktop.org/software/PackageKit/"
  14. PURPOSE "Required to build the PackageKit backend"
  15. TYPE OPTIONAL)
  16. -set_package_properties(AppStreamQt PROPERTIES
  17. +set_package_properties(AppStreamQt5 PROPERTIES
  18. DESCRIPTION "Library that lists Appstream resources"
  19. URL "https://www.freedesktop.org"
  20. PURPOSE "Required to build the PackageKit, Flatpak and Snap backends"
  21. diff --git a/libdiscover/appstream/AppStreamUtils.cpp b/libdiscover/appstream/AppStreamUtils.cpp
  22. index 94f030c9d..c2080c17a 100644
  23. --- a/libdiscover/appstream/AppStreamUtils.cpp
  24. +++ b/libdiscover/appstream/AppStreamUtils.cpp
  25. @@ -7,11 +7,11 @@
  26. #include "AppStreamUtils.h"
  27. #include "utils.h"
  28. -#include <AppStreamQt/pool.h>
  29. -#include <AppStreamQt/release.h>
  30. -#include <AppStreamQt/screenshot.h>
  31. -#include <AppStreamQt/spdx.h>
  32. -#include <AppStreamQt/version.h>
  33. +#include <AppStreamQt5/pool.h>
  34. +#include <AppStreamQt5/release.h>
  35. +#include <AppStreamQt5/screenshot.h>
  36. +#include <AppStreamQt5/spdx.h>
  37. +#include <AppStreamQt5/version.h>
  38. #include <Category/Category.h>
  39. #include <KLocalizedString>
  40. #include <QDebug>
  41. @@ -35,10 +35,20 @@ QUrl AppStreamUtils::imageOfKind(const QList<AppStream::Image> &images, AppStrea
  42. QString AppStreamUtils::changelogToHtml(const AppStream::Component &appdata)
  43. {
  44. - if (appdata.releases().isEmpty())
  45. +#if ASQ_CHECK_VERSION(1, 0, 0)
  46. + const auto releases = appdata.releasesPlain();
  47. +#else
  48. + const auto releases = appdata.releases();
  49. +#endif
  50. + if (releases.isEmpty()) {
  51. return {};
  52. + }
  53. - const auto release = appdata.releases().constFirst();
  54. +#if ASQ_CHECK_VERSION(1, 0, 0)
  55. + const auto release = releases.indexSafe(0).value();
  56. +#else
  57. + const auto release = releases.constFirst();
  58. +#endif
  59. if (release.description().isEmpty())
  60. return {};
  61. @@ -49,7 +59,7 @@ QString AppStreamUtils::changelogToHtml(const AppStream::Component &appdata)
  62. Screenshots AppStreamUtils::fetchScreenshots(const AppStream::Component &appdata)
  63. {
  64. - const auto appdataScreenshots = appdata.screenshots();
  65. + const auto appdataScreenshots = appdata.screenshotsAll();
  66. Screenshots ret;
  67. ret.reserve(appdataScreenshots.size());
  68. for (const AppStream::Screenshot &s : appdataScreenshots) {
  69. @@ -131,10 +141,10 @@ QString AppStreamUtils::versionString(const QString &version, const AppStream::C
  70. if (version.isEmpty()) {
  71. return {};
  72. } else {
  73. - if (appdata.releases().isEmpty())
  74. + if (appdata.releasesPlain().isEmpty())
  75. return version;
  76. - auto release = appdata.releases().constFirst();
  77. + auto release = appdata.releasesPlain().indexSafe(0).value();
  78. if (release.timestamp().isValid() && version.startsWith(release.version())) {
  79. QLocale l;
  80. return i18n("%1, released on %2", version, l.toString(release.timestamp().date(), QLocale::ShortFormat));
  81. @@ -256,7 +266,7 @@ QList<AppStream::Component> AppStreamUtils::componentsByCategories(AppStream::Po
  82. {
  83. QList<AppStream::Component> ret;
  84. for (const auto &categoryName : cat->involvedCategories()) {
  85. - ret += pool->componentsByCategories({categoryName});
  86. + ret += pool->componentsByCategories({categoryName}).toList();
  87. }
  88. kRemoveDuplicates(ret, kind);
  89. return ret;
  90. diff --git a/libdiscover/appstream/AppStreamUtils.h b/libdiscover/appstream/AppStreamUtils.h
  91. index 383e55aa8..906bd327a 100644
  92. --- a/libdiscover/appstream/AppStreamUtils.h
  93. +++ b/libdiscover/appstream/AppStreamUtils.h
  94. @@ -6,9 +6,9 @@
  95. #pragma once
  96. -#include <AppStreamQt/component.h>
  97. -#include <AppStreamQt/image.h>
  98. -#include <AppStreamQt/pool.h>
  99. +#include <AppStreamQt5/component.h>
  100. +#include <AppStreamQt5/image.h>
  101. +#include <AppStreamQt5/pool.h>
  102. #include <QColor>
  103. #include <QList>
  104. #include <QUrl>
  105. diff --git a/libdiscover/backends/CMakeLists.txt b/libdiscover/backends/CMakeLists.txt
  106. index bd3a03256..c2e0ec12d 100644
  107. --- a/libdiscover/backends/CMakeLists.txt
  108. +++ b/libdiscover/backends/CMakeLists.txt
  109. @@ -8,11 +8,11 @@ function(add_unit_test name)
  110. Qt::Test Qt::Core ${EXTRA_LIBS})
  111. endfunction()
  112. -if(KF5Attica_FOUND AND KF5NewStuff_FOUND AND AppStreamQt_FOUND)
  113. +if(KF5Attica_FOUND AND KF5NewStuff_FOUND AND AppStreamQt5_FOUND)
  114. add_subdirectory(KNSBackend)
  115. endif()
  116. -if(packagekitqt5_FOUND AND AppStreamQt_FOUND)
  117. +if(packagekitqt5_FOUND AND AppStreamQt5_FOUND)
  118. add_subdirectory(PackageKitBackend)
  119. endif()
  120. @@ -22,10 +22,10 @@ if(BUILD_DummyBackend)
  121. endif()
  122. option(BUILD_FlatpakBackend "Build Flatpak support" "ON")
  123. -if(Flatpak_FOUND AND AppStreamQt_FOUND AND BUILD_FlatpakBackend)
  124. +if(Flatpak_FOUND AND AppStreamQt5_FOUND AND BUILD_FlatpakBackend)
  125. add_subdirectory(FlatpakBackend)
  126. elseif(BUILD_FlatpakBackend)
  127. - message(WARNING "BUILD_FlatpakBackend enabled but Flatpak=${Flatpak_FOUND} or AppStreamQt=${AppStreamQt_FOUND} not found")
  128. + message(WARNING "BUILD_FlatpakBackend enabled but Flatpak=${Flatpak_FOUND} or AppStreamQt=${AppStreamQt5_FOUND} not found")
  129. endif()
  130. find_package(Snapd)
  131. @@ -41,7 +41,7 @@ if(BUILD_SteamOSBackend)
  132. endif()
  133. option(BUILD_SnapBackend "Build Snap support." "ON")
  134. -if(BUILD_SnapBackend AND AppStreamQt_FOUND AND Snapd_FOUND)
  135. +if(BUILD_SnapBackend AND AppStreamQt5_FOUND AND Snapd_FOUND)
  136. add_subdirectory(SnapBackend)
  137. endif()
  138. diff --git a/libdiscover/backends/FlatpakBackend/CMakeLists.txt b/libdiscover/backends/FlatpakBackend/CMakeLists.txt
  139. index eac5a3241..905f2ee7f 100644
  140. --- a/libdiscover/backends/FlatpakBackend/CMakeLists.txt
  141. +++ b/libdiscover/backends/FlatpakBackend/CMakeLists.txt
  142. @@ -15,7 +15,7 @@ set(flatpak-backend_SRCS
  143. add_library(flatpak-backend MODULE ${flatpak-backend_SRCS})
  144. target_link_libraries(flatpak-backend Qt::Core Qt::Widgets Qt::Concurrent KF5::CoreAddons KF5::ConfigCore KF5::KIOGui Discover::Common AppStreamQt PkgConfig::Flatpak)
  145. -if (AppStreamQt_VERSION VERSION_GREATER 0.14.6)
  146. +if (AppStreamQt5_VERSION VERSION_GREATER 0.14.6)
  147. target_compile_definitions(flatpak-backend PRIVATE -DAPPSTREAM_NEW_POOL_API)
  148. endif()
  149. diff --git a/libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp b/libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
  150. index 99488469b..2471bb8f0 100644
  151. --- a/libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
  152. +++ b/libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
  153. @@ -20,12 +20,12 @@
  154. #include <resources/StandardBackendUpdater.h>
  155. #include <utils.h>
  156. -#include <AppStreamQt/bundle.h>
  157. -#include <AppStreamQt/icon.h>
  158. -#include <AppStreamQt/metadata.h>
  159. -#include <AppStreamQt/pool.h>
  160. -#include <AppStreamQt/release.h>
  161. -#include <AppStreamQt/version.h>
  162. +#include <AppStreamQt5/bundle.h>
  163. +#include <AppStreamQt5/icon.h>
  164. +#include <AppStreamQt5/metadata.h>
  165. +#include <AppStreamQt5/pool.h>
  166. +#include <AppStreamQt5/release.h>
  167. +#include <AppStreamQt5/version.h>
  168. #include <KAboutData>
  169. #include <KConfigGroup>
  170. @@ -159,18 +159,19 @@ public:
  171. QList<AppStream::Component> componentsByName(const QString &name)
  172. {
  173. - QList<AppStream::Component> comps = m_pool->componentsById(name);
  174. - if (!comps.isEmpty())
  175. - return comps;
  176. + auto comps = m_pool->componentsById(name);
  177. + if (!comps.isEmpty()) {
  178. + return comps.toList();
  179. + }
  180. comps = m_pool->componentsByProvided(AppStream::Provided::KindId, name);
  181. - return comps;
  182. + return comps.toList();
  183. }
  184. QList<AppStream::Component> componentsByFlatpakId(const QString &ref)
  185. {
  186. #if ASQ_CHECK_VERSION(0, 16, 0)
  187. - QList<AppStream::Component> comps = m_pool->componentsByBundleId(AppStream::Bundle::KindFlatpak, ref, false);
  188. + QList<AppStream::Component> comps = m_pool->componentsByBundleId(AppStream::Bundle::KindFlatpak, ref, false).toList();
  189. #else
  190. QList<AppStream::Component> comps = m_pool->components();
  191. comps = kFilter<QList<AppStream::Component>>(comps, [&ref](const AppStream::Component &component) {
  192. @@ -181,7 +182,7 @@ public:
  193. if (!comps.isEmpty())
  194. return comps;
  195. - comps = m_pool->componentsByProvided(AppStream::Provided::KindId, ref.section('/', 1, 1));
  196. + comps = m_pool->componentsByProvided(AppStream::Provided::KindId, ref.section('/', 1, 1)).toList();
  197. return comps;
  198. }
  199. @@ -274,7 +275,11 @@ static std::optional<AppStream::Metadata> metadataFromBytes(GBytes *appstreamGz,
  200. gconstpointer data = g_bytes_get_data(appstream, &len);
  201. AppStream::Metadata metadata;
  202. +#if ASQ_CHECK_VERSION(0, 16, 0)
  203. + metadata.setFormatStyle(AppStream::Metadata::FormatStyleCatalog);
  204. +#else
  205. metadata.setFormatStyle(AppStream::Metadata::FormatStyleCollection);
  206. +#endif
  207. AppStream::Metadata::MetadataError error = metadata.parse(QString::fromUtf8((char *)data, len), AppStream::Metadata::FormatKindXml);
  208. if (error != AppStream::Metadata::MetadataErrorNoError) {
  209. qWarning() << "Failed to parse appstream metadata: " << error;
  210. @@ -479,7 +484,7 @@ FlatpakResource *FlatpakBackend::getAppForInstalledRef(FlatpakInstallation *inst
  211. g_autoptr(GBytes) metadata = flatpak_installed_ref_load_appdata(ref, 0, 0);
  212. if (metadata) {
  213. auto meta = metadataFromBytes(metadata, m_cancellable);
  214. - comps = meta->components();
  215. + comps = meta->components().toList();
  216. }
  217. }
  218. @@ -626,7 +631,7 @@ void FlatpakBackend::addAppFromFlatpakBundle(const QUrl &url, ResultsStream *str
  219. return;
  220. }
  221. - const QList<AppStream::Component> components = metadata->components();
  222. + const QList<AppStream::Component> components = metadata->components().toList();
  223. if (components.size()) {
  224. asComponent = components.first();
  225. } else {
  226. @@ -777,7 +782,11 @@ AppStream::Component fetchComponentFromRemote(const QSettings &settings, GCancel
  227. AppStream::Pool pool;
  228. #ifdef APPSTREAM_NEW_POOL_API
  229. pool.setLoadStdDataLocations(false);
  230. +#if ASQ_CHECK_VERSION(0, 16, 0)
  231. + pool.addExtraDataLocation(appstreamLocation, AppStream::Metadata::FormatStyleCatalog);
  232. +#else
  233. pool.addExtraDataLocation(appstreamLocation, AppStream::Metadata::FormatStyleCollection);
  234. +#endif
  235. #else
  236. pool.clearMetadataLocations();
  237. pool.addMetadataLocation(appstreamLocation);
  238. @@ -795,7 +804,7 @@ AppStream::Component fetchComponentFromRemote(const QSettings &settings, GCancel
  239. }
  240. // TODO optimise, this lookup should happen in libappstream
  241. - auto comps = pool.components();
  242. + auto comps = pool.components().toList();
  243. comps = kFilter<QList<AppStream::Component>>(comps, [name, branch](const AppStream::Component &component) {
  244. const QString id = component.bundle(AppStream::Bundle::KindFlatpak).id();
  245. // app/app.getspace.Space/x86_64/stable
  246. @@ -1079,7 +1088,11 @@ void FlatpakBackend::createPool(QSharedPointer<FlatpakSource> source)
  247. #ifdef APPSTREAM_NEW_POOL_API
  248. pool->setLoadStdDataLocations(false);
  249. +#if ASQ_CHECK_VERSION(0, 16, 0)
  250. + pool->addExtraDataLocation(appstreamDirPath, AppStream::Metadata::FormatStyleCatalog);
  251. +#else
  252. pool->addExtraDataLocation(appstreamDirPath, AppStream::Metadata::FormatStyleCollection);
  253. +#endif
  254. #else
  255. pool->clearMetadataLocations();
  256. pool->addMetadataLocation(appstreamDirPath);
  257. @@ -1558,11 +1571,11 @@ ResultsStream *FlatpakBackend::search(const AbstractResourcesBackend::Filters &f
  258. for (const auto &source : qAsConst(m_flatpakSources)) {
  259. QList<FlatpakResource *> resources;
  260. if (source->m_pool) {
  261. - const auto a = !filter.search.isEmpty() ? source->m_pool->search(filter.search)
  262. + const auto a = !filter.search.isEmpty() ? source->m_pool->search(filter.search).toList()
  263. #if ASQ_CHECK_VERSION(0, 15, 6)
  264. : filter.category ? AppStreamUtils::componentsByCategories(source->m_pool, filter.category, AppStream::Bundle::KindFlatpak)
  265. #endif
  266. - : source->m_pool->components();
  267. + : source->m_pool->components().toList();
  268. resources = kTransform<QList<FlatpakResource *>>(a, [this, &source](const auto &comp) {
  269. return resourceForComponent(comp, source);
  270. });
  271. diff --git a/libdiscover/backends/FlatpakBackend/FlatpakBackend.h b/libdiscover/backends/FlatpakBackend/FlatpakBackend.h
  272. index 66188095a..878965bfc 100644
  273. --- a/libdiscover/backends/FlatpakBackend/FlatpakBackend.h
  274. +++ b/libdiscover/backends/FlatpakBackend/FlatpakBackend.h
  275. @@ -14,7 +14,7 @@
  276. #include <QVariantList>
  277. #include <resources/AbstractResourcesBackend.h>
  278. -#include <AppStreamQt/component.h>
  279. +#include <AppStreamQt5/component.h>
  280. #include "flatpak-helper.h"
  281. diff --git a/libdiscover/backends/FlatpakBackend/FlatpakResource.cpp b/libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
  282. index 7ed905ead..1af8c9e3f 100644
  283. --- a/libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
  284. +++ b/libdiscover/backends/FlatpakBackend/FlatpakResource.cpp
  285. @@ -13,9 +13,11 @@
  286. #include <Transaction/AddonList.h>
  287. -#include <AppStreamQt/icon.h>
  288. -#include <AppStreamQt/screenshot.h>
  289. -#include <AppStreamQt/utils.h>
  290. +#include <AppStreamQt5/developer.h>
  291. +#include <AppStreamQt5/icon.h>
  292. +#include <AppStreamQt5/screenshot.h>
  293. +#include <AppStreamQt5/utils.h>
  294. +#include <AppStreamQt5/version.h>
  295. #include <appstream/AppStreamUtils.h>
  296. #include <KConfigGroup>
  297. @@ -24,7 +26,7 @@
  298. #include <KIO/ApplicationLauncherJob>
  299. #include <KLocalizedString>
  300. -#include <AppStreamQt/release.h>
  301. +#include <AppStreamQt5/release.h>
  302. #include <QDebug>
  303. #include <QDesktopServices>
  304. #include <QDir>
  305. @@ -113,7 +115,11 @@ QList<PackageState> FlatpakResource::addonsInformation()
  306. QString FlatpakResource::availableVersion() const
  307. {
  308. if (m_availableVersion.isEmpty()) {
  309. +#if ASQ_CHECK_VERSION(1, 0, 0)
  310. + const auto releases = m_appdata.releasesPlain().entries();
  311. +#else
  312. const auto releases = m_appdata.releases();
  313. +#endif
  314. if (!releases.isEmpty()) {
  315. auto latestVersion = releases.constFirst().version();
  316. for (const auto &release : releases) {
  317. @@ -649,8 +655,13 @@ QUrl FlatpakResource::url() const
  318. QDate FlatpakResource::releaseDate() const
  319. {
  320. - if (!m_appdata.releases().isEmpty()) {
  321. - auto release = m_appdata.releases().constFirst();
  322. +#if ASQ_CHECK_VERSION(1, 0, 0)
  323. + if (!m_appdata.releasesPlain().isEmpty()) {
  324. + auto release = m_appdata.releasesPlain().indexSafe(0).value();
  325. +#else
  326. + if (const auto releases = m_appdata.releases(); !releases.isEmpty()) {
  327. + auto release = releases.constFirst();
  328. +#endif
  329. return release.timestamp().date();
  330. }
  331. @@ -673,7 +684,7 @@ QString FlatpakResource::sourceIcon() const
  332. QString FlatpakResource::author() const
  333. {
  334. - QString name = m_appdata.developerName();
  335. + QString name = m_appdata.developer().name();
  336. if (name.isEmpty()) {
  337. name = m_appdata.projectGroup();
  338. @@ -711,8 +722,13 @@ QString FlatpakResource::versionString()
  339. if (ref) {
  340. version = flatpak_installed_ref_get_appdata_version(ref);
  341. }
  342. +#if ASQ_CHECK_VERSION(1, 0, 0)
  343. + } else if (!m_appdata.releasesPlain().isEmpty()) {
  344. + const auto release = m_appdata.releasesPlain().indexSafe(0).value();
  345. +#else
  346. } else if (!m_appdata.releases().isEmpty()) {
  347. - auto release = m_appdata.releases().constFirst();
  348. + const auto release = m_appdata.releases().constFirst();
  349. +#endif
  350. version = release.version();
  351. } else {
  352. version = m_id.branch;
  353. diff --git a/libdiscover/backends/FlatpakBackend/FlatpakResource.h b/libdiscover/backends/FlatpakBackend/FlatpakResource.h
  354. index 06e1b030a..648b6a5a7 100644
  355. --- a/libdiscover/backends/FlatpakBackend/FlatpakResource.h
  356. +++ b/libdiscover/backends/FlatpakBackend/FlatpakResource.h
  357. @@ -12,7 +12,7 @@
  358. #include "FlatpakPermission.h"
  359. #include "flatpak-helper.h"
  360. -#include <AppStreamQt/component.h>
  361. +#include <AppStreamQt5/component.h>
  362. #include <QAbstractItemModel>
  363. #include <QPixmap>
  364. diff --git a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
  365. index 510266dfd..740127879 100644
  366. --- a/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
  367. +++ b/libdiscover/backends/PackageKitBackend/AppPackageKitResource.cpp
  368. @@ -6,10 +6,12 @@
  369. #include "AppPackageKitResource.h"
  370. #include "utils.h"
  371. -#include <AppStreamQt/icon.h>
  372. -#include <AppStreamQt/image.h>
  373. -#include <AppStreamQt/release.h>
  374. -#include <AppStreamQt/screenshot.h>
  375. +#include <AppStreamQt5/developer.h>
  376. +#include <AppStreamQt5/icon.h>
  377. +#include <AppStreamQt5/image.h>
  378. +#include <AppStreamQt5/release.h>
  379. +#include <AppStreamQt5/screenshot.h>
  380. +#include <AppStreamQt5/version.h>
  381. #include <KLocalizedString>
  382. #include <KService>
  383. #include <PackageKit/Daemon>
  384. @@ -236,8 +238,13 @@ QString AppPackageKitResource::versionString()
  385. QDate AppPackageKitResource::releaseDate() const
  386. {
  387. +#if ASQ_CHECK_VERSION(1, 0, 0)
  388. + if (!m_appdata.releasesPlain().isEmpty()) {
  389. + const auto release = m_appdata.releasesPlain().indexSafe(0).value();
  390. +#else
  391. if (!m_appdata.releases().isEmpty()) {
  392. - auto release = m_appdata.releases().constFirst();
  393. + const auto release = m_appdata.releases().constFirst();
  394. +#endif
  395. return release.timestamp().date();
  396. }
  397. @@ -246,7 +253,7 @@ QDate AppPackageKitResource::releaseDate() const
  398. QString AppPackageKitResource::author() const
  399. {
  400. - QString name = m_appdata.developerName();
  401. + QString name = m_appdata.developer().name();
  402. if (name.isEmpty()) {
  403. name = m_appdata.projectGroup();
  404. diff --git a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
  405. index 6902318a3..f713b9036 100644
  406. --- a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
  407. +++ b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
  408. @@ -13,9 +13,10 @@
  409. #include "PKTransaction.h"
  410. #include "PackageKitSourcesBackend.h"
  411. #include "PackageKitUpdater.h"
  412. -#include <AppStreamQt/release.h>
  413. -#include <AppStreamQt/utils.h>
  414. -#include <AppStreamQt/version.h>
  415. +#include <AppStreamQt5/release.h>
  416. +#include <AppStreamQt5/systeminfo.h>
  417. +#include <AppStreamQt5/utils.h>
  418. +#include <AppStreamQt5/version.h>
  419. #include <appstream/AppStreamIntegration.h>
  420. #include <appstream/AppStreamUtils.h>
  421. #include <appstream/OdrsReviewsBackend.h>
  422. @@ -309,12 +310,16 @@ void PackageKitBackend::reloadPackageList()
  423. }
  424. acquireFetching(false);
  425. - const QList<AppStream::Component> distroComponents = m_appdata->componentsById(AppStream::Utils::currentDistroComponentId());
  426. + const auto distroComponents = m_appdata->componentsById(AppStream::SystemInfo::currentDistroComponentId());
  427. if (distroComponents.isEmpty()) {
  428. - qWarning() << "no component found for" << AppStream::Utils::currentDistroComponentId();
  429. + qWarning() << "no component found for" << AppStream::SystemInfo::currentDistroComponentId();
  430. }
  431. - for (const AppStream::Component &dc : distroComponents) {
  432. + for (const auto list = distroComponents.toList(); const AppStream::Component &dc : list) {
  433. +#if ASQ_CHECK_VERSION(1, 0, 0)
  434. + const auto releases = dc.releasesPlain().entries();
  435. +#else
  436. const auto releases = dc.releases();
  437. +#endif
  438. for (const auto &r : releases) {
  439. int cmp = AppStream::Utils::vercmpSimple(r.version(), AppStreamIntegration::global()->osRelease()->versionId());
  440. if (cmp == 0) {
  441. @@ -552,7 +557,7 @@ QList<AppStream::Component> PackageKitBackend::componentsById(const QString &id)
  442. if (comps.isEmpty()) {
  443. comps = m_appdata->componentsByProvided(AppStream::Provided::KindId, id);
  444. }
  445. - return comps;
  446. + return comps.toList();
  447. }
  448. static const auto needsResolveFilter = [](AbstractResource *res) {
  449. @@ -698,13 +703,15 @@ ResultsStream *PackageKitBackend::search(const AbstractResourcesBackend::Filters
  450. if (!stream) {
  451. return;
  452. }
  453. - const auto components = !filter.search.isEmpty() ? m_appdata->search(filter.search)
  454. -#if ASQ_CHECK_VERSION(0, 15, 6)
  455. - : filter.category ? AppStreamUtils::componentsByCategories(m_appdata.get(),
  456. - filter.category,
  457. - AppStream::Bundle::KindUnknown)
  458. -#endif
  459. - : m_appdata->components();
  460. + QList<AppStream::Component> components;
  461. + if (!filter.search.isEmpty()) {
  462. + components = m_appdata->search(filter.search).toList();
  463. + } else if (filter.category) {
  464. + components = AppStreamUtils::componentsByCategories(m_appdata.get(), filter.category, AppStream::Bundle::KindUnknown);
  465. + } else {
  466. + components = m_appdata->components().toList();
  467. + }
  468. +
  469. const QSet<QString> ids = kTransform<QSet<QString>>(components, [](const AppStream::Component &comp) {
  470. return comp.id();
  471. });
  472. diff --git a/libdiscover/backends/PackageKitBackend/PackageKitBackend.h b/libdiscover/backends/PackageKitBackend/PackageKitBackend.h
  473. index d9a5fd824..93899450b 100644
  474. --- a/libdiscover/backends/PackageKitBackend/PackageKitBackend.h
  475. +++ b/libdiscover/backends/PackageKitBackend/PackageKitBackend.h
  476. @@ -7,7 +7,7 @@
  477. #pragma once
  478. #include "PackageKitResource.h"
  479. -#include <AppStreamQt/pool.h>
  480. +#include <AppStreamQt5/pool.h>
  481. #include <PackageKit/Transaction>
  482. #include <QFile>
  483. #include <QPointer>
  484. diff --git a/libdiscover/backends/PackageKitBackend/PackageKitResource.cpp b/libdiscover/backends/PackageKitBackend/PackageKitResource.cpp
  485. index 8bdaec395..c7e2c0077 100644
  486. --- a/libdiscover/backends/PackageKitBackend/PackageKitResource.cpp
  487. +++ b/libdiscover/backends/PackageKitBackend/PackageKitResource.cpp
  488. @@ -10,7 +10,7 @@
  489. #include "PackageKitMessages.h"
  490. #include "appstream/AppStreamUtils.h"
  491. #include "config-paths.h"
  492. -#include <AppStreamQt/spdx.h>
  493. +#include <AppStreamQt5/spdx.h>
  494. #include <KIO/ApplicationLauncherJob>
  495. #include <KLocalizedString>
  496. #include <KService>
  497. diff --git a/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.cpp b/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.cpp
  498. index 6e1528be4..eb06b6510 100644
  499. --- a/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.cpp
  500. +++ b/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.cpp
  501. @@ -10,8 +10,8 @@
  502. #include "Transaction/TransactionModel.h"
  503. -#include <AppStreamQt/release.h>
  504. -#include <AppStreamQt/utils.h>
  505. +#include <AppStreamQt5/release.h>
  506. +#include <AppStreamQt5/utils.h>
  507. #include <Category/Category.h>
  508. #include <KLocalizedString>
  509. #include <appstream/AppStreamIntegration.h>
  510. @@ -316,7 +316,7 @@ void RpmOstreeBackend::lookForNextMajorVersion()
  511. }
  512. // Look at releases to see if we have a new major version available.
  513. - const QList<AppStream::Component> distroComponents = m_appdata->componentsById(distroId);
  514. + const auto distroComponents = m_appdata->componentsById(distroId);
  515. if (distroComponents.isEmpty()) {
  516. qWarning() << "rpm-ostree-backend: No component found for" << distroId;
  517. return;
  518. @@ -324,8 +324,12 @@ void RpmOstreeBackend::lookForNextMajorVersion()
  519. QString currentVersion = AppStreamIntegration::global()->osRelease()->versionId();
  520. QString nextVersion;
  521. - for (const AppStream::Component &dc : distroComponents) {
  522. + for (const auto list = distroComponents.toList(); const AppStream::Component &dc : list) {
  523. +#if ASQ_CHECK_VERSION(1, 0, 0)
  524. + const auto releases = dc.releasesPlain().entries();
  525. +#else
  526. const auto releases = dc.releases();
  527. +#endif
  528. for (const auto &r : releases) {
  529. // Only look at stable releases unless development mode is enabled
  530. if ((r.kind() != AppStream::Release::KindStable) && !m_developmentEnabled) {
  531. diff --git a/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.h b/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.h
  532. index 8ceed1af1..ea0a07c6f 100644
  533. --- a/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.h
  534. +++ b/libdiscover/backends/RpmOstreeBackend/RpmOstreeBackend.h
  535. @@ -14,7 +14,7 @@
  536. #include <resources/AbstractResourcesBackend.h>
  537. #include <resources/StandardBackendUpdater.h>
  538. -#include <AppStreamQt/pool.h>
  539. +#include <AppStreamQt5/pool.h>
  540. #include <QTimer>
  541. class DiscoverAction;