summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configure.c2
-rw-r--r--src/main.h11
-rw-r--r--src/packages.c22
-rw-r--r--src/remove.c5
-rw-r--r--src/trigproc.c4
5 files changed, 33 insertions, 11 deletions
diff --git a/src/configure.c b/src/configure.c
index 0da9723f6..99fc81634 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -608,7 +608,7 @@ deferred_configure(struct pkginfo *pkg)
vdew_nonambig));
}
- if (dependtry > 1)
+ if (dependtry >= DEPEND_TRY_CYCLES)
if (findbreakcycle(pkg))
sincenothing = 0;
diff --git a/src/main.h b/src/main.h
index d1b31b196..b0d08f9da 100644
--- a/src/main.h
+++ b/src/main.h
@@ -217,7 +217,16 @@ enum dep_check breakses_ok(struct pkginfo *pkg, struct varbuf *aemsgs);
void deferred_remove(struct pkginfo *pkg);
void deferred_configure(struct pkginfo *pkg);
-extern int sincenothing, dependtry;
+enum dependtry {
+ DEPEND_TRY_NORMAL = 1,
+ DEPEND_TRY_CYCLES = 2,
+ DEPEND_TRY_FORCE_DEPENDS_VERSION = 3,
+ DEPEND_TRY_FORCE_DEPENDS = 4,
+ DEPEND_TRY_LAST,
+};
+
+extern enum dependtry dependtry;
+extern int sincenothing;
/* from cleanup.c (most of these are declared in archives.h) */
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);
diff --git a/src/remove.c b/src/remove.c
index fb27341f6..75f9c0f86 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -71,7 +71,10 @@ static void checkforremoval(struct pkginfo *pkgtoremove,
pkg_name(depender, pnaw_always));
continue;
}
- if (dependtry > 1) { if (findbreakcycle(pkgtoremove)) sincenothing= 0; }
+ if (dependtry >= DEPEND_TRY_CYCLES) {
+ if (findbreakcycle(pkgtoremove))
+ sincenothing = 0;
+ }
varbuf_snapshot(raemsgs, &raemsgs_state);
ok= dependencies_ok(depender,pkgtoremove,raemsgs);
if (ok == DEP_CHECK_HALT &&
diff --git a/src/trigproc.c b/src/trigproc.c
index 14b0814a6..76d901176 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -390,7 +390,7 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type)
pkg_name(pkg, pnaw_always),
pkg_status_name(pkg));
- if (dependtry > 1) {
+ if (dependtry >= DEPEND_TRY_CYCLES) {
gaveup = check_trigger_cycle(pkg);
if (gaveup == pkg)
return;
@@ -436,7 +436,7 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type)
varbuf_destroy(&depwhynot);
}
- if (dependtry <= 1) {
+ if (dependtry < DEPEND_TRY_CYCLES) {
gaveup = check_trigger_cycle(pkg);
if (gaveup == pkg)
return;