[packagekit] yum requirements -- can and cannot remove gimp

Richard Hughes hughsient at gmail.com
Wed Nov 7 09:53:33 PST 2007


On Wed, 2007-11-07 at 13:37 +0100, Matej Cepl wrote:
> I want to remove GIMP (big, fat and I don't use it). Because PK 
> (so far) cannot remove all depending packages

Ohh it can. You just have to pass the force method into RemovePackage,
which is something we can't do yet in pkcon; see below.

> I have to check 
> dependencies first:
> 
> [matej at viklef ~]$ pkcon get requires gimp
> resolve runtime was 0.8 seconds
> get-requires runtime was 0.8 seconds                                            
> [matej at viklef ~]$

Well, we need to be careful in discussion about GetRequires and
GetDepends. GetRequires gets all the packages that depend _on_ this
package, i.e. the ones that would have to be removed if it was removed.
GetDepends gets all the packages that this package requires on the
system for the dependencies to be satisfied.

so:

glibc -> hal -> gnome-power-manager

GetDepends on hal should return glibc, and GetRequires on hal should be
gnome-power-manager.

Saying that, I can't seem to get much output of GetRequires at all, even
for hal (which I know is needed by gnome-power-manager). I guess this is
a backend problem.

[hughsie at hughsie-laptop PackageKit]$ pkcon get requires hal
resolve runtime was 1.0 seconds
get-requires runtime was 1.0 seconds 

> [matej at viklef ~]$ pkcon remove gimp
> resolve runtime was 0.8 seconds
>     [..........................................................]    
> 0%          Error: dep-resolution-failed : package could not be 
> remove, because something depends on it
> remove-package runtime was 5.2 seconds                                          
> [matej at viklef ~]$
> 
> Ouch, so there is something (what the hell is this kind of error 
> message -- „something depends on it“; cannot PK tell me what 
> depends on it, or even better to suggest to remove it as well?).

This is a problem with the backend - if we failed with a generic error
then the details field should explain exactly why. In this case, I would
have expected the yum backend to return:

dep-resolution-failed : "package could not be removed, because the
following packages depend on it: xsane-gimp, gimp-help." Tim, is is
possible to include this information in the yum error text?

> [matej at viklef ~]$ sudo repoquery -q --whatrequires gimp
> gutenprint-plugin-5.0.1-5.fc8
> [matej at viklef ~]$ 
> 
> OK, so I have to remove gutenprint-plugin first, right?

Yes, unless we add a pkcon remove foo --force option for power users.

> [matej at viklef ~]$ pkcon remove gutenprint-plugin gimp
> resolve runtime was 0.8 seconds
>     [..........................................................]    
> 0%          Error: dep-resolution-failed : package could not be 
> remove, because something depends on it
> remove-package runtime was 5.2 seconds                                          
> [matej at viklef ~]$ 
> 
> No, I can't.

That's not supported - I did think of allowing multiple packages to be
removed and removed in the API, but that complicated things too much.

The real fix here is to make pkcon into a first rate command line tool,
i.e. when you do:

pkcon remove gimp

pcon does:

* Resolve to a package_id
* GetRequires pacakge_id

If nothing requires the package, just call Remove(false) and exit

If something requires it, then do GetRequires on all the packages (the
fact that it's recursive shouldn't be a problem; if it is we can add a
boolean flag to the GetRequires api)

* We then print a list of packages that would be removed (just like yum)
and ask the user: "Is it okay to continue? [Y\n]"

and if the user presses [Y] we just do a RemovePackage with the force
bit set.

This is very similar to the user interaction we get with yum, and means
it can be re-used for all the backends that implement all the right
methods.

Something like this is also a sane thing to do for pk-application also.
Comments?

Richard.




More information about the PackageKit mailing list