[devel] gb-task-repo-vercheck (vercheck): Use rpmevrcmp

Alexey Tourbin =?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Пн Фев 16 16:05:08 MSK 2009


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)
    73  {
    74      const char * one, * two;
    75      int_32 * epochOne, * epochTwo;
    76      int rc;
    77  
    78      if (!headerGetEntry(first, RPMTAG_EPOCH, NULL, (void **) &epochOne, NULL))
    79          epochOne = NULL;
    80      if (!headerGetEntry(second, RPMTAG_EPOCH, NULL, (void **) &epochTwo,
    81                          NULL))
    82          epochTwo = NULL;
    83  
    84      if (epochOne && !epochTwo)
    85          return 1;
    86      else if (!epochOne && epochTwo)
    87          return -1;
    88      else if (epochOne && epochTwo) {
    89          if (*epochOne < *epochTwo)
    90              return -1;
    91          else if (*epochOne > *epochTwo)
    92              return 1;
    93      }
    94  
    95      rc = headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
    96      rc = headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
    97  
    98      rc = rpmvercmp(one, two);
    99      if (rc)
   100          return rc;
   101  
   102      (void) headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
   103      (void) headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
   104  
   105      rc = rpmvercmp(one, two);
   106      if (rc)
   107          return rc;
   108  
   109      if (upgrade_honor_buildtime())
   110          return rpmBuildTimeCompare(first, second);
   111  
   112      return 0;
   113  }

Thus, rpm will not upgrade a package (by default), and apt-rpm will
not consider an upgrade, if zero serial gets removed (and, say,
release number is increased).

Let's try to remove zero serial from e.g. kbd and see what happens.
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?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/20090216/5bdde657/attachment.bin>


Подробная информация о списке рассылки Devel