Hi rpm-4 and rpm-5,

while implementing virtual triggers I stumbled over the fact
that conflicts on files only work in one direction. Example:

Package A contains /foo
Package B has "Conflicts: /foo"

If A is already installed and one tries to install B, a dependency
conflict is reported:
    error: Failed dependencies:
            /foo conflicts with B-1-1.i586

If B is already installed and one tries to install A, no error
is displayed and the package is installed.

So, is this a known bug? Is it worth fixing?

If this needs fixing, here's an idea: As it probably costs too
much time to test each file in the file list for conflicts, how
about creating a index of the conflicts first and only test
the files that match the index?

I.e. add a function

char *rpmdbKeyIterator(rpmdbMatchIterator mi) {
    int rc, xx;
    dbiIndex dbi; 

    dbi = dbiOpen(mi->mi_db, mi->mi_rpmtag, 0);
    if (mi->mi_dbc == NULL)
        xx = dbiCopen(dbi, dbi->dbi_txnid, &mi->mi_dbc, mi->mi_cflags);
    rc = dbiGet(dbi, mi->mi_dbc, &mi->mi_key, &mi->mi_data, DB_NEXT);
    if (rc) 
        return 0;
    if (mi->mi_keyp)
        free((char *)mi->mi_keyp);
    mi->mi_keyp = (void *)xmalloc(mi->mi_key.size + 1);
    memcpy((char *)mi->mi_keyp, mi->mi_key.data, mi->mi_key.size);
    ((char *)mi->mi_keyp)[mi->mi_key.size] = 0; 
    mi->mi_keylen = mi->mi_key.size;
    return (char *)mi->mi_keyp;
}

to rpmdb.c, then use

    mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, 0, 0);
    while ((key = rpmdbKeyIterator(mi)) != 0)
      ...

to create an array of basenames, sort it and then go through the
filelist and match only if bsearch for the basename returns true.

Thoughts?

Cheers,
  Michael.

-- 
Michael Schroeder                                   [EMAIL PROTECTED]
SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
https://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to