From: Michael Tremer Date: Thu, 31 Aug 2023 05:42:44 +0000 (+0000) Subject: repo: Reformat code that downloads metadata X-Git-Tag: 0.9.29~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=678d9918ce0efa5bc876b08204ac2b7ebf066a79;p=pakfire.git repo: Reformat code that downloads metadata There are no functional changes here, but this is better to read. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 646394501..e2e80d63a 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -489,6 +489,14 @@ static int pakfire_repo_refresh_mirrorlist(struct pakfire_repo* repo, const int } static int pakfire_repo_download_metadata(struct pakfire_repo* repo, const char* path, int force) { + // Local repositories don't need to download metadata + if (pakfire_repo_is_local(repo)) + return 0; + + // Do nothing if running in offline mode + if (pakfire_has_flag(repo->pakfire, PAKFIRE_FLAGS_OFFLINE)) + return 0; + // Fetch refresh interval time_t refresh = repo->appdata->refresh; @@ -523,12 +531,10 @@ static int pakfire_repo_refresh_metadata(struct pakfire_repo* repo, const int fo if (r) return r; - // Don't try to refresh the metadata for local repositories and if we are running offline - if (!pakfire_repo_is_local(repo) && !pakfire_has_flag(repo->pakfire, PAKFIRE_FLAGS_OFFLINE)) { - r = pakfire_repo_download_metadata(repo, path, force); - if (r) - return r; - } + // Potentially download new metadata + r = pakfire_repo_download_metadata(repo, path, force); + if (r) + return r; // Parse metadata return pakfire_repo_read_metadata(repo, path);