diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-07 11:12:24 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-07-09 06:08:44 +0000 |
commit | 080fa825ddf932cf95ef38ffa2107e3a99d49610 (patch) | |
tree | 19692ca0e69738437c4b02feb9ee97ec5a77a202 /src/database.c | |
parent | f1125dfcde748300846f9fba07f29791ec980c1a (diff) | |
download | apk-tools-080fa825ddf932cf95ef38ffa2107e3a99d49610.tar.gz apk-tools-080fa825ddf932cf95ef38ffa2107e3a99d49610.tar.bz2 apk-tools-080fa825ddf932cf95ef38ffa2107e3a99d49610.tar.xz apk-tools-080fa825ddf932cf95ef38ffa2107e3a99d49610.zip |
implement --update-cache option
This will update the repository cache upon db_open.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 729d604..2b20c8f 100644 --- a/src/database.c +++ b/src/database.c @@ -1026,7 +1026,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t repository) struct apk_istream *is = NULL; struct apk_bstream *bs = NULL; struct apk_repository *repo; - int r, n; + int r, n = 1; if (repository.ptr == NULL || *repository.ptr == '\0' || *repository.ptr == '#') @@ -1045,9 +1045,13 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t repository) if (apk_url_local_file(repo->url) == NULL) { csum_blob(repository, repo->url_csum); + if (apk_flags & APK_UPDATE_CACHE) + n = apk_repository_update(db, repo); + bs = apk_db_cache_open(db, repo->url_csum, apk_index_gz); if (bs == NULL) { - n = apk_repository_update(db, repo); + if (n == 1) + n = apk_repository_update(db, repo); if (n < 0) return n; bs = apk_db_cache_open(db, repo->url_csum, |