]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Use buildversion for comparison if two versions are identical
authorMichael Schroeder <mls@suse.de>
Tue, 9 Apr 2019 14:32:01 +0000 (16:32 +0200)
committerMichael Schroeder <mls@suse.de>
Tue, 9 Apr 2019 14:32:01 +0000 (16:32 +0200)
ext/repo_testcase.c
src/policy.c

index 11a46728938028c968bfcb100ef4772946349fa7..48d8a0eda14d5a130fba02b07a1eed3c623721e2 100644 (file)
@@ -469,6 +469,9 @@ testcase_write_testtags(Repo *repo, FILE *fp)
          for (i = 0; i < q.count; i++)
            fprintf(fp, "=Flv: %s\n", pool_id2str(pool, q.elements[i]));
        }
+      tmp = solvable_lookup_str(s, SOLVABLE_BUILDVERSION);
+      if (tmp)
+        fprintf(fp, "=Bvr: %s\n", tmp);
       ti = solvable_lookup_num(s, SOLVABLE_BUILDTIME, 0);
       if (ti)
        fprintf(fp, "=Tim: %u\n", ti);
@@ -690,6 +693,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags)
        case 'F' << 16 | 'l' << 8 | 'v':
          repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_BUILDFLAVOR, line + 6);
          break;
+       case 'B' << 16 | 'v' << 8 | 'r':
+         repodata_set_str(data, s - pool->solvables, SOLVABLE_BUILDVERSION, line + 6);
+         break;
         default:
          break;
         }
index 5f6111520efd157e273c3eb92b4e8575adeffb63..9e42a876b102f010726ac7f7622b3d065c0bb7b6 100644 (file)
@@ -831,6 +831,19 @@ move_installed_to_front(Pool *pool, Queue *plist)
     }
 }
 
+static int
+pool_buildversioncmp(Pool *pool, Solvable *s1, Solvable *s2)
+{
+  const char *bv2, *bv1 = solvable_lookup_str(s1, SOLVABLE_BUILDVERSION);
+  if (bv1)
+    {
+      bv2 = solvable_lookup_str(s2, SOLVABLE_BUILDVERSION);
+      if (bv1 != bv2)
+       return pool_evrcmp_str(pool, bv1, bv2, EVRCMP_COMPARE);
+    }
+  return 0;
+}
+
 /*
  * prune_to_best_version
  *
@@ -878,6 +891,8 @@ prune_to_best_version(Pool *pool, Queue *plist)
       if (r == 0 && has_package_link(pool, s))
         r = pool_link_evrcmp(pool, best, s);
 #endif
+      if (r == 0 && pool->disttype == DISTTYPE_CONDA)
+       r = pool_buildversioncmp(pool, best, s);
       if (r < 0)
        best = s;
     }