代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libdnf 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From e7cf3d198e7b107cffc788f96f51fde2d843dd82 Mon Sep 17 00:00:00 2001
From: Alessandro Astone <ales.astone@gmail.com>
Date: Thu, 28 Sep 2023 14:50:22 +0200
Subject: [PATCH] dnf-repo: Don't download repository if our local cache is up
to date
Verified by comparing the hash of repomd.xml
Conflict:NA
Reference:https://github.com/rpm-software-management/libdnf/commit/e7cf3d198e7b107cffc788f96f51fde2d843dd82
---
libdnf/dnf-repo.cpp | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index 48434fd9be..c2495f564e 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -969,6 +969,9 @@ dnf_repo_set_keyfile_data(DnfRepo *repo, gboolean reloadFromGKeyFile, GError **e
dnf_repo_apply_setopts(*conf, repoId);
}
+ if (dnf_context_get_cache_dir(priv->context))
+ conf->basecachedir().set(libdnf::Option::Priority::REPOCONFIG, dnf_context_get_cache_dir(priv->context));
+
/* baseurl is optional; if missing, unset it */
g_auto(GStrv) baseurls = NULL;
auto & repoBaseurls = conf->baseurl().getValue();
@@ -1463,6 +1466,7 @@ dnf_repo_check_internal(DnfRepo *repo,
error_local->message);
return FALSE;
}
+ repoImpl->repomdFn = yum_repo->repomd;
/* get timestamp */
ret = lr_result_getinfo(priv->repo_result, &error_local,
@@ -1765,8 +1769,10 @@ dnf_repo_update(DnfRepo *repo,
if (!dnf_repo_set_keyfile_data(repo, TRUE, error))
return FALSE;
+ auto repoImpl = libdnf::repoGetImpl(priv->repo);
+
/* countme support */
- libdnf::repoGetImpl(priv->repo)->addCountmeFlag(priv->repo_handle);
+ repoImpl->addCountmeFlag(priv->repo_handle);
/* take lock */
ret = dnf_state_take_lock(state,
@@ -1784,6 +1790,28 @@ dnf_repo_update(DnfRepo *repo,
if (!ret)
goto out;
+ state_local = dnf_state_get_child(state);
+ dnf_state_action_start(state_local,
+ DNF_STATE_ACTION_DOWNLOAD_METADATA, NULL);
+
+ try {
+ if (repoImpl->isInSync()) {
+ /* reset timestamp */
+ ret = utimes(repoImpl->repomdFn.c_str(), NULL);
+ if (!ret)
+ g_debug("Failed to reset timestamp on repomd.xml");
+ ret = dnf_state_done(state, error);
+ if (!ret)
+ goto out;
+
+ /* skip check */
+ ret = dnf_state_finished(state, error);
+ goto out;
+ }
+ } catch (std::exception & ex) {
+ g_debug("Failed to verify if metadata is in sync: \"%s\". Proceding with download", ex.what());
+ }
+
/* remove the temporary space if it already exists */
if (g_file_test(priv->location_tmp, G_FILE_TEST_EXISTS)) {
ret = dnf_remove_recursive(priv->location_tmp, error);
@@ -1842,7 +1870,7 @@ dnf_repo_update(DnfRepo *repo,
goto out;
/* Callback to display progress of downloading */
- state_local = updatedata.state = dnf_state_get_child(state);
+ updatedata.state = state_local;
ret = lr_handle_setopt(priv->repo_handle, error,
LRO_PROGRESSDATA, &updatedata);
if (!ret)
@@ -1867,8 +1895,6 @@ dnf_repo_update(DnfRepo *repo,
}
lr_result_clear(priv->repo_result);
- dnf_state_action_start(state_local,
- DNF_STATE_ACTION_DOWNLOAD_METADATA, NULL);
ret = lr_handle_perform(priv->repo_handle,
priv->repo_result,
&error_local);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。