Skip to content

Commit

Permalink
prevent automatic repository index update for 'apk del'
Browse files Browse the repository at this point in the history
ref #9063
  • Loading branch information
fabled committed Jul 18, 2018
1 parent d609ef3 commit e1a05c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/apk_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/del.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit e1a05c7

Please sign in to comment.