flatpak-1.15.4
This commit is contained in:
@@ -0,0 +1,316 @@
|
|||||||
|
From c0c466f269d96b27b5b477a67f903a6229b2df93 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matthias Klumpp <matthias@tenstral.net>
|
||||||
|
Date: Sun, 8 Oct 2023 20:55:12 +0200
|
||||||
|
Subject: [PATCH] Adjust to AppStream 1.0 API changes
|
||||||
|
|
||||||
|
---
|
||||||
|
app/flatpak-builtins-remote-info.c | 16 +++----
|
||||||
|
app/flatpak-builtins-remote-ls.c | 16 +++----
|
||||||
|
app/flatpak-builtins-search.c | 17 ++++++--
|
||||||
|
app/flatpak-builtins-utils.c | 69 +++++++++++++++++++++---------
|
||||||
|
app/flatpak-builtins-utils.h | 20 ++++-----
|
||||||
|
5 files changed, 88 insertions(+), 50 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/app/flatpak-builtins-remote-info.c b/app/flatpak-builtins-remote-info.c
|
||||||
|
index 5f6b737c3f..501c102055 100644
|
||||||
|
--- a/app/flatpak-builtins-remote-info.c
|
||||||
|
+++ b/app/flatpak-builtins-remote-info.c
|
||||||
|
@@ -180,24 +180,24 @@ flatpak_builtin_remote_info (int argc, char **argv, GCancellable *cancellable, G
|
||||||
|
int rows, cols;
|
||||||
|
int width;
|
||||||
|
g_autoptr(AsMetadata) mdata = as_metadata_new ();
|
||||||
|
- AsComponent *app = NULL;
|
||||||
|
+ AsComponent *cpt = NULL;
|
||||||
|
const char *version = NULL;
|
||||||
|
const char *license = NULL;
|
||||||
|
g_autofree char *id = flatpak_decomposed_dup_id (ref);
|
||||||
|
|
||||||
|
flatpak_get_window_size (&rows, &cols);
|
||||||
|
|
||||||
|
- flatpak_dir_load_appstream_store (preferred_dir, remote, id, mdata, NULL, NULL);
|
||||||
|
- app = as_store_find_app (mdata, flatpak_decomposed_get_ref (ref));
|
||||||
|
- if (app)
|
||||||
|
+ flatpak_dir_load_appstream_data (preferred_dir, remote, id, mdata, NULL, NULL);
|
||||||
|
+ cpt = metadata_find_component (mdata, flatpak_decomposed_get_ref (ref));
|
||||||
|
+ if (cpt)
|
||||||
|
{
|
||||||
|
- const char *name = as_component_get_name (app);
|
||||||
|
- const char *comment = as_component_get_summary (app);
|
||||||
|
+ const char *name = as_component_get_name (cpt);
|
||||||
|
+ const char *comment = as_component_get_summary (cpt);
|
||||||
|
|
||||||
|
print_wrapped (MIN (cols, 80), "\n%s - %s\n", name, comment);
|
||||||
|
|
||||||
|
- version = as_app_get_version (app);
|
||||||
|
- license = as_component_get_project_license (app);
|
||||||
|
+ version = component_get_version_latest (cpt);
|
||||||
|
+ license = as_component_get_project_license (cpt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commit_v)
|
||||||
|
diff --git a/app/flatpak-builtins-remote-ls.c b/app/flatpak-builtins-remote-ls.c
|
||||||
|
index 1da12439ae..fd718c9fb6 100644
|
||||||
|
--- a/app/flatpak-builtins-remote-ls.c
|
||||||
|
+++ b/app/flatpak-builtins-remote-ls.c
|
||||||
|
@@ -231,7 +231,7 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
|
||||||
|
if (need_appstream_data)
|
||||||
|
{
|
||||||
|
mdata = as_metadata_new ();
|
||||||
|
- flatpak_dir_load_appstream_store (dir, remote, NULL, mdata, NULL, NULL);
|
||||||
|
+ flatpak_dir_load_appstream_data (dir, remote, NULL, mdata, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
keys = (FlatpakDecomposed **) g_hash_table_get_keys_as_array (names, &n_keys);
|
||||||
|
@@ -244,7 +244,7 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
|
||||||
|
guint64 installed_size;
|
||||||
|
guint64 download_size;
|
||||||
|
g_autofree char *runtime = NULL;
|
||||||
|
- AsComponent *app = NULL;
|
||||||
|
+ AsComponent *cpt = NULL;
|
||||||
|
gboolean has_sparse_cache;
|
||||||
|
VarMetadataRef sparse_cache;
|
||||||
|
g_autofree char *id = flatpak_decomposed_dup_id (ref);
|
||||||
|
@@ -278,7 +278,7 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (need_appstream_data)
|
||||||
|
- app = as_store_find_app (mdata, ref_str);
|
||||||
|
+ cpt = metadata_find_component (mdata, ref_str);
|
||||||
|
|
||||||
|
if (app_runtime && runtime)
|
||||||
|
{
|
||||||
|
@@ -296,8 +296,8 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
|
||||||
|
const char *name = NULL;
|
||||||
|
g_autofree char *readable_id = NULL;
|
||||||
|
|
||||||
|
- if (app)
|
||||||
|
- name = as_component_get_name (app);
|
||||||
|
+ if (cpt)
|
||||||
|
+ name = as_component_get_name (cpt);
|
||||||
|
|
||||||
|
if (name == NULL)
|
||||||
|
readable_id = flatpak_decomposed_dup_readable_id (ref);
|
||||||
|
@@ -307,13 +307,13 @@ ls_remote (GHashTable *refs_hash, const char **arches, const char *app_runtime,
|
||||||
|
else if (strcmp (columns[j].name, "description") == 0)
|
||||||
|
{
|
||||||
|
const char *comment = NULL;
|
||||||
|
- if (app)
|
||||||
|
- comment = as_component_get_summary (app);
|
||||||
|
+ if (cpt)
|
||||||
|
+ comment = as_component_get_summary (cpt);
|
||||||
|
|
||||||
|
flatpak_table_printer_add_column (printer, comment);
|
||||||
|
}
|
||||||
|
else if (strcmp (columns[j].name, "version") == 0)
|
||||||
|
- flatpak_table_printer_add_column (printer, app ? as_app_get_version (app) : "");
|
||||||
|
+ flatpak_table_printer_add_column (printer, cpt ? component_get_version_latest (cpt) : "");
|
||||||
|
else if (strcmp (columns[j].name, "ref") == 0)
|
||||||
|
flatpak_table_printer_add_column (printer, ref_str);
|
||||||
|
else if (strcmp (columns[j].name, "application") == 0)
|
||||||
|
diff --git a/app/flatpak-builtins-search.c b/app/flatpak-builtins-search.c
|
||||||
|
index 6a8ff80cd3..3c85e4e9b9 100644
|
||||||
|
--- a/app/flatpak-builtins-search.c
|
||||||
|
+++ b/app/flatpak-builtins-search.c
|
||||||
|
@@ -76,7 +76,7 @@ get_remote_stores (GPtrArray *dirs, const char *arch, GCancellable *cancellable)
|
||||||
|
{
|
||||||
|
g_autoptr(AsMetadata) mdata = as_metadata_new ();
|
||||||
|
|
||||||
|
- flatpak_dir_load_appstream_store (dir, remotes[j], arch, mdata, cancellable, &error);
|
||||||
|
+ flatpak_dir_load_appstream_data (dir, remotes[j], arch, mdata, cancellable, &error);
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
{
|
||||||
|
@@ -185,7 +185,7 @@ component_get_branch (AsComponent *app)
|
||||||
|
static void
|
||||||
|
print_app (Column *columns, MatchResult *res, FlatpakTablePrinter *printer)
|
||||||
|
{
|
||||||
|
- const char *version = as_app_get_version (res->app);
|
||||||
|
+ const char *version = component_get_version_latest (res->app);
|
||||||
|
g_autofree char *id = component_get_flatpak_id (res->app);
|
||||||
|
const char *name = as_component_get_name (res->app);
|
||||||
|
const char *comment = as_component_get_summary (res->app);
|
||||||
|
@@ -272,12 +272,21 @@ flatpak_builtin_search (int argc, char **argv, GCancellable *cancellable, GError
|
||||||
|
for (j = 0; j < remote_stores->len; ++j)
|
||||||
|
{
|
||||||
|
AsMetadata *mdata = g_ptr_array_index (remote_stores, j);
|
||||||
|
+#if AS_CHECK_VERSION(1, 0, 0)
|
||||||
|
+ AsComponentBox *apps = as_metadata_get_components (mdata);
|
||||||
|
+#else
|
||||||
|
GPtrArray *apps = as_metadata_get_components (mdata);
|
||||||
|
- guint i;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
- for (i = 0; i < apps->len; ++i)
|
||||||
|
+#if AS_CHECK_VERSION(1, 0, 0)
|
||||||
|
+ for (guint i = 0; i < as_component_box_len (apps); ++i)
|
||||||
|
+ {
|
||||||
|
+ AsComponent *app = as_component_box_index (apps, i);
|
||||||
|
+#else
|
||||||
|
+ for (guint i = 0; i < apps->len; ++i)
|
||||||
|
{
|
||||||
|
AsComponent *app = g_ptr_array_index (apps, i);
|
||||||
|
+#endif
|
||||||
|
const char *remote_name = g_object_get_data (G_OBJECT (mdata), "remote-name");
|
||||||
|
g_autoptr(FlatpakDecomposed) decomposed = NULL;
|
||||||
|
|
||||||
|
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
|
||||||
|
index 073d96d139..a0dc3dd820 100644
|
||||||
|
--- a/app/flatpak-builtins-utils.c
|
||||||
|
+++ b/app/flatpak-builtins-utils.c
|
||||||
|
@@ -1043,50 +1043,79 @@ ellipsize_string_full (const char *text, int len, FlatpakEllipsizeMode mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
-as_app_get_version (AsComponent *app)
|
||||||
|
+component_get_version_latest (AsComponent *component)
|
||||||
|
{
|
||||||
|
- GPtrArray *releases = as_component_get_releases (app);
|
||||||
|
+#if AS_CHECK_VERSION(1, 0, 0)
|
||||||
|
+ AsReleaseList *releases = NULL;
|
||||||
|
+
|
||||||
|
+ /* load releases without network access, ignoring any errors */
|
||||||
|
+ as_component_load_releases (component, FALSE, NULL);
|
||||||
|
+
|
||||||
|
+ /* fetch default releases even if previous loading has failed */
|
||||||
|
+ releases = as_component_get_releases_plain (component);
|
||||||
|
+ if (releases != NULL && as_release_list_len (releases) > 0)
|
||||||
|
+ return as_release_get_version (as_release_list_index (releases, 0));
|
||||||
|
+#else
|
||||||
|
+ GPtrArray *releases = as_component_get_releases (component);
|
||||||
|
|
||||||
|
if (releases != NULL && releases->len > 0)
|
||||||
|
return as_release_get_version (AS_RELEASE (g_ptr_array_index (releases, 0)));
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AsComponent *
|
||||||
|
-as_store_find_app (AsMetadata *mdata,
|
||||||
|
- const char *ref)
|
||||||
|
+metadata_find_component (AsMetadata *mdata,
|
||||||
|
+ const char *ref)
|
||||||
|
{
|
||||||
|
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
|
||||||
|
- const char *appid = flatpak_ref_get_name (rref);
|
||||||
|
- g_autofree char *desktopid = g_strconcat (appid, ".desktop", NULL);
|
||||||
|
- int j;
|
||||||
|
+ const char *cid = flatpak_ref_get_name (rref);
|
||||||
|
+ g_autofree char *desktopid = g_strconcat (cid, ".desktop", NULL);
|
||||||
|
|
||||||
|
- for (j = 0; j < 2; j++)
|
||||||
|
+ for (int j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
- const char *id = j == 0 ? appid : desktopid;
|
||||||
|
+ const char *id = j == 0 ? cid : desktopid;
|
||||||
|
+#if AS_CHECK_VERSION(1, 0, 0)
|
||||||
|
+ AsComponentBox *cbox = as_metadata_get_components (mdata);
|
||||||
|
+
|
||||||
|
+ for (gsize i = 0; i < as_component_box_len (cbox); i++)
|
||||||
|
+ {
|
||||||
|
+ AsComponent *component = as_component_box_index (cbox, i);
|
||||||
|
+ AsBundle *bundle;
|
||||||
|
+
|
||||||
|
+ if (g_strcmp0 (as_component_get_id (component), id) != 0)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ bundle = as_component_get_bundle (component, AS_BUNDLE_KIND_FLATPAK);
|
||||||
|
+ if (bundle &&
|
||||||
|
+ g_str_equal (as_bundle_get_id (bundle), ref))
|
||||||
|
+ return component;
|
||||||
|
+ }
|
||||||
|
+#else
|
||||||
|
GPtrArray *components = as_metadata_get_components (mdata);
|
||||||
|
|
||||||
|
for (gsize i = 0; i < components->len; i++)
|
||||||
|
{
|
||||||
|
- AsComponent *app = g_ptr_array_index (components, i);
|
||||||
|
+ AsComponent *component = g_ptr_array_index (components, i);
|
||||||
|
AsBundle *bundle;
|
||||||
|
|
||||||
|
- if (g_strcmp0 (as_component_get_id (app), id) != 0)
|
||||||
|
+ if (g_strcmp0 (as_component_get_id (component), id) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
- bundle = as_component_get_bundle (app, AS_BUNDLE_KIND_FLATPAK);
|
||||||
|
+ bundle = as_component_get_bundle (component, AS_BUNDLE_KIND_FLATPAK);
|
||||||
|
if (bundle &&
|
||||||
|
g_str_equal (as_bundle_get_id (bundle), ref))
|
||||||
|
- return app;
|
||||||
|
+ return component;
|
||||||
|
}
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
- * flatpak_dir_load_appstream_store:
|
||||||
|
+ * flatpak_dir_load_appstream_data:
|
||||||
|
* @self: a #FlatpakDir
|
||||||
|
* @remote_name: name of the remote to load the AppStream data for
|
||||||
|
* @arch: (nullable): name of the architecture to load the AppStream data for,
|
||||||
|
@@ -1104,12 +1133,12 @@ as_store_find_app (AsMetadata *mdata,
|
||||||
|
* otherwise
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
-flatpak_dir_load_appstream_store (FlatpakDir *self,
|
||||||
|
- const gchar *remote_name,
|
||||||
|
- const gchar *arch,
|
||||||
|
- AsMetadata *mdata,
|
||||||
|
- GCancellable *cancellable,
|
||||||
|
- GError **error)
|
||||||
|
+flatpak_dir_load_appstream_data (FlatpakDir *self,
|
||||||
|
+ const gchar *remote_name,
|
||||||
|
+ const gchar *arch,
|
||||||
|
+ AsMetadata *mdata,
|
||||||
|
+ GCancellable *cancellable,
|
||||||
|
+ GError **error)
|
||||||
|
{
|
||||||
|
const char *install_path = flatpak_file_get_path_cached (flatpak_dir_get_path (self));
|
||||||
|
g_autoptr(GFile) appstream_file = NULL;
|
||||||
|
diff --git a/app/flatpak-builtins-utils.h b/app/flatpak-builtins-utils.h
|
||||||
|
index 958cd79a42..257a6b952f 100644
|
||||||
|
--- a/app/flatpak-builtins-utils.h
|
||||||
|
+++ b/app/flatpak-builtins-utils.h
|
||||||
|
@@ -160,16 +160,16 @@ void print_aligned_take (int len,
|
||||||
|
const char *title,
|
||||||
|
char *value);
|
||||||
|
|
||||||
|
-AsComponent *as_store_find_app (AsMetadata *mdata,
|
||||||
|
- const char *ref);
|
||||||
|
-const char *as_app_get_version (AsComponent *component);
|
||||||
|
-
|
||||||
|
-gboolean flatpak_dir_load_appstream_store (FlatpakDir *self,
|
||||||
|
- const gchar *remote_name,
|
||||||
|
- const gchar *arch,
|
||||||
|
- AsMetadata *mdata,
|
||||||
|
- GCancellable *cancellable,
|
||||||
|
- GError **error);
|
||||||
|
+AsComponent *metadata_find_component (AsMetadata *mdata,
|
||||||
|
+ const char *ref);
|
||||||
|
+const char *component_get_version_latest (AsComponent *component);
|
||||||
|
+
|
||||||
|
+gboolean flatpak_dir_load_appstream_data (FlatpakDir *self,
|
||||||
|
+ const gchar *remote_name,
|
||||||
|
+ const gchar *arch,
|
||||||
|
+ AsMetadata *mdata,
|
||||||
|
+ GCancellable *cancellable,
|
||||||
|
+ GError **error);
|
||||||
|
|
||||||
|
int cell_width (const char *text);
|
||||||
|
const char *cell_advance (const char *text,
|
||||||
|
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
|
||||||
|
index 83d46551..da90af25 100644
|
||||||
|
--- a/app/flatpak-builtins-utils.c
|
||||||
|
+++ b/app/flatpak-builtins-utils.c
|
||||||
|
@@ -1129,7 +1129,7 @@ flatpak_dir_load_appstream_store (FlatpakDir *self,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
appstream_file = g_file_new_for_path (appstream_path);
|
||||||
|
- as_metadata_set_format_style (mdata, AS_FORMAT_STYLE_COLLECTION);
|
||||||
|
+ as_metadata_set_format_style (mdata, AS_FORMAT_STYLE_CATALOG);
|
||||||
|
#ifdef HAVE_APPSTREAM_0_14_0
|
||||||
|
success = as_metadata_parse_file (mdata, appstream_file, AS_FORMAT_KIND_XML, &local_error);
|
||||||
|
#else
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<License>LGPLv2.1</License>
|
<License>LGPLv2.1</License>
|
||||||
<Summary>Application distribution framework</Summary>
|
<Summary>Application distribution framework</Summary>
|
||||||
<Description>Linux application sandboxing and distribution framework, formerly xdg-app</Description>
|
<Description>Linux application sandboxing and distribution framework, formerly xdg-app</Description>
|
||||||
<Archive sha1sum="807b4fe57b42cbbd1b7da18efdae8afcb19bfcef" type="tarxz">https://github.com/flatpak/flatpak/releases/download/1.15.3/flatpak-1.15.3.tar.xz</Archive>
|
<Archive sha1sum="8b08ae85c70dbf68d7bf575aae0cddbd515b8f92" type="tarxz">https://github.com/flatpak/flatpak/releases/download/1.15.4/flatpak-1.15.4.tar.xz</Archive>
|
||||||
<BuildDependencies>
|
<BuildDependencies>
|
||||||
<Dependency>xmlto</Dependency>
|
<Dependency>xmlto</Dependency>
|
||||||
<Dependency>zstd-devel</Dependency>
|
<Dependency>zstd-devel</Dependency>
|
||||||
@@ -41,8 +41,7 @@
|
|||||||
<Dependency>appstream-devel</Dependency>
|
<Dependency>appstream-devel</Dependency>
|
||||||
</BuildDependencies>
|
</BuildDependencies>
|
||||||
<Patches>
|
<Patches>
|
||||||
<!--Patch level="1">bubblewrap_libglnx_submodule.patch</Patch-->
|
<Patch level="1">appstream-1.0.patch</Patch>
|
||||||
<!--Patch>flatpak-1.0.2-var_symlink_fix.diff</Patch-->
|
|
||||||
</Patches>
|
</Patches>
|
||||||
</Source>
|
</Source>
|
||||||
|
|
||||||
@@ -117,6 +116,13 @@
|
|||||||
</Package>
|
</Package>
|
||||||
|
|
||||||
<History>
|
<History>
|
||||||
|
<Update release="19">
|
||||||
|
<Date>2023-11-14</Date>
|
||||||
|
<Version>1.15.4</Version>
|
||||||
|
<Comment>Version bump.</Comment>
|
||||||
|
<Name>Mustafa Cinasal</Name>
|
||||||
|
<Email>muscnsl@gmail.com</Email>
|
||||||
|
</Update>
|
||||||
<Update release="18">
|
<Update release="18">
|
||||||
<Date>2023-03-15</Date>
|
<Date>2023-03-15</Date>
|
||||||
<Version>1.15.3</Version>
|
<Version>1.15.3</Version>
|
||||||
|
|||||||
Reference in New Issue
Block a user