diff options
author | Timo Teräs <timo.teras@iki.fi> | 2018-01-08 11:45:09 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2018-01-08 11:56:48 +0200 |
commit | 5f7dcadc691f4064464be02427fa6e7fd61888f1 (patch) | |
tree | 69a9a9c8fcb1b2e32ee94a5a3997d6e169128ec2 /src/database.c | |
parent | d0a25d670a35583701f07196d5ed2ba51eab9f3a (diff) | |
download | apk-tools-5f7dcadc691f4064464be02427fa6e7fd61888f1.tar.gz apk-tools-5f7dcadc691f4064464be02427fa6e7fd61888f1.tar.bz2 apk-tools-5f7dcadc691f4064464be02427fa6e7fd61888f1.tar.xz apk-tools-5f7dcadc691f4064464be02427fa6e7fd61888f1.zip |
auto-update index only when database is opened for writing
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c index df06ade..3976d3d 100644 --- a/src/database.c +++ b/src/database.c @@ -1517,6 +1517,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) r = -1; goto ret_r; } + if (dbopts->open_flags & APK_OPENF_WRITE) db->open_write = 1; if (!dbopts->cache_dir) dbopts->cache_dir = "etc/apk/cache"; apk_db_setup_repositories(db, dbopts->cache_dir); @@ -2263,7 +2264,7 @@ int apk_db_add_repository(apk_database_t _db, apk_blob_t _repository) r = apk_repo_format_real_url(db, repo, NULL, buf, sizeof(buf)); if (r == 0) apk_message("fetch %s", buf); } else { - apk_repository_update(db, repo); + if (db->open_write) apk_repository_update(db, repo); r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo); } } else { |