}
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;
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);