summaryrefslogtreecommitdiff
path: root/src/packages.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/packages.c')
-rw-r--r--src/packages.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/packages.c b/src/packages.c
index f735ec3e1..7ca003433 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -49,7 +49,8 @@
static struct pkginfo *progress_bytrigproc;
static struct pkg_queue queue = PKG_QUEUE_INIT;
-int sincenothing = 0, dependtry = 1;
+enum dependtry dependtry = DEPEND_TRY_NORMAL;
+int sincenothing = 0;
void
enqueue_package(struct pkginfo *pkg)
@@ -231,7 +232,7 @@ void process_queue(void) {
* trigger processing, w/o jumping into the next dependtry. */
dependtry++;
sincenothing = 0;
- if (dependtry > 4)
+ if (dependtry >= DEPEND_TRY_LAST)
internerr("exceeded dependtry %d (sincenothing=%d; queue.length=%d)",
dependtry, sincenothing, queue.length);
} else if (sincenothing > queue.length * 2 + 2) {
@@ -243,7 +244,7 @@ void process_queue(void) {
} else {
dependtry++;
sincenothing = 0;
- if (dependtry > 4)
+ if (dependtry >= DEPEND_TRY_LAST)
internerr("exceeded dependtry %d (sincenothing=%d, queue.length=%d)",
dependtry, sincenothing, queue.length);
}
@@ -349,6 +350,15 @@ enum found_status {
FOUND_OK = 3,
};
+static enum found_status
+found_forced_on(enum dependtry dependtry_forced)
+{
+ if (dependtry >= dependtry_forced)
+ return FOUND_FORCED;
+ else
+ return FOUND_DEFER;
+}
+
/*
* Return values:
* 0: cannot be satisfied.
@@ -406,7 +416,7 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
pkg_name(possdependee, pnaw_always),
versiondescribe(&provider->version, vdew_nonambig));
if (fc_dependsversion)
- thisf = (dependtry >= 3) ? FOUND_FORCED : FOUND_DEFER;
+ thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION);
debug(dbg_depcondetail, " bad version");
goto unsuitable;
}
@@ -419,7 +429,7 @@ deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby,
versiondescribe(&possdependee->installed.version,
vdew_nonambig));
if (fc_dependsversion)
- thisf = (dependtry >= 3) ? FOUND_FORCED : FOUND_DEFER;
+ thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION);
debug(dbg_depcondetail, " bad version");
goto unsuitable;
}
@@ -688,7 +698,7 @@ dependencies_ok(struct pkginfo *pkg, struct pkginfo *removing,
if (thisf > found) found= thisf;
}
if (fc_depends) {
- thisf = (dependtry >= 4) ? FOUND_FORCED : FOUND_DEFER;
+ thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS);
if (thisf > found) {
found = thisf;
debug(dbg_depcondetail, " rescued by force-depends, found %d", found);