[devel] Сборка новой версии после использования epoch

Ivan Zakharyaschev imz на altlinux.org
Ср Фев 12 23:10:44 MSK 2020


On Wed, 12 Feb 2020, Mikhail Novosyolov wrote:

> 12.02.2020 22:05, Mikhail Novosyolov пишет:
> > 12.02.2020 13:58, Ivan Zakharyaschev пишет:
> >>> Спасибо за пояснение. Это бы еще где-то документировать...
> >> Предлагайте изменения, вносите изменения, если есть желание.
> > Даже если бы было большое желание таким заняться, чтобы это описать, 
> > пришлось бы изучить код альтовского форка rpm и apt. При чем очень 
> > тщательно. А это почти невозможно, нюансы пропустятся.
> >
> > То есть я бы не стал ждать, что сообщество напишет подобную документацию.
> >
> Впрочем, Вы уже сами в предыдущих письмах документировали это поведение, 
> но большинство людей не попадут на эти тексты, поскольку, чтобы туда 
> попасть, потребуется весьма специфических поисковый запрос.

Предлагайте место, куда скопировать (где бы Вы нашли с большой 
вероятностью), или сами скопируйте, если есть желание.

Ещё это было описано в changelog (то, что касается отношения 
обновляемости между пакетами):

* Вт июн 11 2019 Ivan Zakharyaschev <imz на altlinux.org> 4.13.0.1-alt9
- lib: introduced rpmEVRDTCompare() (useful for APT).
- Changes in what is considered "newer" by rpm -U  pertaining to disttag
  comparison. (On the whole, to determine which package is "newer", first,
  the EVRs are compared, then the branch prefixes of the disttags if the
  disttags are present, and then the buildtimes.) The comparison of the disttags:
  + Before the comparison of disttags, an optional initial padding
    (which is terminated by :) is skipped. (This will be useful for
    generating >,<-deps compatible with disttag-unaware rpm & apt.)
  + If a disttag contains no + separator (old format), the branch prefix is
    assumed to be empty (and hence "older" than any other branch prefix).
  + If the branch prefix of a disttag is equal to %_priority_distbranch
    (and it is not empty), then it is "newer" than any other ones.
  + The branch prefixes of disttags are ordered by rpmvercmp() rather than
    lexicographically. (For example, the numeric parts of "p8" or "p10" are
    compared as numbers. However, the first letter in "p7" or "c8.1" is more
    significant.)
- Give a default value to %_priority_distbranch based on the disttag
  when this package is built (the prefix before +),
  i.e., the current repo branch by default.
  (Useful for getting the rpm tool with good behavior in branches (like p9)
  forked off Sisyphus after disttags were introduced.)

Также исходный код этой функции довольно понятен и даёт точное описание 
алгоритма обновляемости, которое я описывал словами вчера:

http://git.altlinux.org/gears/r/rpm.git?p=rpm.git;a=blob;f=lib/rpmvercmp.c;h=93bb4ff644e92460b331d57bd06d5a368d9b1eb6;hb=31123348f4c6b33563ffc986d0ba4db57c7477f5#l203

/* Decide which package is "newer" (for upgrade).
 */
int rpmEVRDTCompare(const struct rpmEVRDT * const fst,
                    const struct rpmEVRDT * const snd)
{
    int rc = 0; /* same "new" (an upgrade in neither direction is possible) */

    rc = rpm_cmp_uint(fst->has_epoch ? fst->epoch : 0,
                      snd->has_epoch ? snd->epoch : 0);

    if (rc) return rc;

    if (!fst->version && snd->version)
        rc = -1;
    if (fst->version && !snd->version)
        rc = 1;
    if (fst->version && snd->version)
        rc = rpmvercmp(fst->version,
                       snd->version);

    if (rc) return rc;

    if (!fst->release && snd->release)
        rc = -1;
    if (fst->release && !snd->release)
        rc = 1;
    if (fst->release && snd->release)
        rc = rpmvercmp(fst->release,
                       snd->release);

    if (rc) return rc;

    /* NB: if one of disttags is absent, we don't decide based on the disttags;
       rather we fallback to the decision based on the buildtimes.
    */
    if (fst->disttag && snd->disttag)
        rc = rpm_cmp_disttag(fst->disttag,
                             snd->disttag);

    if (rc) return rc;

    if (upgrade_honor_buildtime()) {
        /* Currently an absent buildtime is treated as the least one.
           Another possibility could be to skip buildtime comparison then.
           However, the current treatment is good for the work of hsh --with-stuff
           in case when buildtime is absent in the non-local repo indexes.
        */
        if (!fst->has_buildtime && snd->has_buildtime)
            rc = -1;
        if (fst->has_buildtime && !snd->has_buildtime)
            rc = 1;
        if (fst->has_buildtime && snd->has_buildtime)
            rc = rpm_cmp_uint(fst->buildtime,
                              snd->buildtime);
    }

    return rc;
}


-- 
Best regards,
Ivan


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