test: improve pinning tests
parent
1bb2fa7862
commit
4676c5d63a
13
src/apk.c
13
src/apk.c
|
@ -462,13 +462,16 @@ int main(int argc, char **argv)
|
|||
}
|
||||
for (i = 0; i < test_repos->num; i++) {
|
||||
struct apk_bstream *bs;
|
||||
char *fn = test_repos->item[i];
|
||||
apk_blob_t spec = APK_BLOB_STR(test_repos->item[i]), name, tag;
|
||||
int repo_tag = 0;
|
||||
if (fn[0] == '+') {
|
||||
repo_tag = apk_db_get_tag_id(&db, APK_BLOB_STR("testing"));
|
||||
fn++;
|
||||
|
||||
if (apk_blob_split(spec, APK_BLOB_STR(":"), &tag, &name)) {
|
||||
repo_tag = apk_db_get_tag_id(&db, tag);
|
||||
} else {
|
||||
name = spec;
|
||||
}
|
||||
bs = apk_bstream_from_file(AT_FDCWD, fn);
|
||||
|
||||
bs = apk_bstream_from_file(AT_FDCWD, name.ptr);
|
||||
if (bs != NULL) {
|
||||
apk_db_index_read(&db, bs, i);
|
||||
db.repo_tags[repo_tag].allowed_repos |= BIT(i);
|
||||
|
|
|
@ -356,7 +356,7 @@ static int get_topology_score(
|
|||
};
|
||||
|
||||
if (ss->solver_flags & APK_SOLVERF_AVAILABLE) {
|
||||
/* not upgrading: it is not preferred to change package */
|
||||
/* available preferred */
|
||||
if ((pkg->repos == 0) && ns->has_available_pkgs)
|
||||
score.non_preferred_actions++;
|
||||
} else if (ns->inherited_reinstall ||
|
||||
|
@ -364,6 +364,9 @@ static int get_topology_score(
|
|||
/* reinstall requested, but not available */
|
||||
if (!pkg_available(ss->db, pkg))
|
||||
score.non_preferred_actions++;
|
||||
} else if (ns->inherited_upgrade ||
|
||||
((ns->solver_flags_local|ss->solver_flags) & APK_SOLVERF_UPGRADE)) {
|
||||
/* upgrading - score is just locked here */
|
||||
} else if ((ns->inherited_upgrade == 0) &&
|
||||
((ns->solver_flags_local|ss->solver_flags) & APK_SOLVERF_UPGRADE) == 0 &&
|
||||
((ns->solver_flags_maybe & APK_SOLVERF_UPGRADE) == 0 || (ps->locked))) {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
C:Q1eVpkasfqZAukAXFYbgwt4xffZWU=
|
||||
P:a
|
||||
V:3
|
||||
S:1
|
||||
I:1
|
||||
D:b
|
||||
p:testing
|
||||
|
||||
C:Q1hdUpqRv5mYgJEqW52UmVsv23ysE=
|
||||
P:b
|
||||
V:3
|
||||
S:1
|
||||
I:1
|
||||
|
||||
C:Q1eVpkasfqZAukAXFYbg324xAt4WU=
|
||||
P:c
|
||||
V:3
|
||||
S:1
|
||||
I:1
|
||||
D:a>=3
|
||||
p:testing
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
C:Q1eVpkasfqZAukfffYbgwt4xffZWU=
|
||||
P:a
|
||||
V:3.1
|
||||
S:1
|
||||
I:1
|
||||
D:b
|
||||
|
||||
C:Q1hdUpqRv5mYgJEqff2UmVsv23ysE=
|
||||
P:b
|
||||
V:3.1
|
||||
S:1
|
||||
I:1
|
||||
|
||||
C:Q1eVpkasfqZAukAffYsd324xAt4WU=
|
||||
P:c
|
||||
V:3.1
|
||||
S:1
|
||||
I:1
|
||||
D:a>=3
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo +pinning.repo
|
||||
--test-repo testing:pinning.repo
|
||||
add a
|
||||
@EXPECT
|
||||
(1/2) Installing b (2)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo +pinning.repo
|
||||
--test-repo testing:pinning.repo
|
||||
add a@testing
|
||||
@EXPECT
|
||||
(1/2) Installing b (2)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo +pinning.repo
|
||||
--test-repo testing:pinning.repo
|
||||
add a@testing b@testing
|
||||
@EXPECT
|
||||
(1/2) Installing b@testing (3)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo +pinning.repo
|
||||
--test-repo testing:pinning.repo
|
||||
add c@testing
|
||||
@EXPECT
|
||||
(1/3) Installing b (2)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo testing:pinning.repo
|
||||
--test-repo testing:pinning.repo2
|
||||
--test-instdb pinning.installed
|
||||
--test-world "c@testing"
|
||||
add
|
||||
@EXPECT
|
||||
OK: 0 MiB in 3 packages
|
|
@ -0,0 +1,11 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo testing:pinning.repo
|
||||
--test-repo testing:pinning.repo2
|
||||
--test-instdb pinning.installed
|
||||
--test-world "c@testing"
|
||||
upgrade
|
||||
@EXPECT
|
||||
(1/2) Upgrading a@testing (3 -> 3.1)
|
||||
(2/2) Upgrading c@testing (3 -> 3.1)
|
||||
OK: 0 MiB in 3 packages
|
|
@ -0,0 +1,11 @@
|
|||
@ARGS
|
||||
--test-repo basic.repo
|
||||
--test-repo testing:pinning.repo
|
||||
--test-repo testing2:pinning.repo
|
||||
--test-instdb pinning.installed
|
||||
--test-world "c@testing"
|
||||
add c@testing2
|
||||
@EXPECT
|
||||
(1/2) Updating pinning a@testing2 (3)
|
||||
(2/2) Updating pinning c@testing2 (3)
|
||||
OK: 0 MiB in 3 packages
|
Loading…
Reference in New Issue