summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Makefile.am.inc5
-rw-r--r--app/flatpak-builtins-build-bundle.c2
-rw-r--r--app/flatpak-builtins-build-commit-from.c8
-rw-r--r--app/flatpak-builtins-build-export.c46
-rw-r--r--app/flatpak-builtins-build-finish.c20
-rw-r--r--app/flatpak-builtins-build-import-bundle.c4
-rw-r--r--app/flatpak-builtins-build-init.c6
-rw-r--r--app/flatpak-builtins-build-sign.c2
-rw-r--r--app/flatpak-builtins-build-update-repo.c4
-rw-r--r--app/flatpak-builtins-build.c6
-rw-r--r--app/flatpak-builtins-config.c2
-rw-r--r--app/flatpak-builtins-create-usb.c12
-rw-r--r--app/flatpak-builtins-document-export.c2
-rw-r--r--app/flatpak-builtins-document-info.c2
-rw-r--r--app/flatpak-builtins-document-list.c9
-rw-r--r--app/flatpak-builtins-document-unexport.c2
-rw-r--r--app/flatpak-builtins-enter.c6
-rw-r--r--app/flatpak-builtins-history.c2
-rw-r--r--app/flatpak-builtins-info.c2
-rw-r--r--app/flatpak-builtins-install.c8
-rw-r--r--app/flatpak-builtins-kill.c4
-rw-r--r--app/flatpak-builtins-list.c2
-rw-r--r--app/flatpak-builtins-make-current.c2
-rw-r--r--app/flatpak-builtins-mask.c9
-rw-r--r--app/flatpak-builtins-override.c2
-rw-r--r--app/flatpak-builtins-permission-list.c2
-rw-r--r--app/flatpak-builtins-permission-remove.c2
-rw-r--r--app/flatpak-builtins-permission-reset.c2
-rw-r--r--app/flatpak-builtins-permission-set.c2
-rw-r--r--app/flatpak-builtins-permission-show.c2
-rw-r--r--app/flatpak-builtins-pin.c9
-rw-r--r--app/flatpak-builtins-ps.c4
-rw-r--r--app/flatpak-builtins-remote-add.c8
-rw-r--r--app/flatpak-builtins-remote-delete.c2
-rw-r--r--app/flatpak-builtins-remote-info.c2
-rw-r--r--app/flatpak-builtins-remote-list.c2
-rw-r--r--app/flatpak-builtins-remote-ls.c2
-rw-r--r--app/flatpak-builtins-remote-modify.c2
-rw-r--r--app/flatpak-builtins-repair.c40
-rw-r--r--app/flatpak-builtins-repo.c2
-rw-r--r--app/flatpak-builtins-run.c2
-rw-r--r--app/flatpak-builtins-search.c6
-rw-r--r--app/flatpak-builtins-uninstall.c129
-rw-r--r--app/flatpak-builtins-update.c7
-rw-r--r--app/flatpak-builtins-utils.c16
-rw-r--r--app/flatpak-cli-transaction.c359
-rw-r--r--app/flatpak-complete.c8
-rw-r--r--app/flatpak-main.c21
-rw-r--r--app/flatpak-polkit-agent-text-listener.c2
-rw-r--r--app/flatpak-quiet-transaction.c54
-rw-r--r--app/flatpak-table-printer.c2
-rw-r--r--app/meson.build143
52 files changed, 772 insertions, 229 deletions
diff --git a/app/Makefile.am.inc b/app/Makefile.am.inc
index 0c375eb1..8af1840a 100644
--- a/app/Makefile.am.inc
+++ b/app/Makefile.am.inc
@@ -2,6 +2,7 @@ bin_PROGRAMS += \
flatpak \
$(NULL)
+EXTRA_DIST += app/meson.build
EXTRA_DIST += app/parse-datetime.y
flatpak_dbus_built_sources = app/flatpak-permission-dbus-generated.c app/flatpak-permission-dbus-generated.h
@@ -44,7 +45,6 @@ libflatpak_app_la_LIBADD = \
$(AM_LDADD) \
$(BASE_LIBS) \
$(OSTREE_LIBS) \
- $(SOUP_LIBS) \
$(JSON_LIBS) \
$(APPSTREAM_LIBS) \
$(SYSTEMD_LIBS) \
@@ -55,7 +55,6 @@ libflatpak_app_la_CFLAGS = \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(OSTREE_CFLAGS) \
- $(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(APPSTREAM_CFLAGS) \
$(SYSTEMD_CFLAGS) \
@@ -136,7 +135,6 @@ flatpak_LDADD = \
$(AM_LDADD) \
$(BASE_LIBS) \
$(OSTREE_LIBS) \
- $(SOUP_LIBS) \
$(JSON_LIBS) \
$(APPSTREAM_LIBS) \
$(SYSTEMD_LIBS) \
@@ -151,7 +149,6 @@ flatpak_CFLAGS = \
$(AM_CFLAGS) \
$(BASE_CFLAGS) \
$(OSTREE_CFLAGS) \
- $(SOUP_CFLAGS) \
$(JSON_CFLAGS) \
$(APPSTREAM_CFLAGS) \
$(SYSTEMD_CFLAGS) \
diff --git a/app/flatpak-builtins-build-bundle.c b/app/flatpak-builtins-build-bundle.c
index cfd18001..49a1b968 100644
--- a/app/flatpak-builtins-build-bundle.c
+++ b/app/flatpak-builtins-build-bundle.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2015 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-build-commit-from.c b/app/flatpak-builtins-build-commit-from.c
index e2e53291..7b03aa6a 100644
--- a/app/flatpak-builtins-build-commit-from.c
+++ b/app/flatpak-builtins-build-commit-from.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2015 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -129,7 +129,7 @@ static GVariant *
new_bytearray (const guchar *data,
gsize len)
{
- gpointer data_copy = g_memdup (data, len);
+ gpointer data_copy = g_memdup2 (data, len);
GVariant *ret = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data_copy,
len, FALSE, g_free, data_copy);
@@ -719,7 +719,7 @@ flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancella
{
g_autoptr(GError) local_error = NULL;
if (!rewrite_delta (src_repo, resolved_ref, dst_repo, commit_checksum, dst_commitv, from[j], &local_error))
- g_debug ("Failed to copy delta: %s", local_error->message);
+ g_info ("Failed to copy delta: %s", local_error->message);
}
}
}
@@ -738,7 +738,7 @@ flatpak_builtin_build_commit_from (int argc, char **argv, GCancellable *cancella
if (opt_no_summary_index)
flags |= FLATPAK_REPO_UPDATE_FLAG_DISABLE_INDEX;
- g_debug ("Updating summary");
+ g_info ("Updating summary");
if (!flatpak_repo_update (dst_repo, flags,
(const char **) opt_gpg_key_ids,
opt_gpg_homedir,
diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c
index 936f6ad5..e2d85dd8 100644
--- a/app/flatpak-builtins-build-export.c
+++ b/app/flatpak-builtins-build-export.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -208,7 +208,7 @@ commit_filter (OstreeRepo *repo,
if (matches_patterns (commit_data->exclude, path) &&
!matches_patterns (commit_data->include, path))
{
- g_debug ("Excluding %s", path);
+ g_info ("Excluding %s", path);
return OSTREE_REPO_COMMIT_FILTER_SKIP;
}
@@ -391,15 +391,17 @@ validate_icon_file (GFile *file, GError **error)
g_ptr_array_add (args, NULL);
- if (!g_spawn_sync (NULL, (char **) args->pdata, NULL, 0, NULL, NULL, NULL, &err, &status, error))
+ if (!g_spawn_sync (NULL, (char **) args->pdata, NULL,
+ G_SPAWN_STDOUT_TO_DEV_NULL,
+ NULL, NULL, NULL, &err, &status, error))
{
- g_debug ("Icon validation: %s", (*error)->message);
+ g_info ("Icon validation: %s", (*error)->message);
return FALSE;
}
if (!g_spawn_check_exit_status (status, NULL))
{
- g_debug ("Icon validation: %s", err);
+ g_info ("Icon validation: %s", err);
return flatpak_fail (error, "%s is not a valid icon: %s", name, err);
}
@@ -489,21 +491,34 @@ check_refs:
if (!g_key_file_load_from_file (key_file, path, G_KEY_FILE_NONE, error))
return FALSE;
+ *activatable = g_key_file_get_boolean (key_file,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE,
+ NULL);
+
+ /* Validate Exec command: Unless we have DBusActivatable=true the key should
+ * be present and – if set to a non-empty value – should point to an existing
+ * binary.
+ *
+ * Empty values are allowed, they will result in the default command being
+ * run by Flatpak when starting the application.
+ */
command = g_key_file_get_string (key_file,
G_KEY_FILE_DESKTOP_GROUP,
G_KEY_FILE_DESKTOP_KEY_EXEC,
&local_error);
- if (!command)
+ if (!command && *activatable == FALSE)
{
g_print (_("WARNING: Can't find Exec key in %s: %s\n"), path, local_error->message);
g_clear_error (&local_error);
}
-
- argv = g_strsplit (command, " ", 0);
-
- bin_file = convert_app_absolute_path (argv[0], files);
- if (!g_file_query_exists (bin_file, NULL))
- g_print (_("WARNING: Binary not found for Exec line in %s: %s\n"), path, command);
+ else if (command && strlen(command) > 0)
+ {
+ argv = g_strsplit (command, " ", 0);
+ bin_file = convert_app_absolute_path (argv[0], files);
+ if (!g_file_query_exists (bin_file, NULL))
+ g_print (_("WARNING: Binary not found for Exec line in %s: %s\n"), path, command);
+ }
*icon = g_key_file_get_string (key_file,
G_KEY_FILE_DESKTOP_GROUP,
@@ -512,11 +527,6 @@ check_refs:
if (*icon && !g_str_has_prefix (*icon, app_id))
g_print (_("WARNING: Icon not matching app id in %s: %s\n"), path, *icon);
- *activatable = g_key_file_get_boolean (key_file,
- G_KEY_FILE_DESKTOP_GROUP,
- G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE,
- NULL);
-
return TRUE;
}
@@ -1141,7 +1151,7 @@ flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
if (opt_no_summary_index)
flags |= FLATPAK_REPO_UPDATE_FLAG_DISABLE_INDEX;
- g_debug ("Updating summary");
+ g_info ("Updating summary");
if (!flatpak_repo_update (repo, flags,
(const char **) opt_gpg_key_ids,
opt_gpg_homedir,
diff --git a/app/flatpak-builtins-build-finish.c b/app/flatpak-builtins-build-finish.c
index 9407a959..4d25dd58 100644
--- a/app/flatpak-builtins-build-finish.c
+++ b/app/flatpak-builtins-build-finish.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -175,7 +175,7 @@ export_dir (int source_parent_fd,
else
{
source_printable = g_build_filename (source_relpath, dent->d_name, NULL);
- g_debug ("Not exporting non-regular file %s", source_printable);
+ g_info ("Not exporting non-regular file %s", source_printable);
}
}
@@ -265,7 +265,7 @@ collect_exports (GFile *base,
if (g_file_query_exists (src, cancellable))
{
- g_debug ("Exporting from %s", path);
+ g_info ("Exporting from %s", path);
g_autoptr(GFile) dest = NULL;
g_autoptr(GFile) dest_parent = NULL;
@@ -275,10 +275,10 @@ collect_exports (GFile *base,
dest = g_file_resolve_relative_path (export, path);
dest_parent = g_file_get_parent (dest);
- g_debug ("Ensuring export/%s parent exists", path);
+ g_info ("Ensuring export/%s parent exists", path);
if (!flatpak_mkdir_p (dest_parent, cancellable, error))
return FALSE;
- g_debug ("Copying from files/%s", path);
+ g_info ("Copying from files/%s", path);
if (!copy_exports (src,
dest,
path,
@@ -401,14 +401,14 @@ update_metadata (GFile *base, FlatpakContext *arg_context, gboolean is_runtime,
{
if (g_key_file_has_key (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, NULL))
{
- g_debug ("Command key is present");
+ g_info ("Command key is present");
if (opt_command)
g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, opt_command);
}
else if (opt_command)
{
- g_debug ("Using explicitly provided command %s", opt_command);
+ g_info ("Using explicitly provided command %s", opt_command);
g_key_file_set_string (keyfile, group, FLATPAK_METADATA_KEY_COMMAND, opt_command);
}
@@ -419,7 +419,7 @@ update_metadata (GFile *base, FlatpakContext *arg_context, gboolean is_runtime,
g_autoptr(GFileEnumerator) bin_enum = NULL;
g_autoptr(GFileInfo) child_info = NULL;
- g_debug ("Looking for executables");
+ g_info ("Looking for executables");
bin_dir = g_file_resolve_relative_path (base, "files/bin");
if (g_file_query_exists (bin_dir, cancellable))
@@ -687,12 +687,12 @@ flatpak_builtin_build_finish (int argc, char **argv, GCancellable *cancellable,
if (!is_runtime)
{
- g_debug ("Collecting exports");
+ g_info ("Collecting exports");
if (!collect_exports (base, id, arg_context, cancellable, error))
return FALSE;
}
- g_debug ("Updating metadata");
+ g_info ("Updating metadata");
if (!update_metadata (base, arg_context, is_runtime, cancellable, error))
return FALSE;
diff --git a/app/flatpak-builtins-build-import-bundle.c b/app/flatpak-builtins-build-import-bundle.c
index 98e03cd2..79ed93b8 100644
--- a/app/flatpak-builtins-build-import-bundle.c
+++ b/app/flatpak-builtins-build-import-bundle.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2015 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -248,7 +248,7 @@ flatpak_builtin_build_import (int argc, char **argv, GCancellable *cancellable,
if (opt_no_summary_index)
flags |= FLATPAK_REPO_UPDATE_FLAG_DISABLE_INDEX;
- g_debug ("Updating summary");
+ g_info ("Updating summary");
if (!flatpak_repo_update (repo, flags,
(const char **) opt_gpg_key_ids,
opt_gpg_homedir,
diff --git a/app/flatpak-builtins-build-init.c b/app/flatpak-builtins-build-init.c
index d84cad0a..bcfa3be9 100644
--- a/app/flatpak-builtins-build-init.c
+++ b/app/flatpak-builtins-build-init.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -115,7 +115,7 @@ ensure_extensions (FlatpakDeploy *src_deploy, const char *default_arch, const ch
subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
if (subpaths[0] != NULL)
- return flatpak_fail (error, _("Requested extension %s is only partially installed"), ext->installed_id);
+ return flatpak_fail (error, _("Requested extension %s/%s/%s is only partially installed"), ext->installed_id, default_arch, default_branch);
}
if (top_dir)
@@ -144,7 +144,7 @@ ensure_extensions (FlatpakDeploy *src_deploy, const char *default_arch, const ch
if (!found)
{
g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
- return flatpak_fail (error, _("Requested extension %s not installed"), requested_extension_name);
+ return flatpak_fail (error, _("Requested extension %s/%s/%s not installed"), requested_extension_name, default_arch, default_branch);
}
}
diff --git a/app/flatpak-builtins-build-sign.c b/app/flatpak-builtins-build-sign.c
index bff76cd6..e959002c 100644
--- a/app/flatpak-builtins-build-sign.c
+++ b/app/flatpak-builtins-build-sign.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-build-update-repo.c b/app/flatpak-builtins-build-update-repo.c
index aa17b4ad..7a3fa8f9 100644
--- a/app/flatpak-builtins-build-update-repo.c
+++ b/app/flatpak-builtins-build-update-repo.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014-2019 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -400,7 +400,7 @@ generate_all_deltas (OstreeRepo *repo,
if (ignore_ref)
{
- g_debug ("Ignoring deltas for ref %s", ref);
+ g_info ("Ignoring deltas for ref %s", ref);
continue;
}
diff --git a/app/flatpak-builtins-build.c b/app/flatpak-builtins-build.c
index b18d6e65..f9f1a404 100644
--- a/app/flatpak-builtins-build.c
+++ b/app/flatpak-builtins-build.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -189,7 +189,7 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
FlatpakRunFlags run_flags;
const char *group = NULL;
const char *runtime_key = NULL;
- const char *dest = NULL;
+ g_autofree char *dest = NULL;
gboolean is_app = FALSE;
gboolean is_extension = FALSE;
gboolean is_app_extension = FALSE;
@@ -487,7 +487,7 @@ flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
/* We add the actual bind below so that we're not shadowed by other extensions or their tmpfs */
if (extension_point)
- dest = extension_point;
+ dest = g_strdup (extension_point);
else if (is_app)
dest = g_strdup ("/app");
else
diff --git a/app/flatpak-builtins-config.c b/app/flatpak-builtins-config.c
index fb956c0f..0d01e2e2 100644
--- a/app/flatpak-builtins-config.c
+++ b/app/flatpak-builtins-config.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2017 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-create-usb.c b/app/flatpak-builtins-create-usb.c
index 652b9429..8250029f 100644
--- a/app/flatpak-builtins-create-usb.c
+++ b/app/flatpak-builtins-create-usb.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Matthew Leeds
*
* This program is free software; you can redistribute it and/or
@@ -111,7 +111,7 @@ add_related (GHashTable *all_refs,
g_autofree char *branch = NULL;
GList *extensions, *l;
- g_debug ("Finding related refs for ‘%s’", flatpak_decomposed_get_ref (ref));
+ g_info ("Finding related refs for ‘%s’", flatpak_decomposed_get_ref (ref));
arch = flatpak_decomposed_dup_arch (ref);
branch = flatpak_decomposed_dup_branch (ref);
@@ -228,7 +228,7 @@ add_runtime (GHashTable *all_refs,
CommitAndSubpaths *c_s;
g_autoptr(GVariant) extra_data_sources = NULL;
- g_debug ("Finding the runtime for ‘%s’", flatpak_decomposed_get_ref (ref));
+ g_info ("Finding the runtime for ‘%s’", flatpak_decomposed_get_ref (ref));
deploy_data = flatpak_dir_get_deploy_data (dir, ref, FLATPAK_DEPLOY_VERSION_ANY, cancellable, error);
if (deploy_data == NULL)
@@ -316,7 +316,7 @@ ostree_create_usb (GOptionContext *context,
* more performant than bare-user */
OstreeRepoMode mode = OSTREE_REPO_MODE_ARCHIVE;
- g_debug ("%s: Creating repository in mode %u", G_STRFUNC, mode);
+ g_info ("%s: Creating repository in mode %u", G_STRFUNC, mode);
g_autoptr(OstreeRepo) dest_repo = ostree_repo_create_at (mount_root_dfd, dest_repo_path,
mode, NULL, cancellable, error);
@@ -785,7 +785,7 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE
else
{
/* Appstream2 is only for efficiency, so just print a debug message */
- g_debug (_("Couldn't find appstream2 data for remote ‘%s’ arch ‘%s’: %s\n"),
+ g_info (_("Couldn't find appstream2 data for remote ‘%s’ arch ‘%s’: %s\n"),
remote_name, current_arch, appstream2_error->message);
}
}
@@ -814,7 +814,7 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE
g_string_append_printf (all_refs_str, "(%s, %s) ", collection_ref->collection_id, collection_ref->ref_name);
}
- g_debug ("Copying the following refs: %s", all_refs_str->str);
+ g_info ("Copying the following refs: %s", all_refs_str->str);
if (!ostree_create_usb (context, src_repo, mount_root_path, mount_root_stbuf,
mount_root_dfd, all_refs, cancellable, error))
diff --git a/app/flatpak-builtins-document-export.c b/app/flatpak-builtins-document-export.c
index 3fd92523..65c35848 100644
--- a/app/flatpak-builtins-document-export.c
+++ b/app/flatpak-builtins-document-export.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-document-info.c b/app/flatpak-builtins-document-info.c
index 3e3eab61..6ac19661 100644
--- a/app/flatpak-builtins-document-info.c
+++ b/app/flatpak-builtins-document-info.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2016 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-document-list.c b/app/flatpak-builtins-document-list.c
index 56387a72..c8c29ec5 100644
--- a/app/flatpak-builtins-document-list.c
+++ b/app/flatpak-builtins-document-list.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2016 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -109,7 +109,7 @@ print_documents (const char *app_id,
g_autoptr(GVariantIter) iter2 = NULL;
const char *app_id2 = NULL;
const char **perms = NULL;
- gboolean just_perms = FALSE;
+ gboolean have_perms = FALSE, just_perms = FALSE;
if (need_perms)
{
@@ -117,9 +117,10 @@ print_documents (const char *app_id,
if (!xdp_dbus_documents_call_info_sync (documents, id, &origin2, &apps2, NULL, error))
return FALSE;
iter2 = g_variant_iter_new (apps2);
+ have_perms = g_variant_iter_next (iter2, "{&s^a&s}", &app_id2, &perms);
}
- while ((iter2 && g_variant_iter_next (iter2, "{&s^a&s}", &app_id2, &perms)) || !just_perms)
+ do
{
for (i = 0; columns[i].name; i++)
{
@@ -149,7 +150,7 @@ print_documents (const char *app_id,
flatpak_table_printer_finish_row (printer);
just_perms = TRUE;
- }
+ } while (have_perms && g_variant_iter_next (iter2, "{&s^a&s}", &app_id2, &perms));
}
flatpak_table_printer_print (printer);
diff --git a/app/flatpak-builtins-document-unexport.c b/app/flatpak-builtins-document-unexport.c
index 8aa6f437..8bac8e01 100644
--- a/app/flatpak-builtins-document-unexport.c
+++ b/app/flatpak-builtins-document-unexport.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2016 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-enter.c b/app/flatpak-builtins-enter.c
index 6c0d9dee..5d96f9a2 100644
--- a/app/flatpak-builtins-enter.c
+++ b/app/flatpak-builtins-enter.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -248,7 +248,6 @@ flatpak_builtin_enter (int argc,
for (e = environment; e < environment + environment_len; e = e + strlen (e) + 1)
{
if (*e != 0 &&
- !g_str_has_prefix (e, "DISPLAY=") &&
!g_str_has_prefix (e, "PULSE_SERVER=") &&
!g_str_has_prefix (e, "PULSE_CLIENTCONFIG=") &&
!g_str_has_prefix (e, "XDG_RUNTIME_DIR=") &&
@@ -264,9 +263,6 @@ flatpak_builtin_enter (int argc,
xdg_runtime_dir = g_strdup_printf ("/run/user/%d", uid);
g_ptr_array_add (envp_array, g_strdup_printf ("XDG_RUNTIME_DIR=%s", xdg_runtime_dir));
- if (g_file_test ("/tmp/.X11-unix/X99", G_FILE_TEST_EXISTS))
- g_ptr_array_add (envp_array, g_strdup ("DISPLAY=:99.0"));
-
pulse_path = g_strdup_printf ("/run/user/%d/pulse/native", uid);
if (g_file_test (pulse_path, G_FILE_TEST_EXISTS))
{
diff --git a/app/flatpak-builtins-history.c b/app/flatpak-builtins-history.c
index 4ac6e291..1d45063e 100644
--- a/app/flatpak-builtins-history.c
+++ b/app/flatpak-builtins-history.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-info.c b/app/flatpak-builtins-info.c
index 58caa2e2..5f544579 100644
--- a/app/flatpak-builtins-info.c
+++ b/app/flatpak-builtins-info.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2016 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-install.c b/app/flatpak-builtins-install.c
index 970bf3ea..0666ea21 100644
--- a/app/flatpak-builtins-install.c
+++ b/app/flatpak-builtins-install.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -221,9 +221,9 @@ install_from (FlatpakDir *dir,
if (g_str_has_prefix (filename, "http:") ||
g_str_has_prefix (filename, "https:"))
{
- g_autoptr(SoupSession) soup_session = NULL;
- soup_session = flatpak_create_soup_session (PACKAGE_STRING);
- file_data = flatpak_load_uri (soup_session, filename, 0, NULL, NULL, NULL, NULL, cancellable, error);
+ g_autoptr(FlatpakHttpSession) http_session = NULL;
+ http_session = flatpak_create_http_session (PACKAGE_STRING);
+ file_data = flatpak_load_uri (http_session, filename, 0, NULL, NULL, NULL, NULL, cancellable, error);
if (file_data == NULL)
{
g_prefix_error (error, "Can't load uri %s: ", filename);
diff --git a/app/flatpak-builtins-kill.c b/app/flatpak-builtins-kill.c
index 10979d4a..c1a1ee11 100644
--- a/app/flatpak-builtins-kill.c
+++ b/app/flatpak-builtins-kill.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -62,7 +62,7 @@ kill_instance (const char *id,
}
}
- g_debug ("Killed %d instances", killed);
+ g_info ("Killed %d instances", killed);
if (killed == 0)
return flatpak_fail (error, _("%s is not running"), id);
diff --git a/app/flatpak-builtins-list.c b/app/flatpak-builtins-list.c
index fe5c3213..50b93e42 100644
--- a/app/flatpak-builtins-list.c
+++ b/app/flatpak-builtins-list.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-make-current.c b/app/flatpak-builtins-make-current.c
index 98e99e0b..9973491c 100644
--- a/app/flatpak-builtins-make-current.c
+++ b/app/flatpak-builtins-make-current.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-mask.c b/app/flatpak-builtins-mask.c
index 9f3f56bf..52b8830a 100644
--- a/app/flatpak-builtins-mask.c
+++ b/app/flatpak-builtins-mask.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2019 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -49,7 +49,6 @@ flatpak_builtin_mask (int argc, char **argv, GCancellable *cancellable, GError *
g_autoptr(GOptionContext) context = NULL;
g_autoptr(GPtrArray) dirs = NULL;
FlatpakDir *dir;
- g_autoptr(GPtrArray) patterns = NULL;
int i;
context = g_option_context_new (_("[PATTERN…] - disable updates and automatic installation matching patterns"));
@@ -62,10 +61,12 @@ flatpak_builtin_mask (int argc, char **argv, GCancellable *cancellable, GError *
dir = g_ptr_array_index (dirs, 0);
- patterns = flatpak_dir_get_config_patterns (dir, "masked");
-
if (argc == 1)
{
+ g_autoptr(GPtrArray) patterns = NULL;
+
+ patterns = flatpak_dir_get_config_patterns (dir, "masked");
+
if (patterns->len == 0)
{
if (flatpak_fancy_output ())
diff --git a/app/flatpak-builtins-override.c b/app/flatpak-builtins-override.c
index 7b743ca2..cbd7aa82 100644
--- a/app/flatpak-builtins-override.c
+++ b/app/flatpak-builtins-override.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-permission-list.c b/app/flatpak-builtins-permission-list.c
index 6835e0cd..3f6465e2 100644
--- a/app/flatpak-builtins-permission-list.c
+++ b/app/flatpak-builtins-permission-list.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-permission-remove.c b/app/flatpak-builtins-permission-remove.c
index cec8164b..e9fff1e5 100644
--- a/app/flatpak-builtins-permission-remove.c
+++ b/app/flatpak-builtins-permission-remove.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-permission-reset.c b/app/flatpak-builtins-permission-reset.c
index 943786fa..c89f1e91 100644
--- a/app/flatpak-builtins-permission-reset.c
+++ b/app/flatpak-builtins-permission-reset.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-permission-set.c b/app/flatpak-builtins-permission-set.c
index 5a8554b0..46edf83e 100644
--- a/app/flatpak-builtins-permission-set.c
+++ b/app/flatpak-builtins-permission-set.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-permission-show.c b/app/flatpak-builtins-permission-show.c
index 29db2d7a..33395f41 100644
--- a/app/flatpak-builtins-permission-show.c
+++ b/app/flatpak-builtins-permission-show.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-pin.c b/app/flatpak-builtins-pin.c
index 4a84da38..52e4da52 100644
--- a/app/flatpak-builtins-pin.c
+++ b/app/flatpak-builtins-pin.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2020 Endless OS Foundation LLC
*
* This program is free software; you can redistribute it and/or
@@ -51,7 +51,6 @@ flatpak_builtin_pin (int argc, char **argv, GCancellable *cancellable, GError **
g_autoptr(GOptionContext) context = NULL;
g_autoptr(GPtrArray) dirs = NULL;
FlatpakDir *dir;
- g_autoptr(GPtrArray) patterns = NULL;
int i;
context = g_option_context_new (_("[PATTERN…] - disable automatic removal of runtimes matching patterns"));
@@ -64,10 +63,12 @@ flatpak_builtin_pin (int argc, char **argv, GCancellable *cancellable, GError **
dir = g_ptr_array_index (dirs, 0);
- patterns = flatpak_dir_get_config_patterns (dir, "pinned");
-
if (argc == 1)
{
+ g_autoptr(GPtrArray) patterns = NULL;
+
+ patterns = flatpak_dir_get_config_patterns (dir, "pinned");
+
if (patterns->len == 0)
{
if (flatpak_fancy_output ())
diff --git a/app/flatpak-builtins-ps.c b/app/flatpak-builtins-ps.c
index 6259bc32..6df51e0b 100644
--- a/app/flatpak-builtins-ps.c
+++ b/app/flatpak-builtins-ps.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -108,7 +108,7 @@ get_compositor_apps (void)
if (ret)
g_variant_get (ret, "(@a{sv})", &list);
else
- g_debug ("Failed to get information about running apps from background portal backends");
+ g_info ("Failed to get information about running apps from background portal backends");
return list;
}
diff --git a/app/flatpak-builtins-remote-add.c b/app/flatpak-builtins-remote-add.c
index e273ca9d..0c390ff2 100644
--- a/app/flatpak-builtins-remote-add.c
+++ b/app/flatpak-builtins-remote-add.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -244,10 +244,10 @@ load_options (const char *remote_name,
{
const char *options_data;
gsize options_size;
- g_autoptr(SoupSession) soup_session = NULL;
+ g_autoptr(FlatpakHttpSession) http_session = NULL;
- soup_session = flatpak_create_soup_session (PACKAGE_STRING);
- bytes = flatpak_load_uri (soup_session, filename, 0, NULL, NULL, NULL, NULL, NULL, &local_error);
+ http_session = flatpak_create_http_session (PACKAGE_STRING);
+ bytes = flatpak_load_uri (http_session, filename, 0, NULL, NULL, NULL, NULL, NULL, &local_error);
if (bytes == NULL)
{
diff --git a/app/flatpak-builtins-remote-delete.c b/app/flatpak-builtins-remote-delete.c
index f0bbd766..6d18982e 100644
--- a/app/flatpak-builtins-remote-delete.c
+++ b/app/flatpak-builtins-remote-delete.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-remote-info.c b/app/flatpak-builtins-remote-info.c
index 7e079643..c15eb8a2 100644
--- a/app/flatpak-builtins-remote-info.c
+++ b/app/flatpak-builtins-remote-info.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2017 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-remote-list.c b/app/flatpak-builtins-remote-list.c
index f9742a48..2b8da762 100644
--- a/app/flatpak-builtins-remote-list.c
+++ b/app/flatpak-builtins-remote-list.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-remote-ls.c b/app/flatpak-builtins-remote-ls.c
index 3f7cdfb3..1da12439 100644
--- a/app/flatpak-builtins-remote-ls.c
+++ b/app/flatpak-builtins-remote-ls.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-remote-modify.c b/app/flatpak-builtins-remote-modify.c
index 904a94a5..88d735bc 100644
--- a/app/flatpak-builtins-remote-modify.c
+++ b/app/flatpak-builtins-remote-modify.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-repair.c b/app/flatpak-builtins-repair.c
index 821580f2..eeb7f633 100644
--- a/app/flatpak-builtins-repair.c
+++ b/app/flatpak-builtins-repair.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -357,11 +357,14 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
* + Verify the commits they point to and all object they reference:
* + Remove any invalid objects
* + Note any missing objects
- * + Any refs that had invalid object, or non-partial refs that had missing objects are removed
- * + prune (depth=0) all object not references by a ref, which gets rid of any possibly invalid non-scanned objects
+ * + Any refs that had invalid object, or non-partial refs that had missing
+ * objects are removed
+ * + Prune (depth=0) all object not references by a ref, which gets rid of
+ * any possibly invalid non-scanned objects
* * Remove leftover .removed contents
* + Enumerate all deployed refs:
- * + if they are not in the repo (or is partial for a non-subdir deploy), re-install them (pull + deploy)
+ * If they are not in the repo (or is partial for a non-subdir deploy),
+ * re-install them (pull + deploy)
*/
if (!flatpak_dir_delete_mirror_refs (dir, opt_dry_run, cancellable, error))
@@ -401,7 +404,8 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
if (!opt_dry_run)
{
g_print (_("Removing non-deployed ref %s…\n"), refspec);
- (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, cancellable, NULL);
+ (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL,
+ cancellable, NULL);
}
else
g_print (_("Skipping non-deployed ref %s…\n"), refspec);
@@ -409,13 +413,17 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
continue;
}
- /* When printing progress, we have to print a newline character at the end, otherwise errors printing in
- sections of the code that we don't control won't have a leading newline. Therefore, the status line will
- always print a trailing newline, and here we just go up a line back onto the previous progress line.
-
- This does also mean that other areas of this code section that print errors will need to print a trailing
- newline as well, otherwise the output will overwrite any errors. */
- if (flatpak_fancy_output ())
+ /* When printing progress, we have to print a newline character at the end,
+ * otherwise errors printing in sections of the code that we don't control
+ * won't have a leading newline. Therefore, the status line will always
+ * print a trailing newline, and here we just go up a line back onto the
+ * previous progress line.
+
+ * This does also mean that other areas of this code section that print
+ * errors will need to print a trailing newline as well, otherwise the
+ * output will overwrite any errors.
+ */
+ if (flatpak_fancy_output () && i != 1)
g_print ("\033[A\r\033[K");
g_print (_("[%d/%d] Verifying %s…\n"), i, g_hash_table_size (all_refs), refspec);
@@ -442,10 +450,12 @@ flatpak_builtin_repair (int argc, char **argv, GCancellable *cancellable, GError
}
if (!opt_dry_run)
- (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL, cancellable, NULL);
+ (void) ostree_repo_set_ref_immediate (repo, remote, ref_name, NULL,
+ cancellable, NULL);
- /* If using fancy output, print another trailing newline, so the next progress line won't overwrite
- these errors. */
+ /* If using fancy output, print another trailing newline, so the next
+ * progress line won't overwrite these errors.
+ */
if (flatpak_fancy_output () && i < g_hash_table_size (all_refs))
g_print ("\n");
}
diff --git a/app/flatpak-builtins-repo.c b/app/flatpak-builtins-repo.c
index d9d5c4fd..2973585e 100644
--- a/app/flatpak-builtins-repo.c
+++ b/app/flatpak-builtins-repo.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2017 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-run.c b/app/flatpak-builtins-run.c
index 9f517374..69975e21 100644
--- a/app/flatpak-builtins-run.c
+++ b/app/flatpak-builtins-run.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/flatpak-builtins-search.c b/app/flatpak-builtins-search.c
index cbc9da81..6a8ff80c 100644
--- a/app/flatpak-builtins-search.c
+++ b/app/flatpak-builtins-search.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2017 Patrick Griffis
*
* This program is free software; you can redistribute it and/or
@@ -285,8 +285,8 @@ flatpak_builtin_search (int argc, char **argv, GCancellable *cancellable, GError
if (bundle == NULL || as_bundle_get_id (bundle) == NULL ||
(decomposed = flatpak_decomposed_new_from_ref (as_bundle_get_id (bundle), NULL)) == NULL)
{
- g_debug ("Ignoring app %s from remote %s as it lacks a flatpak bundle",
- as_component_get_id (app), remote_name);
+ g_info ("Ignoring app %s from remote %s as it lacks a flatpak bundle",
+ as_component_get_id (app), remote_name);
continue;
}
diff --git a/app/flatpak-builtins-uninstall.c b/app/flatpak-builtins-uninstall.c
index bbe82e04..78143908 100644
--- a/app/flatpak-builtins-uninstall.c
+++ b/app/flatpak-builtins-uninstall.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -69,6 +69,8 @@ typedef struct
{
FlatpakDir *dir;
GHashTable *refs_hash;
+ GHashTable *runtime_app_map;
+ GHashTable *extension_app_map;
GPtrArray *refs;
} UninstallDir;
@@ -89,18 +91,28 @@ uninstall_dir_free (UninstallDir *udir)
{
g_object_unref (udir->dir);
g_hash_table_unref (udir->refs_hash);
+ g_clear_pointer (&udir->runtime_app_map, g_hash_table_unref);
+ g_clear_pointer (&udir->extension_app_map, g_hash_table_unref);
g_ptr_array_unref (udir->refs);
g_free (udir);
}
static void
uninstall_dir_add_ref (UninstallDir *udir,
- FlatpakDecomposed*ref)
+ FlatpakDecomposed *ref)
{
if (g_hash_table_insert (udir->refs_hash, flatpak_decomposed_ref (ref), NULL))
g_ptr_array_add (udir->refs, flatpak_decomposed_ref (ref));
}
+static void
+uninstall_dir_remove_ref (UninstallDir *udir,
+ FlatpakDecomposed *ref)
+{
+ g_hash_table_remove (udir->refs_hash, ref);
+ g_ptr_array_remove (udir->refs, ref);
+}
+
static UninstallDir *
uninstall_dir_ensure (GHashTable *uninstall_dirs,
FlatpakDir *dir)
@@ -141,6 +153,94 @@ flatpak_delete_data (gboolean yes_opt,
return TRUE;
}
+static gboolean
+confirm_runtime_removal (gboolean yes_opt,
+ UninstallDir *udir,
+ FlatpakDecomposed *ref)
+{
+ g_autoptr(GPtrArray) apps = NULL;
+ g_autoptr(GError) local_error = NULL;
+ g_autofree char *ref_name = NULL;
+ const char *ref_branch;
+ const char *on = "";
+ const char *off = "";
+ gboolean is_extension;
+
+ if (flatpak_fancy_output ())
+ {
+ on = FLATPAK_ANSI_BOLD_ON;
+ off = FLATPAK_ANSI_BOLD_OFF;
+ }
+
+ is_extension = flatpak_dir_is_runtime_extension (udir->dir, ref);
+ if (is_extension)
+ {
+ apps = flatpak_dir_list_app_refs_with_runtime_extension (udir->dir,
+ &udir->runtime_app_map,
+ &udir->extension_app_map,
+ ref, NULL, &local_error);
+ if (apps == NULL)
+ g_info ("Unable to list apps using extension %s: %s\n",
+ flatpak_decomposed_get_ref (ref), local_error->message);
+ }
+ else
+ {
+ apps = flatpak_dir_list_app_refs_with_runtime (udir->dir,
+ &udir->runtime_app_map,
+ ref, NULL, &local_error);
+ if (apps == NULL)
+ g_info ("Unable to list apps using runtime %s: %s\n",
+ flatpak_decomposed_get_ref (ref), local_error->message);
+ }
+
+ if (apps == NULL || apps->len == 0)
+ return TRUE;
+
+ /* Exclude any apps that will be removed by the current transaction */
+ for (guint i = 0; i < udir->refs->len; i++)
+ {
+ FlatpakDecomposed *uninstall_ref = g_ptr_array_index (udir->refs, i);
+ guint j;
+
+ if (flatpak_decomposed_is_runtime (uninstall_ref))
+ continue;
+
+ if (g_ptr_array_find_with_equal_func (apps, uninstall_ref,
+ (GEqualFunc)flatpak_decomposed_equal, &j))
+ g_ptr_array_remove_index_fast (apps, j);
+ }
+
+ if (apps->len == 0)
+ return TRUE;
+
+ ref_name = flatpak_decomposed_dup_id (ref);
+ ref_branch = flatpak_decomposed_get_branch (ref);
+
+ if (is_extension)
+ g_print (_("Info: applications using the extension %s%s%s branch %s%s%s:\n"),
+ on, ref_name, off, on, ref_branch, off);
+ else
+ g_print (_("Info: applications using the runtime %s%s%s branch %s%s%s:\n"),
+ on, ref_name, off, on, ref_branch, off);
+
+ g_print (" ");
+ for (guint i = 0; i < apps->len; i++)
+ {
+ FlatpakDecomposed *app_ref = g_ptr_array_index (apps, i);
+ g_autofree char *id = flatpak_decomposed_dup_id (app_ref);
+ if (i != 0)
+ g_print (", ");
+ g_print ("%s", id);
+ }
+ g_print ("\n");
+
+ if (!yes_opt &&
+ !flatpak_yes_no_prompt (FALSE, _("Really remove?")))
+ return FALSE;
+
+ return TRUE;
+}
+
gboolean
flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GError **error)
{
@@ -169,6 +269,9 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
if (argc >= 2 && opt_unused)
return usage_error (context, _("Must not specify REFs when using --unused"), error);
+ if (opt_noninteractive)
+ opt_yes = TRUE; /* Implied */
+
prefs = &argv[1];
n_prefs = argc - 1;
@@ -406,14 +509,32 @@ flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
/* This disables the remote metadata update, since uninstall is a local-only op */
flatpak_transaction_set_no_pull (transaction, TRUE);
- for (i = 0; i < udir->refs->len; i++)
+ /* Walk through the array backwards so we can safely remove */
+ for (i = udir->refs->len; i > 0; i--)
{
- FlatpakDecomposed *ref = g_ptr_array_index (udir->refs, i);
+ FlatpakDecomposed *ref = g_ptr_array_index (udir->refs, i - 1);
+
+ /* In case it's a runtime for an installed app or an optional runtime
+ * extension of an installed app, prompt the user for confirmation (in
+ * the former case the transaction will error out if executed). This
+ * is limited to checking within the same installation; it won't
+ * prompt for a user app depending on a system runtime.
+ */
+ if (!opt_force_remove &&
+ !confirm_runtime_removal (opt_yes, udir, ref))
+ {
+ uninstall_dir_remove_ref (udir, ref);
+ continue;
+ }
if (!flatpak_transaction_add_uninstall (transaction, flatpak_decomposed_get_ref (ref), error))
return FALSE;
}
+ /* These caches may no longer be valid once the transaction runs */
+ g_clear_pointer (&udir->runtime_app_map, g_hash_table_unref);
+ g_clear_pointer (&udir->extension_app_map, g_hash_table_unref);
+
if (!flatpak_transaction_run (transaction, cancellable, error))
{
if (g_error_matches (*error, FLATPAK_ERROR, FLATPAK_ERROR_ABORTED))
diff --git a/app/flatpak-builtins-update.c b/app/flatpak-builtins-update.c
index b1975796..b5184a33 100644
--- a/app/flatpak-builtins-update.c
+++ b/app/flatpak-builtins-update.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -269,7 +269,10 @@ flatpak_builtin_update (int argc,
}
if (!has_updates)
- g_print (_("Nothing to do.\n"));
+ {
+ g_print ("\n");
+ g_print (_("Nothing to do.\n"));
+ }
if (n_prefs == 0)
{
diff --git a/app/flatpak-builtins-utils.c b/app/flatpak-builtins-utils.c
index a2402ad4..83d46551 100644
--- a/app/flatpak-builtins-utils.c
+++ b/app/flatpak-builtins-utils.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -677,11 +677,11 @@ update_appstream (GPtrArray *dirs,
ts_file_age = get_appstream_timestamp (dir, remotes[i], arch);
if (ts_file_age < ttl)
{
- g_debug ("%s:%s appstream age %" G_GUINT64_FORMAT " is less than ttl %" G_GUINT64_FORMAT, remotes[i], arch, ts_file_age, ttl);
+ g_info ("%s:%s appstream age %" G_GUINT64_FORMAT " is less than ttl %" G_GUINT64_FORMAT, remotes[i], arch, ts_file_age, ttl);
continue;
}
else
- g_debug ("%s:%s appstream age %" G_GUINT64_FORMAT " is greater than ttl %" G_GUINT64_FORMAT, remotes[i], arch, ts_file_age, ttl);
+ g_info ("%s:%s appstream age %" G_GUINT64_FORMAT " is greater than ttl %" G_GUINT64_FORMAT, remotes[i], arch, ts_file_age, ttl);
if (flatpak_dir_get_remote_disabled (dir, remotes[i]) ||
flatpak_dir_get_remote_noenumerate (dir, remotes[i]))
@@ -690,7 +690,7 @@ update_appstream (GPtrArray *dirs,
if (flatpak_dir_is_user (dir))
{
if (quiet)
- g_debug (_("Updating appstream data for user remote %s"), remotes[i]);
+ g_info (_("Updating appstream data for user remote %s"), remotes[i]);
else
{
g_print (_("Updating appstream data for user remote %s"), remotes[i]);
@@ -700,7 +700,7 @@ update_appstream (GPtrArray *dirs,
else
{
if (quiet)
- g_debug (_("Updating appstream data for remote %s"), remotes[i]);
+ g_info (_("Updating appstream data for remote %s"), remotes[i]);
else
{
g_print (_("Updating appstream data for remote %s"), remotes[i]);
@@ -711,7 +711,7 @@ update_appstream (GPtrArray *dirs,
NULL, cancellable, &local_error))
{
if (quiet)
- g_debug ("%s: %s", _("Error updating"), local_error->message);
+ g_info ("%s: %s", _("Error updating"), local_error->message);
else
g_printerr ("%s: %s\n", _("Error updating"), local_error->message);
}
@@ -735,11 +735,11 @@ update_appstream (GPtrArray *dirs,
ts_file_age = get_appstream_timestamp (dir, remote, arch);
if (ts_file_age < ttl)
{
- g_debug ("%s:%s appstream age %" G_GUINT64_FORMAT " is less than ttl %" G_GUINT64_FORMAT, remote, arch, ts_file_age, ttl);
+ g_info ("%s:%s appstream age %" G_GUINT64_FORMAT " is less than ttl %" G_GUINT64_FORMAT, remote, arch, ts_file_age, ttl);
continue;
}
else
- g_debug ("%s:%s appstream age %" G_GUINT64_FORMAT " is greater than ttl %" G_GUINT64_FORMAT, remote, arch, ts_file_age, ttl);
+ g_info ("%s:%s appstream age %" G_GUINT64_FORMAT " is greater than ttl %" G_GUINT64_FORMAT, remote, arch, ts_file_age, ttl);
if (!flatpak_dir_update_appstream (dir, remote, arch, &changed,
NULL, cancellable, error))
diff --git a/app/flatpak-cli-transaction.c b/app/flatpak-cli-transaction.c
index d553e244..5a08d537 100644
--- a/app/flatpak-cli-transaction.c
+++ b/app/flatpak-cli-transaction.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -40,6 +40,8 @@ struct _FlatpakCliTransaction
GError *first_operation_error;
GHashTable *eol_actions;
+ GHashTable *runtime_app_map;
+ GHashTable *extension_app_map;
int rows;
int cols;
@@ -193,28 +195,6 @@ install_authenticator (FlatpakTransaction *old_transaction,
return;
}
-static char *
-op_type_to_string (FlatpakTransactionOperationType operation_type)
-{
- switch (operation_type)
- {
- case FLATPAK_TRANSACTION_OPERATION_INSTALL:
- return _("install");
-
- case FLATPAK_TRANSACTION_OPERATION_UPDATE:
- return _("update");
-
- case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
- return _("install bundle");
-
- case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
- return _("uninstall");
-
- default:
- return "Unknown type"; /* Should not happen */
- }
-}
-
static gboolean
redraw (FlatpakCliTransaction *self)
{
@@ -492,52 +472,123 @@ operation_error (FlatpakTransaction *transaction,
FlatpakTransactionOperationType op_type = flatpak_transaction_operation_get_operation_type (op);
const char *ref = flatpak_transaction_operation_get_ref (op);
g_autoptr(FlatpakRef) rref = flatpak_ref_parse (ref, NULL);
- g_autofree char *msg = NULL;
gboolean non_fatal = (detail & FLATPAK_TRANSACTION_ERROR_DETAILS_NON_FATAL) != 0;
g_autofree char *text = NULL;
+ const char *on = "";
+ const char *off = "";
+
+ if (flatpak_fancy_output ())
+ {
+ on = FLATPAK_ANSI_BOLD_ON;
+ off = FLATPAK_ANSI_BOLD_OFF;
+ }
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_SKIPPED))
{
set_op_progress (self, op, "⍻");
- msg = g_strdup_printf (_("Info: %s was skipped"), flatpak_ref_get_name (rref));
+ text = g_strdup_printf (_("Info: %s was skipped"), flatpak_ref_get_name (rref));
if (flatpak_fancy_output ())
{
- flatpak_table_printer_set_cell (self->printer, self->progress_row, 0, msg);
+ flatpak_table_printer_set_cell (self->printer, self->progress_row, 0, text);
self->progress_row++;
flatpak_table_printer_add_span (self->printer, "");
flatpak_table_printer_finish_row (self->printer);
redraw (self);
}
else
- g_print ("%s\n", msg);
+ g_print ("%s\n", text);
return TRUE;
}
set_op_progress (self, op, "✗");
+ /* Here we go to great lengths not to split the sentences. See
+ * https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences
+ */
if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED))
- msg = g_strdup_printf (_("%s already installed"), flatpak_ref_get_name (rref));
- else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
- msg = g_strdup_printf (_("%s not installed"), flatpak_ref_get_name (rref));
+ {
+ if (non_fatal)
+ text = g_strdup_printf (_("Warning: %s%s%s already installed"),
+ on, flatpak_ref_get_name (rref), off);
+ else
+ text = g_strdup_printf (_("Error: %s%s%s already installed"),
+ on, flatpak_ref_get_name (rref), off);
+ }
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
- msg = g_strdup_printf (_("%s not installed"), flatpak_ref_get_name (rref));
+ {
+ if (non_fatal)
+ text = g_strdup_printf (_("Warning: %s%s%s not installed"),
+ on, flatpak_ref_get_name (rref), off);
+ else
+ text = g_strdup_printf (_("Error: %s%s%s not installed"),
+ on, flatpak_ref_get_name (rref), off);
+ }
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NEED_NEW_FLATPAK))
- msg = g_strdup_printf (_("%s needs a later flatpak version"), flatpak_ref_get_name (rref));
+ {
+ if (non_fatal)
+ text = g_strdup_printf (_("Warning: %s%s%s needs a later flatpak version"),
+ on, flatpak_ref_get_name (rref), off);
+ else
+ text = g_strdup_printf (_("Error: %s%s%s needs a later flatpak version"),
+ on, flatpak_ref_get_name (rref), off);
+ }
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_OUT_OF_SPACE))
- msg = g_strdup (_("Not enough disk space to complete this operation"));
+ {
+ if (non_fatal)
+ text = g_strdup (_("Warning: Not enough disk space to complete this operation"));
+ else
+ text = g_strdup (_("Error: Not enough disk space to complete this operation"));
+ }
else if (error)
- msg = g_strdup (error->message);
+ {
+ if (non_fatal)
+ text = g_strdup_printf (_("Warning: %s"), error->message);
+ else
+ text = g_strdup_printf (_("Error: %s"), error->message);
+ }
else
- msg = g_strdup (_("(internal error, please report)"));
+ text = g_strdup ("(internal error, please report)");
if (!non_fatal && self->first_operation_error == NULL)
- g_propagate_prefixed_error (&self->first_operation_error,
- g_error_copy (error),
- _("Failed to %s %s: "),
- op_type_to_string (op_type), flatpak_ref_get_name (rref));
-
- text = g_strconcat (non_fatal ? _("Warning:") : _("Error:"), " ", msg, NULL);
+ {
+ /* Here we go to great lengths not to split the sentences. See
+ * https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences
+ */
+ switch (op_type)
+ {
+ case FLATPAK_TRANSACTION_OPERATION_INSTALL:
+ g_propagate_prefixed_error (&self->first_operation_error,
+ g_error_copy (error),
+ _("Failed to install %s%s%s: "),
+ on, flatpak_ref_get_name (rref), off);
+ break;
+
+ case FLATPAK_TRANSACTION_OPERATION_UPDATE:
+ g_propagate_prefixed_error (&self->first_operation_error,
+ g_error_copy (error),
+ _("Failed to update %s%s%s: "),
+ on, flatpak_ref_get_name (rref), off);
+ break;
+
+ case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
+ g_propagate_prefixed_error (&self->first_operation_error,
+ g_error_copy (error),
+ _("Failed to install bundle %s%s%s: "),
+ on, flatpak_ref_get_name (rref), off);
+ break;
+
+ case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
+ g_propagate_prefixed_error (&self->first_operation_error,
+ g_error_copy (error),
+ _("Failed to uninstall %s%s%s: "),
+ on, flatpak_ref_get_name (rref), off);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+ }
if (flatpak_fancy_output ())
{
@@ -650,6 +701,175 @@ typedef enum {
EOL_REBASE, /* Choose to rebase */
} EolAction;
+static void
+print_eol_info_message (FlatpakDir *dir,
+ FlatpakDecomposed *ref,
+ const char *ref_name,
+ const char *rebased_to_ref,
+ const char *reason)
+{
+ gboolean is_pinned = flatpak_dir_ref_is_pinned (dir, flatpak_decomposed_get_ref (ref));
+ g_autofree char *ref_branch = flatpak_decomposed_dup_branch (ref);
+ const char *on = "";
+ const char *off = "";
+
+ if (flatpak_fancy_output ())
+ {
+ on = FLATPAK_ANSI_BOLD_ON;
+ off = FLATPAK_ANSI_BOLD_OFF;
+ }
+
+ /* Here we go to great lengths not to split the sentences. See
+ * https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences
+ */
+ if (rebased_to_ref)
+ {
+ g_autoptr(FlatpakDecomposed) eolr_decomposed = NULL;
+ g_autofree char *eolr_name = NULL;
+ const char *eolr_branch;
+
+ eolr_decomposed = flatpak_decomposed_new_from_ref (rebased_to_ref, NULL);
+
+ /* These are guarantees from FlatpakTransaction */
+ g_assert (eolr_decomposed != NULL);
+ g_assert (flatpak_decomposed_get_kind (ref) == flatpak_decomposed_get_kind (eolr_decomposed));
+
+ eolr_name = flatpak_decomposed_dup_id (eolr_decomposed);
+ eolr_branch = flatpak_decomposed_get_branch (eolr_decomposed);
+
+ if (is_pinned)
+ {
+ /* Only runtimes can be pinned */
+ g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
+ on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ }
+ else
+ {
+ if (flatpak_decomposed_is_runtime (ref))
+ g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
+ on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ else
+ g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, in favor of %s%s%s branch %s%s%s\n"),
+ on, ref_name, off, on, ref_branch, off, on, eolr_name, off, on, eolr_branch, off);
+ }
+ }
+ else if (reason)
+ {
+ if (is_pinned)
+ {
+ /* Only runtimes can be pinned */
+ g_print (_("\nInfo: (pinned) runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
+ on, ref_name, off, on, ref_branch, off);
+ }
+ else
+ {
+ if (flatpak_decomposed_is_runtime (ref))
+ g_print (_("\nInfo: runtime %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
+ on, ref_name, off, on, ref_branch, off);
+ else
+ g_print (_("\nInfo: app %s%s%s branch %s%s%s is end-of-life, with reason:\n"),
+ on, ref_name, off, on, ref_branch, off);
+ }
+ g_print (" %s\n", reason);
+ }
+}
+
+static void
+check_current_transaction_for_dependent_apps (GPtrArray *apps,
+ FlatpakTransaction *transaction,
+ FlatpakDecomposed *ref)
+{
+ g_autoptr(FlatpakTransactionOperation) ref_op = NULL;
+ GPtrArray *related_ops;
+
+ ref_op = flatpak_transaction_get_operation_for_ref (transaction, NULL, flatpak_decomposed_get_ref (ref), NULL);
+ g_assert (ref_op != NULL);
+
+ /* Get the related ops to find any apps that use @ref as a runtime or extension */
+ related_ops = flatpak_transaction_operation_get_related_to_ops (ref_op);
+ if (related_ops == NULL)
+ return;
+
+ for (int i = 0; i < related_ops->len; i++)
+ {
+ FlatpakTransactionOperation *related_op = g_ptr_array_index (related_ops, i);
+ const char *related_op_ref = flatpak_transaction_operation_get_ref (related_op);
+ g_autoptr(FlatpakDecomposed) related_op_decomposed = flatpak_decomposed_new_from_ref (related_op_ref, NULL);
+
+ if (related_op_decomposed == NULL)
+ continue;
+ if (flatpak_decomposed_id_is_subref (related_op_decomposed))
+ continue;
+
+ /* Recurse in case @ref was a runtime extension. We need to check since a
+ * runtime can have a runtime extension in its related ops in the
+ * extra-data case, so if we recurse unconditionally it could be infinite
+ * recursion.
+ */
+ if (flatpak_decomposed_is_runtime (related_op_decomposed))
+ {
+ GKeyFile *metadata = flatpak_transaction_operation_get_metadata (ref_op);
+ if (g_key_file_has_group (metadata, FLATPAK_METADATA_GROUP_EXTENSION_OF))
+ check_current_transaction_for_dependent_apps (apps, transaction, related_op_decomposed);
+ }
+ else if (!g_ptr_array_find_with_equal_func (apps, related_op_decomposed, (GEqualFunc)flatpak_decomposed_equal, NULL))
+ g_ptr_array_add (apps, g_steal_pointer (&related_op_decomposed));
+ }
+}
+
+static GPtrArray *
+find_reverse_dep_apps (FlatpakTransaction *transaction,
+ FlatpakDir *dir,
+ FlatpakDecomposed *ref,
+ gboolean *out_is_extension)
+{
+ FlatpakCliTransaction *self = FLATPAK_CLI_TRANSACTION (transaction);
+ g_autoptr(GPtrArray) apps = NULL;
+ g_autoptr(GError) local_error = NULL;
+
+ g_assert (out_is_extension);
+
+ *out_is_extension = flatpak_dir_is_runtime_extension (dir, ref);
+ if (*out_is_extension)
+ {
+ /* Find apps which are using the ref as an extension directly or as an
+ * extension of their runtime.
+ */
+ apps = flatpak_dir_list_app_refs_with_runtime_extension (dir,
+ &self->runtime_app_map,
+ &self->extension_app_map,
+ ref, NULL, &local_error);
+ if (apps == NULL)
+ {
+ g_info ("Unable to list apps using extension %s: %s\n",
+ flatpak_decomposed_get_ref (ref), local_error->message);
+ return NULL;
+ }
+ }
+ else
+ {
+ /* Find any apps using the runtime directly */
+ apps = flatpak_dir_list_app_refs_with_runtime (dir, &self->runtime_app_map, ref,
+ NULL, &local_error);
+ if (apps == NULL)
+ {
+ g_info ("Unable to find apps using runtime %s: %s\n",
+ flatpak_decomposed_get_ref (ref), local_error->message);
+ return NULL;
+ }
+ }
+
+ /* Also check the current transaction since it's possible the EOL ref
+ * and/or any app(s) that depend on it are not installed. It's also
+ * possible the current transaction updates one of the apps to a
+ * newer runtime but we don't handle that yet
+ * (https://github.com/flatpak/flatpak/issues/4832)
+ */
+ check_current_transaction_for_dependent_apps (apps, transaction, ref);
+
+ return g_steal_pointer (&apps);
+}
+
static gboolean
end_of_lifed_with_rebase (FlatpakTransaction *transaction,
const char *remote,
@@ -709,32 +929,24 @@ end_of_lifed_with_rebase (FlatpakTransaction *transaction,
if (action == EOL_UNDECIDED)
{
- gboolean is_pinned = flatpak_dir_ref_is_pinned (dir, flatpak_decomposed_get_ref (ref));
- g_autofree char *branch = flatpak_decomposed_dup_branch (ref);
action = EOL_IGNORE;
- if (rebased_to_ref)
- if (is_pinned)
- g_print (_("Info: (pinned) %s//%s is end-of-life, in favor of %s\n"), name, branch, rebased_to_ref);
- else
- g_print (_("Info: %s//%s is end-of-life, in favor of %s\n"), name, branch, rebased_to_ref);
- else if (reason)
- {
- if (is_pinned)
- g_print (_("Info: (pinned) %s//%s is end-of-life, with reason:\n"), name, branch);
- else
- g_print (_("Info: %s//%s is end-of-life, with reason:\n"), name, branch);
- g_print (" %s\n", reason);
- }
+ print_eol_info_message (dir, ref, name, rebased_to_ref, reason);
- if (flatpak_decomposed_is_runtime (ref))
+ if (flatpak_decomposed_is_runtime (ref) && !rebased_to_ref)
{
- g_autoptr(GPtrArray) apps = flatpak_dir_list_app_refs_with_runtime (dir, ref, NULL, NULL);
+ gboolean is_extension;
+ g_autoptr(GPtrArray) apps = find_reverse_dep_apps (transaction, dir, ref, &is_extension);
+
if (apps && apps->len > 0)
{
- g_print (_("Applications using this runtime:\n"));
+ if (is_extension)
+ g_print (_("Info: applications using this extension:\n"));
+ else
+ g_print (_("Info: applications using this runtime:\n"));
+
g_print (" ");
- for (int i = 0; i < apps->len; i++)
+ for (guint i = 0; i < apps->len; i++)
{
FlatpakDecomposed *app_ref = g_ptr_array_index (apps, i);
g_autofree char *id = flatpak_decomposed_dup_id (app_ref);
@@ -748,8 +960,9 @@ end_of_lifed_with_rebase (FlatpakTransaction *transaction,
if (rebased_to_ref && remote)
{
+ /* The context for this prompt is in print_eol_info_message() */
if (self->disable_interaction ||
- flatpak_yes_no_prompt (TRUE, _("Replace it with %s?"), rebased_to_ref))
+ flatpak_yes_no_prompt (TRUE, _("Replace?")))
{
if (self->disable_interaction)
g_print (_("Updating to rebased version\n"));
@@ -762,7 +975,7 @@ end_of_lifed_with_rebase (FlatpakTransaction *transaction,
}
else
{
- g_debug ("%s is end-of-life, using action from parent ren", name);
+ g_info ("%s is end-of-life, using action from parent ref", name);
}
/* Cache for later comparison and reuse */
@@ -951,6 +1164,14 @@ print_permissions (FlatpakCliTransaction *self,
int i, j;
int rows, cols;
int table_rows, table_cols;
+ const char *on = "";
+ const char *off = "";
+
+ if (flatpak_fancy_output ())
+ {
+ on = FLATPAK_ANSI_BOLD_ON;
+ off = FLATPAK_ANSI_BOLD_OFF;
+ }
if (metadata == NULL)
return;
@@ -991,9 +1212,9 @@ print_permissions (FlatpakCliTransaction *self,
g_print ("\n");
if (old_metadata)
- g_print (_("New %s permissions:"), flatpak_ref_get_name (rref));
+ g_print (_("New %s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
else
- g_print (_("%s permissions:"), flatpak_ref_get_name (rref));
+ g_print (_("%s%s%s permissions:"), on, flatpak_ref_get_name (rref), off);
g_print ("\n");
@@ -1079,6 +1300,10 @@ transaction_ready_pre_auth (FlatpakTransaction *transaction)
FlatpakTablePrinter *printer;
const char *op_shorthand[] = { "i", "u", "i", "r" };
+ /* These caches may no longer be valid once the transaction runs */
+ g_clear_pointer (&self->runtime_app_map, g_hash_table_unref);
+ g_clear_pointer (&self->extension_app_map, g_hash_table_unref);
+
if (ops == NULL)
return TRUE;
@@ -1323,6 +1548,12 @@ flatpak_cli_transaction_finalize (GObject *object)
g_hash_table_unref (self->eol_actions);
+ if (self->runtime_app_map)
+ g_hash_table_unref (self->runtime_app_map);
+
+ if (self->extension_app_map)
+ g_hash_table_unref (self->extension_app_map);
+
if (self->printer)
flatpak_table_printer_free (self->printer);
diff --git a/app/flatpak-complete.c b/app/flatpak-complete.c
index 9c68df12..fad0638d 100644
--- a/app/flatpak-complete.c
+++ b/app/flatpak-complete.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2018 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -265,7 +265,7 @@ flatpak_complete_partial_ref (FlatpakCompletion *completion,
if (last_dot == NULL)
continue; /* Shouldn't really happen */
- /* Only complete to subrefs is fully matching real part.
+ /* Only complete to subrefs if fully matching real part.
* For example, only match org.foo.Bar.Sources for
* "org.foo.Bar", "org.foo.Bar." or "org.foo.Bar.S", but
* not for "org.foo" or other shorter prefixes.
@@ -555,8 +555,8 @@ parse_completion_line_to_argv (const char *initial_completion_line,
/* Make a shallow copy of argv, which will be our "working set" */
completion->argc = completion->original_argc;
- completion->argv = g_memdup (completion->original_argv,
- sizeof (gchar *) * (completion->original_argc + 1));
+ completion->argv = g_memdup2 (completion->original_argv,
+ sizeof (gchar *) * (completion->original_argc + 1));
return parse_result;
}
diff --git a/app/flatpak-main.c b/app/flatpak-main.c
index 23979327..343869dc 100644
--- a/app/flatpak-main.c
+++ b/app/flatpak-main.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -176,7 +176,7 @@ static GOptionEntry empty_entries[] = {
};
GOptionEntry user_entries[] = {
- { "user", 0, 0, G_OPTION_ARG_NONE, &opt_user, N_("Work on the user installation"), NULL },
+ { "user", 'u', 0, G_OPTION_ARG_NONE, &opt_user, N_("Work on the user installation"), NULL },
{ "system", 0, 0, G_OPTION_ARG_NONE, &opt_system, N_("Work on the system-wide installation (default)"), NULL },
{ "installation", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_installations, N_("Work on a non-default system-wide installation"), N_("NAME") },
{ NULL }
@@ -358,12 +358,12 @@ flatpak_option_context_parse (GOptionContext *context,
else
{
if (opt_verbose > 0)
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
+ g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, message_handler, NULL);
if (opt_verbose > 1)
- g_log_set_handler (G_LOG_DOMAIN "2", G_LOG_LEVEL_DEBUG, message_handler, NULL);
+ g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, message_handler, NULL);
if (opt_ostree_verbose)
- g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG, message_handler, NULL);
+ g_log_set_handler ("OSTree", G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO, message_handler, NULL);
if (opt_verbose > 0 || opt_ostree_verbose)
flatpak_disable_fancy_output ();
@@ -601,12 +601,17 @@ install_polkit_agent (void)
PolkitAgentListener *listener = NULL;
g_autoptr(GError) local_error = NULL;
g_autoptr(GDBusConnection) bus = NULL;
+ const char *on_session;
+
+ on_session = g_getenv ("FLATPAK_SYSTEM_HELPER_ON_SESSION");
+ if (on_session != NULL)
+ return NULL;
bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
if (bus == NULL)
{
- g_debug ("Unable to connect to system bus: %s", local_error->message);
+ g_info ("Unable to connect to system bus: %s", local_error->message);
return NULL;
}
@@ -614,7 +619,7 @@ install_polkit_agent (void)
listener = flatpak_polkit_agent_text_listener_new (NULL, &local_error);
if (listener == NULL)
{
- g_debug ("Failed to create polkit agent listener: %s", local_error->message);
+ g_info ("Failed to create polkit agent listener: %s", local_error->message);
}
else
{
@@ -638,7 +643,7 @@ install_polkit_agent (void)
&local_error);
if (agent == NULL)
{
- g_debug ("Failed to register polkit agent listener: %s", local_error->message);
+ g_info ("Failed to register polkit agent listener: %s", local_error->message);
}
g_object_unref (listener);
}
diff --git a/app/flatpak-polkit-agent-text-listener.c b/app/flatpak-polkit-agent-text-listener.c
index 5455f465..e0e75ed8 100644
--- a/app/flatpak-polkit-agent-text-listener.c
+++ b/app/flatpak-polkit-agent-text-listener.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright (C) 2008 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
diff --git a/app/flatpak-quiet-transaction.c b/app/flatpak-quiet-transaction.c
index a820c082..0a2c5ca7 100644
--- a/app/flatpak-quiet-transaction.c
+++ b/app/flatpak-quiet-transaction.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2019 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
@@ -91,25 +91,55 @@ new_operation (FlatpakTransaction *transaction,
}
}
-static char *
-op_type_to_string (FlatpakTransactionOperationType operation_type)
+static void
+print_op_error_msg (FlatpakTransactionOperationType operation_type,
+ FlatpakRef *rref,
+ const char *msg,
+ gboolean non_fatal)
{
+ /* Here we go to great lengths not to split the sentences. See
+ * https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences
+ */
switch (operation_type)
{
case FLATPAK_TRANSACTION_OPERATION_INSTALL:
- return _("install");
+ if (non_fatal)
+ g_printerr (_("Warning: Failed to install %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ else
+ g_printerr (_("Error: Failed to install %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ break;
case FLATPAK_TRANSACTION_OPERATION_UPDATE:
- return _("update");
+ if (non_fatal)
+ g_printerr (_("Warning: Failed to update %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ else
+ g_printerr (_("Error: Failed to update %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ break;
case FLATPAK_TRANSACTION_OPERATION_INSTALL_BUNDLE:
- return _("install bundle");
+ if (non_fatal)
+ g_printerr (_("Warning: Failed to install bundle %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ else
+ g_printerr (_("Error: Failed to install bundle %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ break;
case FLATPAK_TRANSACTION_OPERATION_UNINSTALL:
- return _("uninstall");
+ if (non_fatal)
+ g_printerr (_("Warning: Failed to uninstall %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ else
+ g_printerr (_("Error: Failed to uninstall %s: %s\n"),
+ flatpak_ref_get_name (rref), msg);
+ break;
default:
- return "Unknown type"; /* Should not happen */
+ g_assert_not_reached ();
}
}
@@ -136,8 +166,6 @@ operation_error (FlatpakTransaction *transaction,
msg = g_strdup_printf (_("%s already installed"), flatpak_ref_get_name (rref));
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
msg = g_strdup_printf (_("%s not installed"), flatpak_ref_get_name (rref));
- else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED))
- msg = g_strdup_printf (_("%s not installed"), flatpak_ref_get_name (rref));
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_NEED_NEW_FLATPAK))
msg = g_strdup_printf (_("%s needs a later flatpak version"), flatpak_ref_get_name (rref));
else if (g_error_matches (error, FLATPAK_ERROR, FLATPAK_ERROR_OUT_OF_SPACE))
@@ -145,11 +173,7 @@ operation_error (FlatpakTransaction *transaction,
else
msg = g_strdup (error->message);
- g_printerr (_("%s Failed to %s %s: %s\n"),
- non_fatal ? _("Warning:") : _("Error:"),
- op_type_to_string (op_type),
- flatpak_ref_get_name (rref),
- msg);
+ print_op_error_msg (op_type, rref, msg, non_fatal);
if (non_fatal)
return TRUE; /* Continue */
diff --git a/app/flatpak-table-printer.c b/app/flatpak-table-printer.c
index c6a2a323..6ec00e26 100644
--- a/app/flatpak-table-printer.c
+++ b/app/flatpak-table-printer.c
@@ -1,4 +1,4 @@
-/*
+/* vi:set et sw=2 sts=2 cin cino=t0,f0,(0,{s,>2s,n-s,^-s,e-s:
* Copyright © 2014 Red Hat, Inc
*
* This program is free software; you can redistribute it and/or
diff --git a/app/meson.build b/app/meson.build
new file mode 100644
index 00000000..30665b6b
--- /dev/null
+++ b/app/meson.build
@@ -0,0 +1,143 @@
+# Copyright 2022 Collabora Ltd.
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+sources = [
+ 'flatpak-builtins-utils.c',
+ 'flatpak-table-printer.c',
+]
+
+parse_datetime = custom_target(
+ 'parse-datetime.c',
+ input : [
+ 'parse-datetime.y',
+ ],
+ output : [
+ 'parse-datetime.c',
+ ],
+ build_by_default : true,
+ command : [
+ bison,
+ '@INPUT@',
+ '-o', '@OUTPUT@',
+ ],
+)
+
+flatpak_permission_gdbus = gnome.gdbus_codegen(
+ 'flatpak-permission-dbus-generated',
+ sources: [
+ '../data/org.freedesktop.impl.portal.PermissionStore.xml',
+ ],
+ interface_prefix : 'org.freedesktop.impl.portal',
+ namespace : 'XdpDbus',
+)
+
+libflatpak_app = static_library(
+ 'libflatpak-app',
+ sources : sources + [parse_datetime[0]],
+ dependencies : base_deps + [
+ appstream_dep,
+ json_glib_dep,
+ libflatpak_common_base_dep,
+ libglnx_dep,
+ libostree_dep,
+ libsystemd_dep,
+ polkit_agent_dep,
+ ],
+ include_directories : [
+ common_include_directories,
+ include_directories('.'),
+ ],
+ install : false,
+)
+libflatpak_app_dep = declare_dependency(
+ dependencies : [
+ base_deps,
+ appstream_dep,
+ json_glib_dep,
+ libglnx_dep,
+ libostree_dep,
+ libsystemd_dep,
+ polkit_agent_dep,
+ ],
+ include_directories : [
+ common_include_directories,
+ include_directories('.'),
+ ],
+ link_with : [
+ libflatpak_app,
+ ],
+)
+
+sources = [
+ 'flatpak-builtins-build-bundle.c',
+ 'flatpak-builtins-build-commit-from.c',
+ 'flatpak-builtins-build-export.c',
+ 'flatpak-builtins-build-finish.c',
+ 'flatpak-builtins-build-import-bundle.c',
+ 'flatpak-builtins-build-init.c',
+ 'flatpak-builtins-build-sign.c',
+ 'flatpak-builtins-build-update-repo.c',
+ 'flatpak-builtins-build.c',
+ 'flatpak-builtins-config.c',
+ 'flatpak-builtins-create-usb.c',
+ 'flatpak-builtins-document-export.c',
+ 'flatpak-builtins-document-info.c',
+ 'flatpak-builtins-document-list.c',
+ 'flatpak-builtins-document-unexport.c',
+ 'flatpak-builtins-enter.c',
+ 'flatpak-builtins-history.c',
+ 'flatpak-builtins-info.c',
+ 'flatpak-builtins-install.c',
+ 'flatpak-builtins-kill.c',
+ 'flatpak-builtins-list.c',
+ 'flatpak-builtins-make-current.c',
+ 'flatpak-builtins-mask.c',
+ 'flatpak-builtins-override.c',
+ 'flatpak-builtins-permission-list.c',
+ 'flatpak-builtins-permission-remove.c',
+ 'flatpak-builtins-permission-reset.c',
+ 'flatpak-builtins-permission-set.c',
+ 'flatpak-builtins-permission-show.c',
+ 'flatpak-builtins-pin.c',
+ 'flatpak-builtins-ps.c',
+ 'flatpak-builtins-remote-add.c',
+ 'flatpak-builtins-remote-delete.c',
+ 'flatpak-builtins-remote-info.c',
+ 'flatpak-builtins-remote-list.c',
+ 'flatpak-builtins-remote-ls.c',
+ 'flatpak-builtins-remote-modify.c',
+ 'flatpak-builtins-repair.c',
+ 'flatpak-builtins-repo.c',
+ 'flatpak-builtins-run.c',
+ 'flatpak-builtins-search.c',
+ 'flatpak-builtins-uninstall.c',
+ 'flatpak-builtins-update.c',
+ 'flatpak-cli-transaction.c',
+ 'flatpak-complete.c',
+ 'flatpak-main.c',
+ 'flatpak-quiet-transaction.c',
+]
+
+if build_system_helper
+ sources += [
+ 'flatpak-polkit-agent-text-listener.c',
+ ]
+endif
+
+flatpak_exe = executable(
+ 'flatpak',
+ dependencies : base_deps + [
+ appstream_dep,
+ json_glib_dep,
+ libflatpak_app_dep,
+ libflatpak_common_dep,
+ libflatpak_common_base_dep,
+ libglnx_dep,
+ libostree_dep,
+ libsystemd_dep,
+ polkit_agent_dep,
+ ],
+ install : true,
+ install_dir : get_option('bindir'),
+ sources : sources + flatpak_gdbus + flatpak_permission_gdbus,
+)