summaryrefslogtreecommitdiff
path: root/src/test.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-10-29 05:18:21 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-10-29 05:18:21 +0300
commit500f8d4a7d7b17871647392e79e4c7a17c210534 (patch)
tree47d4b1cd04e374d88e26e352eeac9f51da083451 /src/test.c
parente682e6596c101d634b3780a98773c8433b3baadb (diff)
downloadapk-tools-500f8d4a7d7b17871647392e79e4c7a17c210534.tar.gz
apk-tools-500f8d4a7d7b17871647392e79e4c7a17c210534.tar.bz2
apk-tools-500f8d4a7d7b17871647392e79e4c7a17c210534.tar.xz
apk-tools-500f8d4a7d7b17871647392e79e4c7a17c210534.zip
solver, db: implement repository pinning
Improves /etc/apk/repositories format so you can say: http://nl.alpinelinux.org/alpine/v2.3/main @edge http://nl.alpinelinux.org/alpine/edge/main @testing http://nl.alpinelinux.org/alpine/edge/testing After which you can pin dependencies to these tags using: apk add stableapp newapp@edge bleedingapp@testing Apk will now by default only use the untagged repositories, but adding a tag to specific dependency: 1. will prefer that tag for the name 2. allowing pulling in dependencies from that tag (though, it prefers untagged packages to satisfy deps if possible) fixes #575
Diffstat (limited to 'src/test.c')
-rw-r--r--src/test.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/test.c b/src/test.c
index 9fc3e1f..29ee789 100644
--- a/src/test.c
+++ b/src/test.c
@@ -91,7 +91,7 @@ static inline void print_change(struct apk_package *oldpkg,
}
}
-static void print_dep_errors(char *label, struct apk_dependency_array *deps)
+static void print_dep_errors(struct apk_database *db, char *label, struct apk_dependency_array *deps)
{
int i, print_label = 1;
char buf[256];
@@ -110,7 +110,7 @@ static void print_dep_errors(char *label, struct apk_dependency_array *deps)
} else {
printf(" ");
}
- apk_blob_push_dep(&p, dep);
+ apk_blob_push_dep(&p, db, dep);
p = apk_blob_pushed(APK_BLOB_BUF(buf), p);
fwrite(p.ptr, p.len, 1, stdout);
}
@@ -131,12 +131,12 @@ static void print_errors_in_solution(struct apk_database *db, int unsatisfiable,
pkg->name->state_ptr = pkg;
}
- print_dep_errors("world", db->world);
+ print_dep_errors(db, "world", db->world);
for (i = 0; i < solution->num; i++) {
struct apk_package *pkg = solution->item[i];
char pkgtext[256];
snprintf(pkgtext, sizeof(pkgtext), PKG_VER_FMT, PKG_VER_PRINTF(solution->item[i]));
- print_dep_errors(pkgtext, pkg->depends);
+ print_dep_errors(db, pkgtext, pkg->depends);
}
}
@@ -153,6 +153,8 @@ static int test_main(void *pctx, struct apk_database *db, int argc, char **argv)
if (argc != 1)
return -EINVAL;
+ apk_db_get_tag_id(db, APK_BLOB_STR("testing"));
+
/* load installed db */
if (ctx->installed_db != NULL) {
bs = apk_bstream_from_file(AT_FDCWD, ctx->installed_db);
@@ -165,9 +167,16 @@ static int test_main(void *pctx, struct apk_database *db, int argc, char **argv)
/* load additional indexes */
if (ctx->repos) {
for (i = 0; i < ctx->repos->num; i++) {
- bs = apk_bstream_from_file(AT_FDCWD, ctx->repos->item[i]);
+ char *fn = ctx->repos->item[i];
+ int repo = 0;
+ if (fn[0] == '+') {
+ fn++;
+ repo = 1;
+ }
+ bs = apk_bstream_from_file(AT_FDCWD, fn);
if (bs != NULL) {
apk_db_index_read(db, bs, i);
+ db->repo_tags[repo].allowed_repos |= BIT(i);
bs->close(bs, NULL);
}
}