src/suse.c
/*
 * pool_trivial_installable - calculate if a set of solvables is
 * trivial installable without any other installs/deinstalls of
 * packages not belonging to the set.
 *
 * the state is returned in the result queue:
 * 1:  solvable is installable without any other package changes
 * 0:  solvable is not installable
 * -1: solvable is installable, but doesn't constrain any installed packages
 */
calculate if a set of solvables is
trivial installable without any other installs/deinstalls of
packages not belonging to the set.

the state is returned in the result queue:
1:  solvable is installable without any other package changes
0:  solvable is not installable
-1: solvable is installable, but doesn't constrain any installed packages
calculate if a set of solvables is trivial installable without any other installs / deinstalls of packages not belonging to the set . the state is returned in the result queue : 1 : solvable is installable without any other package changes 0 : solvable is not installable - 1 : solvable is installable but doesn ' t constrain any installed packages
void
pool_trivial_installable_multiversionmap(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res, Map *multiversionmap)
{
  int i, r, m, did;
  Id p, *dp, con, *conp, req, *reqp;
  unsigned char *map;
  Solvable *s;
  map = solv_calloc(pool->nsolvables, 1);
  for (p = 1; p < pool->nsolvables; p++)
    {
      if (!MAPTST(installedmap, p))
	continue;
      map[p] |= 9;
      s = pool->solvables + p;
      if (!s->conflicts)
	continue;
      conp = s->repo->idarraydata + s->conflicts;
      while ((con = *conp++) != 0)
	{
	  dp = pool_whatprovides_ptr(pool, con);
	  for (; *dp; dp++)
	    map[p] |= 2;	
	}
    }
  for (i = 0; i < pkgs->count; i++)
    map[pkgs->elements[i]] = 16;
  for (i = 0, did = 0; did < pkgs->count; i++, did++)
    {
      if (i == pkgs->count)
	i = 0;
      p = pkgs->elements[i];
      if ((map[p] & 16) == 0)
	continue;
      if ((map[p] & 2) != 0)
	{
	  map[p] = 2;
	  continue;
	}
      s = pool->solvables + p;
      m = 1;
      if (s->requires)
	{
	  reqp = s->repo->idarraydata + s->requires;
	  while ((req = *reqp++) != 0)
	    {
	      if (req == SOLVABLE_PREREQMARKER)
		continue;
	      r = providedbyinstalled_xmap(pool, map, req, 0, 0);
	      if (!r)
		{
		  map[p] = 2;
		  did = 0;
		  break;
		}
	      if (r == 16)
		break;	
	      m |= r;	
	    }
	  if (req)
	    continue;
	  if ((m & 9) == 9)
	    m = 9;
	}
      if (s->conflicts)
	{
	  int ispatch = 0;	
	  if (!strncmp("patch:", pool_id2str(pool, s->name), 6))
	    ispatch = 1;
	  conp = s->repo->idarraydata + s->conflicts;
	  while ((con = *conp++) != 0)
	    {
	      if ((providedbyinstalled_xmap(pool, map, con, ispatch, multiversionmap) & 1) != 0)
		{
		  map[p] = 2;
		  did = 0;
		  break;
		}
	      if ((m == 1 || m == 17) && ISRELDEP(con))
		{
		  con = dep2name(pool, con);
		  if ((providedbyinstalled_xmap(pool, map, con, ispatch, multiversionmap) & 1) != 0)
		    m = 9;
		}
	    }
	  if (con)
	    continue;	
	}
      if (m != map[p])
	{
	  map[p] = m;
	  did = 0;
	}
    }
  queue_free(res);
  queue_init_clone(res, pkgs);
  for (i = 0; i < pkgs->count; i++)
    {
      m = map[pkgs->elements[i]];
      if ((m & 9) == 9)
	r = 1;
      else if (m & 1)
	r = -1;
      else
	r = 0;
      res->elements[i] = r;
    }
  free(map);
}
void pool_trivial_installable_multiversionmap ( Pool * pool , Map * installedmap , Queue * pkgs , Queue * res , Map * multiversionmap ) { int i , r , m , did ; Id p , * dp , con , * conp , req , * reqp ; unsigned char * map ; Solvable * s ; map = solv_calloc ( pool -> nsolvables , 1 ) ; for ( p = 1 ; p < pool -> nsolvables ; p ++ ) { if ( ! MAPTST ( installedmap , p ) ) continue ; map [ p ] |= 9 ; s = pool -> solvables + p ; if ( ! s -> conflicts ) continue ; conp = s -> repo -> idarraydata + s -> conflicts ; while ( ( con = * conp ++ ) != 0 ) { dp = pool_whatprovides_ptr ( pool , con ) ; for ( ; * dp ; dp ++ ) map [ p ] |= 2 ; } } for ( i = 0 ; i < pkgs -> count ; i ++ ) map [ pkgs -> elements [ i ] ] = 16 ; for ( i = 0 , did = 0 ; did < pkgs -> count ; i ++ , did ++ ) { if ( i == pkgs -> count ) i = 0 ; p = pkgs -> elements [ i ] ; if ( ( map [ p ] & 16 ) == 0 ) continue ; if ( ( map [ p ] & 2 ) != 0 ) { map [ p ] = 2 ; continue ; } s = pool -> solvables + p ; m = 1 ; if ( s -> requires ) { reqp = s -> repo -> idarraydata + s -> requires ; while ( ( req = * reqp ++ ) != 0 ) { if ( req == SOLVABLE_PREREQMARKER ) continue ; r = providedbyinstalled_xmap ( pool , map , req , 0 , 0 ) ; if ( ! r ) { map [ p ] = 2 ; did = 0 ; break ; } if ( r == 16 ) break ; m |= r ; } if ( req ) continue ; if ( ( m & 9 ) == 9 ) m = 9 ; } if ( s -> conflicts ) { int ispatch = 0 ; if ( ! strncmp ( " " , pool_id2str ( pool , s -> name ) , 6 ) ) ispatch = 1 ; conp = s -> repo -> idarraydata + s -> conflicts ; while ( ( con = * conp ++ ) != 0 ) { if ( ( providedbyinstalled_xmap ( pool , map , con , ispatch , multiversionmap ) & 1 ) != 0 ) { map [ p ] = 2 ; did = 0 ; break ; } if ( ( m == 1 || m == 17 ) && ISRELDEP ( con ) ) { con = dep2name ( pool , con ) ; if ( ( providedbyinstalled_xmap ( pool , map , con , ispatch , multiversionmap ) & 1 ) != 0 ) m = 9 ; } } if ( con ) continue ; } if ( m != map [ p ] ) { map [ p ] = m ; did = 0 ; } } queue_free ( res ) ; queue_init_clone ( res , pkgs ) ; for ( i = 0 ; i < pkgs -> count ; i ++ ) { m = map [ pkgs -> elements [ i ] ] ; if ( ( m & 9 ) == 9 ) r = 1 ; else if ( m & 1 ) r = -1 ; else r = 0 ; res -> elements [ i ] = r ; } free ( map ) ; }
pool_trivial_installable - calculate if a set of solvables is
 trivial installable without any other installs/deinstalls of
 packages not belonging to the set.
pool_trivial_installable - calculate if a set of solvables is trivial installable without any other installs / deinstalls of packages not belonging to the set .
/* XXX: self conflict ? */ /* decided and miss */ /* undecided */ /* 1 | 9 | 17 */ /* see solver.c patch handling */ /* found a conflict */