Skip to content

Commit

Permalink
system-helper: Add flags to all methods
Browse files Browse the repository at this point in the history
Some methods were missing a flags argument. This
will be a problem in the future, when we want to
pass a no-interaction flag to all methods. Therefore,
add an empty flags enum for every method that is lacking
one now.

This is an api change for the system-helper interface.

Closes: flatpak#2370
Approved by: alexlarsson
  • Loading branch information
Matthias Clasen authored and rh-atomic-bot committed Dec 3, 2018
1 parent 624cc6f commit 1ba30f7
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 9 deletions.
42 changes: 42 additions & 0 deletions common/flatpak-dir-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,48 @@ typedef enum {

#define FLATPAK_HELPER_UPDATE_REMOTE_FLAGS_ALL (0)

typedef enum {
FLATPAK_HELPER_DEPLOY_APPSTREAM_FLAGS_NONE = 0,
} FlatpakHelperDeployAppstreamFlags;

#define FLATPAK_HELPER_DEPLOY_APPSTREAM_FLAGS_ALL (FLATPAK_HELPER_DEPLOY_APPSTREAM_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_REMOVE_LOCAL_REF_FLAGS_NONE = 0,
} FlatpakHelperRemoveLocalRefFlags;

#define FLATPAK_HELPER_REMOVE_LOCAL_REF_FLAGS_ALL (FLATPAK_HELPER_REMOVE_LOCAL_REF_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_PRUNE_LOCAL_REPO_FLAGS_NONE = 0,
} FlatpakHelperPruneLocalRepoFlags;

#define FLATPAK_HELPER_PRUNE_LOCAL_REPO_FLAGS_ALL (FLATPAK_HELPER_PRUNE_LOCAL_REPO_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_RUN_TRIGGERS_FLAGS_NONE = 0,
} FlatpakHelperRunTriggersFlags;

#define FLATPAK_HELPER_RUN_TRIGGERS_FLAGS_ALL (FLATPAK_HELPER_RUN_TRIGGERS_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_ENSURE_REPO_FLAGS_NONE = 0,
} FlatpakHelperEnsureRepoFlags;

#define FLATPAK_HELPER_ENSURE_REPO_FLAGS_ALL (FLATPAK_HELPER_ENSURE_REPO_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_UPDATE_SUMMARY_FLAGS_NONE = 0,
} FlatpakHelperUpdateSummaryFlags;

#define FLATPAK_HELPER_UPDATE_SUMMARY_FLAGS_ALL (FLATPAK_HELPER_UPDATE_SUMMARY_FLAGS_NONE)

typedef enum {
FLATPAK_HELPER_GENERATE_OCI_SUMMARY_FLAGS_NONE = 0,
} FlatpakHelperGenerateOciSummaryFlags;

#define FLATPAK_HELPER_GENERATE_OCI_SUMMARY_FLAGS_ALL (FLATPAK_HELPER_GENERATE_OCI_SUMMARY_FLAGS_NONE)

typedef enum {
FLATPAK_PULL_FLAGS_NONE = 0,
FLATPAK_PULL_FLAGS_DOWNLOAD_EXTRA_DATA = 1 << 0,
Expand Down
41 changes: 32 additions & 9 deletions common/flatpak-dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ flatpak_dir_system_helper_call_deploy (FlatpakDir *self,
static gboolean
flatpak_dir_system_helper_call_deploy_appstream (FlatpakDir *self,
const gchar *arg_repo_path,
guint arg_flags,
const gchar *arg_origin,
const gchar *arg_arch,
const gchar *arg_installation,
Expand All @@ -1239,8 +1240,9 @@ flatpak_dir_system_helper_call_deploy_appstream (FlatpakDir *self,
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "DeployAppstream",
g_variant_new ("(^aysss)",
g_variant_new ("(^ayusss)",
arg_repo_path,
arg_flags,
arg_origin,
arg_arch,
arg_installation),
Expand Down Expand Up @@ -1358,6 +1360,7 @@ flatpak_dir_system_helper_call_update_remote (FlatpakDir *self,

static gboolean
flatpak_dir_system_helper_call_remove_local_ref (FlatpakDir *self,
guint arg_flags,
const gchar *arg_remote,
const gchar *arg_ref,
const gchar *arg_installation,
Expand All @@ -1366,7 +1369,8 @@ flatpak_dir_system_helper_call_remove_local_ref (FlatpakDir *self,
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "RemoveLocalRef",
g_variant_new ("(sss)",
g_variant_new ("(usss)",
arg_flags,
arg_remote,
arg_ref,
arg_installation),
Expand All @@ -1376,70 +1380,80 @@ flatpak_dir_system_helper_call_remove_local_ref (FlatpakDir *self,

static gboolean
flatpak_dir_system_helper_call_prune_local_repo (FlatpakDir *self,
guint arg_flags,
const gchar *arg_installation,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "PruneLocalRepo",
g_variant_new ("(s)",
g_variant_new ("(us)",
arg_flags,
arg_installation),
cancellable, error);
return ret != NULL;
}

static gboolean
flatpak_dir_system_helper_call_run_triggers (FlatpakDir *self,
guint arg_flags,
const gchar *arg_installation,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "RunTriggers",
g_variant_new ("(s)",
g_variant_new ("(us)",
arg_flags,
arg_installation),
cancellable, error);
return ret != NULL;
}

static gboolean
flatpak_dir_system_helper_call_ensure_repo (FlatpakDir *self,
guint arg_flags,
const gchar *arg_installation,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "EnsureRepo",
g_variant_new ("(s)",
g_variant_new ("(us)",
arg_flags,
arg_installation),
cancellable, error);
return ret != NULL;
}

static gboolean
flatpak_dir_system_helper_call_update_summary (FlatpakDir *self,
guint arg_flags,
const gchar *arg_installation,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "UpdateSummary",
g_variant_new ("(s)",
g_variant_new ("(us)",
arg_flags,
arg_installation),
cancellable, error);
return ret != NULL;
}

static gboolean
flatpak_dir_system_helper_call_generate_oci_summary (FlatpakDir *self,
guint arg_flags,
const gchar *arg_origin,
const gchar *arg_installation,
GCancellable *cancellable,
GError **error)
{
g_autoptr(GVariant) ret =
flatpak_dir_system_helper_call (self, "GenerateOciSummary",
g_variant_new ("(ss)",
g_variant_new ("(uss)",
arg_flags,
arg_origin,
arg_installation),
cancellable, error);
Expand Down Expand Up @@ -2289,6 +2303,7 @@ _flatpak_dir_ensure_repo (FlatpakDir *self,
const char *installation = flatpak_dir_get_id (self);

if (!flatpak_dir_system_helper_call_ensure_repo (self,
FLATPAK_HELPER_ENSURE_REPO_FLAGS_NONE,
installation ? installation : "",
NULL, &local_error))
{
Expand Down Expand Up @@ -3478,6 +3493,7 @@ flatpak_dir_update_appstream (FlatpakDir *self,

if (!flatpak_dir_system_helper_call_deploy_appstream (self,
child_repo_path ? child_repo_path : "",
FLATPAK_HELPER_DEPLOY_APPSTREAM_FLAGS_NONE,
remote,
arch,
installation ? installation : "",
Expand Down Expand Up @@ -5414,6 +5430,7 @@ flatpak_dir_run_triggers (FlatpakDir *self,
const char *installation = flatpak_dir_get_id (self);

if (!flatpak_dir_system_helper_call_run_triggers (self,
FLATPAK_HELPER_RUN_TRIGGERS_FLAGS_NONE,
installation ? installation : "",
cancellable,
error))
Expand Down Expand Up @@ -7140,7 +7157,8 @@ flatpak_dir_prune_origin_remote (FlatpakDir *self,
gpg_data_v = g_variant_ref_sink (g_variant_new_from_data (G_VARIANT_TYPE ("ay"), "", 0, TRUE, NULL, NULL));

flatpak_dir_system_helper_call_configure_remote (self,
0, remote,
FLATPAK_HELPER_CONFIGURE_FLAGS_NONE,
remote,
"",
gpg_data_v,
installation ? installation : "",
Expand Down Expand Up @@ -8898,6 +8916,7 @@ flatpak_dir_remove_ref (FlatpakDir *self,
const char *installation = flatpak_dir_get_id (self);

if (!flatpak_dir_system_helper_call_remove_local_ref (self,
FLATPAK_HELPER_REMOVE_LOCAL_REF_FLAGS_NONE,
remote_name,
ref,
installation ? installation : "",
Expand Down Expand Up @@ -8994,6 +9013,7 @@ flatpak_dir_prune (FlatpakDir *self,
const char *installation = flatpak_dir_get_id (self);

if (!flatpak_dir_system_helper_call_prune_local_repo (self,
FLATPAK_HELPER_PRUNE_LOCAL_REPO_FLAGS_NONE,
installation ? installation : "",
cancellable,
error))
Expand Down Expand Up @@ -9058,6 +9078,7 @@ flatpak_dir_update_summary (FlatpakDir *self,
const char *installation = flatpak_dir_get_id (self);

return flatpak_dir_system_helper_call_update_summary (self,
FLATPAK_HELPER_UPDATE_SUMMARY_FLAGS_NONE,
installation ? installation : "",
cancellable,
error);
Expand Down Expand Up @@ -9275,7 +9296,9 @@ flatpak_dir_remote_make_oci_summary (FlatpakDir *self,
{
const char *installation = flatpak_dir_get_id (self);

if (!flatpak_dir_system_helper_call_generate_oci_summary (self, remote,
if (!flatpak_dir_system_helper_call_generate_oci_summary (self,
FLATPAK_HELPER_GENERATE_OCI_SUMMARY_FLAGS_NONE,
remote,
installation ? installation : "",
cancellable, error))
return FALSE;
Expand Down
7 changes: 7 additions & 0 deletions data/org.freedesktop.Flatpak.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

<method name="DeployAppstream">
<arg type='ay' name='repo_path' direction='in'/>
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='origin' direction='in'/>
<arg type='s' name='arch' direction='in'/>
<arg type='s' name='installation' direction='in'/>
Expand Down Expand Up @@ -123,28 +124,34 @@
</method>

<method name="RemoveLocalRef">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='remote' direction='in'/>
<arg type='s' name='ref' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>

<method name="PruneLocalRepo">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>

<method name="RunTriggers">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>

<method name="EnsureRepo">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>

<method name="UpdateSummary">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>

<method name="GenerateOciSummary">
<arg type='u' name='flags' direction='in'/>
<arg type='s' name='origin' direction='in'/>
<arg type='s' name='installation' direction='in'/>
</method>
Expand Down

0 comments on commit 1ba30f7

Please sign in to comment.