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.
cute-signatures
Timo Teräs 2014-05-19 11:50:10 +03:00
parent 7e64edfad6
commit 1dc70477b5
5 changed files with 21 additions and 3 deletions

View File

@ -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 *);

View File

@ -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;

View File

@ -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);

View File

@ -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);

8
test/basic16.test Normal file
View File

@ -0,0 +1,8 @@
@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