@@ -1430,6 +1430,137 @@ matchdep(Pool *pool, Id id, char *rname, int rflags, Id revr, int flags)
14301430 return matchdep_str (rname , pool_id2str (pool , id ), flags );
14311431}
14321432
1433+ static int
1434+ selection_make_matchsolvable_common_limited (Pool * pool , Queue * selection , Queue * solvidq , Id solvid , int flags , int keyname , int marker , struct limiter * limiter )
1435+ {
1436+ Id * wp ;
1437+ Map m , missc ;
1438+ int reloff , boff ;
1439+ int li , i , j ;
1440+ Id p ;
1441+ Queue q ;
1442+
1443+ if (solvidq )
1444+ {
1445+ map_init (& m , pool -> nsolvables );
1446+ for (i = 0 ; i < solvidq -> count ; i ++ )
1447+ MAPSET (& m , solvidq -> elements [i ]);
1448+ }
1449+ queue_init (& q );
1450+ reloff = pool -> ss .nstrings ;
1451+ map_init (& missc , reloff + pool -> nrels );
1452+ for (li = limiter -> start ; li < limiter -> end ; li ++ )
1453+ {
1454+ Solvable * s ;
1455+ p = limiter -> mapper ? limiter -> mapper [li ] : li ;
1456+ if (solvidq && MAPTST (& m , p ))
1457+ continue ;
1458+ if (!solvidq && p == solvid )
1459+ continue ;
1460+ s = pool -> solvables + p ;
1461+ if (!s -> repo || (limiter -> repofilter && s -> repo != limiter -> repofilter ))
1462+ continue ;
1463+ if (s -> arch == ARCH_SRC || s -> arch == ARCH_NOSRC )
1464+ {
1465+ if (!(flags & SELECTION_SOURCE_ONLY ) && !(flags & SELECTION_WITH_SOURCE ))
1466+ continue ;
1467+ if (!(flags & SELECTION_WITH_DISABLED ) && pool_disabled_solvable (pool , s ))
1468+ continue ;
1469+ }
1470+ else
1471+ {
1472+ if ((flags & SELECTION_SOURCE_ONLY ) != 0 )
1473+ continue ;
1474+ if (s -> repo != pool -> installed )
1475+ {
1476+ if (!(flags & SELECTION_WITH_DISABLED ) && pool_disabled_solvable (pool , s ))
1477+ continue ;
1478+ if (!(flags & SELECTION_WITH_BADARCH ) && pool_badarch_solvable (pool , s ))
1479+ continue ;
1480+ }
1481+ }
1482+ if (q .count )
1483+ queue_empty (& q );
1484+ repo_lookup_deparray (s -> repo , p , keyname , & q , marker );
1485+ if (!q .count )
1486+ continue ;
1487+ for (i = 0 ; i < q .count ; i ++ )
1488+ {
1489+ Id dep = q .elements [i ];
1490+ boff = ISRELDEP (dep ) ? reloff + GETRELID (dep ) : dep ;
1491+ if (MAPTST (& missc , boff ))
1492+ continue ;
1493+ if (ISRELDEP (dep ))
1494+ {
1495+ Reldep * rd = GETRELDEP (pool , dep );
1496+ if (!ISRELDEP (rd -> name ) && rd -> flags < 8 )
1497+ {
1498+ /* do pre-filtering on the base */
1499+ if (MAPTST (& missc , rd -> name ))
1500+ continue ;
1501+ wp = pool_whatprovides_ptr (pool , rd -> name );
1502+ if (solvidq )
1503+ {
1504+ for (wp = pool_whatprovides_ptr (pool , dep ); * wp ; wp ++ )
1505+ if (MAPTST (& m , * wp ))
1506+ break ;
1507+ }
1508+ else
1509+ {
1510+ for (wp = pool_whatprovides_ptr (pool , dep ); * wp ; wp ++ )
1511+ if (* wp == solvid )
1512+ break ;
1513+ }
1514+ if (!* wp )
1515+ {
1516+ /* the base does not include solvid, no need to check the complete dep */
1517+ MAPSET (& missc , rd -> name );
1518+ MAPSET (& missc , boff );
1519+ continue ;
1520+ }
1521+ }
1522+ }
1523+ wp = pool_whatprovides_ptr (pool , dep );
1524+ if (solvidq )
1525+ {
1526+ for (wp = pool_whatprovides_ptr (pool , dep ); * wp ; wp ++ )
1527+ if (MAPTST (& m , * wp ))
1528+ break ;
1529+ }
1530+ else
1531+ {
1532+ for (wp = pool_whatprovides_ptr (pool , dep ); * wp ; wp ++ )
1533+ if (* wp == solvid )
1534+ break ;
1535+ }
1536+ if (* wp )
1537+ {
1538+ queue_push (selection , p );
1539+ break ;
1540+ }
1541+ MAPSET (& missc , boff );
1542+ }
1543+ }
1544+ queue_free (& q );
1545+ map_free (& missc );
1546+ if (solvidq )
1547+ map_free (& m );
1548+ if (!selection -> count )
1549+ return 0 ;
1550+
1551+ /* convert package list to selection */
1552+ j = selection -> count ;
1553+ queue_insertn (selection , 0 , selection -> count , 0 );
1554+ for (i = 0 ; i < selection -> count ; )
1555+ {
1556+ selection -> elements [i ++ ] = SOLVER_SOLVABLE | SOLVER_NOAUTOSET ;
1557+ selection -> elements [i ++ ] = selection -> elements [j ++ ];
1558+ }
1559+ if ((flags & SELECTION_FLAT ) != 0 )
1560+ selection_flatten (pool , selection );
1561+ return SELECTION_PROVIDES ;
1562+ }
1563+
14331564static int
14341565selection_make_matchdeps_common_limited (Pool * pool , Queue * selection , const char * name , Id dep , int flags , int keyname , int marker , struct limiter * limiter )
14351566{
@@ -1449,6 +1580,9 @@ selection_make_matchdeps_common_limited(Pool *pool, Queue *selection, const char
14491580 if (name && dep )
14501581 return 0 ;
14511582
1583+ if ((flags & SELECTION_MATCH_SOLVABLE ) != 0 )
1584+ return selection_make_matchsolvable_common_limited (pool , selection , (Queue * )name , dep , flags , keyname , marker , limiter );
1585+
14521586 if ((flags & SELECTION_MATCH_DEPSTR ) != 0 )
14531587 flags &= ~SELECTION_REL ;
14541588
@@ -1558,7 +1692,8 @@ selection_make_matchdeps_common_limited(Pool *pool, Queue *selection, const char
15581692 queue_push (selection , p );
15591693 continue ;
15601694 }
1561- queue_empty (& q );
1695+ if (q .count )
1696+ queue_empty (& q );
15621697 repo_lookup_deparray (s -> repo , p , keyname , & q , marker );
15631698 if (!q .count )
15641699 continue ;
@@ -1708,6 +1843,18 @@ selection_make_matchdepid(Pool *pool, Queue *selection, Id dep, int flags, int k
17081843 return selection_make_matchdeps_common (pool , selection , 0 , dep , flags , keyname , marker );
17091844}
17101845
1846+ int
1847+ selection_make_matchsolvable (Pool * pool , Queue * selection , Id solvid , int flags , int keyname , int marker )
1848+ {
1849+ return selection_make_matchdeps_common (pool , selection , 0 , solvid , flags | SELECTION_MATCH_SOLVABLE , keyname , marker );
1850+ }
1851+
1852+ int
1853+ selection_make_matchsolvablelist (Pool * pool , Queue * selection , Queue * solvidq , int flags , int keyname , int marker )
1854+ {
1855+ return selection_make_matchdeps_common (pool , selection , (const char * )solvidq , 0 , flags | SELECTION_MATCH_SOLVABLE , keyname , marker );
1856+ }
1857+
17111858static inline int
17121859pool_is_kind (Pool * pool , Id name , Id kind )
17131860{
0 commit comments