--- /dev/null
+Index: pkg.c
+===================================================================
+RCS file: /cvsroot/installer/poldek/pkg.c,v
+retrieving revision 1.51.4.7
+diff -u -r1.51.4.7 pkg.c
+--- pkg.c 14 Aug 2004 21:28:12 -0000 1.51.4.7
++++ pkg.c 25 Aug 2004 14:31:55 -0000
+@@ -21,7 +21,7 @@
+ #include <rpm/rpmlib.h>
+ #include <trurl/nstr.h>
+ #include <trurl/nassert.h>
+-
++#define ENABLE_TRACE 0
+ #include "i18n.h"
+ #include "rpmadds.h"
+ #include "log.h"
+@@ -716,13 +716,23 @@
+
+ #define rel_not_match(cmprc, req) (rel_match(cmprc, req) == 0)
+
++static void promote_epoch_warn(int verbose_level,
++ const char *title0, const char *p0,
++ const char *p1)
++{
++ if (verbose > verbose_level)
++ logn(LOGWARN, "%s '%s' needs an epoch (assuming same "
++ "epoch as %s)\n", title0, p0, p1);
++}
++
++
+ __inline__
+ int cap_match_req(const struct capreq *cap, const struct capreq *req,
+ int strict)
+ {
+ register int cmprc = 0, evr = 0;
+
+- DBGMSG_F("cap %s req %s\n", capreq_snprintf_s(cap), capreq_snprintf_s0(req));
++ DBGF("cap %s req %s\n", capreq_snprintf_s(cap), capreq_snprintf_s0(req));
+
+ if (strcmp(capreq_name(cap), capreq_name(req)) != 0)
+ return 0;
+@@ -730,11 +740,24 @@
+ if (!capreq_versioned(req))
+ return 1;
+
+- if (capreq_has_epoch(cap)) {
+- if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
+- if (verbose > 2)
+- logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
+- capreq_snprintf_s(req), capreq_snprintf_s0(cap));
++ if (capreq_has_epoch(cap) || capreq_has_epoch(req)) {
++ int promote = 0;
++
++ if (poldek_conf_promote_epoch) {
++ if (!capreq_has_epoch(req)) {
++ promote_epoch_warn(1, "req", capreq_snprintf_s(req),
++ capreq_snprintf_s0(cap));
++ promote = 1;
++ }
++
++ if (!capreq_has_epoch(cap)) {
++ promote_epoch_warn(1, "cap", capreq_snprintf_s(cap),
++ capreq_snprintf_s0(req));
++ promote = 1;
++ }
++ }
++
++ if (promote) {
+ cmprc = 0;
+
+ } else {
+@@ -744,10 +767,13 @@
+ }
+ evr = 1;
+
+- } else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
++ }
++#if 0 /* disabled autopromotion */
++ else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
+ cmprc = 0;
+ evr = 1;
+ }
++#endif
+
+ #if 0
+ if (capreq_has_epoch(req)) {
+@@ -799,11 +825,21 @@
+ if (promote_epoch == -1)
+ promote_epoch = poldek_conf_promote_epoch;
+
+- if (pkg->epoch) {
++ if (pkg->epoch || capreq_has_epoch(req)) {
++ int promote = 0;
+ if (!capreq_has_epoch(req) && promote_epoch) {
+- if (verbose > 1)
+- logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
+- capreq_snprintf_s(req), pkg_snprintf_epoch_s(pkg));
++ promote_epoch_warn(1, "req", capreq_snprintf_s(req),
++ pkg_snprintf_epoch_s(pkg));
++ promote = 1;
++ }
++
++ if (!pkg->epoch && capreq_epoch(req) > 0 && promote_epoch) {
++ promote_epoch_warn(1, "package", pkg_snprintf_epoch_s(pkg),
++ capreq_snprintf_s(req));
++ promote = 1;
++ }
++
++ if (promote) {
+ cmprc = 0;
+
+ } else {
+@@ -813,11 +849,13 @@
+ }
+ evr = 1;
+
+- } else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
++ }
++#if 0 /* disabled autopromotion */
++ else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
+ cmprc = 0;
+ evr = 1;
+ }
+-
++#endif
+
+ if (capreq_has_ver(req)) {
+ cmprc = rpmvercmp(pkg->ver, capreq_ver(req));
+@@ -885,8 +923,8 @@
+
+ cap = n_array_nth(pkg->caps, n);
+ if (cap_match_req(cap, req, strict)) {
+- DBGMSG("chk%d (%s-%s-%s) -> match (%d)\n", n, capreq_name(cap),
+- capreq_ver(cap), capreq_rel(cap), strict);
++ DBGMSG("chk%d %s -> match (strict %d)\n", n,
++ capreq_snprintf_s(cap), strict);
+ return 1;
+ }
+ n++;
+@@ -896,21 +934,19 @@
+
+ cap = n_array_nth(pkg->caps, n);
+ if (strcmp(capreq_name(cap), capreq_name(req)) != 0) {
+- DBGMSG("chk%d %s-%s-%s -> NOT match IRET\n", i,
+- capreq_name(cap), capreq_ver(cap),
+- capreq_rel(cap));
++ DBGMSG("chk%d %s -> NOT match IRET\n", i,
++ capreq_snprintf_s(cap));
+ return 0;
+ }
+
+
+ if (cap_match_req(cap, req, strict)) {
+- DBGMSG("chk %s-%s-%s -> match\n", capreq_name(cap),
+- capreq_ver(cap), capreq_rel(cap));
++ DBGMSG("chk%d %s -> match (strict %d)\n", i,
++ capreq_snprintf_s(cap), strict);
+ return 1;
+ } else {
+- DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
+- capreq_name(cap), capreq_ver(cap),
+- capreq_rel(cap));
++ DBGMSG("chk%d %s -> match (strict %d)\n", i,
++ capreq_snprintf_s(cap), strict);
+ }
+ }
+ DBGMSG("NONE\n");
+@@ -1020,7 +1056,7 @@
+ cnfl = n_array_nth(pkg->cnfls, n);
+
+ if (cnfl_is_obsl(cnfl) && pkg_match_req(opkg, cnfl, 1)) {
+- DBGMSG("chk%d (%s-%s-%s) -> match\n", n,
++ DBGMSG("chk%d %s -> match\n", n,
+ capreq_snprintf_s(cnfl));
+ return 1;
+ }
+@@ -1034,17 +1070,17 @@
+ continue;
+
+ if (strcmp(capreq_name(cnfl), pkg->name) != 0) {
+- DBGMSG("chk%d %s-%s-%s -> NOT match IRET\n", i,
++ DBGMSG("chk%d %s -> NOT match IRET\n", i,
+ capreq_snprintf_s(cnfl));
+ return 0;
+ }
+
+
+ if (pkg_match_req(opkg, cnfl, 1)) {
+- DBGMSG("chk %s-%s-%s -> match\n", capreq_snprintf_s(cnfl));
++ DBGMSG("chk %s -> match\n", capreq_snprintf_s(cnfl));
+ return 1;
+ } else {
+- DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
++ DBGMSG("chk%d %s -> NOT match\n", i,
+ capreq_snprintf_s(cnfl));
+ }
+ }