I tried the two ways here:
1. steps:
    'select pattern base'
    'deselect package A'
    'resolve pool'
 Result: A, B, C, D
2. steps:
    'select pattern base'
    'resolve pool'
    'deselect package A'
 Result: B, C, D
    
I attached my source code, which was adapted to use the first way.
And I have tested in openSUSE 12.2, it runs successfully, my chroot 
includes A, B, C, D however, instead of printing resolve problems.

Thanks
Gui

-----Original Message-----
From: Michael Andres [mailto:m...@suse.de] 
Sent: Wednesday, July 17, 2013 11:31 PM
To: zypp-devel@opensuse.org
Cc: Chen, Gui; Zhang, Qiang Z
Subject: Re: [zypp-devel] excluding one package in a pattern in libzypp

On Wednesday 17 July 2013 09:15:13 Chen, Gui wrote:
> Hi list,
>
> I am trying to create a chroot with libzypp, and I found when I need 
> to remove a package and this package is part of a pattern which will 
> be installed, the dependencies of the package will stay there. For 
> example, if 'A' and 'C' are in a pattern 'base', and 'A' requires 'B', 
> 'C' requires 'D', I need to install pattern 'base', also I need to set 
> 'A' uninstalled, but I end up having 'B', 'C', 'D' in my chroot. If I 
> am not installing 'A', I definitely needn't 'B' installed.
> Is there any comment? should I file a bug?

How did you do it?

You can't 'install pattern:base' and 'remove A' in one step, because 
'pattern:base requires A':

        'select pattern:base'
        'deselect A'
        'resolve pool'  (fails: pattern:base requires A')
        
What you describe could be created this way:
        'select pattern:base'
        'resolve pool'  (will select A C, B, D)
        'deselect A'
     Here 'D' is still selected, but just because 
     'resolve pool' was not called after changing 
     the selection.


However, if a 'resolve pool' fails, the Resolver provides list of 
'Resolver::problems()'. Each Problem usually has a list of solutions().
A ProblemSolution can be applied to the resolver.

        Problem 1:
        ====================================
        pattern:base requires A, but this requirement cannot be provided
        ------------------------------------

        Solutions for problem #1:
        ====================================
        do not ask to delete all solvables providing A
        ------------------------------------
        do not ask to install a solvable providing pattern:base
        ------------------------------------
   ==>  ignore some dependencies of pattern:base
        ------------------------------------

If I apply the last solution, then resolve again, I get C and D selected.

-- 

cu,
    Michael Andres

+------------------------------------------------------------------+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862  27AC 3FB8 9E3A 27C6 B0E4
+------------------------------------------------------------------+
Michael Andres   SUSE LINUX Products GmbH, Development,   m...@suse.de
GF:Jeff Hawn,Jennifer Guild,Felix Imend├Ârffer, HRB16746(AG N├╝rnberg) 
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+------------------------------------------------------------------+

Attachment: group.cc
Description: group.cc

Attachment: repository.tar.gz
Description: repository.tar.gz

Reply via email to