summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-12-07 10:41:13 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-12-07 12:50:32 +0000
commitc43bfed8deaa0dab47c54db9b8f374853d345a6b (patch)
tree0a257c0462ea99483946b142b1dd03424add1496 /src/database.c
parent14b74c4dc097ff71280e99edc651b685b9582950 (diff)
downloadapk-tools-c43bfed8deaa0dab47c54db9b8f374853d345a6b.tar.gz
apk-tools-c43bfed8deaa0dab47c54db9b8f374853d345a6b.tar.bz2
apk-tools-c43bfed8deaa0dab47c54db9b8f374853d345a6b.tar.xz
apk-tools-c43bfed8deaa0dab47c54db9b8f374853d345a6b.zip
db: add support for --no-cache
Implement --no-cache. The index is read directly from network and not cached. This is useful for docker, where you install a set of packages and directly after purge the cache. (see https://github.com/gliderlabs/docker-alpine/blob/1fc9e59d1689fc4eaf930ec66389fe58062fccec/builder/scripts/apk-install) fixes #4905
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 8a56401..31ac3e4 100644
--- a/src/database.c
+++ b/src/database.c
@@ -2198,7 +2198,13 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository)
if (apk_flags & APK_UPDATE_CACHE)
apk_repository_update(db, repo);
}
- r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo);
+ if (apk_flags & APK_NO_CACHE) {
+ r = apk_repo_format_real_url(db, repo, NULL, buf, sizeof(buf));
+ if (r == 0)
+ apk_message("fetch %s", buf);
+ } else {
+ r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo);
+ }
} else {
db->local_repos |= BIT(repo_num);
db->available_repos |= BIT(repo_num);