Commit 1dc70477 authored by Timo Teräs's avatar Timo Teräs

solver: fix installation of non-repository packages during tmpfs boot

allow packages in the cache's installed to be selected for installation
by the solver. add test case for the issue.
parent 7e64edfa
......@@ -114,9 +114,10 @@ struct apk_package {
struct apk_dependency_array *depends, *install_if, *provides;
size_t installed_size, size;
time_t build_time;
unsigned repos : APK_MAX_REPOS;
unsigned marked : 1;
unsigned uninstallable : 1;
unsigned repos : APK_MAX_REPOS;
unsigned cached_non_repository : 1;
struct apk_checksum csum;
};
APK_ARRAY(apk_package_array, struct apk_package *);
......
......@@ -379,6 +379,9 @@ static void print_pinning_errors(struct print_state *ps, struct apk_package *pkg
if (!(pkg->repos & db->available_repos)) {
label_start(ps, "masked in:");
apk_print_indented_fmt(&ps->i, "--no-network");
} else if (pkg->repos == BIT(APK_REPOSITORY_CACHED)) {
label_start(ps, "masked in:");
apk_print_indented_fmt(&ps->i, "cache");
} else {
if (pkg->repos & apk_db_get_pinning_mask_repos(db, APK_DEFAULT_PINNING_MASK | BIT(tag)))
return;
......
......@@ -760,6 +760,8 @@ int apk_db_index_read(struct apk_database *db, struct apk_bstream *bs, int repo)
if (repo >= 0) {
pkg->repos |= BIT(repo);
} else if (repo == -2) {
pkg->cached_non_repository = 1;
} else if (repo == -1 && ipkg == NULL) {
/* Installed package without files */
ipkg = apk_pkg_install(db, pkg);
......
......@@ -197,6 +197,7 @@ static void discover_name(struct apk_solver_state *ss, struct apk_name *name)
* or it's a 'virtual' package with install_size zero */
pkg->ss.pkg_selectable =
(pkg->repos & db->available_repos) ||
pkg->cached_non_repository ||
pkg->ipkg;
/* Prune install_if packages that are no longer available,
......@@ -212,8 +213,11 @@ static void discover_name(struct apk_solver_state *ss, struct apk_name *name)
pkg->ss.tag_preferred =
(pkg->filename != NULL) ||
(pkg->installed_size == 0) ||
!!(repos & ss->default_repos);
pkg->ss.tag_ok = pkg->ss.tag_preferred || pkg->ipkg;
(repos & ss->default_repos);
pkg->ss.tag_ok =
pkg->ss.tag_preferred ||
pkg->cached_non_repository ||
pkg->ipkg;
foreach_array_item(dep, pkg->depends) {
discover_name(ss, dep->name);
......
@ARGS
--no-network
--test-repo !basic.repo
add a
@EXPECT
(1/2) Installing b (2)
(2/2) Installing a (2)
OK: 0 MiB in 0 packages
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment