diff options
author | Timo Teräs <timo.teras@iki.fi> | 2018-01-03 15:17:11 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2018-01-03 16:00:38 +0200 |
commit | 039ff3bd466819909a5295a43e40947a9e0b6c16 (patch) | |
tree | 1f22b1a16dd752e48142a0c5aff0697fb100ea78 /src/database.c | |
parent | f90af35e9c563bd4f865d8d47a7ae357191494db (diff) | |
download | apk-tools-039ff3bd466819909a5295a43e40947a9e0b6c16.tar.gz apk-tools-039ff3bd466819909a5295a43e40947a9e0b6c16.tar.bz2 apk-tools-039ff3bd466819909a5295a43e40947a9e0b6c16.tar.xz apk-tools-039ff3bd466819909a5295a43e40947a9e0b6c16.zip |
split --force to several --force-[type] options
This unloads --force as several of the things are really not wanted
together. E.g. --force-refresh is a lot different from --force-broken-world
and doing --force to get the other might introduce unwanted behaviour.
--force is still kept for backwards compatibility and it enables
most things --force was used for.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/database.c b/src/database.c index 162ce1a..4ea4fb4 100644 --- a/src/database.c +++ b/src/database.c @@ -47,7 +47,7 @@ enum { }; int apk_verbosity = 1; -unsigned int apk_flags = 0; +unsigned int apk_flags = 0, apk_force = 0; static apk_blob_t tmpprefix = { .len=8, .ptr = ".apknew." }; @@ -633,7 +633,7 @@ int apk_cache_download(struct apk_database *db, struct apk_repository *repo, r = apk_repo_format_real_url(db, repo, pkg, url, sizeof(url)); if (r < 0) return r; - if ((apk_flags & APK_FORCE) || + if ((apk_force & APK_FORCE_REFRESH) || fstatat(db->cache_fd, cacheitem, &st, 0) != 0) st.st_mtime = 0; @@ -867,13 +867,13 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo) case 's': ipkg->broken_script = 1; break; case 'x': ipkg->broken_xattr = 1; break; default: - if (!(apk_flags & APK_FORCE)) + if (!(apk_force & APK_FORCE_OLD_APK)) goto old_apk_tools; } } break; default: - if (r != 0 && !(apk_flags & APK_FORCE)) + if (r != 0 && !(apk_force & APK_FORCE_OLD_APK)) goto old_apk_tools; /* Installed. So mark the package as installable. */ pkg->filename = NULL; @@ -2033,7 +2033,7 @@ int apk_db_check_world(struct apk_database *db, struct apk_dependency_array *wor struct apk_dependency *dep; int bad = 0, tag; - if (apk_flags & APK_FORCE) + if (apk_force & APK_FORCE_BROKEN_WORLD) return 0; foreach_array_item(dep, world) { @@ -2463,7 +2463,7 @@ static int apk_db_install_archive_entry(void *_ctx, if (pkg_prio >= 0) break; - if (!(apk_flags & APK_FORCE)) { + if (!(apk_force & APK_FORCE_OVERWRITE)) { apk_error(PKG_VER_FMT": trying to overwrite %s owned by "PKG_VER_FMT".", PKG_VER_PRINTF(pkg), ae->name, PKG_VER_PRINTF(opkg)); ipkg->broken_files = 1; |