summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-05-19 11:50:10 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-05-19 11:50:10 +0300
commit1dc70477b5e9b07808001093ec33d2530d1799e1 (patch)
treec725ea0196c7a4834da5fa73d164bd96acc3eeee
parent7e64edfad62da8e180f660820bfa7a2fc321a72a (diff)
downloadapk-tools-1dc70477b5e9b07808001093ec33d2530d1799e1.tar.gz
apk-tools-1dc70477b5e9b07808001093ec33d2530d1799e1.tar.bz2
apk-tools-1dc70477b5e9b07808001093ec33d2530d1799e1.tar.xz
apk-tools-1dc70477b5e9b07808001093ec33d2530d1799e1.zip
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.
-rw-r--r--src/apk_package.h3
-rw-r--r--src/commit.c3
-rw-r--r--src/database.c2
-rw-r--r--src/solver.c8
-rw-r--r--test/basic16.test8
5 files changed, 21 insertions, 3 deletions
diff --git a/src/apk_package.h b/src/apk_package.h
index 0d61e23..77b66c0 100644
--- a/src/apk_package.h
+++ b/src/apk_package.h
@@ -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 *);
diff --git a/src/commit.c b/src/commit.c
index 8766cc8..bf3b4a2 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -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;
diff --git a/src/database.c b/src/database.c
index 356ba22..3f1b6f6 100644
--- a/src/database.c
+++ b/src/database.c
@@ -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);
diff --git a/src/solver.c b/src/solver.c
index 2b35924..59edb1c 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -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);
diff --git a/test/basic16.test b/test/basic16.test
new file mode 100644
index 0000000..f23bd5d
--- /dev/null
+++ b/test/basic16.test
@@ -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