diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 14:24:34 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 14:38:27 +0300 |
commit | 9d100378074d21f99dc26bae8417932dc110664e (patch) | |
tree | e66829190a5648b146698e372b2a9403d535f866 /src/cache.c | |
parent | dbb642206d2ef73c5428a04cb10bb27e7cdd3b29 (diff) | |
download | apk-tools-9d100378074d21f99dc26bae8417932dc110664e.tar.gz apk-tools-9d100378074d21f99dc26bae8417932dc110664e.tar.bz2 apk-tools-9d100378074d21f99dc26bae8417932dc110664e.tar.xz apk-tools-9d100378074d21f99dc26bae8417932dc110664e.zip |
db: refactor repository file construction
Fixes also 'fetch' applet to prefer copying/linking to files from
cache if possible.
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/cache.c b/src/cache.c index fc58f7e..d1ce06e 100644 --- a/src/cache.c +++ b/src/cache.c @@ -31,7 +31,6 @@ static int cache_download(struct apk_database *db) struct apk_change *change; struct apk_package *pkg; struct apk_repository *repo; - char item[PATH_MAX], cacheitem[PATH_MAX]; int i, r, ret = 0; r = apk_solver_solve(db, 0, db->world, &changeset); @@ -50,13 +49,9 @@ static int cache_download(struct apk_database *db) if (repo == NULL) continue; - apk_pkg_format_cache(pkg, APK_BLOB_BUF(cacheitem)); - apk_pkg_format_plain(pkg, APK_BLOB_BUF(item)); - r = apk_cache_download(db, repo->url, pkg->arch, - item, cacheitem, - APK_SIGN_VERIFY_IDENTITY); + r = apk_cache_download(db, repo, pkg, APK_SIGN_VERIFY_IDENTITY); if (r) { - apk_error("%s: %s", item, apk_error_str(r)); + apk_error(PKG_VER_FMT ": %s", PKG_VER_PRINTF(pkg), apk_error_str(r)); ret++; } } @@ -76,7 +71,7 @@ static void cache_clean_item(struct apk_database *db, int dirfd, const char *nam b = APK_BLOB_STR(name); for (i = 0; i < db->num_repos; i++) { /* Check if this is a valid index */ - apk_cache_format_index(APK_BLOB_BUF(tmp), &db->repos[i]); + apk_repo_format_cache_index(APK_BLOB_BUF(tmp), &db->repos[i]); if (apk_blob_compare(b, APK_BLOB_STR(tmp)) == 0) return; } |