--- /dev/null
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of Novell nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* bitmap.c
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* bitmap.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* evr.c
*
* version compare
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* evr.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* hash.h
* generic hash functions
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* Generic policy interface for SAT solver
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* Generic policy interface for SAT solver
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* pool.c
*
* The pool contains information about solvables
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* pool.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* poolarch.c
*
* create architecture policies
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#ifndef POOLARCH_H
#define POOLARCH_H
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* poolid.c
*
* Id management
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* poolid.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* poolid_private.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* pooltypes.h
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#ifndef POOLVENDOR_H
#define POOLVENDOR_H
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* queue.c
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* queue.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo.c
*
* Manage metadata coming from one repository
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_solv.c
*
* Read the binary dump of a Repo and create a Repo * from it
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_solv.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* solvable.h
*
* A solvable represents an object with name-epoch:version-release.arch and dependencies
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* solver.c
*
* SAT based dependency solver
return 0;
}
+static inline int
+is_supplemented(Solver *solv, Solvable *s)
+{
+ Id sup, *supp;
+ if (!s->supplements && !s->freshens)
+ return 0;
+ if (s->supplements)
+ {
+ supp = s->repo->idarraydata + s->supplements;
+ while ((sup = *supp++) != 0)
+ if (dep_fulfilled(solv, sup))
+ break;
+ if (!sup)
+ return 0;
+ }
+ if (s->freshens)
+ {
+ supp = s->repo->idarraydata + s->freshens;
+ while ((sup = *supp++) != 0)
+ if (dep_fulfilled(solv, sup))
+ break;
+ if (!sup)
+ return 0;
+ }
+ return 1;
+}
+
static void
prune_to_highest_prio(Pool *pool, Queue *plist)
{
Pool *pool = solv->pool;
int i, j;
Solvable *s;
- Id p, *pp, sup, *supp, rec, *recp, sug, *sugp, enh, *enhp;
+ Id p, *pp, rec, *recp, sug, *sugp, enh, *enhp;
if (solv->recommends_index < 0)
{
plist->elements[j++] = p;
continue;
}
- s = pool->solvables + p;
- if (!s->supplements && !s->freshens)
- continue;
- if (s->supplements)
- {
- supp = s->repo->idarraydata + s->supplements;
- while ((sup = *supp++) != 0)
- if (dep_fulfilled(solv, sup))
- break;
- if (!sup)
- continue;
- }
- if (s->freshens)
- {
- supp = s->repo->idarraydata + s->freshens;
- while ((sup = *supp++) != 0)
- if (dep_fulfilled(solv, sup))
- break;
- if (!sup)
- continue;
- }
- plist->elements[j++] = s - pool->solvables;
+ if (is_supplemented(solv, pool->solvables + p))
+ plist->elements[j++] = p;
}
if (j)
plist->count = j;
solv->decisionq_why.count--;
solv->propagate_index = solv->decisionq.count;
}
- while (solv->minimize.count && solv->minimize.elements[solv->minimize.count - 1] < -level)
+ while (solv->minimize.count && solv->minimize.elements[solv->minimize.count - 1] <= -level)
{
solv->minimize.count--;
while (solv->minimize.count && solv->minimize.elements[solv->minimize.count - 1] >= 0)
int systemlevel;
int level, olevel;
Rule *r;
- int i, n;
+ int i, j, n;
Solvable *s;
Pool *pool = solv->pool;
Id p, *dp;
prune_to_recommended(solv, &dq);
if (dq.count > 1)
prune_best_version_arch(pool, &dq);
+ j = 0;
if (dq.count > 1)
{
- int j;
- for (j = 1; j < dq.count; j++)
- queue_push(&solv->minimize, dq.elements[j]);
- queue_push(&solv->minimize, -level);
+ /* choose the supplemented one */
+ for (j = 0; j < dq.count; j++)
+ if (is_supplemented(solv, pool->solvables + dq.elements[j]))
+ break;
+ if (j == dq.count)
+ {
+ for (j = 1; j < dq.count; j++)
+ queue_push(&solv->minimize, dq.elements[j]);
+ queue_push(&solv->minimize, -level);
+ j = 0;
+ }
}
- p = dq.elements[0];
+ p = dq.elements[j];
s = pool->solvables + p;
#if 0
printf("installing %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
}
else
{
- Id *supp, sup;
s = pool->solvables + i;
if (!s->supplements && !s->freshens)
continue;
if (!pool_installable(pool, s))
continue;
- if (s->supplements)
- {
- supp = s->repo->idarraydata + s->supplements;
- while ((sup = *supp++) != 0)
- if (dep_fulfilled(solv, sup))
- break;
- if (!sup)
- continue;
- }
- if (s->freshens)
- {
- supp = s->repo->idarraydata + s->freshens;
- while ((sup = *supp++) != 0)
- if (dep_fulfilled(solv, sup))
- break;
- if (!sup)
- continue;
- }
- queue_pushunique(&dq, i);
+ if (is_supplemented(solv, s))
+ queue_pushunique(&dq, i);
}
}
if (dq.count)
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* solver.h
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* util.h
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#ifndef ATTR_STORE_H
#define ATTR_STORE_H
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#ifndef ATTR_STORE_P_H
#define ATTR_STORE_P_H
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* helix2solv.c
*
* parse 'helix' type xml and write out .solv file
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* mergesolv
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
Repo * pool_addrepo_content(Pool *pool, FILE *fp);
-/* -*- mode: C; c-file-style: "gnu"; fill-column: 78 -*- */
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
/*
* repo_helix.c
*
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_helix.h
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
extern Repo *pool_addrepo_patchxml(Pool *pool, FILE *fp);
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_rpmdb
*
* convert rpm db to repo
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
extern Repo *pool_addrepo_rpmdb(Pool *pool, Repo *ref);
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
extern Repo *pool_addrepo_rpmmd(Pool *pool, FILE *fp);
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
extern Repo *pool_addrepo_susetags(Pool *pool, FILE *fp, Id vendor, int with_attr);
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_write.c
*
* Write Repo data out to binary file
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* repo_write.h
*
*/
/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
* rpmdb2solv
*
*/
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
#include <sys/types.h>
#include <limits.h>
#include <fcntl.h>