2015-12-14 21:01:21 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "libglnx/libglnx.h"
|
|
|
|
|
2015-11-26 22:07:05 +00:00
|
|
|
#include <xdg-app.h>
|
2016-02-25 19:10:32 +00:00
|
|
|
#include <gio/gunixoutputstream.h>
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-15 11:26:59 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
progress_cb (const char *status,
|
2016-05-06 14:03:27 +00:00
|
|
|
guint progress,
|
|
|
|
gboolean estimating,
|
|
|
|
gpointer user_data)
|
2015-12-15 11:26:59 +00:00
|
|
|
{
|
|
|
|
g_print ("status: %s, progress: %d estimating: %d, user_data: %p\n", status, progress, estimating, user_data);
|
|
|
|
}
|
|
|
|
|
2015-12-21 10:13:00 +00:00
|
|
|
static gboolean
|
2016-05-06 14:03:27 +00:00
|
|
|
monitor_callback (GFileMonitor * monitor,
|
|
|
|
GFile * child,
|
|
|
|
GFile * other_file,
|
2015-12-21 10:13:00 +00:00
|
|
|
GFileMonitorEvent eflags)
|
|
|
|
{
|
|
|
|
g_print ("Database changed\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2015-11-26 22:07:05 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
|
|
|
XdgAppInstallation *installation;
|
|
|
|
XdgAppInstalledRef *app1;
|
|
|
|
XdgAppInstalledRef *app2;
|
2015-12-07 15:17:06 +00:00
|
|
|
XdgAppRemoteRef *remote_ref;
|
2016-05-06 14:03:27 +00:00
|
|
|
|
2015-12-17 20:07:52 +00:00
|
|
|
g_autoptr(GPtrArray) remotes = NULL;
|
2015-12-15 11:26:59 +00:00
|
|
|
GError *error = NULL;
|
2015-11-26 22:07:05 +00:00
|
|
|
int i, j;
|
|
|
|
|
2015-12-18 13:20:28 +00:00
|
|
|
installation = xdg_app_installation_new_user (NULL, &error);
|
2015-12-18 11:27:26 +00:00
|
|
|
if (installation == NULL)
|
|
|
|
{
|
|
|
|
g_print ("error: %s\n", error->message);
|
|
|
|
return 1;
|
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-21 10:13:00 +00:00
|
|
|
if (argc == 4)
|
|
|
|
{
|
|
|
|
GFileMonitor * monitor = xdg_app_installation_create_monitor (installation, NULL, NULL);
|
|
|
|
GMainLoop *main_loop;
|
|
|
|
|
2016-05-06 14:03:27 +00:00
|
|
|
g_signal_connect (monitor, "changed", (GCallback) monitor_callback, NULL);
|
2015-12-21 10:13:00 +00:00
|
|
|
main_loop = g_main_loop_new (NULL, FALSE);
|
|
|
|
g_main_loop_run (main_loop);
|
|
|
|
}
|
|
|
|
|
2015-12-15 11:26:59 +00:00
|
|
|
if (argc == 3)
|
|
|
|
{
|
|
|
|
app1 = xdg_app_installation_install (installation,
|
|
|
|
argv[1],
|
|
|
|
XDG_APP_REF_KIND_APP,
|
|
|
|
argv[2],
|
|
|
|
NULL, NULL,
|
2016-05-06 14:03:27 +00:00
|
|
|
progress_cb, (gpointer) 0xdeadbeef,
|
2015-12-15 11:26:59 +00:00
|
|
|
NULL, &error);
|
|
|
|
if (app1 == NULL)
|
|
|
|
g_print ("Error: %s\n", error->message);
|
|
|
|
else
|
|
|
|
g_print ("Installed %s: %s\n", argv[2],
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (app1)));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-15 11:43:56 +00:00
|
|
|
if (argc == 2)
|
|
|
|
{
|
|
|
|
app1 = xdg_app_installation_update (installation,
|
2015-12-18 11:14:57 +00:00
|
|
|
XDG_APP_UPDATE_FLAGS_NONE,
|
2015-12-15 11:43:56 +00:00
|
|
|
XDG_APP_REF_KIND_APP,
|
|
|
|
argv[1],
|
|
|
|
NULL, NULL,
|
2016-05-06 14:03:27 +00:00
|
|
|
progress_cb, (gpointer) 0xdeadbeef,
|
2015-12-15 11:43:56 +00:00
|
|
|
NULL, &error);
|
|
|
|
if (app1 == NULL)
|
|
|
|
g_print ("Error: %s\n", error->message);
|
|
|
|
else
|
|
|
|
g_print ("Updated %s: %s\n", argv[1],
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (app1)));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-24 13:44:05 +00:00
|
|
|
g_print ("\n**** Loading bundle\n");
|
|
|
|
{
|
|
|
|
g_autoptr(GFile) f = g_file_new_for_commandline_arg ("tests/hello.xdgapp");
|
|
|
|
g_autoptr(XdgAppBundleRef) bundle = xdg_app_bundle_ref_new (f, &error);
|
|
|
|
if (bundle == NULL)
|
|
|
|
{
|
|
|
|
g_print ("Error loading bundle: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_autofree char *path = g_file_get_path (xdg_app_bundle_ref_get_file (bundle));
|
|
|
|
g_autoptr(GBytes) metadata = xdg_app_bundle_ref_get_metadata (bundle);
|
2016-02-26 11:53:47 +00:00
|
|
|
g_autoptr(GBytes) appdata = xdg_app_bundle_ref_get_appstream (bundle);
|
2016-05-06 14:03:27 +00:00
|
|
|
g_print ("%d %s %s %s %s %s %"G_GUINT64_FORMAT "\n%s\n",
|
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (bundle)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (bundle)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (bundle)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (bundle)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (bundle)),
|
2016-02-24 13:44:05 +00:00
|
|
|
path,
|
2016-02-25 20:34:44 +00:00
|
|
|
xdg_app_bundle_ref_get_installed_size (bundle),
|
2016-05-06 14:03:27 +00:00
|
|
|
(char *) g_bytes_get_data (metadata, NULL));
|
2016-02-25 19:10:32 +00:00
|
|
|
|
|
|
|
if (appdata != NULL)
|
|
|
|
{
|
|
|
|
g_autoptr(GZlibDecompressor) decompressor = NULL;
|
|
|
|
g_autoptr(GOutputStream) out2 = NULL;
|
|
|
|
g_autoptr(GOutputStream) out = NULL;
|
|
|
|
|
|
|
|
out = g_unix_output_stream_new (1, FALSE);
|
|
|
|
decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_GZIP);
|
|
|
|
out2 = g_converter_output_stream_new (out, G_CONVERTER (decompressor));
|
|
|
|
|
|
|
|
if (!g_output_stream_write_all (out2,
|
|
|
|
g_bytes_get_data (appdata, NULL),
|
|
|
|
g_bytes_get_size (appdata),
|
|
|
|
NULL, NULL, &error))
|
|
|
|
{
|
|
|
|
g_print ("Error decompressing appdata: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
}
|
2016-02-24 13:44:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-17 20:37:30 +00:00
|
|
|
g_print ("\n**** Checking for updates\n");
|
|
|
|
{
|
|
|
|
g_autoptr(GPtrArray) updates =
|
|
|
|
xdg_app_installation_list_installed_refs_for_update (installation,
|
|
|
|
NULL, &error);
|
|
|
|
|
|
|
|
if (updates == NULL)
|
|
|
|
{
|
|
|
|
g_print ("check for updates error: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (i = 0; i < updates->len; i++)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppInstalledRef *ref = g_ptr_array_index (updates, i);
|
|
|
|
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
2015-12-18 11:14:57 +00:00
|
|
|
xdg_app_installed_ref_get_latest_commit (ref),
|
2015-12-17 20:37:30 +00:00
|
|
|
xdg_app_installed_ref_get_origin (ref),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (ref),
|
2016-01-19 14:05:06 +00:00
|
|
|
xdg_app_installed_ref_get_is_current (ref),
|
|
|
|
xdg_app_installed_ref_get_installed_size (ref));
|
2015-12-17 20:37:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-17 18:50:40 +00:00
|
|
|
g_print ("\n**** Listing all installed refs\n");
|
|
|
|
{
|
|
|
|
g_autoptr(GPtrArray) refs = NULL;
|
|
|
|
|
|
|
|
refs = xdg_app_installation_list_installed_refs (installation,
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < refs->len; i++)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppInstalledRef *ref = g_ptr_array_index (refs, i);
|
|
|
|
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
2015-12-18 11:14:57 +00:00
|
|
|
xdg_app_installed_ref_get_latest_commit (ref),
|
2015-12-17 18:50:40 +00:00
|
|
|
xdg_app_installed_ref_get_origin (ref),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (ref),
|
2016-01-19 14:05:06 +00:00
|
|
|
xdg_app_installed_ref_get_is_current (ref),
|
|
|
|
xdg_app_installed_ref_get_installed_size (ref));
|
2015-12-17 18:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-07 15:16:43 +00:00
|
|
|
g_print ("**** Listing all installed apps\n");
|
2015-12-17 18:50:40 +00:00
|
|
|
{
|
|
|
|
g_autoptr(GPtrArray) apps = NULL;
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-17 18:50:40 +00:00
|
|
|
apps = xdg_app_installation_list_installed_refs_by_kind (installation,
|
|
|
|
XDG_APP_REF_KIND_APP,
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < apps->len; i++)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppInstalledRef *app = g_ptr_array_index (apps, i);
|
|
|
|
|
|
|
|
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (app)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (app)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (app)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (app)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (app)),
|
2015-12-18 11:14:57 +00:00
|
|
|
xdg_app_installed_ref_get_latest_commit (app),
|
2015-12-17 18:50:40 +00:00
|
|
|
xdg_app_installed_ref_get_origin (app),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (app),
|
2016-01-19 14:05:06 +00:00
|
|
|
xdg_app_installed_ref_get_is_current (app),
|
|
|
|
xdg_app_installed_ref_get_installed_size (app));
|
2016-05-06 14:03:27 +00:00
|
|
|
g_print ("metadata:\n%s\n", (char *) g_bytes_get_data (xdg_app_installed_ref_load_metadata (app, NULL, NULL), NULL));
|
2015-12-17 18:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-07 15:16:43 +00:00
|
|
|
g_print ("\n**** Listing all installed runtimes\n");
|
2015-12-17 18:50:40 +00:00
|
|
|
{
|
|
|
|
g_autoptr(GPtrArray) runtimes = NULL;
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-17 18:50:40 +00:00
|
|
|
runtimes = xdg_app_installation_list_installed_refs_by_kind (installation,
|
|
|
|
XDG_APP_REF_KIND_RUNTIME,
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
for (i = 0; i < runtimes->len; i++)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppInstalledRef *runtime = g_ptr_array_index (runtimes, i);
|
2015-12-17 18:50:40 +00:00
|
|
|
g_print ("%d %s %s %s %s %s %s %d\n",
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (runtime)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (runtime)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (runtime)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (runtime)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (runtime)),
|
2015-12-17 18:50:40 +00:00
|
|
|
xdg_app_installed_ref_get_origin (runtime),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (runtime),
|
2015-12-17 19:10:10 +00:00
|
|
|
xdg_app_installed_ref_get_is_current (runtime));
|
2015-12-17 18:50:40 +00:00
|
|
|
}
|
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-07 15:16:43 +00:00
|
|
|
g_print ("\n**** Getting installed gedit master\n");
|
2015-12-17 19:33:02 +00:00
|
|
|
app1 = xdg_app_installation_get_installed_ref (installation,
|
2015-11-26 22:07:05 +00:00
|
|
|
XDG_APP_REF_KIND_APP,
|
|
|
|
"org.gnome.gedit",
|
|
|
|
NULL, "master", NULL, NULL);
|
|
|
|
if (app1)
|
2015-12-07 12:36:39 +00:00
|
|
|
{
|
|
|
|
g_print ("gedit master: %d %s %s %s %s %s %s %d\n",
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (app1)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (app1)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (app1)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (app1)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (app1)),
|
2015-12-07 12:36:39 +00:00
|
|
|
xdg_app_installed_ref_get_origin (app1),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (app1),
|
2015-12-17 19:10:10 +00:00
|
|
|
xdg_app_installed_ref_get_is_current (app1));
|
2015-12-17 19:33:02 +00:00
|
|
|
}
|
|
|
|
if (!xdg_app_installation_launch (installation,
|
|
|
|
"org.gnome.gedit",
|
|
|
|
NULL, NULL, NULL,
|
|
|
|
NULL, &error))
|
|
|
|
{
|
|
|
|
g_print ("launch gedit error: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
2015-12-07 12:36:39 +00:00
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
|
2015-12-07 15:16:43 +00:00
|
|
|
g_print ("\n**** Getting current installed gedit\n");
|
2015-12-17 19:10:10 +00:00
|
|
|
app2 = xdg_app_installation_get_current_installed_app (installation,
|
2015-11-26 22:07:05 +00:00
|
|
|
"org.gnome.gedit",
|
|
|
|
NULL, NULL);
|
|
|
|
if (app2)
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
g_print ("gedit current: %d %s %s %s %s %s %s %d\n",
|
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (app2)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (app2)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (app2)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (app2)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (app2)),
|
|
|
|
xdg_app_installed_ref_get_origin (app2),
|
|
|
|
xdg_app_installed_ref_get_deploy_dir (app2),
|
|
|
|
xdg_app_installed_ref_get_is_current (app2));
|
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
|
|
|
|
|
2015-12-07 15:16:43 +00:00
|
|
|
g_print ("\n**** Listing remotes\n");
|
2015-11-26 22:07:05 +00:00
|
|
|
remotes = xdg_app_installation_list_remotes (installation,
|
|
|
|
NULL, NULL);
|
|
|
|
|
2015-12-17 20:07:52 +00:00
|
|
|
for (i = 0; i < remotes->len; i++)
|
2015-11-26 22:07:05 +00:00
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppRemote *remote = g_ptr_array_index (remotes, i);
|
2015-12-17 18:57:01 +00:00
|
|
|
g_autoptr(GPtrArray) refs = NULL;
|
2016-01-19 14:18:44 +00:00
|
|
|
g_print ("\nRemote: %s %d %s %s %d %d %s\n",
|
2015-12-17 20:07:52 +00:00
|
|
|
xdg_app_remote_get_name (remote),
|
2015-12-21 09:25:41 +00:00
|
|
|
xdg_app_remote_get_prio (remote),
|
2015-12-17 20:07:52 +00:00
|
|
|
xdg_app_remote_get_url (remote),
|
|
|
|
xdg_app_remote_get_title (remote),
|
|
|
|
xdg_app_remote_get_gpg_verify (remote),
|
2016-01-19 14:18:44 +00:00
|
|
|
xdg_app_remote_get_noenumerate (remote),
|
|
|
|
g_file_get_path (xdg_app_remote_get_appstream_dir (remote, NULL)));
|
2015-12-17 20:07:52 +00:00
|
|
|
|
|
|
|
g_print ("\n**** Listing remote refs on %s\n", xdg_app_remote_get_name (remote));
|
|
|
|
refs = xdg_app_installation_list_remote_refs_sync (installation, xdg_app_remote_get_name (remote),
|
2015-12-17 19:51:59 +00:00
|
|
|
NULL, NULL);
|
2015-11-26 22:07:05 +00:00
|
|
|
if (refs)
|
|
|
|
{
|
2015-12-17 18:57:01 +00:00
|
|
|
for (j = 0; j < refs->len; j++)
|
2015-11-26 22:07:05 +00:00
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
XdgAppRemoteRef *ref = g_ptr_array_index (refs, j);
|
2015-12-07 15:16:02 +00:00
|
|
|
g_print ("%d %s %s %s %s %s\n",
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
2015-12-17 18:57:01 +00:00
|
|
|
xdg_app_remote_ref_get_remote_name (ref));
|
2016-01-14 15:44:00 +00:00
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
guint64 download_size;
|
|
|
|
guint64 installed_size;
|
|
|
|
if (!xdg_app_installation_fetch_remote_size_sync (installation,
|
|
|
|
xdg_app_remote_get_name (remote),
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
2016-01-14 15:44:00 +00:00
|
|
|
&download_size,
|
|
|
|
&installed_size,
|
|
|
|
NULL, &error))
|
|
|
|
{
|
|
|
|
g_print ("error fetching sizes: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
g_print ("Download size: %"G_GUINT64_FORMAT " Installed size: %"G_GUINT64_FORMAT "\n",
|
|
|
|
download_size, installed_size);
|
|
|
|
}
|
2016-04-14 17:29:40 +00:00
|
|
|
|
|
|
|
if (!xdg_app_installation_fetch_remote_size_sync2 (installation,
|
|
|
|
xdg_app_remote_get_name (remote),
|
2016-05-06 14:03:27 +00:00
|
|
|
XDG_APP_REF (ref),
|
2016-04-14 17:29:40 +00:00
|
|
|
&download_size,
|
|
|
|
&installed_size,
|
|
|
|
NULL, &error))
|
|
|
|
{
|
|
|
|
g_print ("error fetching sizes2: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
|
|
|
else
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
g_print ("Download size2: %"G_GUINT64_FORMAT " Installed size2: %"G_GUINT64_FORMAT "\n",
|
|
|
|
download_size, installed_size);
|
|
|
|
}
|
2016-04-14 17:29:40 +00:00
|
|
|
|
2016-01-14 15:44:00 +00:00
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
}
|
|
|
|
}
|
2015-12-07 15:17:06 +00:00
|
|
|
|
2016-04-14 17:29:40 +00:00
|
|
|
g_print ("\n**** Getting remote platform 3.20 on %s\n", xdg_app_remote_get_name (remote));
|
2015-12-08 10:01:13 +00:00
|
|
|
error = NULL;
|
2015-12-17 20:07:52 +00:00
|
|
|
remote_ref = xdg_app_installation_fetch_remote_ref_sync (installation, xdg_app_remote_get_name (remote),
|
2016-04-14 17:29:40 +00:00
|
|
|
XDG_APP_REF_KIND_RUNTIME,
|
|
|
|
"org.gnome.Platform", NULL, "3.20",
|
2015-12-17 19:51:59 +00:00
|
|
|
NULL, &error);
|
2015-12-07 15:17:06 +00:00
|
|
|
if (remote_ref)
|
|
|
|
{
|
2015-12-08 10:01:13 +00:00
|
|
|
GBytes *metadata;
|
2016-04-14 17:29:40 +00:00
|
|
|
GBytes *metadata2;
|
2015-12-08 10:01:13 +00:00
|
|
|
|
2015-12-07 15:17:06 +00:00
|
|
|
g_print ("%d %s %s %s %s %s\n",
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_kind (XDG_APP_REF (remote_ref)),
|
|
|
|
xdg_app_ref_get_name (XDG_APP_REF (remote_ref)),
|
|
|
|
xdg_app_ref_get_arch (XDG_APP_REF (remote_ref)),
|
|
|
|
xdg_app_ref_get_branch (XDG_APP_REF (remote_ref)),
|
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (remote_ref)),
|
2015-12-07 15:17:06 +00:00
|
|
|
xdg_app_remote_ref_get_remote_name (remote_ref));
|
2015-12-08 10:01:13 +00:00
|
|
|
|
2015-12-17 20:07:52 +00:00
|
|
|
metadata = xdg_app_installation_fetch_remote_metadata_sync (installation, xdg_app_remote_get_name (remote),
|
2016-05-06 14:03:27 +00:00
|
|
|
xdg_app_ref_get_commit (XDG_APP_REF (remote_ref)), NULL, &error);
|
2015-12-08 10:01:13 +00:00
|
|
|
if (metadata)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
g_print ("metadata: %s\n", (char *) g_bytes_get_data (metadata, NULL));
|
2015-12-08 10:01:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("fetch error\n");
|
|
|
|
g_print ("error: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2016-04-14 17:29:40 +00:00
|
|
|
|
|
|
|
metadata2 = xdg_app_installation_fetch_remote_metadata_sync2 (installation, xdg_app_remote_get_name (remote),
|
2016-05-06 14:03:27 +00:00
|
|
|
XDG_APP_REF (remote_ref), NULL, &error);
|
2016-04-14 17:29:40 +00:00
|
|
|
if (metadata2)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
g_print ("metadata2: %s\n", (char *) g_bytes_get_data (metadata2, NULL));
|
2016-04-14 17:29:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("fetch error\n");
|
|
|
|
g_print ("error: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2015-12-07 15:17:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_print ("error: %s\n", error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
}
|
2015-11-26 22:07:05 +00:00
|
|
|
}
|
2015-12-15 07:44:50 +00:00
|
|
|
return 0;
|
2015-11-26 22:07:05 +00:00
|
|
|
}
|