]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-rev-promote.patch
- new from mis
[packages/poldek.git] / poldek-rev-promote.patch
1 Index: pkg.c
2 ===================================================================
3 RCS file: /cvsroot/installer/poldek/pkg.c,v
4 retrieving revision 1.51.4.7
5 diff -u -r1.51.4.7 pkg.c
6 --- pkg.c       14 Aug 2004 21:28:12 -0000      1.51.4.7
7 +++ pkg.c       25 Aug 2004 14:31:55 -0000
8 @@ -21,7 +21,7 @@
9  #include <rpm/rpmlib.h>
10  #include <trurl/nstr.h>
11  #include <trurl/nassert.h>
12 -
13 +#define ENABLE_TRACE 0
14  #include "i18n.h"
15  #include "rpmadds.h"
16  #include "log.h"
17 @@ -716,13 +716,23 @@
18  
19  #define rel_not_match(cmprc, req) (rel_match(cmprc, req) == 0)
20  
21 +static void promote_epoch_warn(int verbose_level,
22 +                               const char *title0, const char *p0,
23 +                               const char *p1)
24 +{
25 +    if (verbose > verbose_level)
26 +        logn(LOGWARN, "%s '%s' needs an epoch (assuming same "
27 +             "epoch as %s)\n", title0, p0, p1);
28 +}
29 +
30 +
31  __inline__
32  int cap_match_req(const struct capreq *cap, const struct capreq *req,
33                    int strict)
34  {
35      register int cmprc = 0, evr = 0;
36  
37 -    DBGMSG_F("cap %s req %s\n", capreq_snprintf_s(cap), capreq_snprintf_s0(req));
38 +    DBGF("cap %s req %s\n", capreq_snprintf_s(cap), capreq_snprintf_s0(req));
39      
40      if (strcmp(capreq_name(cap), capreq_name(req)) != 0)
41          return 0;
42 @@ -730,11 +740,24 @@
43      if (!capreq_versioned(req))
44          return 1;
45  
46 -    if (capreq_has_epoch(cap)) {
47 -        if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
48 -            if (verbose > 2)
49 -                logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
50 -                     capreq_snprintf_s(req), capreq_snprintf_s0(cap));
51 +    if (capreq_has_epoch(cap) || capreq_has_epoch(req)) {
52 +        int promote = 0;
53 +        
54 +        if (poldek_conf_promote_epoch) {
55 +            if (!capreq_has_epoch(req)) {
56 +                promote_epoch_warn(1, "req", capreq_snprintf_s(req),
57 +                                   capreq_snprintf_s0(cap));
58 +                promote = 1;
59 +            }
60 +
61 +            if (!capreq_has_epoch(cap)) {
62 +                promote_epoch_warn(1, "cap", capreq_snprintf_s(cap),
63 +                                   capreq_snprintf_s0(req));
64 +                promote = 1;
65 +            }
66 +        }
67 +        
68 +        if (promote) {
69              cmprc = 0;
70              
71          } else {
72 @@ -744,10 +767,13 @@
73          }
74          evr = 1;
75          
76 -    } else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
77 +    }
78 +#if 0                           /* disabled autopromotion */
79 +    else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
80          cmprc = 0;
81          evr = 1;
82      }
83 +#endif    
84  
85  #if 0    
86      if (capreq_has_epoch(req)) {
87 @@ -799,11 +825,21 @@
88      if (promote_epoch == -1)
89          promote_epoch = poldek_conf_promote_epoch;
90  
91 -    if (pkg->epoch) {
92 +    if (pkg->epoch || capreq_has_epoch(req)) {
93 +        int promote = 0;
94          if (!capreq_has_epoch(req) && promote_epoch) {
95 -            if (verbose > 1)
96 -                logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
97 -                     capreq_snprintf_s(req), pkg_snprintf_epoch_s(pkg));
98 +            promote_epoch_warn(1, "req", capreq_snprintf_s(req),
99 +                               pkg_snprintf_epoch_s(pkg));
100 +            promote = 1;
101 +        } 
102 +
103 +        if (!pkg->epoch && capreq_epoch(req) > 0 && promote_epoch) {
104 +            promote_epoch_warn(1, "package", pkg_snprintf_epoch_s(pkg),
105 +                               capreq_snprintf_s(req));
106 +            promote = 1;
107 +        }
108 +
109 +        if (promote) {
110              cmprc = 0;
111              
112          } else {
113 @@ -813,11 +849,13 @@
114          }
115          evr = 1;
116          
117 -    } else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
118 +    }
119 +#if 0    /* disabled autopromotion */
120 +    else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
121          cmprc = 0;
122          evr = 1;
123      }
124 -    
125 +#endif    
126      
127      if (capreq_has_ver(req)) {
128          cmprc = rpmvercmp(pkg->ver, capreq_ver(req));
129 @@ -885,8 +923,8 @@
130  
131          cap = n_array_nth(pkg->caps, n);
132          if (cap_match_req(cap, req, strict)) {
133 -            DBGMSG("chk%d (%s-%s-%s) -> match (%d)\n", n, capreq_name(cap),
134 -                   capreq_ver(cap), capreq_rel(cap), strict);
135 +            DBGMSG("chk%d %s -> match (strict %d)\n", n,
136 +                   capreq_snprintf_s(cap), strict);
137              return 1;
138          }
139          n++;
140 @@ -896,21 +934,19 @@
141  
142              cap = n_array_nth(pkg->caps, n);
143              if (strcmp(capreq_name(cap), capreq_name(req)) != 0) {
144 -                DBGMSG("chk%d %s-%s-%s -> NOT match IRET\n", i,
145 -                       capreq_name(cap), capreq_ver(cap),
146 -                       capreq_rel(cap));
147 +                DBGMSG("chk%d %s -> NOT match IRET\n", i,
148 +                       capreq_snprintf_s(cap));
149                  return 0;
150              }
151                  
152                  
153              if (cap_match_req(cap, req, strict)) {
154 -                DBGMSG("chk %s-%s-%s -> match\n", capreq_name(cap),
155 -                       capreq_ver(cap), capreq_rel(cap));
156 +                DBGMSG("chk%d %s -> match (strict %d)\n", i,
157 +                       capreq_snprintf_s(cap), strict);
158                  return 1;
159              } else {
160 -                DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
161 -                       capreq_name(cap), capreq_ver(cap),
162 -                       capreq_rel(cap));
163 +                DBGMSG("chk%d %s -> match (strict %d)\n", i,
164 +                       capreq_snprintf_s(cap), strict);
165              }
166          }
167          DBGMSG("NONE\n");
168 @@ -1020,7 +1056,7 @@
169          cnfl = n_array_nth(pkg->cnfls, n);
170          
171          if (cnfl_is_obsl(cnfl) && pkg_match_req(opkg, cnfl, 1)) {
172 -            DBGMSG("chk%d (%s-%s-%s) -> match\n", n,
173 +            DBGMSG("chk%d %s -> match\n", n,
174                     capreq_snprintf_s(cnfl));
175              return 1;
176          }
177 @@ -1034,17 +1070,17 @@
178                  continue;
179              
180              if (strcmp(capreq_name(cnfl), pkg->name) != 0) {
181 -                DBGMSG("chk%d %s-%s-%s -> NOT match IRET\n", i,
182 +                DBGMSG("chk%d %s -> NOT match IRET\n", i,
183                         capreq_snprintf_s(cnfl));
184                  return 0;
185              }
186                  
187                  
188              if (pkg_match_req(opkg, cnfl, 1)) {
189 -                DBGMSG("chk %s-%s-%s -> match\n", capreq_snprintf_s(cnfl));
190 +                DBGMSG("chk %s -> match\n", capreq_snprintf_s(cnfl));
191                  return 1;
192              } else {
193 -                DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
194 +                DBGMSG("chk%d %s -> NOT match\n", i,
195                         capreq_snprintf_s(cnfl));
196              }
197          }
This page took 0.039628 seconds and 3 git commands to generate.