diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-08-06 16:00:20 +0300 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-08-06 16:00:20 +0300 |
commit | f02f326238fd1e6424bf914e102ce265e7c156ec (patch) | |
tree | ceded7eb995efa68086b613cbc286d198b60da0a /src/cache.c | |
parent | ced1fa83d6361ebfdc40920d98eb292ca4661b4e (diff) | |
download | apk-tools-f02f326238fd1e6424bf914e102ce265e7c156ec.tar.gz apk-tools-f02f326238fd1e6424bf914e102ce265e7c156ec.tar.bz2 apk-tools-f02f326238fd1e6424bf914e102ce265e7c156ec.tar.xz apk-tools-f02f326238fd1e6424bf914e102ce265e7c156ec.zip |
db: prefer local repositories, and implement --no-network
this helps boots sequence when network is not available.
Diffstat (limited to 'src/cache.c')
-rw-r--r-- | src/cache.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/cache.c b/src/cache.c index d4509e1..f9bcb6f 100644 --- a/src/cache.c +++ b/src/cache.c @@ -28,6 +28,7 @@ static int cache_download(struct apk_database *db) struct apk_state *state; struct apk_change *change; struct apk_package *pkg; + struct apk_repository *repo; char item[PATH_MAX], cacheitem[PATH_MAX]; int i, r = 0; @@ -54,17 +55,13 @@ static int cache_download(struct apk_database *db) if (faccessat(db->cache_fd, cacheitem, R_OK, 0) == 0) continue; - for (i = 0; i < db->num_repos; i++) { - if (!(pkg->repos & BIT(i))) - continue; + repo = apk_db_select_repo(db, pkg); + if (repo == NULL) + continue; - apk_pkg_format_plain(pkg, APK_BLOB_BUF(item)); - r = apk_cache_download(db, db->repos[i].url, - item, cacheitem, - APK_SIGN_VERIFY_IDENTITY); - if (r != 0) - return r; - } + apk_pkg_format_plain(pkg, APK_BLOB_BUF(item)); + apk_cache_download(db, repo->url, item, cacheitem, + APK_SIGN_VERIFY_IDENTITY); } err: |