You are not logged in.

#1 2007-07-03 11:56:58

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Does pacman ever check _all_ dependencies?

Hi,

I've been thinking about this for some time, and tried to find the answer on the forum to no avail. So, the question is this: does pacman ever check the consistency of dependencies among all the installed packages?

The reason for my asking is mostly due to the existence of the --nodeps option when removing packages. I think the answer to my question is "no", since I just tested it by removing wget (needed by hwd and abcde on my system) with the --nodeps option, and then did a pacman -Syu. pacman did not see that a dependency was missing - not very surprisingly, since the packages depending on wget were up to date.

Now, is there any option that makes pacman do a full dependency check on the system? If there isn't, I would very much welcome one. Or, perhaps even better IMO, if pacman did that when doing a full system upgrade (-Su) - at least that it notified the user that some dependencies were missing (if any) and asked whether the user wanted to install them.

Since I haven't found an existing tool to this end, I wrote a python script for this some time ago; chkpkgs.py. Sorry if the code isn't up to python standards - I'm still learning smile


EDIT: Changed the subject to something smarter tongue
EDIT 2: Posted an updated version of chkpkgs.py in the pastebin. Now it does not use the REQUIREDBY field, but creates this info from the DEPENDS info.

Last edited by Bebo (2007-07-04 07:57:40)

Offline

#2 2007-07-03 16:33:04

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Does pacman ever check _all_ dependencies?

Hm, could you also post this on pacman-dev ML ?
I think there are more people knowing pacman there wink

Anyway, that --nodeps option is indeed problematic, since it breaks the db. I also don't think pacman can detect or repair these broken dependencies, but I'm not even sure. That idea is probably worth discussing.

Btw, your script finds three more package in provided/unrequired than the option there :
http://bugs.archlinux.org/task/7208
which just prints package with an empty RequiredBy.

So looks like I've three broken entries in my local database (which have a RequiredBy field non empty, while it should be empty).


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#3 2007-07-03 16:46:26

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: Does pacman ever check _all_ dependencies?

I don't think pacman does this yet, though it would be a good feature to be able to scan the local DB for inconsistencies - it's been talked about before, in any case, and recently iirc.

However, I don't think it should be the default behavior during an -Su operation - if a user removed a package with the --nodeps flag, then it's assumed the user knew what they were doing.  It would be very aggravating if pacman "knew better" than the user, and automatically re-installed these deps that the user doesn't want on every upgrade.

Last edited by Cerebral (2007-07-03 16:46:43)

Offline

#4 2007-07-03 17:22:13

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

shining, yes, --nodeps is problematic as you say, in that exact way. I'm not sure what you mean by you finding 3 more provided/unrequired packages though; is there a bug in my script? The provided/unrequired just means that they are installed ("provided" by the set of currently installed packages) but have nothing that depends on _them_. (They have probably pulled some dependencies though.)

Cerebral, I completely agree with you - pacman should not decide to do anything like that on its own. You should be able to wreck your system, if that's what you want smile It's just that if one fiddles around with the packages too much, and uses pacman -Rd too recklessly and forget what packages one removed, it would be good to have a means to check the db consistency when the dust has settled.

Offline

#5 2007-07-03 18:03:04

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

Just a remark on the script; it is one or two months old and I had to recall what I had done, to better answer shining's comment. The requiredby information is _only_ used to find the "solitary" packages, i.e. those that don't depend on any other package && are not required by any other package. The provided/unrequired and required/unprovided packages are found only by looking at what packages are installed on the system and the dependencies of each installed package. (Maybe it would be better to find the solitary packages by this info alone, too. I'll see if I get around to it, some time smile)

Offline

#6 2007-07-03 20:52:20

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Does pacman ever check _all_ dependencies?

Bebo wrote:

Just a remark on the script; it is one or two months old and I had to recall what I had done, to better answer shining's comment. The requiredby information is _only_ used to find the "solitary" packages, i.e. those that don't depend on any other package && are not required by any other package. The provided/unrequired and required/unprovided packages are found only by looking at what packages are installed on the system and the dependencies of each installed package. (Maybe it would be better to find the solitary packages by this info alone, too. I'll see if I get around to it, some time smile)

As you said your script computes the RequiredBy field again, but this information is already in the local db, example :

pacman -Qi filesystem | grep Required
Required By    : fakeroot  hal  slocate

pacman uses this information for finding which packages are not required by any others, while your script does not.
So they find nearly the same result, except for 3 packages. But I believe it's my database which is broken, and that for these 3 packages, the RequiredBy field is wrong :

LANG=C pacman -Qi libnetworkmanager pkgconfig xulrunner | grep -E "Name|Required"
Name           : libnetworkmanager
Required By    : pidgin  
Name           : pkgconfig
Required By    : sshfs  
Name           : xulrunner
Required By    : kazehakase  

LANG=C pacman -Qi pidgin sshfs kazehakase | grep -E "Name|Depends"
Name           : pidgin
Depends On     : startup-notification  gtkspell  libxss  gstreamer0.10  
Name           : sshfs
Depends On     : fuse  glib2  openssh  
Name           : kazehakase
Depends On     : osb-browser-svn  osb-jscore-svn  osb-nrcit-svn

eg libnetworkmanager is required by pidgin, but pidgin doesn't depend on anything related to libnetworkmanager, as far as I can tell. Same for two others.

Since your script doesn't use the RequiredBy field, but compute it, it shows these 3 packages : libnetworkmanager, pkgconfig and xulrunner.

Is this more clear (I'm not sure wink) ?


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2007-07-03 21:33:35

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

Okay, I see what you mean. I've rewritten the script a bit now, so it does not need the requiredby info at all, but only the depends info. However, the script is in an in-between state now, so it knows about both. What with your "odd" local db, could you please test the script at http://pastebin.archlinux.org/7679 and just show me what it says? I _think_ it will detect the errors, but I'm not sure. The script will be in the pastebin for a day.

Offline

#8 2007-07-03 22:45:07

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Does pacman ever check _all_ dependencies?

Bebo wrote:

Okay, I see what you mean. I've rewritten the script a bit now, so it does not need the requiredby info at all, but only the depends info. However, the script is in an in-between state now, so it knows about both. What with your "odd" local db, could you please test the script at http://pastebin.archlinux.org/7679 and just show me what it says? I _think_ it will detect the errors, but I'm not sure. The script will be in the pastebin for a day.

Hm no, it didn't : http://pastebin.archlinux.org/7695


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#9 2007-07-04 06:04:17

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

Okay, thanks a lot for testing. I'll just remove the requiredby stuff then, it's, er, obsolete smile

Offline

#10 2007-07-04 07:58:55

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

Posted an updated version of the chkpkgs.py script: http://pastebin.archlinux.org/7809

Offline

#11 2007-07-04 10:24:22

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Does pacman ever check _all_ dependencies?

Erm, what I said earlier about your original script is totally wrong.
I thought you didn't use the requiredby info from the database in your script, and that would explain the difference. But your script did use requiredby...
Maybe it has to do with how it used this information then, maybe not totally blindly.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#12 2007-07-04 11:08:46

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Does pacman ever check _all_ dependencies?

Well, the script used requiredby _only_ for getting the solitary packages, it has never used that info for the other cases. The latest version doesn't use the requiredby info at all.

Offline

#13 2007-07-04 11:21:44

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: Does pacman ever check _all_ dependencies?

Oh I see, I get it now smile Well, it would still be interesting to find the inconsistencies, like you tried earlier smile

And as I said in my first reply, some people might read the pacman-dev ML but not this forum, so consider bringing this topic there.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

Board footer

Powered by FluxBB