[devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp
Alexey Tourbin
=?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Сб Фев 28 17:17:25 MSK 2009
On Tue, Feb 17, 2009 at 02:29:39AM +0300, Dmitry V. Levin wrote:
> On Mon, Feb 16, 2009 at 04:05:08PM +0300, Alexey Tourbin wrote:
> > On Mon, Feb 16, 2009 at 03:23:12PM +0300, Dmitry V. Levin wrote:
> > > On Mon, Feb 16, 2009 at 11:16:51AM +0300, Alexey Tourbin wrote:
> > > [...]
> > > > 0:1.0-alt1 cmp 1.0-alt2 should yield 1.
> > >
> > > Why?
> > >
> > > > Zero serial is greater than no serial.
> > >
> > > Why?
> >
> > This is because how rpm-4.0 works.
> >
> > lib/psm.c:
> > 72 int rpmVersionCompare(Header first, Header second)
>
> If rpmVersionCompare() works this way, why rpmEVRcmp() doesn't work the
> same way?
That's because rpmEVRcmp() is botched.
rpmdb/rpmvercmp.c:
155 /* Compare {A,B} [epoch:]version[-release] */
156 int
157 rpmEVRcmp(const char * const aE, const char * const aV, const char * const aR,
158 const char * const aDepend,
159 const char * const bE, const char * const bV, const char * const bR,
160 const char * const bDepend)
161 {
162 int sense = 0;
163
164 rpmMessage(RPMMESS_DEBUG, "cmp e=%s, v=%s, r=%s\n and e=%s, v=%s, r=%s\n ",
165 aE, aV, aR, bE, bV, bR);
166
167
168 if (aE && *aE && bE && *bE)
169 sense = rpmvercmp(aE, bE);
170 else if (aE && *aE && atol(aE) > 0) {
171 /* XXX legacy epoch-less requires/conflicts compatibility */
172 rpmMessage(RPMMESS_DEBUG, _("the \"B\" dependency needs an epoch (assuming same as \"A\")\n\tA %s\tB %s\n"),
173 aDepend, bDepend);
174 sense = 0;
175 } else if (bE && *bE && atol(bE) > 0)
176 sense = -1;
177
178 if (sense == 0) {
179 sense = rpmvercmp(aV, bV);
180 if (sense == 0 && aR && *aR && bR && *bR) {
181 sense = rpmvercmp(aR, bR);
182 }
183 }
184
185 return sense;
186 }
That is, rpmEVRcmp() does not exercise quite the same logic as
rpmVersionCompare().
> Let's fix librpm rather than multiply workarounds.
Prepending zero serial was wrong anyway.
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип : application/pgp-signature
Размер : 197 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url : <http://lists.altlinux.org/pipermail/devel/attachments/20090228/b5d6b596/attachment.bin>
Подробная информация о списке рассылки Devel