prevent automatic repository index update for 'apk del'

ref #9063
cute-signatures
Timo Teräs 2018-07-18 13:28:49 +03:00
parent d609ef3c6c
commit e1a05c74cb
3 changed files with 7 additions and 4 deletions

View File

@ -156,7 +156,7 @@ struct apk_database {
unsigned int pending_triggers;
int performing_self_upgrade : 1;
int permanent : 1;
int open_write : 1;
int autoupdate : 1;
int open_complete : 1;
int compat_newfeatures : 1;
int compat_notinstallable : 1;
@ -211,6 +211,7 @@ struct apk_db_file *apk_db_file_query(struct apk_database *db,
#define APK_OPENF_NO_SYS_REPOS 0x0100
#define APK_OPENF_NO_INSTALLED_REPO 0x0200
#define APK_OPENF_CACHE_WRITE 0x0400
#define APK_OPENF_NO_AUTOUPDATE 0x0800
#define APK_OPENF_NO_REPOS (APK_OPENF_NO_SYS_REPOS | \
APK_OPENF_NO_INSTALLED_REPO)

View File

@ -1519,7 +1519,9 @@ 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->open_flags & APK_OPENF_WRITE) &&
!(dbopts->open_flags & APK_OPENF_NO_AUTOUPDATE))
db->autoupdate = 1;
if (!dbopts->cache_dir) dbopts->cache_dir = "etc/apk/cache";
apk_db_setup_repositories(db, dbopts->cache_dir);
@ -2266,7 +2268,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 {
if (db->open_write) apk_repository_update(db, repo);
if (db->autoupdate) apk_repository_update(db, repo);
r = apk_repo_format_cache_index(APK_BLOB_BUF(buf), repo);
}
} else {

View File

@ -161,7 +161,7 @@ static struct apk_applet apk_del = {
.name = "del",
.help = "Remove PACKAGEs from 'world' and uninstall them",
.arguments = "PACKAGE...",
.open_flags = APK_OPENF_WRITE,
.open_flags = APK_OPENF_WRITE | APK_OPENF_NO_AUTOUPDATE,
.command_groups = APK_COMMAND_GROUP_INSTALL,
.context_size = sizeof(struct del_ctx),
.optgroups = { &optgroup_global, &optgroup_commit, &optgroup_applet },