appstream: Drop flatpak_dir_check_for_appstream_update

This early bailout is not really needed, because noop updates is
pretty fast. Also, doing that breaks the timestamp updates.

Closes: #1585
Approved by: alexlarsson
This commit is contained in:
Alexander Larsson
2018-04-17 13:17:55 +02:00
committed by Atomic Bot
parent 9afca51507
commit 096f7d4fb5
3 changed files with 1 additions and 71 deletions

View File

@@ -468,8 +468,7 @@ update_appstream (GPtrArray *dirs,
g_debug ("%s age %" G_GUINT64_FORMAT " is greater than ttl %" G_GUINT64_FORMAT, ts_file_path, ts_file_age, ttl);
if (flatpak_dir_get_remote_disabled (dir, remotes[i]) ||
flatpak_dir_get_remote_noenumerate (dir, remotes[i]) ||
!flatpak_dir_check_for_appstream_update (dir, remotes[i], arch, &local_error))
flatpak_dir_get_remote_noenumerate (dir, remotes[i]))
{
if (local_error)
{
@@ -529,19 +528,6 @@ update_appstream (GPtrArray *dirs,
found = TRUE;
/* Early bail out check */
if (!flatpak_dir_check_for_appstream_update (dir, remote, arch, &local_error))
{
if (local_error)
{
if (quiet)
g_debug ("%s: %s", _("Error updating"), local_error->message);
else
g_printerr ("%s: %s\n", _("Error updating"), local_error->message);
}
continue;
}
progress = ostree_async_progress_new_and_connect (no_progress_cb, NULL);
res = flatpak_dir_update_appstream (dir, remote, arch, &changed,
progress, cancellable, error);

View File

@@ -2339,57 +2339,6 @@ flatpak_dir_find_latest_rev (FlatpakDir *self,
return TRUE;
}
gboolean
flatpak_dir_check_for_appstream_update (FlatpakDir *self,
const char *remote,
const char *arch,
GError **error)
{
const char *old_checksum = NULL;
g_autofree char *new_checksum = NULL;
g_autoptr(GFile) active_link = NULL;
g_autofree char *branch = NULL;
g_autoptr(GFileInfo) file_info = NULL;
g_autoptr(GError) local_error = NULL;
g_autoptr(FlatpakRemoteState) state = NULL;
if (!flatpak_dir_maybe_ensure_repo (self, NULL, NULL))
return TRUE;
active_link = flatpak_build_file (flatpak_dir_get_path (self),
"appstream",
remote,
arch,
"active",
NULL);
file_info = g_file_query_info (active_link, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
NULL, NULL);
if (file_info != NULL)
old_checksum = g_file_info_get_symlink_target (file_info);
branch = g_strdup_printf ("appstream/%s", arch);
state = flatpak_dir_get_remote_state_optional (self, remote, NULL, &local_error);
if (state == NULL ||
!flatpak_dir_find_latest_rev (self, state, branch, NULL, &new_checksum,
NULL, NULL, &local_error))
{
flatpak_fail (error, _("Failed to find latest revision for ref %s from remote %s: %s"),
branch, remote, local_error->message);
new_checksum = NULL;
}
if (new_checksum == NULL)
{
g_debug ("No %s branch for remote %s, ignoring", branch, remote);
return FALSE; /* No appstream branch, don't update, no error */
}
return g_strcmp0 (new_checksum, old_checksum) != 0;
}
static gboolean
child_repo_ensure_summary (OstreeRepo *child_repo,
FlatpakRemoteState *state,
@@ -2418,7 +2367,6 @@ child_repo_ensure_summary (OstreeRepo *child_repo,
return TRUE;
}
gboolean
flatpak_dir_update_appstream (FlatpakDir *self,
const char *remote,

View File

@@ -399,10 +399,6 @@ gboolean flatpak_dir_deploy_appstream (FlatpakDir *self,
gboolean *out_changed,
GCancellable *cancellable,
GError **error);
gboolean flatpak_dir_check_for_appstream_update (FlatpakDir *self,
const char *remote,
const char *arch,
GError **error);
gboolean flatpak_dir_update_appstream (FlatpakDir *self,
const char *remote,
const char *arch,