forked from Mirrors/flatpak-builder
XdgAppDir: Touch .changes file each time something changes
parent
1264335458
commit
cd490d12a7
|
@ -237,6 +237,9 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
if (!import_keys (dir, remote_name, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -301,5 +304,8 @@ xdg_app_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
if (!import_keys (dir, remote_name, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -54,5 +54,8 @@ xdg_app_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -167,6 +167,9 @@ xdg_app_builtin_install_runtime (int argc, char **argv, GCancellable *cancellabl
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
|
@ -251,6 +254,9 @@ xdg_app_builtin_install_app (int argc, char **argv, GCancellable *cancellable, G
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
|
@ -504,6 +510,9 @@ xdg_app_builtin_install_bundle (int argc, char **argv, GCancellable *cancellable
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
|
|
|
@ -80,5 +80,8 @@ xdg_app_builtin_make_current_app (int argc, char **argv, GCancellable *cancellab
|
|||
|
||||
glnx_release_lock_file (&lock);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,9 @@ xdg_app_builtin_uninstall_runtime (int argc, char **argv, GCancellable *cancella
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
if (!was_deployed)
|
||||
return xdg_app_fail (error, "Nothing to uninstall");
|
||||
|
||||
|
@ -173,6 +176,9 @@ xdg_app_builtin_uninstall_app (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
if (!was_deployed)
|
||||
return xdg_app_fail (error, "Nothing to uninstall");
|
||||
|
||||
|
|
|
@ -105,6 +105,9 @@ xdg_app_builtin_update_runtime (int argc, char **argv, GCancellable *cancellable
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -173,5 +176,8 @@ xdg_app_builtin_update_app (int argc, char **argv, GCancellable *cancellable, GE
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -263,6 +263,12 @@ xdg_app_dir_get_path (XdgAppDir *self)
|
|||
return self->basedir;
|
||||
}
|
||||
|
||||
GFile *
|
||||
xdg_app_dir_get_changed_path (XdgAppDir *self)
|
||||
{
|
||||
return g_file_get_child (self->basedir, ".changed");
|
||||
}
|
||||
|
||||
char *
|
||||
xdg_app_dir_load_override (XdgAppDir *self,
|
||||
const char *app_id,
|
||||
|
@ -549,6 +555,9 @@ xdg_app_dir_ensure_repo (XdgAppDir *self,
|
|||
gs_shutil_rm_rf (repodir, cancellable, NULL);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Create .changes file early to avoid polling non-existing file in monitor */
|
||||
xdg_app_dir_mark_changed (self, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -570,6 +579,22 @@ xdg_app_dir_ensure_repo (XdgAppDir *self,
|
|||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_dir_mark_changed (XdgAppDir *self,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GFile) changed_file = NULL;
|
||||
|
||||
g_print ("mark changed\n");
|
||||
changed_file = xdg_app_dir_get_changed_path (self);
|
||||
if (!g_file_replace_contents (changed_file, "", 0, NULL, FALSE,
|
||||
G_FILE_CREATE_REPLACE_DESTINATION, NULL, NULL, error))
|
||||
return FALSE;
|
||||
g_print ("OK\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_dir_pull (XdgAppDir *self,
|
||||
const char *repository,
|
||||
|
|
|
@ -76,6 +76,7 @@ XdgAppDir *xdg_app_dir_get_system (void);
|
|||
XdgAppDir *xdg_app_dir_get_user (void);
|
||||
gboolean xdg_app_dir_is_user (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_path (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_changed_path (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_deploy_dir (XdgAppDir *self,
|
||||
const char *ref);
|
||||
char * xdg_app_dir_get_origin (XdgAppDir *self,
|
||||
|
@ -109,6 +110,8 @@ gboolean xdg_app_dir_ensure_path (XdgAppDir *self,
|
|||
gboolean xdg_app_dir_ensure_repo (XdgAppDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_mark_changed (XdgAppDir *self,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_pull (XdgAppDir *self,
|
||||
const char *repository,
|
||||
const char *ref,
|
||||
|
|
|
@ -753,6 +753,9 @@ xdg_app_installation_install (XdgAppInstallation *self,
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir_clone, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir_clone, error))
|
||||
goto out;
|
||||
|
||||
out:
|
||||
if (main_context)
|
||||
g_main_context_pop_thread_default (main_context);
|
||||
|
@ -867,6 +870,9 @@ xdg_app_installation_update (XdgAppInstallation *self,
|
|||
{
|
||||
if (!xdg_app_dir_prune (dir_clone, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir_clone, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
xdg_app_dir_cleanup_removed (dir_clone, cancellable, NULL);
|
||||
|
@ -961,6 +967,9 @@ xdg_app_installation_uninstall (XdgAppInstallation *self,
|
|||
|
||||
xdg_app_dir_cleanup_removed (dir_clone, cancellable, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir_clone, error))
|
||||
return FALSE;
|
||||
|
||||
if (!was_deployed)
|
||||
{
|
||||
g_set_error (error,
|
||||
|
|
Loading…
Reference in New Issue